Repository navigation
perf(pr-merge): reuse post-merge-dispatch's report by the lane room's rule - #10349
Conversation
… rule The merge job's shell test reused this run's post-merge report only under 6 minutes old by shared.computedAt, which is stamped before the 6-8 minute check runs, and only at the job's own checkout of main. It never passed, so the merge job re-ran the ~225-call check every tick. Extract lane_room's reuse decision into babysit_merge_policy.settle_shared (shared_refusal plus its two keeps: unverified-stale while nothing moved, demotion-changed while the demotion reads the same) and call it from lane_room. babysit_verify_evidence.py settle applies it to the kept report without reading it again; the merge job reuses the report when the code is 0, 1 or 5 and settle exits 0, else runs the check as before. REUSE_MINUTES is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review reviewed Incremental review of The change imports I did not run the tests or the isolation check, and I did not re-review the other nine files, which were reviewed at dad4dbc. The PR spends no prepaid credits or billing. |
|
claude-security-review reviewed No security issues found in the incremental change since dad4dbc. The change is confined to critical-findings: 0 |
post-merge-dispatch now keeps the commit whose code ran its check beside the report. The merge job's reuse (settle) and enable-auto-merge's lane room (lane-room) take it as a required --code-sha, and check_code_unchanged compares the babysit-prs scripts and docs/conventions/pr-pipeline.yaml there with this checkout's HEAD: a change, a missing or malformed commit or a git failure refuses the report, and the lane room reads it again. settle reads the agent identity from the default branch's config, so the merge job runs yq only on its fresh-check path, and the keep step's comment states the new reuse rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CHECK_CODE_ROOT took parents[4] of the script, the plugins directory, so the pathspecs named paths that do not exist and every commit in the clone read as unchanged. Take the repository root, and pin the default root with a test that the two checked paths exist under it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g at HEAD git diff --quiet exits 0 for a path present at neither commit, so a renamed or moved guarded path would read as unchanged. Require each path to exist at HEAD before the diff. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ixtures CheckCodeUnchanged builds git repositories; an inherited absolute GIT_DIR would point its writes at the caller's repository. Pop GIT_DIR, GIT_WORK_TREE and GIT_CONFIG first, as fixture-git-isolation requires. Co-Authored-By: Claude Opus 5.5 <[email protected]>
No related issue: pr-merge tick overhead (post-merge check runs 3x per tick)
Summary
The pr-merge merge job never reused post-merge-dispatch's post-merge report. Its shell test needed the report to be under
REUSE_MINUTES(6) old, measured fromshared.computedAt, butbabysit_postmerge.pystamps that time before its 6-8 minute check runs, so every report was already too old when it was uploaded. The test also needed the report'smainShato equal the merge job's own checkout of main. So every tick ran the ~7 minute, ~225-call check a second time. In run 40382489448 the merge job re-ran for 479 s and produced the sameautoMergesfor all 130 merges.The lane room already settles the same report with the gate's Python rule (
shared_refusalplus two keeps). This PR moves that decision into one function and has the merge job use it.Fix
babysit_merge_policy.settle_sharedholds the reuse decision that was inline inlane_room:shared_refusalat the default branch head, with no self logins, in the lane. It keeps anunverified-staleanswer only when_still_currentholds, and ademotion-changedone only whenread_demotionreads the same demotion. Any other refusal is read again throughpost_merge, or refused when there is none.lane_roomnow calls it, and its unreadable messages and its no-keep path without apost_mergeare unchanged.babysit_verify_evidence.py settle --repo --postmerge-result --agent-identityapplies that rule to the kept report and never reads the report again. It exits 0 when the report stands and 1 when it is refused or a read fails.pr-merge.yml, step "Check earlier lane merges": the report is reused when its code is 0, 1 or 5 andsettleexits 0. Otherwise the step runs the check exactly as before, so exit codes (75 included), lane records andneedsDispatchare untouched.REUSE_MINUTESis gone.What changes and what stays. The old exact-head match and 6-minute age test only decided when the merge job could skip re-running the check. Neither was a gate refusal or a hold. The new rule accepts a moved main that has no new countable lane merge (the
new-merge:#Nwalk), up toSHARED_MAX_AGE(30 min), the same as the lane room does today. Everyshared_refusalcondition still refuses: identity, self logins, lane,floor-differs,config-unreadable,stale,unverified-stale(past 2 minutes, kept only when nothing it was read from moved),new-merge,merged-history-truncated,merged-unreadableanddemotion-changed(kept only on an equal demotion read).SHARED_UNVERIFIED_MAX_AGEis not raised. No gate refusal or hold is narrowed, and the gate's per-candidateassesspath is unchanged.Not shipped: skipping already-verified merges on a re-run.
_judgedoes not treat "verified" as final for a merge commit, so this PR does not skip_judgeor the pin read for merges an earlier report verified:merge.quarantine-days,expired()/demoting()turn the same check into a regression on time alone (babysit_postmerge.py_Context.expired,_Context.demoting).read_pinreturns None for an edited pin, which isread-back-unrecorded, or a failure past 6 hours. A newer pin naming another SHA is a failure.Verification
test_babysit_lane_room.py, written failing first:SettleSharedcovers a fresh report at an unmoved head (reused), a moved head with no new lane merge (reused), and a moved head with an uncounted lane merge (new-merge:#9, refused).unverified-stale: refused with no run check, with a run concluded since, and at a moved head; kept when nothing moved.demotion-changed(refused on a different demotion, kept on an equal one, refused unread without keeps) andstale(refused even when nothing moved).SettleCommandcovers the CLI's bindings and its exit codes.merge-job.test.mjs: the shell tests now use a fakesettle. A judged report is reused only whensettleexits 0. A refusal, a crash, exit 3 or exit 75 runs the check, and a code that could not judge is never offered tosettle.test_an_unusable_answer_with_no_fresh_read_is_unreadable,test_a_failed_recompute_leaves_the_room_unreadableandtest_it_prints_the_room_from_the_post_merge_report.origin/main(fix(pr-merge): carry the verifier reads' run cache through its own trusted artifact #10327):python3 -m unittest discoverover the babysit-prs scripts ran 3086 tests, OK.node --test .github/scripts/pr-merge/*.test.mjsran 496 tests, all passing.actionlint .github/workflows/pr-merge.ymlis clean.pr-merge.ymlpassed: 1092 node tests andscripts/ci-hold-human-gated.test.sh,ci-lanes-pr-hold.test.shandpost-merge-demotion-alert.test.sh.Related
babysit_merge_policy.lane_room,shared_refusal.🤖 Generated with Claude Code