Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Multiple open PRs had unresolved review comments blocking merge. This consolidates the two substantive PRs (#26: runtime bug fixes, #6: reply targeting) with all reviewer feedback applied.

PR #26 — Runtime bug fixes + review feedback

  • stdout protection: Redirect console.logstderr to avoid corrupting MCP StdioServerTransport protocol messages. Uses unknown[] per reviewer.
  • since_id pagination: Wire up lastMentionId with URLSearchParams (reviewer suggestion) to avoid refetching processed mentions each poll cycle.
  • fetchThread hardening: Guard with Array.isArray(response.data) before calling parseThread — prevents crash on unexpected API shapes.
  • Sort immutability: [...tweets].sort() instead of in-place mutation. parseThread signature narrowed from anyunknown.
  • Bounded memory: Cap processedMentions Set at 10k, prune with safe { value, done } iterator (not type assertion). Process mentions oldest-first so Set insertion order is chronological and pruning evicts correctly.

PR #6 — Reply targeting fix + review feedback

  • Add mentionPostId param to analyzeAndDecide() — replies now target the specific mention post instead of always targeting thread.root_post.id.
  • Replace any with typed interface for Grok API response parsing.
// Before: always replied to conversation root
const analysis = await grok.analyzeAndDecide(mention.post.text, thread);
// analysis.action.target_post_id === thread.root_post.id ❌

// After: replies to the actual mention
const analysis = await grok.analyzeAndDecide(mention.post.text, thread, mention.post.id);
// analysis.action.target_post_id === mention.post.id ✅

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 9, 2026 17:55
Co-authored-by: groupthinking <[email protected]>
PR #26 fixes (with review feedback incorporated):
- Redirect console.log to stderr for MCP stdout (unknown[] type)
- Use URLSearchParams for mentions URL + wire up since_id
- Add Array.isArray() guard in fetchThread
- Copy tweets array before sorting + unknown type in parseThread
- Cap processedMentions with safe {value, done} iterator
- Process mentions oldest-first for chronological pruning

PR #6 fix (with review feedback):
- Add mentionPostId param to analyzeAndDecide for reply targeting
- Replace any type with specific type in Grok response parsing

Co-authored-by: groupthinking <[email protected]>
Copilot AI changed the title [WIP] Implement suggestions and correct errors in pending PRs Consolidate review feedback from PRs #26 and #6 into single mergeable change Feb 9, 2026
Copilot AI requested a review from groupthinking February 9, 2026 18:00
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