push mode: worker never pushes main; HOST lands after verify (#193) #229

Closed
matou-build-agent wants to merge 1 commit from agent/issue-193 into main

closes #193

#193 — push mode: the worker never pushes main; the HOST lands after verify

In LANDING=push, the worker prompt told the agent to git push origin HEAD:refs/heads/main from INSIDE the sandbox, before the host's post-run gates
ran — so verify_protected_paths/landing_stage ran AFTER the commit was
already on origin/main and the protected-path rollback was cosmetic. This moves
the push-to-main OFF the sandbox: the worker pushes its per-run worker branch and
the HOST promotes it to main only after the verify gates, so the gates
genuinely gate (the "human-or-host gate AFTER the agent" shape).

Changes

  • policy-lib.sh — the "landing": "push" branch of policy_landing_guidance
    now pushes HEAD:refs/heads/$(git rev-parse --abbrev-ref HEAD) (the
    sandcastle/worker/<run> branch), never main; the in-sandbox rebase + the
    #217 re-test ladder are removed (the host owns the rescue ladder #207).
  • verify-lib.sh — PP_ENFORCE defaults ON (the rollback is no longer
    cosmetic); verify_protected_paths raises VERIFY_PP_VIOLATION.
  • landing-lib.sh — new landing_pp_breach_guard: the land seam never
    pushes a flagged protected-path breach to main (parks a rescue, reds the run).
  • close-report.sh — push-mode gate 1 verifies reachability from the
    worker-branch head pre-land; a commit on neither the worker branch nor main
    is a safe refusal.
  • Prompts re-rendered (.sandcastle/*prompt.md + the idss cutover fixture),
    byte-identical cutover re-proven.

Acceptance

  • The prompt no longer instructs a worker to push to main (worker branch instead). (policy-lib.sh, re-rendered prompts, tests/policy-lib-test.sh, tests/prompt-render-lib-test.sh, tests/worker-conflict-retest-prompt-test.sh)
  • tests/landing-lib-test.sh: worker branch present, protected path touched → NOT landed, rescue parked, run red.
  • tests/run-swarm-landing-test.sh: verify runs before any push to main (static ordering + behavioural).
  • Prompt change re-proven byte-identical in the onboarding cutover fixtures (onboarding/tests/onboard-lib-test.sh).
  • dev-factory's .sandcastle/swarm-policy.sh = LANDING=pr (already set by #220; stays until the coordinated re-vendor — see below).
  • Full offline suite green.
  • PP_ENFORCE=1 flipped (pairs with #208).

Notes for review

  • These are ROOT changes; the running self-copy moves only when a human
    re-vendors .sandcastle + bumps FACTORY_REF (GOTCHAS 4). dev-factory stays
    LANDING=pr
    until then — reverting to push sooner would restore the old
    worker-pushes-main behaviour the vendored copy still carries. The revert rides
    the coordinated re-vendor (#205/#218/#228).
  • Deferred (not formal ACs): an explicit HOST post-land "reachable from main"
    assertion; a pinned-host-test land gate (LANDING_TEST_CMD is unset across
    consumers and landing_run_pinned_tests fails CLOSED, so gating every land on
    it would park every run).
  • Out of scope: reviewer agent #197, server-side branch protection #194, healer
    push path #203.

Screenshots: none — a harness/prompt/test change (shell libs + rendered prompt text + offline tests); no visible UI surface. Evidence is the offline suite (green) cited above.

closes #193 ## #193 — push mode: the worker never pushes `main`; the HOST lands after verify In `LANDING=push`, the worker prompt told the agent to `git push origin HEAD:refs/heads/main` from INSIDE the sandbox, before the host's post-run gates ran — so `verify_protected_paths`/`landing_stage` ran AFTER the commit was already on origin/main and the protected-path rollback was cosmetic. This moves the push-to-main OFF the sandbox: the worker pushes its per-run worker branch and the HOST promotes it to `main` only after the verify gates, so the gates genuinely gate (the "human-or-host gate AFTER the agent" shape). ### Changes - **`policy-lib.sh`** — the `"landing": "push"` branch of `policy_landing_guidance` now pushes `HEAD:refs/heads/$(git rev-parse --abbrev-ref HEAD)` (the `sandcastle/worker/<run>` branch), never `main`; the in-sandbox rebase + the #217 re-test ladder are removed (the host owns the rescue ladder #207). - **`verify-lib.sh`** — `PP_ENFORCE` defaults **ON** (the rollback is no longer cosmetic); `verify_protected_paths` raises `VERIFY_PP_VIOLATION`. - **`landing-lib.sh`** — new `landing_pp_breach_guard`: the land seam never pushes a flagged protected-path breach to `main` (parks a rescue, reds the run). - **`close-report.sh`** — push-mode gate 1 verifies reachability from the worker-branch head pre-land; a commit on neither the worker branch nor `main` is a safe refusal. - Prompts re-rendered (`.sandcastle/*prompt.md` + the idss cutover fixture), byte-identical cutover re-proven. ### Acceptance - [x] The prompt no longer instructs a worker to push to `main` (worker branch instead). (`policy-lib.sh`, re-rendered prompts, `tests/policy-lib-test.sh`, `tests/prompt-render-lib-test.sh`, `tests/worker-conflict-retest-prompt-test.sh`) - [x] `tests/landing-lib-test.sh`: worker branch present, protected path touched → NOT landed, rescue parked, run red. - [x] `tests/run-swarm-landing-test.sh`: verify runs before any push to `main` (static ordering + behavioural). - [x] Prompt change re-proven byte-identical in the onboarding cutover fixtures (`onboarding/tests/onboard-lib-test.sh`). - [x] dev-factory's `.sandcastle/swarm-policy.sh` = `LANDING=pr` (already set by #220; stays until the coordinated re-vendor — see below). - [x] Full offline suite green. - [x] `PP_ENFORCE=1` flipped (pairs with #208). ### Notes for review - These are ROOT changes; the running self-copy moves only when a human re-vendors `.sandcastle` + bumps `FACTORY_REF` (GOTCHAS 4). dev-factory **stays `LANDING=pr`** until then — reverting to `push` sooner would restore the old worker-pushes-main behaviour the vendored copy still carries. The revert rides the coordinated re-vendor (#205/#218/#228). - Deferred (not formal ACs): an explicit HOST post-land "reachable from `main`" assertion; a pinned-host-test land gate (`LANDING_TEST_CMD` is unset across consumers and `landing_run_pinned_tests` fails CLOSED, so gating every land on it would park every run). - Out of scope: reviewer agent #197, server-side branch protection #194, healer push path #203. **Screenshots:** none — a harness/prompt/test change (shell libs + rendered prompt text + offline tests); no visible UI surface. Evidence is the offline suite (green) cited above.
sandcastle: #193 — push mode: worker never pushes main; HOST lands after verify
Some checks failed
ci / static (pull_request) Successful in 2m20s
ci / test (pull_request) Failing after 5m15s
979d55f1c0
The push-mode landing guidance (policy_landing_guidance, rendered into every
consumer's prompt via {{LANDING_RULES}}) no longer tells the worker to
`git push origin HEAD:refs/heads/main` from the sandbox. The worker pushes its
per-run worker branch (HEAD:refs/heads/$(git rev-parse --abbrev-ref HEAD), the
sandcastle/worker/<run> branch it is on); the HOST promotes it to main only
after the post-run verify gates (worker-birth + the protected-path boundary).
The gates that were cosmetic while the worker pushed main itself now genuinely
gate. The in-sandbox rebase + the #217 re-test ladder are gone (a worker branch
has no main conflict; the host owns the rebase-rescue ladder #207).

Key decisions / files:
- policy-lib.sh: rewrite the "landing": "push" branch (worker branch, never main).
- verify-lib.sh: PP_ENFORCE defaults ON (rollback now keeps a breach off main);
  verify_protected_paths raises VERIFY_PP_VIOLATION.
- landing-lib.sh: new landing_pp_breach_guard — the land seam never pushes a
  flagged protected-path breach to main (parks a rescue, reds the run).
- close-report.sh: push-mode gate 1 verifies reachability from the worker-branch
  head pre-land (origin/<wb>); a commit on neither the worker branch nor main is
  a safe refusal, never a false close.
- Prompts re-rendered: .sandcastle/*prompt.md (per-repo layer) +
  onboarding/tests/fixtures/idss-prompts/prompt.md; cutover re-proven byte-identical.
- Tests: policy-lib, prompt-render, worker-conflict-retest (re-anchored),
  verify-lib (PP default-on + VERIFY_PP_VIOLATION), landing-lib (breach->rescue),
  run-swarm-landing (verify-before-push ordering), close-report (WB worker-branch
  gate 1). Full offline suite green.

Deferred (not formal ACs): explicit HOST post-land "reachable from main" check;
a pinned-host-test land gate (LANDING_TEST_CMD unset across consumers -> would
fail-closed-park every run). dev-factory STAYS LANDING=pr until the coordinated
re-vendor carries this into the running .sandcastle copy (reverting sooner would
restore the old worker-pushes-main behaviour the vendored copy still has).

Out of scope: reviewer agent #197, server-side branch protection #194, healer
push path #203.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
Member
close-report gates passed for #193 — every claim verified; this PR is cleared for merge.
<!-- close-report: gates-passed --> close-report gates passed for #193 — every claim verified; this PR is cleared for merge.
ben closed this pull request 2026-10-16 15:58:10 +00:00
Owner

Superseded by PR #245 (the same commit rebased onto main after #232; merged fast-forward as 0d638e1). Closed without merge — #193 is closed by #245.

Superseded by PR #245 (the same commit rebased onto main after #232; merged fast-forward as `0d638e1`). Closed without merge — #193 is closed by #245.
Some checks failed
ci / static (pull_request) Successful in 2m20s
ci / test (pull_request) Failing after 5m15s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory!229
No description provided.