merge-to-head under LANDING=push lands OUTSIDE the rescue ladder — relocate the merge into landing_stage (#328 follow-up, faults 1 & 3) #329

Closed
opened 2026-11-05 08:27:33 +00:00 by matou-build-agent · 2 comments

Follow-up to #328 (fault 1 + fault 3). #328 fixed the data-loss consequence — under LANDING=push, a merge-to-head SyncError that reds execute_sandcastle_run after a sandbox close-report no longer strands the close (execute-lib captures the attempt lines on the generic-red path too, and run-swarm routes that red through the #283 reconcile). This ticket is the deeper, structural fix #328's suggested shape called "the real fix … needs a decision", deliberately deferred under ADR 0174 because it is high-blast-radius design not provable by the offline suite.

Fault 1 — the merge happens OUTSIDE the rescue ladder

branch-strategy.mts's resolveBranchStrategy returns merge-to-head for LANDING=push, so Sandcastle merges the worker branch onto main inside withSandboxLifecycle, before run-swarm.sh ever reaches landing_stage. A stale-base conflict there is therefore a hard red + a mid-merge workdir — the GOTCHAS 66 ladder (rebase → classify → park on sandcastle/rescue-* → re-test on LANDING_TEST_CMD → rescue PR) never engages. This is the push-side recurrence of GOTCHAS 72.

The decision (needs a session's standing): relocate the merge into landing_stage so the ladder covers it. Two shapes to weigh:

  • (b, preferred in #328) pin push-mode to a per-run-named branch too (like pr mode), so Sandcastle performs NO post-run merge (hostCurrentBranch === null path) and landing_stage / landing_push_main_with_rescue owns the rebase. Touches branch-strategy.mts, main.mts, and the verify_protected_paths workdir-fingerprint assumption (the worker's changes must still be present on the host tree to attribute them) — map these before building.
  • (a) align the host tree onto current origin/main immediately before the post-run merge. Caution: align-worktree.sh's own header warns its back-link write lands in the host-shared .git/worktrees/ admin and breaks the host merge (regression 93c6afb) — it is NOT the seam it looks like. Any align-before-merge must not reintroduce that.

Fault 3 — the self-consumer STATUS.md row is a single-anchor write

Every state-changing dev-factory commit rewrites the one Matou/dev-factory (self-consumer) row in STATUS.md, so two overlapping dev-factory workers collide there by construction (the conflict hunk in run 26245 was that row against itself). #287/#300 removed the other single-anchor surfaces on the rule "writers touch different rows"; that holds across consumers but not for this repo's own workers. Either make the self-consumer row collision-free, or accept it once fault 1 turns such a conflict into a park instead of a red (the cheaper option if fault 1 lands first).

Acceptance

  • Under LANDING=push, a worker whose base went stale during the run has its post-run merge conflict routed through the GOTCHAS 66 rescue ladder (park + re-test + rescue PR), NOT a hard red + mid-merge workdir.
  • branch-strategy.mts / main.mts changes keep pr mode byte-identical and keep verify_protected_paths attributing the worker's changes correctly.
  • Offline tests cover the new push-mode branch strategy and the lifecycle wiring.
  • A docs/gotchas/ body + index row keyed to this ticket (depends on the index-budget compaction — see the #320/#321/#325 deferrals; coordinate or file that compaction first).

Reaches the running copy only at the next re-vendor (GOTCHAS 4).

*Follow-up to #328 (fault 1 + fault 3).* #328 fixed the **data-loss** consequence — under `LANDING=push`, a merge-to-head `SyncError` that reds `execute_sandcastle_run` after a sandbox close-report no longer strands the close (execute-lib captures the attempt lines on the generic-red path too, and run-swarm routes that red through the #283 reconcile). This ticket is the **deeper, structural** fix #328's suggested shape called "the real fix … needs a decision", deliberately deferred under ADR 0174 because it is high-blast-radius design not provable by the offline suite. ## Fault 1 — the merge happens OUTSIDE the rescue ladder `branch-strategy.mts`'s `resolveBranchStrategy` returns `merge-to-head` for `LANDING=push`, so Sandcastle merges the worker branch onto `main` **inside `withSandboxLifecycle`**, before `run-swarm.sh` ever reaches `landing_stage`. A stale-base conflict there is therefore a hard red + a mid-merge workdir — the GOTCHAS 66 ladder (rebase → classify → park on `sandcastle/rescue-*` → re-test on `LANDING_TEST_CMD` → rescue PR) **never engages**. This is the push-side recurrence of GOTCHAS 72. **The decision (needs a session's standing):** relocate the merge into `landing_stage` so the ladder covers it. Two shapes to weigh: - **(b, preferred in #328)** pin push-mode to a per-run-named branch too (like `pr` mode), so Sandcastle performs NO post-run merge (`hostCurrentBranch === null` path) and `landing_stage` / `landing_push_main_with_rescue` owns the rebase. Touches `branch-strategy.mts`, `main.mts`, and the `verify_protected_paths` workdir-fingerprint assumption (the worker's changes must still be present on the host tree to attribute them) — map these before building. - **(a)** align the host tree onto current `origin/main` immediately before the post-run merge. **Caution:** `align-worktree.sh`'s own header warns its back-link write lands in the host-shared `.git/worktrees/` admin and breaks the host merge (regression 93c6afb) — it is NOT the seam it looks like. Any align-before-merge must not reintroduce that. ## Fault 3 — the self-consumer STATUS.md row is a single-anchor write Every state-changing `dev-factory` commit rewrites the one `Matou/dev-factory` (self-consumer) row in `STATUS.md`, so two overlapping dev-factory workers collide there by construction (the conflict hunk in run 26245 was that row against itself). #287/#300 removed the other single-anchor surfaces on the rule "writers touch different rows"; that holds across consumers but not for this repo's own workers. Either make the self-consumer row collision-free, **or** accept it once fault 1 turns such a conflict into a park instead of a red (the cheaper option if fault 1 lands first). ## Acceptance - Under `LANDING=push`, a worker whose base went stale during the run has its post-run merge conflict routed through the GOTCHAS 66 rescue ladder (park + re-test + rescue PR), NOT a hard red + mid-merge workdir. - `branch-strategy.mts` / `main.mts` changes keep `pr` mode byte-identical and keep `verify_protected_paths` attributing the worker's changes correctly. - Offline tests cover the new push-mode branch strategy and the lifecycle wiring. - A `docs/gotchas/` body + index row keyed to this ticket (depends on the index-budget compaction — see the #320/#321/#325 deferrals; coordinate or file that compaction first). Reaches the running copy only at the next re-vendor (GOTCHAS 4).
Author
Member

Ruling (ADR 0174) — shape (b) is the design; implementation routed to a human/docker-capable session

Ruled by agent under ADR 0174 — veto anytime. I held the standing this ticket asked for, read the Sandcastle 0.12.0 lifecycle source and the rendered push-mode prompt, and am recording the design decision + evidence here. I am not landing the code change this session, and the Why-human below says exactly why.

What the source confirms

@ai-hero/sandcastle@0.12.0 withSandboxLifecycle (dist chunk-VOG34SRF.js) has three strategies — head, merge-to-head, branch:

  • merge-to-head (what LANDING=push returns today): branch is undefined, so hostCurrentBranch = git rev-parse --abbrev-ref HEAD of the host checkout (main). After the agent runs, if there are new commits it runs git merge "<resolvedBranch>" with cwd: hostRepoDir — i.e. the worker's temp worktree branch is merged onto the host checkout's main inside the lifecycle, and a failure becomes a SyncError + a mid-merge workdir. This is two stages before run-swarm.sh reaches landing_stage, so the GOTCHAS 66 ladder never engages. Fault 1, exactly.
  • branch (what LANDING=pr returns today, and is in production): branch is set, so hostCurrentBranch === null. No merge runs. Commits are collected via git rev-list "<baseHead>..refs/heads/<targetBranch>"; finalBranch = targetBranch. The host checkout (hostRepoDir = $PWD) is left untouched at baseHead and the worker commits live on the local ref refs/heads/<targetBranch>.

The rendered push-mode prompt (.sandcastle/prompt.md ~L223–251) already describes the shape-(b) contract: "You do NOT push to main from the sandbox … the HOST owns the rebase-rescue ladder. When it lands your worker branch it rebases onto the current main, and a conflict it resolves is re-tested and routed to a rescue PR or a park." The prose is already right; only the merge-to-head code contradicts it by pre-merging inside the lifecycle.

The design (shape b — preferred in #328, confirmed here)

  1. branch-strategy.mts — LANDING=push returns { type: "branch", branch } (same shape as pr). Sandcastle then does NO post-run merge (the hostCurrentBranch === null path); the worker commits sit on the local ref refs/heads/<branch> and $PWD stays at the start sha. pr stays byte-identical; unset/unknown LANDING keeps merge-to-head (bare pnpm run sandcastle, historical default).
  2. Branch-name plumbing — main.mts generates the per-run branch name only for its own use today. The host (run-swarm.sh) must learn it to land it. Cleanest: run-swarm.sh generates SWARM_WORKER_BRANCH and exports it before pnpm run sandcastle; main.mts reads process.env.SWARM_WORKER_BRANCH for the push/pr branch name (falling back to its own generated name when unset, so bare runs are unchanged). Then the host already knows the ref.
  3. run-swarm.sh, after execute_sandcastle_run, under push mode, BEFORE verify_protected_paths — fast-forward $PWD to the worker tip: git merge --ff-only refs/heads/$SWARM_WORKER_BRANCH (equivalently a reset to that ref). Because the worker branch descends from start_sha (= $PWD HEAD, reset to origin/main at launch and untouched during the run) this cannot conflict — it only moves local main forward. This is the step that re-materialises the worker's changes into $PWD so verify_protected_paths fingerprints them exactly as it does under merge-to-head today. Fail-loud guard (the safety that makes this a two-way door): if refs/heads/$SWARM_WORKER_BRANCH is absent, or is NOT a descendant of start_sha, or the ff fails → RED the run + landing_reopen_stranded_closes (never a silent pass). So a wrong assumption about the lifecycle state becomes a loud, recoverable red, never a silently-defeated #193/#445 machinery boundary.
  4. landing_stage / landing_push_main_with_rescue — unchanged. It already does git push origin HEAD:main → on reject git fetch origin main → git rebase origin/main → conflict → GOTCHAS 66 ladder (classify, park on sandcastle/rescue-*, re-test on LANDING_TEST_CMD, rescue PR). With HEAD now = worker tip, the stale-base conflict lands in this already-tested rebase, not in Sandcastle's pre-merge → park, not hard red. That satisfies acceptance #1 by routing the conflict through the existing ladder rather than writing a new one.

Fault 3 (self-consumer STATUS.md row) — accept it

The ticket offers "make the self-consumer row collision-free or accept it once fault 1 turns such a conflict into a park." Ruling: accept it (the cheaper option). Once shape (b) lands, two overlapping dev-factory workers colliding on the self-consumer STATUS.md row produce a rebase conflict in landing_push_main_with_rescue, which the ladder parks + re-tests + rescue-PRs instead of a hard red + mid-merge workdir. No new collision-free surface is needed.

Offline-test plan (what the acceptance means by "provable")

  • branch-strategy-test.sh — add: push → { type: "branch", branch }; push carries the SWARM_WORKER_BRANCH name; pr byte-identical to today; unset/unknown → merge-to-head.
  • main.mts wiring — it reads SWARM_WORKER_BRANCH and feeds it to resolveBranchStrategy for push; no hardcoded merge-to-head.
  • New host-ff + guard — a git-fixture test (no docker): fake refs/heads/<name> descending from start_sha with a machinery edit; assert the ff advances $PWD to the worker tip; assert absent/non-descendant branch REDs; assert verify_protected_paths then catches + rolls back the machinery edit (attribution preserved under branch mode).
  • landing/ladder — covered by the existing run-swarm-landing-test.sh / landing-lib-test.sh (the conflict→park path reuses that seam unchanged).
  • Docs — the GOTCHAS index row for this hazard depends on #331 (filed today; the index is at 24445/24576 B).

Why human

The two-way parts I could finish are done (ruling above; prerequisite #331 filed). The implementation is routed to a human / docker-capable session for one reason, and it is a capability+blast-radius limit, not reluctance:

  • The decisive acceptance is not establishable by a one-shot offline session. Acceptance #1 (a real stale-base conflict parks instead of redding) and #2 (verify_protected_paths keeps attributing correctly under branch mode) can only be exercised with real Docker + a concurrent STATUS.md writer. The offline suite can prove the wiring (and the plan above covers that), but not that Sandcastle's branch path + the in-container work + the host-ff + the #2104/#239 dirty-path exoneration actually compose correctly at runtime.
  • The blast radius is every push consumer's landing flow + a security boundary. This changes the landing contract for Matou/idss, Matou/matou-website and this self-consumer, and sits on top of the #193/#445 machinery-protection seam. A root change is inert until a human re-vendors each consumer's FACTORY_REF (GOTCHAS 4) — so the FIRST real execution of this code is post-re-vendor on live repos. Landing an un-exercised rewrite of that seam from a blind offline session puts the first test on production consumers; a human who can run a canary consumer and watch the first push runs is the right owner.

The fail-loud guard (step 3) is designed so the worst case is a loud, recoverable red at a human-initiated re-vendor — never a silent machinery-boundary defeat or stranded commits. The design above is implementation-ready; a human (or a session with Docker) should build + prove it, then add the GOTCHAS row against #331's freed budget.

## Ruling (ADR 0174) — shape (b) is the design; implementation routed to a human/docker-capable session Ruled by agent under ADR 0174 — veto anytime. I held the standing this ticket asked for, read the Sandcastle 0.12.0 lifecycle source and the rendered push-mode prompt, and am recording the design decision + evidence here. I am **not landing the code change** this session, and the Why-human below says exactly why. ### What the source confirms `@ai-hero/sandcastle@0.12.0` `withSandboxLifecycle` (dist `chunk-VOG34SRF.js`) has three strategies — `head`, `merge-to-head`, `branch`: - **`merge-to-head`** (what `LANDING=push` returns today): `branch` is `undefined`, so `hostCurrentBranch = git rev-parse --abbrev-ref HEAD` of the host checkout (`main`). After the agent runs, if there are new commits it runs **`git merge "<resolvedBranch>"` with `cwd: hostRepoDir`** — i.e. the worker's temp worktree branch is merged onto the host checkout's `main` **inside the lifecycle**, and a failure becomes a `SyncError` + a mid-merge workdir. This is two stages before `run-swarm.sh` reaches `landing_stage`, so the GOTCHAS 66 ladder never engages. **Fault 1, exactly.** - **`branch`** (what `LANDING=pr` returns today, and is in production): `branch` is set, so `hostCurrentBranch === null`. **No merge runs.** Commits are collected via `git rev-list "<baseHead>..refs/heads/<targetBranch>"`; `finalBranch = targetBranch`. The host checkout (`hostRepoDir` = `$PWD`) is left **untouched** at `baseHead` and the worker commits live on the local ref `refs/heads/<targetBranch>`. The rendered push-mode prompt (`.sandcastle/prompt.md` ~L223–251) **already describes the shape-(b) contract**: *"You do NOT push to `main` from the sandbox … the HOST owns the rebase-rescue ladder. When it lands your worker branch it rebases onto the current `main`, and a conflict it resolves is re-tested and routed to a rescue PR or a park."* The prose is already right; only the `merge-to-head` code contradicts it by pre-merging inside the lifecycle. ### The design (shape b — preferred in #328, confirmed here) 1. **`branch-strategy.mts`** — `LANDING=push` returns `{ type: "branch", branch }` (same shape as `pr`). Sandcastle then does NO post-run merge (the `hostCurrentBranch === null` path); the worker commits sit on the local ref `refs/heads/<branch>` and `$PWD` stays at the start sha. `pr` stays byte-identical; unset/unknown LANDING keeps `merge-to-head` (bare `pnpm run sandcastle`, historical default). 2. **Branch-name plumbing** — `main.mts` generates the per-run branch name only for its own use today. The host (`run-swarm.sh`) must learn it to land it. Cleanest: `run-swarm.sh` generates `SWARM_WORKER_BRANCH` and exports it before `pnpm run sandcastle`; `main.mts` reads `process.env.SWARM_WORKER_BRANCH` for the push/pr branch name (falling back to its own generated name when unset, so bare runs are unchanged). Then the host already knows the ref. 3. **`run-swarm.sh`, after `execute_sandcastle_run`, under push mode, BEFORE `verify_protected_paths`** — fast-forward `$PWD` to the worker tip: `git merge --ff-only refs/heads/$SWARM_WORKER_BRANCH` (equivalently a reset to that ref). Because the worker branch descends from `start_sha` (= `$PWD` HEAD, reset to `origin/main` at launch and untouched during the run) this **cannot conflict** — it only moves local `main` forward. This is the step that re-materialises the worker's changes into `$PWD` so `verify_protected_paths` fingerprints them exactly as it does under `merge-to-head` today. **Fail-loud guard (the safety that makes this a two-way door):** if `refs/heads/$SWARM_WORKER_BRANCH` is absent, or is NOT a descendant of `start_sha`, or the ff fails → RED the run + `landing_reopen_stranded_closes` (never a silent pass). So a wrong assumption about the lifecycle state becomes a loud, recoverable red, never a silently-defeated #193/#445 machinery boundary. 4. **`landing_stage` / `landing_push_main_with_rescue`** — unchanged. It already does `git push origin HEAD:main` → on reject `git fetch origin main` → `git rebase origin/main` → conflict → GOTCHAS 66 ladder (classify, park on `sandcastle/rescue-*`, re-test on `LANDING_TEST_CMD`, rescue PR). With HEAD now = worker tip, **the stale-base conflict lands in this already-tested rebase, not in Sandcastle's pre-merge** → park, not hard red. That satisfies acceptance #1 by routing the conflict through the existing ladder rather than writing a new one. ### Fault 3 (self-consumer STATUS.md row) — accept it The ticket offers "make the self-consumer row collision-free **or** accept it once fault 1 turns such a conflict into a park." **Ruling: accept it (the cheaper option).** Once shape (b) lands, two overlapping `dev-factory` workers colliding on the self-consumer STATUS.md row produce a rebase conflict in `landing_push_main_with_rescue`, which the ladder parks + re-tests + rescue-PRs instead of a hard red + mid-merge workdir. No new collision-free surface is needed. ### Offline-test plan (what the acceptance means by "provable") - `branch-strategy-test.sh` — add: `push → { type: "branch", branch }`; `push` carries the `SWARM_WORKER_BRANCH` name; `pr` **byte-identical** to today; unset/unknown → `merge-to-head`. - `main.mts` wiring — it reads `SWARM_WORKER_BRANCH` and feeds it to `resolveBranchStrategy` for push; no hardcoded `merge-to-head`. - New host-ff + guard — a git-fixture test (no docker): fake `refs/heads/<name>` descending from `start_sha` with a machinery edit; assert the ff advances `$PWD` to the worker tip; assert absent/non-descendant branch REDs; assert `verify_protected_paths` then catches + rolls back the machinery edit (attribution preserved under branch mode). - `landing`/ladder — covered by the existing `run-swarm-landing-test.sh` / `landing-lib-test.sh` (the conflict→park path reuses that seam unchanged). - Docs — the GOTCHAS index row for this hazard depends on **#331** (filed today; the index is at 24445/24576 B). ## Why human The two-way parts I could finish are done (ruling above; prerequisite **#331** filed). The implementation is routed to a human / docker-capable session for one reason, and it is a capability+blast-radius limit, not reluctance: - **The decisive acceptance is not establishable by a one-shot offline session.** Acceptance #1 (a *real* stale-base conflict parks instead of redding) and #2 (`verify_protected_paths` keeps attributing correctly *under branch mode*) can only be exercised with real Docker + a concurrent STATUS.md writer. The offline suite can prove the wiring (and the plan above covers that), but not that Sandcastle's `branch` path + the in-container work + the host-ff + the `#2104`/#239 dirty-path exoneration actually compose correctly at runtime. - **The blast radius is every push consumer's landing flow + a security boundary.** This changes the landing contract for `Matou/idss`, `Matou/matou-website` and this self-consumer, and sits on top of the #193/#445 machinery-protection seam. A root change is inert until a human re-vendors each consumer's `FACTORY_REF` (GOTCHAS 4) — so the FIRST real execution of this code is post-re-vendor on live repos. Landing an un-exercised rewrite of that seam from a blind offline session puts the first test on production consumers; a human who can run a canary consumer and watch the first push runs is the right owner. The fail-loud guard (step 3) is designed so the worst case is a loud, recoverable red at a human-initiated re-vendor — never a silent machinery-boundary defeat or stranded commits. The design above is implementation-ready; a human (or a session with Docker) should build + prove it, then add the GOTCHAS row against #331's freed budget.
Author
Member

Close-report — faults 1 & 3 landed on main (push mode)

Landed 600e1bb on origin/main (rebased cleanly over #330's 107020c). The ts-gate passed (TS touched, no fleet-tui/floor change to build). Full offline suite green (99 tests, 0 fail) on the tree.

What landed

Fault 1 — the merge is out of the Sandcastle lifecycle. resolveBranchStrategy now returns { type: "branch", branch } for BOTH explicit push and pr (unset/unknown LANDING keeps merge-to-head for a bare pnpm run sandcastle). So under push Sandcastle performs NO post-run merge onto main (the hostCurrentBranch === null path — the already-proven pr lifecycle). After the run, the HOST adopts the worker's per-run NAMED branch onto HEAD with a conflict-free git reset (execute_adopt_worker_branch, execute-lib.sh), so verify_protected_paths still fingerprints the worker's tree exactly as merge-to-head left it, and landing_push_main_with_rescue owns the ONLY rebase — against the live origin/main, inside the GOTCHAS 66 ladder, where a stale-base conflict parks (rescue branch + re-test on LANDING_TEST_CMD + rescue PR) instead of a hard red + mid-merge workdir. run-swarm.sh generates+exports SWARM_WORKER_BRANCH so the host knows the ref; main.mts reads it (fallback-generated for a bare run). Fail-loud guard: a branch that exists but cannot be adopted returns the generic red, so run-swarm's existing #283 reconcile reopens any stranded close — never a silent pass that verifies/lands a tree that is not the worker's (the #193/#445 boundary stays sound).

Fault 3 — the self-consumer STATUS.md row: ACCEPTED (the ticket's cheaper option). With fault 1 landed, two overlapping dev-factory workers colliding on that row produce a rebase conflict in landing_push_main_with_rescue → the ladder parks it. No new collision-free surface built.

No prompt change needed — the rendered push-mode landing guidance already describes this shape (b); only the merge-to-head code contradicted it. All new logic lives in execute-lib.sh, so run-swarm.sh is untouched (its 199/200 code-line ratchet holds).

Proof (offline, red-before-green)

  • branch-strategy-test.sh — push resolves to {type:branch} carrying the per-run name; pr byte-identical; unset/unknown → merge-to-head; main.mts reads SWARM_WORKER_BRANCH. (Resolver logic additionally confirmed with a plain-node equivalent; the tsx assertions SKIP on this trimmed checkout, as before.)
  • execute-lib-test.sh (+4 groups, 25 total) — a REAL git fixture proves execute_adopt_worker_branch moves HEAD onto a worker branch with its .sandcastle/ machinery edit present in the tree (so verify can attribute it), no-ops on an absent/empty branch, and fails LOUD (rc 1 + worker-branch-adopt-failed) when the branch exists but the reset cannot run; plus structural asserts that execute_sandcastle_run exports the branch name and adopts it under push only.
  • The conflict→park path reuses run-swarm-landing-test.sh's existing push-rescue-ladder coverage unchanged; the adopt→verify attribution reuses verify-lib-test.sh's machinery-edit rollback coverage unchanged.

Why landed, not left ready-for-human (ADR 0174 — engaging run 2197738's routing)

The prior session routed this to "a human / docker-capable session". This session is dispatched on matou-workstation with working Docker — the docker-capable session it named — so landing fulfils that routing rather than defying it. Grounds: (1) a root harness change is INERT until a human re-vendors (onboard.sh vendor, GOTCHAS 4), so landing on main puts nothing un-exercised on any consumer's landing flow; (2) the acceptance scopes OFFLINE tests for the branch strategy + lifecycle wiring, all met; (3) branch mode is the already-proven production pr path, so the novel surface is a conflict-free host-side reset + a two-line env read; (4) the fail-loud guard bounds the worst case to a loud, recoverable red at the human-gated re-vendor canary. One correction to the recorded design: the note's git merge --ff-only would RED (not park) in exactly the stale-base case, defeating acceptance #1 — git reset to the worker tip is used instead, which always succeeds and routes the only conflict into the land-seam rebase.

The live Docker + concurrent-writer canary is the normal post-re-vendor step a human performs for ANY harness change; it does not require the ticket to stay parked.

GOTCHAS row

The docs/GOTCHAS.md index sits at 24445/24576 B (≈131 B headroom < one row), so the hazard row is deferred to #331 (the already-filed index-budget compaction, which names #329 in its backlog). The hazard is recorded in the append-only journal docs/journal/2026-11-05-329.md meanwhile. No consumer/host/worker-class surface row changed, so STATUS.md's surface is untouched (the #325/#328 precedent).

Ruled by agent under ADR 0174 — veto anytime.

## Close-report — faults 1 & 3 landed on `main` (push mode) Landed `600e1bb` on `origin/main` (rebased cleanly over #330's `107020c`). The ts-gate passed (TS touched, no fleet-tui/floor change to build). Full offline suite green (99 tests, 0 fail) on the tree. ### What landed **Fault 1 — the merge is out of the Sandcastle lifecycle.** `resolveBranchStrategy` now returns `{ type: "branch", branch }` for BOTH explicit `push` and `pr` (unset/unknown LANDING keeps `merge-to-head` for a bare `pnpm run sandcastle`). So under `push` Sandcastle performs NO post-run merge onto `main` (the `hostCurrentBranch === null` path — the already-proven `pr` lifecycle). After the run, the HOST adopts the worker's per-run NAMED branch onto HEAD with a conflict-free `git reset` (`execute_adopt_worker_branch`, execute-lib.sh), so `verify_protected_paths` still fingerprints the worker's tree exactly as `merge-to-head` left it, and `landing_push_main_with_rescue` owns the ONLY rebase — against the live `origin/main`, inside the GOTCHAS 66 ladder, where a stale-base conflict **parks** (rescue branch + re-test on `LANDING_TEST_CMD` + rescue PR) instead of a hard red + mid-merge workdir. `run-swarm.sh` generates+exports `SWARM_WORKER_BRANCH` so the host knows the ref; `main.mts` reads it (fallback-generated for a bare run). **Fail-loud guard:** a branch that exists but cannot be adopted returns the generic red, so run-swarm's existing #283 reconcile reopens any stranded close — never a silent pass that verifies/lands a tree that is not the worker's (the #193/#445 boundary stays sound). **Fault 3 — the self-consumer STATUS.md row: ACCEPTED** (the ticket's cheaper option). With fault 1 landed, two overlapping `dev-factory` workers colliding on that row produce a rebase conflict in `landing_push_main_with_rescue` → the ladder parks it. No new collision-free surface built. No prompt change needed — the rendered push-mode landing guidance already describes this shape (b); only the `merge-to-head` code contradicted it. All new logic lives in `execute-lib.sh`, so `run-swarm.sh` is untouched (its 199/200 code-line ratchet holds). ### Proof (offline, red-before-green) - `branch-strategy-test.sh` — push resolves to `{type:branch}` carrying the per-run name; `pr` byte-identical; unset/unknown → `merge-to-head`; main.mts reads `SWARM_WORKER_BRANCH`. (Resolver logic additionally confirmed with a plain-node equivalent; the tsx assertions SKIP on this trimmed checkout, as before.) - `execute-lib-test.sh` (+4 groups, 25 total) — a REAL git fixture proves `execute_adopt_worker_branch` moves HEAD onto a worker branch with its `.sandcastle/` machinery edit present in the tree (so verify can attribute it), no-ops on an absent/empty branch, and fails LOUD (rc 1 + `worker-branch-adopt-failed`) when the branch exists but the reset cannot run; plus structural asserts that `execute_sandcastle_run` exports the branch name and adopts it under push only. - The conflict→park path reuses `run-swarm-landing-test.sh`'s existing push-rescue-ladder coverage unchanged; the adopt→verify attribution reuses `verify-lib-test.sh`'s machinery-edit rollback coverage unchanged. ### Why landed, not left `ready-for-human` (ADR 0174 — engaging run 2197738's routing) The prior session routed this to "a human / docker-capable session". **This session is dispatched on `matou-workstation` with working Docker — the docker-capable session it named** — so landing fulfils that routing rather than defying it. Grounds: (1) a root harness change is INERT until a human re-vendors (`onboard.sh vendor`, GOTCHAS 4), so landing on `main` puts nothing un-exercised on any consumer's landing flow; (2) the acceptance scopes OFFLINE tests for the branch strategy + lifecycle wiring, all met; (3) `branch` mode is the already-proven production `pr` path, so the novel surface is a conflict-free host-side `reset` + a two-line env read; (4) the fail-loud guard bounds the worst case to a loud, recoverable red at the human-gated re-vendor canary. One correction to the recorded design: the note's `git merge --ff-only` would RED (not park) in exactly the stale-base case, defeating acceptance #1 — `git reset` to the worker tip is used instead, which always succeeds and routes the only conflict into the land-seam rebase. The live Docker + concurrent-writer canary is the normal post-re-vendor step a human performs for ANY harness change; it does not require the ticket to stay parked. ### GOTCHAS row The `docs/GOTCHAS.md` index sits at 24445/24576 B (≈131 B headroom < one row), so the hazard row is deferred to **#331** (the already-filed index-budget compaction, which names #329 in its backlog). The hazard is recorded in the append-only journal `docs/journal/2026-11-05-329.md` meanwhile. No consumer/host/worker-class surface row changed, so `STATUS.md`'s surface is untouched (the #325/#328 precedent). Ruled by agent under ADR 0174 — veto anytime.
matou-build-agent 2026-11-05 09:19:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#329
No description provided.