merge-to-head SyncError under LANDING=push reds the run OUTSIDE the rescue ladder AND skips the stranded-close reconcile — #324 closed with its commit only on the worker branch #328

Closed
opened 2026-11-05 02:23:28 +00:00 by matou-build-agent · 4 comments

Filed by the swarm healer — incident signature de52d60f56b4, run https://git.matou.nz/Matou/dev-factory/actions/runs/26245 (leg host=bens-mac-04), evidence /tmp/matou-heal-Matou-dev-factory.2noc0E.

Symptom

The swarm leg went green through the worker's whole job — #324 finished, close-report.sh passed every gate and closed the ticket, the worker branch was pushed — and then the run reded at stage sandcastle run (workers) with exit 1 after the agent had stopped (run-verdict.txt, job-log.txt:122, worker-logs.txt:251):

Agent stopped
Capturing session
Merging to main
Git sync failed: Merge of 'sandcastle/worker/20261104-200255-c897e8' onto 'main' failed.
The temporary branch ... has been preserved.
SyncError  (_tag: 'Fail')   [ELIFECYCLE] Command failed with exit code 1.

workdir-git.txt shows the workdir left mid-merge (MERGE_HEAD present) with three conflicted paths:

UU STATUS.md
UU fleet-tui/floor/server/server.js
UU fleet-tui/floor/web/office.js

