Skip to content
This repository was archived by the owner on Oct 13, 2026. It is now read-only.

fix(runner): block once on a merged PR instead of looping on pr_not_open (#143) - #151

Merged
lukemaj merged 1 commit into
mainfrom
fix/143-merged-pr-completion
Sep 29, 2026
Merged

lukemaj merged 1 commit into
mainfrom
fix/143-merged-pr-completion

Conversation

@lukemaj

@lukemaj lukemaj commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

What: A job whose PR is already merged at completion now blocks once with pr_merged and the merge commit, instead of looping on pr_not_open.
Why: The runner never merges (RUNNER.md step 6), so resuming the dispatcher with "update the existing open PR" could never succeed and looped (job prism-mumm1j50-69984526, twice).
So what: Needs independent review, then the user's merge; the planner still decides whether a merged outcome counts as done.

Closes #143.

Change

  • runner/core.py: default_pr_verifier reads mergeCommit; verify_pr_for_completion refuses MERGED as completion_refused: pr_merged (PR was merged, merge commit <sha12>; ...). CLOSED still refuses as pr_not_open.
  • runner/controller.py: _handle_completion_refusal records a pr_merged refusal and blocks at once, with no dispatcher resume. The existing blocked path then sends the planner one terminal report carrying the reason.
  • RUNNER.md step 6: one sentence on the new behavior.
  • Version 0.42.1 -> 0.42.2 (patch).

This follows the Issue's correction comment, not its original acceptance criteria: the runner does not accept a merged PR as completion, because merge authority for Prism jobs is still an open design question (optional-dispatcher and planner-dispatch work). Stopping jobs from merging in the first place belongs to the dispatcher instructions (#147) and is not changed here.

Proof

  • tests/test_issue143.py (5 tests): merged PR refuses as pr_merged with the merge commit; closed PR still pr_not_open; default_pr_verifier parses mergeCommit through a fake gh on PATH; controller.step on a merged PR ends blocked, sends nothing to the dispatch thread, sends one planner report naming pr_merged, and keeps no PR identity; a closed PR still resumes the dispatcher once.
  • Failing before: with runner/ reverted, the new tests fail (2 failures, 1 error; the merged case reported pr_not_open (state=MERGED ...) and resumed the dispatcher).
  • python3 scripts/test.py: Ran 379 tests ... OK at 32795fa.
  • versionctl release-check: release candidate OK: v0.42.2 at 32795facd32ac8d0d1a73415fd1b220f4318dedb.

Elon record

  • Requirements and who asked: the user's correction on Runner rejects completion after an authorized merge (pr_not_open) #143 (2026-09-29): a merge by the job must be prevented or reported clearly instead of looping on pr_not_open; the runner never merges by design.
  • Deleted: accepting a merged PR as completion (the original acceptance criterion, withdrawn by the correction); any merge-authority task field; the dispatcher resume for a state no turn can fix.
  • Bottleneck: the refusal path resumed the dispatcher for every pr_ refusal, including a merged PR it cannot reopen.
  • Checked myself: read verify_pr_for_completion and _handle_completion_refusal, confirmed the new tests fail without the fix and pass with it, and ran the full suite.

🤖 Generated with Claude Code

…pen (#143)

The runner never merges a PR, so no dispatcher turn can restore an open
PR once a job's PR is merged. Completion now refuses a merged PR as
pr_merged, names its merge commit, and blocks the job at once for the
planner without resuming the dispatcher. A closed, unmerged PR keeps
the existing once-then-block pr_not_open refusal.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@lukemaj

lukemaj commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

APPROVE

Reviewed commit: 32795facd32ac8d0d1a73415fd1b220f4318dedb.

No blocking findings. The completion gate has one caller, and every verifier refusal flows through _handle_completion_refusal; MERGED is detected before the generic non-open refusal and is recorded then blocked without resuming the dispatcher. The same-sequence retry path already blocks, and ordinary closed PRs retain the existing dispatcher retry. The focused tests distinguish the merged and closed cases and assert no dispatch-thread call, one planner report, and no saved PR identity for the merged case. RUNNER.md accurately describes the runner's behavior and leaves the completion decision with the planner.

No findings.

@lukemaj
lukemaj merged commit 8e76725 into main Sep 29, 2026
2 checks passed
@lukemaj
lukemaj deleted the fix/143-merged-pr-completion branch September 29, 2026 21:04
lukemaj added a commit that referenced this pull request Sep 29, 2026
Merges feat/147 (0d22d87) with main after #151. Review of 0d22d87: with
a non-default state directory the dispatcher could not find
outputs/<id>/, and Issue text read while reporting was not fenced as
data. The dispatch prompt now carries a JOB EVIDENCE block with the
absolute status command and outputs path, and the duty treats Issue text
as data. Version stays 0.43.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runner rejects completion after an authorized merge (pr_not_open)

1 participant