Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Multiple PRs (#26, #6, #13) have been stuck open with unaddressed review feedback. This PR applies their changes with all review comments resolved, so those PRs can be closed.

PR #26 — Runtime bug fixes + review feedback

  • Redirect console.logstderr to avoid MCP StdioServerTransport stdout collision; use unknown[] not any[]
  • Wire up lastMentionId as since_id via URLSearchParams instead of string concatenation
  • Guard fetchThread with Array.isArray() before passing to parseThread
  • parseThread: typed unknown index signature, [...tweets].sort() to avoid in-place mutation
  • Cap processedMentions Set at 10K with iterator-based pruning (oldest-first):
const { value, done } = iter.next();
if (done) break;
this.processedMentions.delete(value);
  • Process mentions in reverse (oldest→newest) so Set insertion order matches chronological order for correct eviction

PR #6 — Reply targeting fix + review feedback

  • analyzeAndDecide(mention, thread, mentionPostId) — replies now target the mention post, not the conversation root
  • Typed Grok API response instead of any
  • Updated all call sites (agent.ts, examples.ts)

PR #13 — GitHub Actions workflows + review feedback

  • auto-label.yml: uses pull_request_target (works on forks), sync-labels: true, no duplicate with: key
  • pr-checks.yml: pull-requests: write permission (fixes Resource not accessible by integration)
  • issue-triage.yml: creates needs-triage label if missing before applying it
  • labeler.yml: correct YAML structure with **/*.yml glob patterns

✨ 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 7 commits February 9, 2026 18:07
This commit applies all actionable review feedback from multiple pending PRs:

## PR #26 - Console.log redirect and type improvements
- Added console.log redirect to stderr in main() to prevent MCP protocol conflicts
- Used unknown[] instead of any[] for type safety
- Refactored fetchMentions() to use URLSearchParams for cleaner URL construction
- Added lastMentionId tracking for efficient pagination
- Added Array.isArray guard in fetchThread() for safer data handling
- Changed parseThread() to use proper typed parameters and copy array before sort

## PR #6 - Pass mention post ID for accurate replies
- Added mentionPostId parameter to analyzeAndDecide() and simulateAnalysis()
- Updated all callers to pass mention.post.id
- Fixed response.json() type with proper type assertion
- Fixed parseGrokResponse to use mentionPostId instead of root_post.id
- Updated examples.ts to pass mention.post.id

## PR #13 - GitHub Actions workflows with review feedback
- Created .github/workflows/auto-label.yml for PR auto-labeling
- Created .github/workflows/pr-checks.yml for CI builds
- Created .github/workflows/issue-triage.yml for automatic issue triage
- Created .github/labeler.yml configuration for auto-labeling
- All workflows use secure permissions and latest action versions

## Additional improvements from review feedback
- Added MAX_PROCESSED_MENTIONS constant (10000) to prevent unbounded memory growth
- Reversed mention processing order (oldest-first) for better chronological handling
- Added safe pruning logic using iterator pattern to cap Set size
- Improved type safety throughout with unknown[] and proper type assertions

All changes compile successfully with TypeScript. No tests to run.
- Extract max_results as MAX_MENTIONS_PER_FETCH constant in XAPIClient
- Add clarifying comment about Set insertion-order iteration in pruning logic
- Use decremented for-loop instead of array copy + reverse for efficiency
- Simplify pruning logic with Array.from().slice() for better readability
- Remove redundant patterns (*.json already covers tsconfig.json, src/** covers all TypeScript files)
- Scope workflows pattern to .github/ directory only to avoid false positives
- Add optional chaining check for data[0]?.id in lastMentionId tracking
- Use optional chaining for error status check in issue-triage workflow
- Use **/*.json to match JSON files in any directory
- Use **/.env* to match .env files in any directory
Copilot AI changed the title [WIP] Update pending PRs by implementing suggestions and corrections Consolidate actionable review feedback from PRs #26, #6, and #13 Feb 9, 2026
Copilot AI requested a review from groupthinking February 9, 2026 18:17
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