Repository navigation
Landing a PR reuses an earlier CI run on the same merged code instead of starting another (GST-3634) - #4760
Merged
Conversation
…ching another (GST-3634) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…atching another (GST-3634) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
Review-Finding: p1/specialist-batched#1 reader=testing Review-Finding: p1/specialist-batched#2 reader=testing Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This was referenced Nov 24, 2026
Merged
capy-ai Bot
added a commit
that referenced
this pull request
Nov 24, 2026
- `/ship` now tells you what to change when GitHub refuses a push for email privacy. (#4748) - The release gate's /cso check accepts the low-confidence hypotheses /cso now reports. (#4753) - /cso reports every security finding the code supports instead of dropping most of them. (#4739) - /cso can search the whole repository in one call, and a daily report now lists its low-confidence hypotheses. (#4742) - A first version's plan and try-it message now open with the owner's own words, and the build is tried the same way he will try it before he is asked. (#4759) - A first version's public export now keeps out the owner's short quotes and his reasons to leave something out, and a phone first-use check installs a build the cloud phone can actually run. (#4772) - Three intermittent test failures are fixed. (#4745) - Free Tests runs its shards on 8-core runners again. (#4749) - A land that waits on an earlier CI run now decides on what that run actually did. (#4763) - Landing a PR no longer starts a new CI run when one for the same merged code is already running or has passed. (#4760) - /ship no longer misses a file-mode change from main on files whose names start with `:`. (#4774) - make-pdf keeps quotes in alt text, link titles and raw HTML attributes inside the attribute, so a Markdown file can no longer add an `onerror`, `onload` or `javascript:` link that runs in the print browser. (#4761) - Posting a PR body that lists earlier /ship runs no longer stops for a phone number that isn't there. (#4747) - A first version's public export now catches a short owner quote whose padding or quote marks are encoded. (#4778) - A first version's public export now also keeps out a short owner quote written with spaces just inside its quote marks. (#4776) - Posting a PR body that lists earlier /ship runs no longer stops for a card number that isn't there. (#4751) - /ship no longer asks for an extra reader when you merge the base branch next to code that was already reviewed. (#4754) - /ship no longer plans narrow re-checks after a fix. (#4741) - /ship can't quietly gain new refusals. (#4740) - `gstack-upgrade` no longer refuses to run after you disable skills. (#4743) - The free test suite splits its shards from this week's recorded test times. (#4744) - gstack now writes up a failed or shelved attempt before closing it. (#4735) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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.
When main has moved,
gstack-ship-queue land --pinnow reuses an earlier CI run on the same merged code: it lands at once on a green run, waits on one still queued and refuses on a red one, instead of starting a new run on every try.Why: GitHub's macOS runner queue has been slower than land's 45-minute wait, so lands kept timing out while the run they started finished green unused.
Nothing to do. Rerunning a timed-out land now waits on the run it named.
What changed
A land onto a moved main kept getting refused with
QUEUE_NOT_READY. Each try built a new merged commit, dispatched a new Free Tests run and gave up after 45 minutes, and the next try ignored the run that had since passed and joined the same queue again. #4753 was refused twice this way on the same base and the same merged tree.Before it dispatches, land now lists the workflow's
workflow_dispatchruns ongstack-land/<pr>and at the merged commit, and keeps those whose head commit has the merged tree. It matches on the tree, never the commit. Cancelled runs are skipped and the newest remaining run decides. A green run still has to passlib/run-evidence.ts'sverifyRun, and one that no longer proves the tree (its artifact expired, or it is too old) gets a fresh dispatch. A timeout names the run the next land will wait on. For a flaky red run, the fix line says to rerun that run (gh run rerun <id>), because rerunning land alone finds the same red run.GitHub keeps a run going after its branch is deleted. Run 45249277829's macOS jobs started after the branch was deleted and passed, and the deleted branch's commit can still be fetched by sha. So land still deletes the scratch branch every time.
Blast radius
The one caller is
landMergedCiinlib/ship-queue-land-direct.ts. When no earlier run matches, the old push, dispatch and wait path runs unchanged (the existing tests still pass). A read-only probe against GitHub with #4753's real runs, with push and dispatch stubbed out, adopted green run 45249277829 through the realverifyRunand pushed nothing.Test Coverage
The test was written first: commit aced15f has 6 new cases failing against main's code. They now pass, plus 3 more added during review (16 in
test/land-merged-ci.test.ts). The cases cover green, still-running, red, tree rather than commit matching, skipping cancelled runs, an unprovable green run falling through, a run at the merged commit, an adopted run that can't be proved, and timeouts on both a dispatched run and an adopted one. Not covered by tests:landMergedCi's fix-line wording, and the liverunsOnAPI call (exercised by the probe above).Pre-Landing Review
The specialist pass found 2 test gaps, both fixed (a test fake whose lookup used up scripted polls, and two untested outcomes at
lib/land-merged-ci.ts:77). The second-model review (GPT-6.2 Sol) and the native adversarial pass raised three findings recorded as blocking. Each was ruled below the blocking floor and ships as an open note:lib/land-merged-ci.ts:77: the choice to dispatch fresh reads the run-list snapshot, not what land saw while polling. If a green run is rerun between listing and polling, a red or timed-out rerun is ignored and land dispatches again (worst case about 90 minutes). It never lands on a red or unproven run. A follow-up PR fixes it.lib/land-merged-ci.ts:47: reuse is keyed on the tree, not on base plus pin, and Free Tests' seed ratchet reads the merge base. This only matters if main returns to an identical merged tree. Tree matching is what the issue asked for.lib/land-merged-ci.ts:63: a red run on a tree never expires, andgh run rerunstops working after 30 days. This needs a merged tree unchanged for 30 days.Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
lib/land-merged-ci.ts:474.lib/land-merged-ci.ts:47— Land skips cancelled or wrong-tree runs before choosing a candidate, but the post-merge Free Tests consumer chooses the newest scratch-branch run before checking its status or tree (scripts/ci-tree-reuse.ts:80–87). In the new test’s older-green/newer-cancelled case, land passes without dispatching but main rejects the cancelled run and queues the entire suite agailib/land-merged-ci.ts:77The worst-case CI wait goes from 45 to 90 minutes, which equalsDIRECT_LOCK_TTL_MS(90 minutes,crew/lib/ship-queue-land-lock.ts:37) beforemerged_checkstime is even added. Another machine could then take over an expired lock while this land is still running. It's also a small correctness slip, because a red result for that tree gets dropped. The fix is to havesettlemark the one case thlib/land-merged-ci.ts:772. INVESTIGATE: a red run now stays red for its tree until someone reruns it by hand. Any conclusion other thansuccessorcancelledrefuses withQUEUE_LAND_MERGED_CHECKS, as a red run:timed_out,startup_failure,action_requiredandstaleincluded (settle, line 63). Every later land on that tree finds the same run, and the only way out isgh run rerun <id>. That isn't alwayslib/land-merged-ci.ts:773. INVESTIGATE: reuse matches on the tree, not the parent commits. Two merged commits can have the same tree and different parents. For example, main moves to B and then a revert C returns it to A's tree. A run on the old merged commit is then accepted for the new one. Anything in the free suite that reads git history (diffs againstHEAD^1or the merge base, checks on changelog fragments orlib/land-merged-ci.ts:1064. FIXABLE: the branch run listing is capped at 20 runs.runsOnasks forper_page=20with no paging (lib/land-merged-ci.ts:106). A PR whosegstack-land/<pr>branch has more than 20 newer dispatch runs on other trees won't find an older run on the matching tree, and dispatches a duplicate. That only wastes CI time; it never lands a wrong tree. Severity: Low. Blocks: no.Exploratory QA
Pass. Probe 001: PR #4753's real runs on the deleted
gstack-land/4753with merged tree 6a3569f1 adopted green run 45249277829, checked by the realverifyRun, with no push or dispatch. Probe 002: the same branch with a tree no run tested adopted nothing and went on to push. Limits: a real dispatch and wait were stubbed out. The timeout and in-progress adoption are covered by unit tests only.Scope Drift
Scope Check: CLEAN. The 45-minute timeout, the required jobs and the 7 required checks are unchanged.
TODOS
No TODO items completed in this PR.
Documentation
Status: current. The docs already describe the new merged-tree CI reuse, so the audit made no edits.
Scope: the branch
land-reuses-merged-tree-ci-runagainst basea256d153, covering committed and working-tree content. The diff touchesdocs/ship-policy.md(thelandpolicy row and the land --pin section),docs/troubleshooting.md(QUEUE_NOT_READY and QUEUE_LAND_MERGED_CHECKS),crew/docs/captain.md(the refusal table) and the changelog fragment. Each was checked againstlib/land-merged-ci.ts,lib/land-merged-checks.tsandlib/run-evidence.ts.Documentation health
docs/ship-policy.md: current. It covers reuse by tree, the newest run that wasn't cancelled deciding, the 45-minute wait, red runs refusing, and thegh run rerunadvice.docs/troubleshooting.md: current. The timeout and red-run fixes match the CLI's fix text.crew/docs/captain.md: current. The rerun guidance for a red run matches.changelog.d/land-reuses-merged-tree-ci-run.md: current. The fragment matches the behavior.Coverage debt: none found.
Diagram drift: none, because no diagrams cover this path.
Tests
bun test test/land-merged-ci.test.ts: 16 pass, 0 failbun run typecheckandbun run typecheck:test: clean, no new diagnosticsAgent notes
Refs GST-3634
Approvals
Approved: yes (record r-03252b3ff4cb). The full approval record stays private.
Plan: exempt: bug fix (R65)
Plan check: exempt bug fix
REVIEW_LOOP: passes=1 blocking_found=4 deferred=0 noted=5 fixed=2 scope=frozen open=4 dispatches=1
Gate edits: none detected (GATE_SCAN tagged=0)
Ruled note: lib/land-merged-ci.ts:77:correctness at 9486779 ruled by GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-23T22:32:26Z) at 2026-11-23T22:32:26.450Z: A: rerun race at line 77 costs at worst a fresh dispatch; never lands a red or unproven run; fixed in the follow-up PR (approval a-4a5ef64f2371)
Ruled note: lib/land-merged-ci.ts:47:correctness at 9486779 ruled by GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-23T22:32:26Z) at 2026-11-23T22:32:26.568Z: B: tree key, not base plus pin; needs main to return to an identical merged tree; tree matching is what the brief asked for (approval a-ea1fbbc32895)
Ruled note: lib/land-merged-ci.ts:63:correctness at 9486779 ruled by GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-23T22:32:26Z) at 2026-11-23T22:32:26.675Z: C: a red run never expires; needs a merged tree unchanged for 30 days (approval a-8653a39469d1)