Why it conflicted: the run checked out 0ea8905 at 01:02:26Z and forked the worker there. Commit 60c41ca (#310, Office clerk slice 5/5, from the previous 18:56 session landing late under push) landed on main at 01:18:49Z — 16 minutes into this run. The #324 worker ran until 02:18Z, then merge-to-head merged its 75-minute-old base onto a main that had moved under it. Both commits touch the same three files.

Three compounding faults (all factory source at the repo root)

1. Under LANDING=push, Sandcastle's own merge-to-head merge happens OUTSIDE the rescue ladder. branch-strategy.mts correctly keeps merge-to-head for push (main is the landing surface), but that merge runs inside withSandboxLifecycle, before run-swarm.sh ever reaches landing_stage. So GOTCHAS 66's ladder — rebase, classify, park on sandcastle/rescue-*, re-test on LANDING_TEST_CMD, rescue PR — never engages. A merely-stale worker base becomes a hard, unrecoverable red plus a mid-merge workdir, which is exactly the failure mode GOTCHAS 72 documents, now recurring on the push side the #230/#287 fixes left with merge-to-head.

2. The sandcastle run red path skips the stranded-close reconcile. run-swarm.sh:461 is a bare *) exit 1 ;; on execute_sandcastle_run failure. landing_reopen_stranded_closes (#283) is wired only on the two later exits — verify_protected_paths (run-swarm.sh:485-488) and landing_stage (493-496). #288 was closed wontfix on the grounds that #283 already reopens-and-flags every close whose commits are not reachable from origin/main — but it cannot fire here, because the run dies two stages earlier. Result: #324 reads closed while 8903a50 exists only on origin/sandcastle/worker/20261104-200255-c897e8 (verified with git ls-remote; the work is safe, just not on main). Worth checking whether EXECUTE_ATTEMPTS_SINK even survives this path — the SyncError is a node uncaught exception, so main.mts's persist-before-teardown may not have run.

3. STATUS.md's self-consumer row is the surviving single-anchor line for this repo's own workers. #287 removed the universally-rewritten **Last updated header and #300 fixed the GOTCHAS index, on the rule that "writers touch different rows". That holds across consumers — but every state-changing dev-factory commit rewrites the one Matou/dev-factory (self-consumer) row, so any two overlapping dev-factory workers collide there by construction. The conflict hunk here is that row against itself (STATUS.md:17-21). The fleet-tui conflicts are genuine overlapping Office-slice work and want the ladder (fault 1), not an anchor change.

Suggested shape (design work — not a mechanical edit)

  • Fault 2 is the cheap, high-value one: route the execute_sandcastle_run red through landing_reopen_stranded_closes too (guarding the attempts-sink availability), so a close can never outlive an unlanded commit no matter which stage reds.
  • Fault 1 is the real fix and needs a decision: either align the worktree onto current origin/main immediately before Sandcastle's post-run merge (align-worktree.sh is the obvious seam), or pin push-mode to a named branch too and let landing_stage own the merge so the GOTCHAS 66 ladder covers it. Note branch-strategy.mts's header comment is now stale — it says "dev-factory sets pr", but this repo has been LANDING=push since #276.
  • Fault 3: make the self-consumer row collision-free, or accept it once fault 1 gives conflicts a park instead of a red.
  • Any fix needs a new docs/gotchas/ body + index row keyed to this ticket, and lands in the running copy only at the next re-vendor (GOTCHAS 4).

Recovery for this incident

The workdir needs no repair: git-setup.sh's git checkout -f main && git reset --hard origin/main clears the conflicted merge on the next tick (proven on a scratch fixture). That also discards the local merge, so #324's commit must be landed from the remote worker branch, or #324 reopened — origin/sandcastle/worker/20261104-200255-c897e8 = 8903a50, needs a conflict resolution against 60c41ca in STATUS.md, fleet-tui/floor/server/server.js, fleet-tui/floor/web/office.js. MERGE_AUTHORITY=human for this repo, so that resolution is a human's (or a re-opened ticket's) call, not the healer's.

> *Filed by the swarm healer* — incident signature `de52d60f56b4`, run https://git.matou.nz/Matou/dev-factory/actions/runs/26245 (leg `host=bens-mac-04`), evidence `/tmp/matou-heal-Matou-dev-factory.2noc0E`. ## Symptom The `swarm` leg went green through the worker's whole job — #324 finished, `close-report.sh` passed every gate and **closed the ticket**, the worker branch was pushed — and then the run reded at stage `sandcastle run (workers)` with exit 1 *after* the agent had stopped (`run-verdict.txt`, `job-log.txt:122`, `worker-logs.txt:251`): ``` Agent stopped Capturing session Merging to main Git sync failed: Merge of 'sandcastle/worker/20261104-200255-c897e8' onto 'main' failed. The temporary branch ... has been preserved. SyncError (_tag: 'Fail') [ELIFECYCLE] Command failed with exit code 1. ``` `workdir-git.txt` shows the workdir left mid-merge (`MERGE_HEAD` present) with three conflicted paths: ``` UU STATUS.md UU fleet-tui/floor/server/server.js UU fleet-tui/floor/web/office.js ``` **Why it conflicted:** the run checked out `0ea8905` at 01:02:26Z and forked the worker there. Commit `60c41ca` (#310, Office clerk slice 5/5, from the *previous* 18:56 session landing late under push) landed on `main` at **01:18:49Z** — 16 minutes into this run. The #324 worker ran until 02:18Z, then `merge-to-head` merged its 75-minute-old base onto a `main` that had moved under it. Both commits touch the same three files. ## Three compounding faults (all factory source at the repo root) **1. Under `LANDING=push`, Sandcastle's own `merge-to-head` merge happens OUTSIDE the rescue ladder.** `branch-strategy.mts` correctly keeps `merge-to-head` for push (`main` *is* the landing surface), but that merge runs inside `withSandboxLifecycle`, before `run-swarm.sh` ever reaches `landing_stage`. So GOTCHAS 66's ladder — rebase, classify, park on `sandcastle/rescue-*`, re-test on `LANDING_TEST_CMD`, rescue PR — **never engages**. A merely-stale worker base becomes a hard, unrecoverable red plus a mid-merge workdir, which is exactly the failure mode GOTCHAS 72 documents, now recurring on the push side the #230/#287 fixes left with `merge-to-head`. **2. The `sandcastle run` red path skips the stranded-close reconcile.** `run-swarm.sh:461` is a bare `*) exit 1 ;;` on `execute_sandcastle_run` failure. `landing_reopen_stranded_closes` (#283) is wired only on the *two later* exits — `verify_protected_paths` (`run-swarm.sh:485-488`) and `landing_stage` (`493-496`). #288 was closed `wontfix` on the grounds that #283 already reopens-and-flags every close whose commits are not reachable from `origin/main` — but it cannot fire here, because the run dies two stages earlier. Result: **#324 reads `closed` while `8903a50` exists only on `origin/sandcastle/worker/20261104-200255-c897e8`** (verified with `git ls-remote`; the work is safe, just not on `main`). Worth checking whether `EXECUTE_ATTEMPTS_SINK` even survives this path — the SyncError is a node *uncaught exception*, so main.mts's persist-before-teardown may not have run. **3. `STATUS.md`'s self-consumer row is the surviving single-anchor line for this repo's own workers.** #287 removed the universally-rewritten `**Last updated` header and #300 fixed the GOTCHAS index, on the rule that "writers touch different rows". That holds across consumers — but *every* state-changing dev-factory commit rewrites the one `Matou/dev-factory` (self-consumer) row, so any two overlapping dev-factory workers collide there by construction. The conflict hunk here is that row against itself (`STATUS.md:17-21`). The `fleet-tui` conflicts are genuine overlapping Office-slice work and want the ladder (fault 1), not an anchor change. ## Suggested shape (design work — not a mechanical edit) - Fault 2 is the cheap, high-value one: route the `execute_sandcastle_run` red through `landing_reopen_stranded_closes` too (guarding the attempts-sink availability), so a close can never outlive an unlanded commit no matter which stage reds. - Fault 1 is the real fix and needs a decision: either align the worktree onto current `origin/main` immediately before Sandcastle's post-run merge (`align-worktree.sh` is the obvious seam), or pin push-mode to a named branch too and let `landing_stage` own the merge so the GOTCHAS 66 ladder covers it. Note `branch-strategy.mts`'s header comment is now stale — it says "dev-factory sets pr", but this repo has been `LANDING=push` since #276. - Fault 3: make the self-consumer row collision-free, or accept it once fault 1 gives conflicts a park instead of a red. - Any fix needs a new `docs/gotchas/` body + index row keyed to this ticket, and lands in the running copy only at the next re-vendor (GOTCHAS 4). ## Recovery for this incident The workdir needs no repair: `git-setup.sh`'s `git checkout -f main && git reset --hard origin/main` clears the conflicted merge on the next tick (proven on a scratch fixture). That also discards the local merge, so **#324's commit must be landed from the remote worker branch, or #324 reopened** — `origin/sandcastle/worker/20261104-200255-c897e8` = `8903a50`, needs a conflict resolution against `60c41ca` in `STATUS.md`, `fleet-tui/floor/server/server.js`, `fleet-tui/floor/web/office.js`. `MERGE_AUTHORITY=human` for this repo, so that resolution is a human's (or a re-opened ticket's) call, not the healer's.
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=26234
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=26234 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=bens-mac-04 run=26326
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=26326 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

⏩ independent reviewer for #328 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #328 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #328 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261105-030149-b06fe6 (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 328,
  "status": "success",
  "commits": [
    "f95e71fe28f5acb50e915b435c5751ac2916fc06"
  ],
  "changed_files": [
    "branch-strategy.mts",
    "execute-lib.sh",
    "run-swarm.sh",
    "tests/execute-lib-test.sh",
    "tests/run-swarm-landing-test.sh",
    "docs/journal/2026-11-05-328.md"
  ],
  "tests": [
    {
      "command": "bash tests/execute-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/run-swarm-landing-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/run-swarm-stages-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/branch-strategy-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/landing-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Fault 2 (data loss): the execute_sandcastle_run red is routed through landing_reopen_stranded_closes so a sandbox close can no longer outlive an unlanded commit": "run-swarm.sh case `*)` now calls landing_reopen_stranded_closes before exit 1 (commit f95e71f); run-swarm-landing-test.sh (a') asserts the reconcile is wired on all three exits and the execute-red one sits between execute_sandcastle_run and verify_protected_paths",
    "The attempt lines survive the generic-red path so the reconcile has data to act on": "execute-lib.sh _execute_capture_attempts is now called on the `*)` red path (log left for the verdict); execute-lib-test.sh groups 5b/5c prove a merge-to-head SyncError preserves the close-report attempt line, including recovery from the host sink",
    "branch-strategy.mts stale header comment corrected (dev-factory has been LANDING=push since #276)": "branch-strategy.mts header: removed the 'dev-factory sets pr' claim, generalised the push/pr note, and added the KNOWN GAP (#328) + #329 pointer",
    "Fault 1 (relocate the merge into the ladder) and fault 3 (self-consumer STATUS.md row) decided and tracked": "ruled a follow-up under ADR 0174 (two-way door; high-blast-radius design not provable offline) and filed as #329 (ready-for-session); recorded in docs/journal/2026-11-05-328.md and the branch-strategy.mts comment",
    "A GOTCHAS hazard entry for the fix": "deferred to the append-only journal (docs/journal/2026-11-05-328.md) because docs/GOTCHAS.md is at 24445B against the #196 ratchet's 24576B ceiling — the same wall #320/#321/#325 deferred for; index compaction is its own ticket",
    "Project-state commit: journal entry added, STATUS.md surface untouched (no pin/consumer/host change)": "docs/journal/2026-11-05-328.md added; STATUS.md surface unchanged per the #325 precedent (a root fix reaches the running copy only at re-vendor)"
  },
  "summary": "Routed the execute_sandcastle_run red through the #283 stranded-close reconcile and captured the close-report attempt lines on that path, so a LANDING=push merge-to-head SyncError can no longer leave a close outliving an unlanded commit; the deeper merge-relocation fix (faults 1 & 3) is filed as #329.",
  "blockers": []
}
**close-report** for #328 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261105-030149-b06fe6` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 328, "status": "success", "commits": [ "f95e71fe28f5acb50e915b435c5751ac2916fc06" ], "changed_files": [ "branch-strategy.mts", "execute-lib.sh", "run-swarm.sh", "tests/execute-lib-test.sh", "tests/run-swarm-landing-test.sh", "docs/journal/2026-11-05-328.md" ], "tests": [ { "command": "bash tests/execute-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/run-swarm-landing-test.sh", "exit_code": 0 }, { "command": "bash tests/run-swarm-stages-test.sh", "exit_code": 0 }, { "command": "bash tests/branch-strategy-test.sh", "exit_code": 0 }, { "command": "bash tests/landing-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 } ], "criteria": { "Fault 2 (data loss): the execute_sandcastle_run red is routed through landing_reopen_stranded_closes so a sandbox close can no longer outlive an unlanded commit": "run-swarm.sh case `*)` now calls landing_reopen_stranded_closes before exit 1 (commit f95e71f); run-swarm-landing-test.sh (a') asserts the reconcile is wired on all three exits and the execute-red one sits between execute_sandcastle_run and verify_protected_paths", "The attempt lines survive the generic-red path so the reconcile has data to act on": "execute-lib.sh _execute_capture_attempts is now called on the `*)` red path (log left for the verdict); execute-lib-test.sh groups 5b/5c prove a merge-to-head SyncError preserves the close-report attempt line, including recovery from the host sink", "branch-strategy.mts stale header comment corrected (dev-factory has been LANDING=push since #276)": "branch-strategy.mts header: removed the 'dev-factory sets pr' claim, generalised the push/pr note, and added the KNOWN GAP (#328) + #329 pointer", "Fault 1 (relocate the merge into the ladder) and fault 3 (self-consumer STATUS.md row) decided and tracked": "ruled a follow-up under ADR 0174 (two-way door; high-blast-radius design not provable offline) and filed as #329 (ready-for-session); recorded in docs/journal/2026-11-05-328.md and the branch-strategy.mts comment", "A GOTCHAS hazard entry for the fix": "deferred to the append-only journal (docs/journal/2026-11-05-328.md) because docs/GOTCHAS.md is at 24445B against the #196 ratchet's 24576B ceiling — the same wall #320/#321/#325 deferred for; index compaction is its own ticket", "Project-state commit: journal entry added, STATUS.md surface untouched (no pin/consumer/host change)": "docs/journal/2026-11-05-328.md added; STATUS.md surface unchanged per the #325 precedent (a root fix reaches the running copy only at re-vendor)" }, "summary": "Routed the execute_sandcastle_run red through the #283 stranded-close reconcile and captured the close-report attempt lines on that path, so a LANDING=push merge-to-head SyncError can no longer leave a close outliving an unlanded commit; the deeper merge-relocation fix (faults 1 & 3) is filed as #329.", "blockers": [] } ``` </details>
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#328
No description provided.