Repository navigation
Land checks a PR whose base moved in a separate clone, then with full CI, before merging (GST-1766) - #4649
Merged
Conversation
…config and hooks (GST-1747) Land records the checkout's git config and hooks before land.merged_checks run, puts back anything a check changed or added and refuses; every ship-queue git call runs with hooks and fsmonitor off. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Guard the commondir and gitdir files and the checkout's .git, follow symlinked config and hooks to their targets, never read a FIFO, socket or device, restore per entry by rename with modes reset children first, and run the restore in a finally so a thrown check still puts the git directory back. Recheck where git finds the git directory after the checks and refuse when it moved or a path could not be put back. Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/specialist-batched#1 reader=security Review-Finding: p1/red-team#2 reader=red-team Review-Finding: p1/red-team#3 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Put back a guarded symlink whenever its target differs, open directories (u+rwx, parents first) before restoring into them, and when a path cannot be put back make no further git call in the checkout: land refuses and leaves the land lock held instead of pushing its release. Run the merged tree's rev-parse and status with the checks' environment, before the restore and followed by a stray-process sweep. Review-Finding: p2/specialist-batched#1 reader=security Review-Finding: p2/red-team#1 reader=red-team Review-Finding: p2/red-team#2 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Per the Captain's grant (a-6bbdd886c96b) replace the restore with a refusal: land compares the guarded git paths (every symlink hop recorded) after land.merged_checks, and on any change it names each path, makes no further git call in the checkout, pushes no lock release and prints the command that releases the lock without running the checks. Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#2 reader=outside-voice Review-Finding: p2/adversarial-native#1 reader=adversarial-native Review-Finding: p2/adversarial-native#2 reader=adversarial-native Review-Finding: p2/adversarial-native#3 reader=adversarial-native Review-Finding: p2/adversarial-native#4 reader=adversarial-native Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…e captain table Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…d-checks Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # docs/captain.md # lib/land-merged-checks.ts # lib/ship-queue-land-direct.ts
… merged tree The merged-tree checks run in a fresh clone with its own .git and a copy of node_modules. Land pins the git and gh it runs before the checks and refuses, holding the land lock, when a check changed a file its later git or gh calls read. A new land.merged_ci key dispatches a workflow on the merged commit and lands only when that run proves the merged tree; gstack's policy runs Free Tests this way. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
Only gstack-ship-queue land turns off git hooks for its git calls; wave, train and other queue pushes keep the checkout's hooks, the managed pre-push guard among them. Review-Finding: p1/red-team#2 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…lock Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ld land lock" This reverts commit 92cc893.
Merged
3 tasks done
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 since a PR's last CI run,
gstack-ship-queue landnow runs its local merge checks in a throwaway clone and can then run the full CI suite on the merged code before it merges.Why: the old checks shared the checkout's git directory, so a PR's own test commands could plant a hook that later ran with land's tokens, and a PR could reach main on a base its full suite never saw.
Nothing to do: gstack's own policy turns the CI run on; other repos opt in with
land.merged_ci.What changed
land.merged_checksrun in a fresh clone outside the checkout (git clone --no-hardlinks, its remote removed) with a copy ofnode_modules, so writes to its.git, hooks, config or modules are deleted with it. About 2.5 s extra per stale-base land on this repo (0.5 s clone, 2.2 s module copy).gitandghat its first call (lib/tool-path.ts) and, before the checks, puts their directories first on its ownPATH, so agita check drops earlier onPATHnever runs. gh's childPATHstarts with the pinned git's directory.commondir/gitdirand their symlink hops (from fix(ship-queue): keep land's merged checks out of the checkout's git config and hooks (GST-1747) #4119, carried here), land now also records every config file git loads in the checkout (includes and the global file), the global and XDG config paths when absent, gh'sconfig.ymlandhosts.yml, and the pinned binaries. A change refuses withQUEUE_LAND_MERGED_CHECKS, makes no further git or gh call, keeps the land lock held, and the fix text now says hold and inspect instead of "merge main and push".land.merged_ci({ workflow, profile }). After any local checks pass, land pushes the merged commit togstack-land/<pr>, dispatches the workflow there, waits up to 45 minutes, and lands only whenlib/run-evidence.tsverifyRunaccepts the run under the named profile with the merged commit and tree. Red run:QUEUE_LAND_MERGED_CHECKS. Can't push, dispatch, finish or prove:QUEUE_NOT_READY. The branch is deleted either way. gstack's policy sets{ "workflow": "free-tests.yml", "profile": "ci-reuse/free-tests" }and keeps its local checks as the fast first step.Things a reviewer should look at
gstack-land/<pr>and runsgh workflow runwith its own credentials. The pushed commit can include workflow file changes from the PR, so the token needs the workflow scope it already uses for branch pushes.gstack-land/*may start other workflows that trigger on any branch push.lib/gh-poll.ts(every gh call through it) now runs the pinned gh with the pinned git's directory first onPATH.ship-queue-land-direct.ts(the fixture's gh shim can't serve run artifacts);test/land-merged-ci.test.tscovers every verdict with fake dependencies.Agent notes
Base: #4119's branch
capy/keep-lands-merged-checks(closed PR, parked at 59b7b26), merged with main at dd61103 (three conflicts resolved: docs/captain.md took main's rewrite, which no longer holds the refusal table; lib/land-merged-checks.ts and lib/ship-queue-land-direct.ts kept both sides). GST-3303 change 7 and GST-1766 in one PR on the Captain's ruling. #4119's four tests were rewritten for the clone: relative writes now land in the clone (test asserts the checkout is untouched and land merges), absolute writes still refuse.Local checks at 9b28718:
bun run typecheckclean,bun run typecheck:testno new diagnostics,gen:skill-docs --host allleft no diff;bun teston test/ship-queue-land-direct, land-merged-ci, gstack-ship-policy, module-size-ratchet, free-seed-ratchet, spawnsync-timeout-tripwire, bun-entry-isolation, changelog-fragments, gh-poll, gh-poll-tripwire, ship-policy-compat: all pass.Approved: yes (record r-32e4bf46e427). The full approval record stays private.
Plan: exempt: audited-list
Plan check: exempt audited-list
REVIEW_LOOP: passes=2 blocking_found=1 deferred=0 noted=1 fixed=1 scope=frozen dispatches=8
Gate edits: 7 listed, 4 read, 0 findings — 0 kept, 0 restored, 0 open
Ruled note: lib/land-merged-checks.ts:62:fix-check at d8efd24 ruled by Captain GStack Minder (GSTA-36), 2026-11-07 at 2026-11-07T08:11:29.416Z: ships as a disclosed note: a checkout whose .git is reached through a symlink chain is not re-located after the checks; GST-1766 moves merged-tree checks to a separate clone (approval a-0530ca53a87c)
Refs from the branch's older commit subjects (gstack-issue-links):
Refs #225
Refs #3338
Refs #3851
Refs #4045
Refs #4051
Refs #4055
Refs #4058
Refs #4059
Refs #4060
Refs #4061
Refs #4062
Refs #4063
Refs #4064
Refs #4065
Refs #4068
Refs #4069
Refs #4070
Refs #4071
Refs #4072
Refs #4073
Refs #4074
Refs #4075
Refs #4076
Refs #4077
Refs #4078
Refs #4079
Refs #4080
Refs #4081
Refs #4082
Refs #4083
Refs #4085
Refs #4087
Refs #4088
Refs #4089
Refs #4090
Refs #4091
Refs #4093
Refs #4094
Refs #4095
Refs #4096
Refs #4098
Refs #4099
Refs #4100
Refs #4101
Refs #4102
Refs #4104
Refs #4105
Refs #4106
Refs #4108
Refs #4109
Refs #4111
Refs #4112
Refs #4115
Second-model review: gpt-6.1-sol, clean. Exploratory QA: pass (5 captures, 2 revalidated after the fix).