-
Notifications
You must be signed in to change notification settings - Fork 1
chore(drain): add Phase 3b parallel per-PR agent dispatch #7453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,17 +189,43 @@ for PR in $OPEN_PRS; do | |
| done | ||
| ``` | ||
|
|
||
| ### Fix branch-specific CI failures | ||
| ### Phase 3b: Parallel per-PR agents (MANDATORY for remaining failures) | ||
|
|
||
| For every still-failing PR after Phase 3, spawn ONE Agent per PR IN PARALLEL using `isolation: "worktree"` and `mode: "bypassPermissions"`. Send all spawn calls in a single message (multiple Agent tool calls in one turn) so they run concurrently. | ||
|
|
||
| Each agent's prompt must include: | ||
| 1. The PR number, title, head branch | ||
| 2. Current failing checks (name + log URL from `gh pr checks $PR`) | ||
| 3. Any unresolved bot/human review comments (fetch via `gh api repos/{owner}/{repo}/pulls/$PR/comments --paginate`) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: No, the GitHub REST endpoint GET /repos/{owner}/{repo}/pulls/{pull_number}/comments does not include review-thread resolved/unresolved state. The response returns an array of PullRequestReviewComment objects, which include fields like id, url, body, path, position, etc., but no field indicating the resolved state of the review thread the comment belongs to. The recommended API to fetch only unresolved PR review comments is the GitHub GraphQL API. Query the pullRequest's reviewThreads connection, filtering or post-filtering for those where isResolved: false, then access the comments within those threads. Example GraphQL query: { repository(owner: "OWNER", name: "REPO") { pullRequest(number: PULL_NUMBER) { reviewThreads(first: 100, unresolved: true) { nodes { isResolved comments(first: 100) { nodes { id body author { login } path line } } } } } } } Note: The reviewThreads connection supports an 'unresolved: Boolean' argument to fetch only unresolved threads. Citations:
REST API endpoint cannot reliably fetch unresolved review comments—use GraphQL instead The Use GitHub's GraphQL API with repository(owner: "OWNER", name: "REPO") {
pullRequest(number: PULL_NUMBER) {
reviewThreads(first: 100, unresolved: true) {
nodes {
isResolved
comments(first: 100) {
nodes { id body author { login } path line }
}
}
}
}
}Suggested doc fix-3. Any unresolved bot/human review comments (fetch via `gh api repos/{owner}/{repo}/pulls/$PR/comments --paginate`)
+3. Any unresolved bot/human review comments (fetch via GraphQL reviewThreads with unresolved: true filter to avoid re-processing resolved feedback)🤖 Prompt for AI Agents |
||
| 4. Instructions: | ||
| - Check out the PR's head branch in the worktree | ||
| - Rebase onto latest `main`; resolve conflicts preserving PR intent | ||
| - Run `pnpm --filter=@jovie/web exec tsc --noEmit`, `pnpm biome check apps/web`, and the failing test files locally | ||
| - Fix root causes (not symptoms); update tests only if they're wrong | ||
| - Address each unaddressed CodeRabbit / Greptile comment (fix or reply explaining why declined) | ||
| - Commit with conventional messages, push to the PR head branch | ||
| - Enable auto-merge via `gh pr merge $PR --auto` | ||
| - Report DONE / DONE_WITH_CONCERNS / BLOCKED with the specific reason | ||
|
|
||
| Sample Agent tool call (repeat per PR, all in one message): | ||
|
|
||
| For each PR that still has failures after the rebase: | ||
| 1. Check out the branch | ||
| 2. Identify the failure (typecheck, lint, test, etc.) | ||
| 3. Fix it, commit, and push | ||
| 4. Wait for CI to go green, then enable auto-merge | ||
| ``` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a language tag to the fenced code block Line 212 violates markdownlint MD040 (missing fenced code language). Add a language identifier (e.g., Suggested doc fix-```
+```javascript
Agent({
subagent_type: "general-purpose",
isolation: "worktree",
mode: "bypassPermissions",
description: "Fix PR #<NUMBER>",
prompt: "<self-contained prompt with failures + comments + instructions>"
})🧰 Tools🪛 markdownlint-cli2 (0.22.0)[warning] 212-212: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||
| Agent({ | ||
| subagent_type: "general-purpose", | ||
| isolation: "worktree", | ||
| mode: "bypassPermissions", | ||
| description: "Fix PR #<NUMBER>", | ||
| prompt: "<self-contained prompt with failures + comments + instructions>" | ||
| }) | ||
|
Comment on lines
+213
to
+219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The |
||
| ``` | ||
|
|
||
| Do NOT wait for one agent before spawning the next. Do NOT run them sequentially. The point of this phase is fan-out. | ||
|
|
||
| After all agents return, re-run Phase 3 auto-merge enablement and report. | ||
|
Comment on lines
+192
to
+224
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The instruction says to spawn one Agent per still-failing PR in a single turn with no upper bound. If the queue has 20+ failing PRs, this creates 20+ concurrent worktree agents simultaneously consuming disk I/O, memory, and GitHub API quota. Consider adding a practical cap (e.g. process at most 10 PRs in parallel, then iterate) and a note that |
||
|
|
||
| ### Close stale or stuck PRs | ||
|
|
||
| PRs that can't be fixed automatically: | ||
| PRs that can't be fixed automatically (agent returns BLOCKED): | ||
| - Close with a comment explaining why | ||
| - Label as `needs-human` if human intervention is required | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -778,7 +778,7 @@ jobs: | |
| needs: [ci-build-public, ci-path-changes, neon-db] | ||
| # Runs Lighthouse CI against the public-route build artifact on PRs. | ||
| # Blocks PRs when triggered (path-gated to public-route changes). | ||
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && needs.ci-build-public.outputs.has_artifact == 'true' && needs.ci-path-changes.outputs.run_public_lighthouse == 'true' }} | ||
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' && needs.ci-build-public.outputs.has_artifact == 'true' && needs.ci-path-changes.outputs.run_public_lighthouse == 'true' }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In GitHub Actions pull_request workflows, github.actor identifies the user or app that triggered the specific workflow run (the "executing actor"), while github.event.pull_request.user.login identifies the author of the pull request itself from the event payload. The key behavioral difference, especially for manual re-runs, is that since July 2022, re-runs use the privileges and actor of the initial triggering run for consistency and security. github.actor remains the original triggerer (e.g., 'dependabot[bot]' for initial Dependabot PR runs), even if manually re-run by a human user. The re-run triggerer is separately available as github.triggering_actor (displayed in UI), but github.actor is stable to the original. For identifying Dependabot-authored PRs reliably (including across re-runs, pushes to the branch, or other triggers), use github.event.pull_request.user.login == 'dependabot[bot]'. Official docs and examples recommend this for Dependabot checks (e.g., in pull_request_target for security restrictions). github.actor may vary if the workflow trigger differs from PR creation (e.g., workflow_run, other bots), though stable on re-runs. Examples: - Initial Dependabot PR open/synchronize: both == 'dependabot[bot]' - Manual re-run of that workflow: github.actor stays 'dependabot[bot]', PR author unchanged. - Push to Dependabot branch by user: new run has github.actor as user, but PR author still 'dependabot[bot]'. - workflow_run triggered by Dependabot test completion: actor may be Dependabot, but use PR author for safety. Citations:
🏁 Script executed: # Check the workflow file at the specified lines
cd .github/workflows && wc -l ci.ymlRepository: JovieInc/Jovie Length of output: 69 🏁 Script executed: # Read the specific lines mentioned in the review
sed -n '780,785p' .github/workflows/ci.yml
sed -n '1033,1038p' .github/workflows/ci.yml
sed -n '1167,1172p' .github/workflows/ci.ymlRepository: JovieInc/Jovie Length of output: 1318 🏁 Script executed: # Get more context around each line to understand the job structure
sed -n '770,790p' .github/workflows/ci.yml
sed -n '1025,1045p' .github/workflows/ci.yml
sed -n '1160,1180p' .github/workflows/ci.ymlRepository: JovieInc/Jovie Length of output: 3210 Use PR author context for Dependabot gating, not triggering actor. Lines 781, 1034, and 1168 use 🔧 Suggested fix- if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' && needs.ci-build-public.outputs.has_artifact == 'true' && needs.ci-path-changes.outputs.run_public_lighthouse == 'true' }}
+ if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.event.pull_request.user.login != 'dependabot[bot]' && needs.ci-build-public.outputs.has_artifact == 'true' && needs.ci-path-changes.outputs.run_public_lighthouse == 'true' }}
- if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' && needs.ci-path-changes.outputs.run_onboarding_lighthouse == 'true' }}
+ if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.event.pull_request.user.login != 'dependabot[bot]' && needs.ci-path-changes.outputs.run_onboarding_lighthouse == 'true' }}
- if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' && needs.ci-path-changes.outputs.run_admin_lighthouse == 'true' }}
+ if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.event.pull_request.user.login != 'dependabot[bot]' && needs.ci-path-changes.outputs.run_admin_lighthouse == 'true' }}Also applies to: 1034-1034, 1168-1168 🤖 Prompt for AI Agents |
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
|
|
@@ -1031,7 +1031,7 @@ jobs: | |
| ci-lighthouse-onboarding-pr: | ||
| name: Lighthouse (onboarding PR) | ||
| needs: [ci-fast, ci-path-changes, neon-db] | ||
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && needs.ci-path-changes.outputs.run_onboarding_lighthouse == 'true' }} | ||
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' && needs.ci-path-changes.outputs.run_onboarding_lighthouse == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
|
|
@@ -1165,7 +1165,7 @@ jobs: | |
| # so dependent jobs would silently skip on admin-UI-only PRs. This job creates | ||
| # its own ephemeral branch below and does not reuse the shared neon-db branch. | ||
| needs: [ci-fast, ci-path-changes] | ||
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && needs.ci-path-changes.outputs.run_admin_lighthouse == 'true' }} | ||
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' && needs.ci-path-changes.outputs.run_admin_lighthouse == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gh api repos/{owner}/{repo}/pulls/$PR/comments --paginatefetches only inline review comments (line-level). General PR-level bot review summaries (e.g. the top-level CodeRabbit or Greptile summary comment) are posted as issue comments and are only accessible viagh api repos/{owner}/{repo}/issues/$PR/comments --paginate. Agents instructed to "address each unaddressed CodeRabbit / Greptile comment" will silently miss all summary-level feedback unless both endpoints are fetched.