Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Addresses unresolved review comments across open PRs to unblock merges. Implements the 5 runtime bug fixes from PR #26 plus type safety and correctness improvements flagged by reviewers on PRs #6 and #4.

Runtime fixes (PR #26)

  • Redirect console.log to stderr — prevents corruption of MCP StdioServerTransport stdout protocol stream
  • Wire lastMentionIdsince_id via URLSearchParams — eliminates redundant refetches each poll cycle
  • Array.isArray() guard before parseThread() / searchTweets — prevents crash on unexpected API response shapes
  • [...tweets].sort() in parseThread — avoids mutating caller's array
  • Cap processedMentions Set at 10k with oldest-first pruning — prevents unbounded memory growth

Type safety (PRs #26, #6)

  • Replace any with Record<string, unknown> in parsePost, parseMentions, searchTweets
  • Typed Grok API response: as { choices: Array<{ message?: { content?: string } }> }
  • unknown[] for console.log override args
  • Safe { value, done } destructure on Set iterator instead of type assertion

Correctness (PR #26 review)

  • Process mentions oldest→newest (.reverse()) so Set insertion order matches chronology, ensuring pruning evicts actually-oldest IDs

README (PR #4 review)

  • Fix double space, broken list numbering in xAI/Grok section
// Before: fragile string concat, no since_id, no Array.isArray guard
const mentionsResponse = await this.makeXAPIRequest(
  `https://api.twitter.com/2/users/${userId}/mentions?max_results=10&...`, 'GET'
);
return this.parseThread(response.data || []);

// After: URLSearchParams, since_id wired, validated
const params = new URLSearchParams({ max_results: '10', expansions: 'author_id', ... });
if (this.lastMentionId) params.set('since_id', this.lastMentionId);
if (!Array.isArray(response.data)) return null;
return this.parseThread(response.data);

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…rams, Array.isArray guards, safe iterators, chronological pruning, README fixes

Co-authored-by: groupthinking <[email protected]>
Copilot AI changed the title [WIP] Resolve actionable comments on pending pull requests Consolidate actionable review feedback from PRs #26, #6, #4 Feb 9, 2026
Copilot AI requested a review from groupthinking February 9, 2026 18:10
@groupthinking
Copy link
Owner

Closing stale draft — superseded by cleanup/ready-to-use merge to main

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