Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Addresses four issues from PR #26 review: missing Array.isArray guard, incorrect pruning order, unsafe iterator pattern, and missing workflow permissions.

Changes

  • Array validation before parseThread: Guard against non-array API responses that would crash on .length access

    if (!Array.isArray(response.data)) {
      console.warn('Unexpected response shape from X API (thread): data is not an array');
      return null;
    }
  • Chronological pruning order: Process mentions oldest-first so Set deletion removes actual oldest entries, not newest

    // X API returns newest-first, reverse to maintain chronological Set order
    for (let i = newMentions.length - 1; i >= 0; i--) {
      await this.processMention(newMentions[i]);
      this.processedMentions.add(newMentions[i].post.id);
    }
  • Type-safe iterator: Replace iter.next().value as string with destructured { value, done } check to prevent exhausted iterator errors

  • Workflow permissions: Add pull-requests: write to fix "Resource not accessible by integration" error when posting PR comments


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix 5 runtime bugs found during debug pass Fix review feedback: Array validation, chronological pruning, safe iteration Feb 9, 2026
Copilot AI requested a review from groupthinking February 9, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants