Skip to content

perf(workflow): replace Copilot scripts with GitHub MCP server#1096

Open
timothyfroehlich wants to merge 11 commits intomainfrom
worktree/github-efficiency
Open

perf(workflow): replace Copilot scripts with GitHub MCP server#1096
timothyfroehlich wants to merge 11 commits intomainfrom
worktree/github-efficiency

Conversation

@timothyfroehlich
Copy link
Owner

Summary

  • Deleted 4 shell scripts (585 lines) that burned excessive GitHub API calls — replaced by GitHub MCP server tools (pull_request_read, add_reply_to_pull_request_comment)
  • Removed review-polling from monitor-gh-actions.sh — the 20s poll loop was burning ~600 REST calls per CI run and causing 403 rate-limit errors
  • Consolidated label-ready.sh from 2 API calls to 1 using gh pr view --json statusCheckRollup
  • Created resolve-thread.sh — thin GraphQL stopgap for the one MCP gap (resolveReviewThread, upstream PR #1919 pending)
  • Updated 8 skill/doc files to describe MCP-first workflow with lightweight subagent (Haiku/Flash) for fetching review comments

Addresses bead PinPoint-e0e1.

Test plan

  • Verify pnpm run check passes (727 tests, all linters)
  • Verify resolve-thread.sh resolves a real thread on a test PR
  • Verify label-ready.sh correctly reads statusCheckRollup on a real PR
  • Verify monitor-gh-actions.sh still monitors CI without the review-polling subshell
  • Test MCP pull_request_read(method: "get_review_comments") returns Copilot threads
  • Test MCP add_reply_to_pull_request_comment posts replies to threads

🤖 Generated with Claude Code

timothyfroehlich and others added 9 commits March 9, 2026 09:40
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The 20s review-polling subshell burned ~600 REST calls per CI run and was
the root cause of 403 rate-limit errors. Review detection now happens via
MCP after CI completes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use gh pr view --json statusCheckRollup to get CI status in the same call
as PR metadata, eliminating a separate gh pr checks call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removed:
- copilot-comments.sh (5 API calls) → MCP pull_request_read get_review_comments
- respond-to-copilot.sh (3 API calls) → MCP add_reply_to_pull_request_comment + resolve-thread.sh
- resolve-copilot-threads.sh (2+N calls) → MCP listing + resolve-thread.sh
- pr-dashboard.sh (3×N calls) → MCP tools / gh pr list

orchestration-status.sh updated to use gh pr list instead of pr-dashboard.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Copilot comments fetched via MCP pull_request_read, not shell scripts
- Replies via MCP add_reply_to_pull_request_comment
- Resolves via resolve-thread.sh (MCP gap stopgap)
- Lightweight subagent (Haiku/Flash) for large response protection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review detection now happens via MCP after CI completes, not during CI.
References pinpoint-ready-to-review skill for the Copilot workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shell scripts replaced by MCP tools:
- pull_request_read(get_review_comments) for fetching
- add_reply_to_pull_request_comment for replies
- resolve-thread.sh for the one remaining MCP gap

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated 5 files that still referenced copilot-comments.sh,
respond-to-copilot.sh, resolve-copilot-threads.sh, and pr-dashboard.sh
to use MCP tools and resolve-thread.sh instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…write

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 9, 2026 14:48
@vercel
Copy link

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pin-point Ready Ready Preview, Comment Mar 12, 2026 2:42am

@supabase
Copy link

supabase bot commented Mar 9, 2026

Updates to Preview Branch (worktree/github-efficiency) ↗︎

Deployments Status Updated
Database Thu, 12 Mar 2026 02:41:55 UTC
Services Thu, 12 Mar 2026 02:41:55 UTC
APIs Thu, 12 Mar 2026 02:41:55 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Thu, 12 Mar 2026 02:41:55 UTC
Migrations Thu, 12 Mar 2026 02:41:55 UTC
Seeding Thu, 12 Mar 2026 02:41:55 UTC
Edge Functions Thu, 12 Mar 2026 02:41:55 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

GitHub's statusCheckRollup sometimes includes entries with null name/status
from third-party integrations (e.g. Supabase branching). The jq
startswith() function crashes on null input. Filter out null-name entries
early and fix parenthesization of the codecov exclusion filter.

Found during testing PR #1096 — the Supabase Preview integration creates
a ghost check entry with all-null fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@timothyfroehlich timothyfroehlich added the ready-for-review PR passed CI and has no unresolved review comments label Mar 11, 2026
Take our MCP-first language for Copilot review management with main's
updated skill paths (.claude/skills/ → .agent/skills/).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.


You can also share your feedback on Copilot code review. Take the survey.

> 1. Call `pull_request_read` with `method: "get_review_comments"`, `owner: "timothyfroehlich"`, `repo: "PinPoint"`, `pullNumber: <NUMBER>`.
> 2. Filter to threads where:
> - `isResolved` is `false`
> - The first comment's author login contains `copilot`
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subagent instructions say to filter review threads where the first comment’s author login “contains copilot”. That heuristic can match unrelated users/bots and could lead to replying to/resolving the wrong threads. Use an explicit allowlist of Copilot reviewer accounts (e.g., the same logins used by label-ready.sh: copilot-pull-request-reviewer / copilot-pull-request-reviewer[bot]), or otherwise match on the specific Copilot app/bot identity returned by MCP.

Suggested change
> - The first comment's author login contains `copilot`
> - The first comment's author login is exactly one of: `copilot-pull-request-reviewer`, `copilot-pull-request-reviewer[bot]`

Copilot uses AI. Check for mistakes.
Comment on lines +573 to +574
2. Filter to unresolved threads where the first comment author contains `copilot`
3. For each comment, fix the code, then reply via MCP and resolve:
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step recommends filtering threads by whether the first comment author login “contains copilot”. That can accidentally include non-Copilot commenters (e.g., users with “copilot” in their username) and cause incorrect replies/resolutions. Prefer an explicit allowlist of the actual Copilot reviewer logins (as used elsewhere in repo scripts) or match on the Copilot app/bot identity returned by MCP.

Suggested change
2. Filter to unresolved threads where the first comment author contains `copilot`
3. For each comment, fix the code, then reply via MCP and resolve:
2. Filter to unresolved threads where the first comment author is identified as Copilot (for example, by matching the Copilot app/bot identity from MCP or using the explicit Copilot reviewer login allowlist used in repo scripts)
3. For each Copilot comment, fix the code, then reply via MCP and resolve:

Copilot uses AI. Check for mistakes.
> 1. Call `pull_request_read` with `method: "get_review_comments"`, `owner: "timothyfroehlich"`, `repo: "PinPoint"`, `pullNumber: <NUMBER>`.
> 2. Filter to threads where:
> - `isResolved` is `false`
> - The first comment's author login contains `copilot`
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the subagent prompt, filtering by “author login contains copilot” is overly broad and can match non-Copilot accounts. To avoid replying/resolving the wrong threads, tighten this to an explicit allowlist of the Copilot reviewer logins used by the repo’s scripts (e.g., copilot-pull-request-reviewer / copilot-pull-request-reviewer[bot]) or the specific Copilot app/bot identity returned by MCP.

Suggested change
> - The first comment's author login contains `copilot`
> - The first comment's author login is one of: `copilot-pull-request-reviewer`, `copilot-pull-request-reviewer[bot]`

Copilot uses AI. Check for mistakes.
) &
REVIEW_WATCHER_PID=$!
fi
trap 'kill "${PIDS[@]}" 2>/dev/null || true; exit 0' TERM
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TERM trap exits with status 0. If this script is terminated (e.g., by a supervisor/timeout), callers that interpret 0 as “all passed” can get a false positive (the skills/docs explicitly treat exit code 0 as pass). Consider exiting with a non-zero status on TERM (e.g., 130/143) and/or writing a distinct signal file so aborted runs aren’t indistinguishable from success.

Suggested change
trap 'kill "${PIDS[@]}" 2>/dev/null || true; exit 0' TERM
trap 'kill "${PIDS[@]}" 2>/dev/null || true; touch "$SIGNAL"; exit 143' TERM

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review PR passed CI and has no unresolved review comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants