Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Implements all unresolved review comments from PR #26 (Fix 5 runtime bugs) to move it toward merge-ready state.

Type safety

  • src/index.ts: any[]unknown[] in console.log stderr redirect
  • src/services/grok.ts: data: any → typed assertion for Grok API response shape

URL construction

  • src/services/xapi.ts: Replace fragile string concatenation with URLSearchParams for mentions endpoint

Runtime validation

  • src/services/xapi.ts: Add Array.isArray() guard in fetchThread() before parseThread() — prevents crash when API returns non-array data

Iterator safety & pruning correctness

  • src/services/agent.ts: Replace iter.next().value as string with destructured { value, done } pattern
  • src/services/agent.ts: Reverse mention processing order to oldest-first so Set insertion is chronological and pruning evicts oldest entries, not newest
// Before: unsafe assertion, wrong eviction order
this.processedMentions.delete(iter.next().value as string);

// After: type-safe, chronological
const { value, done } = iter.next();
if (done) break;
this.processedMentions.delete(value);

💡 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.

Copilot AI and others added 2 commits February 9, 2026 17:52
…y.isArray guard, safe iterators, chronological processing

Co-authored-by: groupthinking <[email protected]>
Copilot AI changed the title [WIP] Review and address actionable events in pending PRs fix: address unresolved review feedback on PR #26 — type safety, URL params, Array.isArray guard, safe iterators, chronological pruning Feb 9, 2026
Copilot AI requested a review from groupthinking February 9, 2026 17:57
@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