Repository navigation
v1.92.0.0 ship-queue: merge trains for any repo (train gates, every prefix gated, direct/update land, train init/doctor) (GSTA-157 PR 2) - #3692
Merged
Conversation
…-red, conditional receipts) (GSTA-157 PR 1) 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>
…, readPause, wait unconfigured) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ers an invalid base policy Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ify usage before fetch, unresolved-head detail) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… 2026-10-31); CHANGELOG entry moved to changelog.d fragment Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…command), every prefix gated, generalized train land (direct/update, merge method), base-red trains, train init/doctor, watch --land (GSTA-157 PR 2) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…base, post-merge checks, output tail, caps) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…merge checks are green Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… fixes 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>
…m resolves gh.exe there) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…py/ship-queue-merge-trains (rule 19 grant, GStack Minder 2026-10-31) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
5 tasks done
garrytan
added a commit
that referenced
this pull request
Oct 31, 2026
…seline to 970 lib/ship-policy.ts:403 and test/ship-queue-train-generic.test.ts:234 use startsWith instead of a caret regex (same result). Main dropped the unused outOk import, so --write-baseline removes that entry; the baseline only shrinks. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This was referenced Oct 31, 2026
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.
What changed
Any repo can now run a merge train on its own CI workflows or a test command; captain.md gains the setup steps (train init, doctor, watch --land).
Before/after as text: Any repo can now run a merge train on its own CI workflows or a test command; captain.md gains the setup steps (train init, doctor, watch --land)
train.gateslistsworkflowsgates (nonce-dispatched CI workflows with workflow-qualifiedrequired_jobs) andcommandgates (a repo command on a Ubicloud VM, bound to the prefix tree). Every entry must be green on every prefix. A train block withoutgateskeeps the old path.train-prefix/<nonce>/t<i>and gated, so the culprit is the first red prefix after a green one, with no bisect.train landgeneralized: it publishes the stamped S_i when the policy stamps and T_i otherwise, with the merge method fromtrain.land.merge_method, adirectmode when the pin's required checks are all green andupdateotherwise. The next slot waits until the previous slot'spost_merge_checksare green.ready --base-red/--fixerand--fixes-base-red; T0 may be red only on the fixer's declared cases, and the fixer sits in slot 1.train init/train doctorread branch protection, workflows and open PRs and print the policy block and workflow snippets;train watch --landruns build, gate, verdict and land and stops at the first refusal.Why
"Trains only worked for gstack's own paid-eval gate": other repos (Truther, gbrain, Founderstar) merged one PR at a time and got stuck whenever main was red. Now any repo can run a train on its own CI or test command, and every tree that lands on main has passed its gate first.
Blast radius
This touches the ship-queue train code, the ship policy schema and the docs for both. gstack's own trains keep their current behavior because a train block without
gatestakes the old code path, and a test parses the repo's .gstack/ship-policy.json unchanged (script ran: the train lane passed 610 tests at tree 68e0643).Approvals
No approvals recorded for branch capy/ship-queue-merge-trains.
Summary
Merge trains only worked for one repo, so every other crew merged one PR at a time and stopped when main went red. This PR lets a repo declare its own gates, gates every prefix so a red train names its culprit right away, and lands each slot with the merge method and checks that repo uses. Review fixes after pass 1 and pass 2 bound workflow re-dispatch, hold a lease during builds, keep the full output tail, and make landing wait for each slot's post-merge checks. The branch carries one merge of the base branch and one of main (rule 19 grant); neither changed the product patch.
Test Coverage
New code paths are covered by the 22-file train lane (610 pass, 0 fail) and the free tier on a remote pregate (24391 tests, 0 failed). Gaps found by review are listed under Review notes (chooseMode wait branch, end-to-end stamp-at-merge without fragments). Coverage percentage was not computed in this run.
Tests ran: typecheck count unavailable
Tests ran: train 610
Pre-Landing Review
Pass 1 found 23 issues; 7 were at the blocking floor and were fixed with tests (468f4e8): unbounded workflow re-dispatch, rebase direct land, retarget before merge, post_merge_checks not gating, concurrent builds, the 1 MB tree line, and merge-only rejecting legacy policies. Pass 2 found 1 blocker, fixed in 583cc1b (train land refuses the next slot until the previous slot's post-merge checks are green). Passes 3 to 5 were clean reads after docs, curation and merge commits.
REVIEW_LOOP: passes=5 blocking_found=8 deferred=0 noted=30 fixed=16 scope=frozen fix_checks=1 dispatches=4
Gate edits: none detected (2 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: issues found. Its first High item (a restarted watcher skipping post-merge checks) was fixed in 583cc1b; its other two (the train lease is local to one clone, and command-only repos with no GitHub CI cannot READY or land) are below the floor and listed in Review notes. The fix-check flagged that the pending post-merge NEXT carries
--timeout 0, which the CLI rejects; it was judged below the floor and is open.Targeted review (money class, at 93fc5dc against main 1b46f37): 1 finding, INFORMATIONAL, below the floor; listed in Review notes.
Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
lib/ship-queue-train-land.ts:119no test reaches chooseMode wait branch or the merge-tree mismatch branchlib/ship-queue-train.ts:433no end-to-end test of a gated train under stamp-at-merge without fragmentslib/ship-queue-train-land.ts:53rulesets-only protection reads as unprotected; direct retried foreverlib/ship-queue-train-land.ts:150post_merge_checks names with commas split by --checks; JSON.stringify is not shell quotinglib/ship-queue-train-cli.ts:186--fixes-base-red split on commas; matrix case ids contain commaslib/ship-queue-train-gate.ts:391all command VMs start at once; a quota refusal settles INCOMPLETElib/ship-queue-train-gate.ts:459record artifact not scoped to the rerun attemptlib/ship-queue-train-gate.ts:132a failed non-required job turns a prefix REDlib/ship-queue-train-gate.ts:452a transient read error settles INCOMPLETElib/ship-queue-train-gate.ts:447rerun completion keyed on run_attempt<2lib/ship-queue-train-gate.ts:291lease takeover race, unowned release, pid reuse after sleeplib/ship-queue-train-land.ts:114direct mode trusts local merge-tree to predict the server merge (post-merge tree check freezes)lib/ship-queue-train-gate.ts:356command rerun skipped silently when the cap is spentlib/ship-queue-train.ts:686refs and gw worktrees left behind for unattributed/incomplete trainslib/ship-queue-train.ts:403a held fixer past max_size refuses the buildlib/ship-queue-train-gate.ts:298the train lease is local; two controllers on separate clones can both run command gateslib/ship-queue-train-ready.ts:228command-only repos with no GitHub CI cannot READY or landlib/ship-queue-train-gate.ts:461crash between rerun request and record allows a third attemptlib/ship-queue-train-gate.ts:342a VM whose teardown is not confirmed (left=1 or unknown) keeps billing until its TTL reaper, up to about 3x the reservation the train cap counted (targeted money pass)Exploratory QA
Not run: this is CLI and library code, and its behavior is exercised by the train lane fixtures (fake gh, fake Ubicloud API). No live repo train was run.
Design Review
No frontend files changed — design review skipped.
Eval Results
No paid evals ran; no prompt-related files changed. The remote pregate cost $0.07 at tree 68e0643 ($0.14 in total with the superseded run at 821cf3b).
Greptile Review
No Greptile comments.
Plan Completion
Built against the GSTA-157 plan approved by Garry ("Do it", 2026-10-29) and re-planned against v1.91.365.0 with GStack Minder's approval (2026-10-31). Deferred: #3603 items 3 to 5 stay with GSTA-154.
Issues
Refs #3611
Verification Results
The plan's checks ran as tests: 610 PASS in the train lane, 0 FAIL, 0 BLOCKED. Not run: a live train on a peer repo.
TODOS
No TODO items completed in this PR.
Documentation
Status: current. This re-audit after the base merge (origin/main 1b46f37 now includes #3611) found no drift in this PR's docs; no edits and no blockers.
Scope: base 1b46f37 to head 93fc5dc, 22 committed files with nothing staged, unstaged or untracked. The docs in the diff are docs/ship-policy.md, docs/troubleshooting.md, docs/captain.md, captain/templates/merge-train-peer.md and the changelog.d fragment. The merge commit changes no bytes compared with 94fa21c, and main's changes since the earlier audit's base touch only unrelated troubleshooting entries. Claims were rechecked against lib/ship-policy.ts (TRAIN_GATES_KEY_VERSION 1.92.0.0; max_size 1 to 5 for a train with gates), lib/ship-queue-train-gate.ts (at most two sends per prefix; UBI_OWNER required; $0.34 reservation at 1800 s), lib/ship-queue-train-init.ts (default cap $3 covers six prefixes and one rerun; the rebase finding), lib/ship-queue-train.ts (prune) and lib/result-codes-release.ts (all seven new codes have troubleshooting anchors). Banned-term check: none configured.
Documentation health:
Documentation coverage:
Diagram drift: none (ARCHITECTURE.md has no ship-queue diagram).
Follow-up: run /document-generate for a tutorial on turning on a train with gates.
Test plan
🤖 Generated with Claude Code