Repository navigation
fix(land): prove push access only on E/F, and fence F's push on the land ref - #695
Conversation
Cloud now gives an auto run's write grant to stages E and F only (cloud#5944, S1 on train #5941): A-D, where an agent reviews and fixes untrusted change content, run on a read grant. The auto preflight dry-ran a push on every stage, so every auto run would have stopped needs_human at A-adversarial. The push dry-run now runs only on E and F (WRITE_STAGES); the gh auth check stays on every auto stage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
[High impact] The changes affect auto land runs that review and write to repository branches. The PR still needs to keep a failed recovery fetch from marking landed work as cancelled.
|
Superseding a land run means a newer push to its land ref. Stage F now pushes the squash atomically with a --force-with-lease that the land ref still points at the pinned head, so if the ref moved GitHub rejects the lease and nothing lands on the base. The run then ends cancelled as superseded instead of retrying through D. This is the write fence Cloud's cancellation cannot give on its own (cloud#5944 review): a cancelled stage's sandbox may outlive the cancel and still hold its GitHub credential, but it can no longer land. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing duplicate #696 in favor of this PR. The relay handoff arrived after it opened. Keeping Additional fixture coverage available in #696 at |
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
The #695 review (kjgbot, Greptile) showed the no-op fence checks nothing: pushing the land ref to its own value is dropped from Git's transaction as up to date, so --force-with-lease only compared the client's advertisement and a land ref moved mid-push still let the old squash land. F now deletes the land ref in the same atomic push, leased on the pinned head. A delete is a real update with an old value, checked inside the transaction, so if the ref moved the push fails and nothing lands. A replayed F that finds its own Land-Run trailer on the base reconciles as landed even though its land ref is gone. Real-Git evidence: examples/land/evidence/push-fence. Also: the read-only test covers a fix round (C-1) explicitly, and the gh preflight message no longer claims a write grant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…nded Greptile on #695: if GitHub accepts the atomic push but the connection drops before git hears back, the push exits nonzero, the land ref is already deleted, and the run was saved cancelled (superseded) for work that landed. On a failed push F now fetches the base and, if this run's Land-Run trailer is on it, records the landed commit before considering supersession. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sion cubic on #695: - A replayed F checks its own Land-Run trailer on the base whenever the land ref is not at the pinned head (gone, or recreated by a newer submission), not only when it is gone. - The fence deletes the land ref, so the auto write grant must allow deleting land/* branches; a dry-run push cannot prove branch rules, so this is documented in the README and the evidence README. - The evidence script captures the server's ref updates on every trial and shell-quotes the paths it writes into the hook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kjgbot
left a comment
There was a problem hiding this comment.
The atomic deletion addresses my original no-op-ref finding; real Git race probe confirmed rejection with main unchanged. The added replay reconciliation has a fresh-hosted-checkout integration gap noted inline. This review does not modify the owned source or train.
kjgbot
left a comment
There was a problem hiding this comment.
Reviewed exact head bd2e03b. The E/F-only write probe matches the staged grants, and the real atomic deletion addresses my original no-op-ref race. Accepted the post-push fresh-retry reporting gap as tracked P2 #697; that recovery behavior remains unfinished and is not part of this signoff. Cloud cancellation still has a separate finding on cloud#5944; this approval does not approve its execution-stop/slot-release path or production rollout.
Companion to cloud#5944, which fixes S1 on Cloud merge train #5941: an auto run's contents:write grant now goes to stages E (the gate's snapshot branch) and F (the squash to the base) only. A–D, where an agent reviews and fixes untrusted change content, run on a read grant.
land.flow.tsdry-ran a push on every auto stage, so with that grant every auto run would stopneeds_humanatA-adversarial.input.stageis inWRITE_STAGES(E,F). Thegh auth statuscheck stays on every auto stage (a read grant authenticates gh too).needs a push-capable git credential at stage E.Tests
auto: review and fix stages run on a read-only credential; a push-denied credential stops at E before any push(replaces the old "fails preflight before any stage runs").auto: the push dry-run runs only on stages E and F.examples/land:npm test91/91,npm run typecheckclean. Land-only; nothing inpackages/changes, so no release is needed. The land deployment is redeployed from the merge commit.Fence stage F's push on the land ref
Answers the cloud#5944 review (Devin, Codex, Greptile, kjgbot) that a cancelled stage F can outlive its cancellation: Cloud writes
cancelledbefore teardown, a provider stop failure can still return 200, and RelayAuth revocation does not revoke the GitHub credential inside the sandbox.Superseding a land run means a newer push to its land ref. F now pushes
git push --atomic --force-with-lease=refs/heads/<ref>:<pinnedSha> origin <squash>:refs/heads/<base> <pinnedSha>:refs/heads/<ref>. If the ref moved, GitHub rejects the lease and the atomic push lands nothing on the base, whatever the old sandbox still holds. The run then re-reads the ref and endscancelled(superseded) instead of retrying through D.Test:
auto: F fences its push on the land ref, and a superseded run lands nothing(fails with the fence removed).examples/land: 92/92, typecheck clean.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes the land auto preflight and fences stage F's push so read-only review stages work and a superseded run can never land stale work.
Cloud now grants
contents:writeonly to auto stages E (gate snapshot branch) and F (squash to base); stages A–D run on a read grant. The preflight previously dry-ran a push on every auto stage, so every auto run would stop atA-adversarial. Separately, stage F's push was unsafe: a cancelled run's sandbox can outlive the cancel and still hold its credential, so it could land after being superseded.WRITE_STAGES(E,F); thegh auth statuscheck stays on every auto stage.--force-with-leaseon the land ref, deleting the ref in the same transaction (pushing it to its own value would be dropped as up to date and check nothing), and ends the run cancelled as superseded if the ref moved instead of retrying through D.Land-Runtrailer on the base reconciles as landed even though its land ref is gone or recreated by a newer submission.land/*branches; a dry-run push cannot prove branch rules, so this is documented rather than preflighted.needs a push-capable git credential at stage E.Tests
examples/land/evidence/push-fenceprovides real-Git evidence that the delete-based fence blocks a moved land ref where the previous lease did not, and captures the server's ref updates on every trial.Written for commit bd2e03b. Summary will update on new commits.
Agent Relay sessions
codexsession01a19dbc· contributor · rangh prcommands · last active 2026-11-03