feat(land): mergePolicy.mode "auto" — real GitHub gate, squash push
Merged
KH
1mo ago+603+603+012345678901234567890123456789-45-45-01234567890123456789
Summary
Phase 3 of AgentWorkforce/cloud#5806. mergePolicy.mode: "auto" lands for real where shadow only planned:
- Stage E really runs the repo's GitHub gate (
ci.flow.ts {"github":true}). A gate short enough to finish insiderunner.stageMinutesapplies its verdict in the same run. One that overruns dies with the sandbox — but theci/<sha>snapshot it pushed and the Actions runs it dispatched outlive it, so the next E run finds the snapshot (its parent is the head under test) and pollsgh run listuntil the dispatched runs complete. Bookkeeping in<stateDir>/github-gate.json, capped atGITHUB_GATE_MAX_ATTEMPTSdispatches /GITHUB_GATE_MAX_POLLSawaits. Red feeds the fix loop like a closed gate (round cap, stuck-finding, not-decreasing all apply); green moves to F. - Stage F squashes the land head onto the latest base and pushes
<commit>:refs/heads/<base>withRelay-Session/Land-Runtrailers. Base moved since the last gate → D; non-fast-forward push → D. Other push failures →needs_human. fixLoop.harnessacceptsclaude|codex|grok|devin, defaultcodex, and is passed to the review flows as theirclis.- Shadow is unchanged: no write token, E records a would-dispatch, F writes a
pushed:falseplan; Cloud still maps shadowlanded→would_land.approvalremains declined.
Test plan
-
npm testinexamples/land— 72/72 pass, covering every new transition (E pending/green/red, F pushed/moved/non-FF, mode discipline, trailers in the commit message,ci/<sha>deletion) -
npm run typecheckclean -
flows check land.flow.tspassed - Codex review of this PR
- Cloud PR: auto allowlist + write grant + secrets, then first real auto land on relay-desktop
Generated with Devin
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Implements mergePolicy.mode: "auto" so the land flow really lands changes — running the repo's GitHub gate at stage E and squash-pushing to the base branch at stage F — where shadow mode only planned them.
Behavior
- Stage E dispatches the repo's gate for real; a gate that overruns the stage window dies with the sandbox, but the
ci/<sha>snapshot and dispatched Actions runs outlive it, so the next E run awaits them viagh run list, capped at 3 dispatches and 6 await runs. - Red gates feed the fix loop like a closed gate; green moves to F.
- Stage F squashes the land head onto the latest base and pushes with
Relay-SessionandLand-Runtrailers; a moved base or non-fast-forward push returns to D. A stage reaped after the push records the landed commit instead of landing twice. - D rebases a head that predates the base even when the base sha is unchanged, and F refuses to squash a head that never contained the base.
fixLoop.harnessacceptsclaude|codex|grok|devin(defaultcodex) and passes the chosen CLI to the review flows;grokanddevinare refused at stage one until their worker adapters land.- Shadow mode is unchanged (no write token, would-dispatch recorded,
pushed:falseplan), andapprovalis still declined. Auto preflightsghauth and a dry-run push at stage one.
Agent Relay sessions
devinsessiongorgeous· opened viagh pr create· last active 2026-11-02