Repository navigation
Conversation
With a runner block, the guarded merge gate now inspects, merges and polls the task's published pull request: the task's latest opened record in github.baseBranch, which GitHub must show from the task branch, into that base, with its marker, as the only open PR from the branch, and not a draft. github.pullRequest becomes optional with a runner block and blocks merging when it names another PR; without a runner block it is required and used as before. The resolved PR must be the same in every validation pass; admission re-reads the PR record in the transaction that saves the attempt, and the attempt pins its PR so reconciliation and queue polls never re-resolve it. The pre-merge already-fixed check treats every PR the task recorded in the repository as its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It changes irreversible merge targeting and concurrent reconciliation across storage, GitHub, and queue lifecycles.
Review effort: Balanced
Findings: None
What changed in this PR
Targets guarded merges at each runner task’s published pull request and pins that target throughout validation, submission, and reconciliation.
Changes:
- Resolves and validates task-published PRs, including draft and branch checks.
- Persists the target PR on merge attempts and scopes gateway caching/polling accordingly.
- Adds regression coverage and updates merge documentation.
| File | Description |
|---|---|
| README.md | Documents runner-managed merge targets. |
| docs/implementation/guarded-merge.md | Defines target selection and pinning. |
| docs/implementation/merge-queue.md | Documents queue target persistence. |
| docs/implementation/pull-request-opening.md | Connects publishing with merging. |
| github/merge.ts | Adds target-aware inspection, merging, caching, and polling. |
| github/pull-requests.ts | Exports the opening marker helper. |
| github/validate.ts | Centralizes base-branch validation. |
| runner/merge.ts | Resolves, validates, and pins task PRs. |
| runner/production.ts | Re-exports shared branch validation. |
| runner/publish.ts | Uses the shared marker helper. |
| runner/review.ts | Records runner-block presence in configuration. |
| runner/store.ts | Persists and guards merge-attempt PR targets. |
| test/browser/review.spec.ts | Updates browser gateway fixtures. |
| test/merge-task-pr.test.ts | Adds task-PR targeting regressions. |
| test/merge.test.ts | Updates merge-state fixtures. |
| test/runner-shutdown.test.ts | Updates shutdown merge fixtures. |
| web/server.ts | Selects runner-published versus configured PR mode. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #121. Stacked on #110 (
feat/103-publish-pr).Problem
Since #103 the runner publishes its own pull request for each task. The guarded merge gate still inspected, merged and polled only
github.pullRequest. A runner task's merge was therefore always blocked: the configured PR's head is not the task head, and the task's own PR counted as "another PR" in the already-fixed check. It could also target the wrong PR. Merge attempts did not record their PR, and nothing read the draft flag.Change
runner/merge.ts,web/server.ts):openedrecord in the configured repository andgithub.baseBranchwhose opening began last.pull-requestblocker.github.pullRequestis optional with a runner block. If it is set and names another PR, merging is blocked.github.pullRequestis required (the server refuses to start without it) and is used as before.draft) in both modes.Store.beginMergeAttemptre-reads the record in the transaction that saves the attempt. It must still be the opening that began last in its base, with the same number, and no opening or update may be in flight.pullRequestin its JSON data, so no migration is needed. Reconciliation, the queue watermark, queue polls andgh pr mergeuse the attempt's PR and never resolve it again.github.pullRequest.github/merge.ts):pr viewnow also reads and validatesnumberandisDraft. For a published target it also readsbodyandisCrossRepository, and lists the open PRs from the task branch (one page; a full page fails closed).openingMarkermoved togithub/pull-requests.ts, andbaseBranchmoved togithub/validate.ts(re-exported fromrunner/production.ts). The server can now check both without loading the runner.guarded-merge.md(new "Which pull request (F: merge the task's published PR, not github.pullRequest #121)" section),merge-queue.md,pull-request-opening.md, README.Evidence
Validated head:
cca2dfd.npm run typecheck: clean.merge-task-pr(45, new),merge,runner-shutdown,review,publish,runner-production,cli,runner-publishing,store,gh-env,already-fixedandrunner-start.Review findings (independent review agent, round 1)
Promise.all. A failing list read left the rule-readghprocesses running past the inspection.#assertPublishable(needsrunningorneeds human; refuses during an active merge).No new AGENTS.md rule: every finding is covered by an existing rule or is one-off.
Copilot review, round 1 (head
cca2dfd)No findings, so nothing changed or was declined. CI on
cca2dfd:testandreal-dockerpassed.Follow-ups: none.
🤖 Generated with Claude Code