Swarm harness: a non-STATUS.md merge conflict strands the workdir + orphan sandcastle/worker branches (dev-factory) #1901

Open
opened 2026-09-25 20:40:23 +00:00 by matou-build-agent · 1 comment

Follow-up split from #1899 (STATUS.md merge=union, landed ead4f1a5). That fix removes the STATUS.md collision — the one recurring cause of the run-32926 SyncError — but two residuals it names are dev-factory concerns, out of this repo's two-way reach:

1. A genuine merge conflict on a NON-STATUS.md path still strands the workdir

@ai-hero/sandcastle runs a plain git merge "<worker-branch>" (execAsync, dist/chunk-VOG34SRF.js) and, on any conflict it can't auto-resolve, raises SyncError and preserves the temporary branch, leaving the host workdir mid-merge (MERGE_HEAD live) — no git merge --abort, no orphan sweep. With STATUS.md now merge=union this can no longer fire on the milestone log, but any real code conflict between two concurrent workers still leaves the same stranded state. This is library behaviour with no between-iteration host hook — the same out-of-reach residual #1717 already recorded. Options from #1899:

  • (3) Retry the merge on conflict: on SyncError, re-fetch, rebase the worker branch onto the new main, re-attempt once, escalate only if a non-STATUS.md path conflicts.
  • (4) Re-serialise only the merge: a host-side flock around the merge-to-main + a fetch, keeping the #1732 de-serialisation intact.

Both live in Matou/dev-factory (the vendored @ai-hero/sandcastle / harness), so they land upstream + re-vendor here (one FACTORY_REF bump), not as an idss-local edit.

2. Orphaned sandcastle/worker/* branches are never swept

A stranded merge leaves a sandcastle/worker/* branch forever. Whatever merge strategy is chosen should also sweep them (guarded so a branch holding un-pushed work is reported, not deleted). Known live orphans from run 32926, on elitebook-distributed-server-03's swarm workdir (~/swarm/Matou/idss), all with their work already safe on PRs #1898/#1897:

  • sandcastle/worker/20260826-041808-6b0e8f
  • sandcastle/worker/20260908-021709-1678bd
  • sandcastle/worker/20260925-190818-d08c0b

(matou-workstation's swarm workdir carries no such orphans as of 2026-09-25.)

Acceptance

  • A non-STATUS.md merge conflict between concurrent workers no longer leaves the host workdir mid-merge; the run fails loud with the conflict but the workdir is restored (or the merge is retried onto the advanced main).
  • Orphaned sandcastle/worker/* branches are swept or reported (never a blind delete of un-pushed work).

Filed by the #1899 session under ADR 0174 (work only that ticket; file follow-ups).

Follow-up split from #1899 (STATUS.md `merge=union`, landed `ead4f1a5`). That fix removes the *STATUS.md* collision — the one recurring cause of the run-32926 SyncError — but two residuals it names are dev-factory concerns, out of this repo's two-way reach: ## 1. A genuine merge conflict on a NON-STATUS.md path still strands the workdir `@ai-hero/sandcastle` runs a plain `git merge "<worker-branch>"` (`execAsync`, `dist/chunk-VOG34SRF.js`) and, on any conflict it can't auto-resolve, raises `SyncError` and *preserves the temporary branch*, leaving the host workdir mid-merge (`MERGE_HEAD` live) — no `git merge --abort`, no orphan sweep. With STATUS.md now `merge=union` this can no longer fire on the milestone log, but any real code conflict between two concurrent workers still leaves the same stranded state. This is library behaviour with no between-iteration host hook — the same out-of-reach residual #1717 already recorded. Options from #1899: - **(3) Retry the merge on conflict**: on `SyncError`, re-fetch, rebase the worker branch onto the new `main`, re-attempt once, escalate only if a non-STATUS.md path conflicts. - **(4) Re-serialise only the merge**: a host-side flock around the merge-to-main + a fetch, keeping the #1732 de-serialisation intact. Both live in `Matou/dev-factory` (the vendored `@ai-hero/sandcastle` / harness), so they land upstream + re-vendor here (one `FACTORY_REF` bump), not as an idss-local edit. ## 2. Orphaned `sandcastle/worker/*` branches are never swept A stranded merge leaves a `sandcastle/worker/*` branch forever. Whatever merge strategy is chosen should also sweep them (guarded so a branch holding un-pushed work is reported, not deleted). Known live orphans from run 32926, on `elitebook-distributed-server-03`'s swarm workdir (`~/swarm/Matou/idss`), all with their work already safe on PRs #1898/#1897: - `sandcastle/worker/20260826-041808-6b0e8f` - `sandcastle/worker/20260908-021709-1678bd` - `sandcastle/worker/20260925-190818-d08c0b` (matou-workstation's swarm workdir carries no such orphans as of 2026-09-25.) ## Acceptance - A non-STATUS.md merge conflict between concurrent workers no longer leaves the host workdir mid-merge; the run fails loud with the conflict but the workdir is restored (or the merge is retried onto the advanced `main`). - Orphaned `sandcastle/worker/*` branches are swept or reported (never a blind delete of un-pushed work). Filed by the #1899 session under ADR 0174 (work only that ticket; file follow-ups).
Author
Member

This was generated by AI during triage.

Triage: bug + ready-for-human

Verified this is not an app report (no <!-- origin: app-report --> marker via .sandcastle/body-marker-lib.sh; body opens "Follow-up split from #1899"). It is an internal follow-up filed by the #1899 session, well-specified, with concrete acceptance.

Category — bug: two defects in existing harness behaviour — a genuine (non-STATUS.md) merge conflict between concurrent workers strands the host workdir mid-merge (MERGE_HEAD live, no --abort), and orphaned sandcastle/worker/* branches are never swept. Same class as #1739 / #1717.

Why human

This is the Ben's-eyes / watched-landing residue, not an ADR 0174 two-way door:

  • The fix is not idss-local. Both options — (3) retry the merge onto the advanced main, or (4) re-serialise only the merge with a host-side flock — live in Matou/dev-factory (@ai-hero/sandcastle / the vendored harness). They reach this repo only via a FACTORY_REF bump + re-vendor, so a swarm worker (idss-only, reads ready-for-agent) cannot execute them. Not ready-for-agent.
  • Adopting a merge-to-main change is the #1684-class watched operation. #1684 established that pulling a harness-core change into idss's FACTORY_REF needs human eyes on the swarm as it lands: a regression in the merge-to-main path wedges every unattended host's swarm, and the revert mechanism itself (the swarm landing commits to main) is exactly what would be broken. That failure mode ("unattended hosts wedge in the field") is not provable by an existing test, so it is not a cleanly agent-revertible two-way door — it needs a watched landing.

Suggested shape for the watched session

  1. dev-factory first (agent-doable there): land option (3) or (4) in Matou/dev-factory behind a reproduction test — drive the run-32926 collision through a scratch repo (as #1899's scripts/tests/status-md-union-merge-test.sh does for the STATUS.md leg) and assert: a non-STATUS.md conflict fails loud but the workdir is restored (or the merge retries onto the advanced main); no work lost. The (3)-vs-(4) choice is a two-way design call the session can rule under ADR 0174.
  2. Adopt into idss (the watched step): bump FACTORY_REF, onboard.sh vendor, reconcile any per-repo .sandcastle deltas, and watch a swarm tick land green before walking away.
  3. Sweep the orphans (needs host standing): the three run-32926 branches on elitebook-distributed-server-03's swarm workdir (~/swarm/Matou/idss) — 20260826-041808-6b0e8f, 20260908-021709-1678bd, 20260925-190818-d08c0b — are safe (their work is on PRs #1898/#1897, per STATUS.md). Sweep guarded: report a branch holding un-pushed work, never blind-delete.

Acceptance (from the issue)

  • A non-STATUS.md merge conflict between concurrent workers no longer leaves the host workdir mid-merge; the run fails loud with the conflict but the workdir is restored (or the merge is retried onto the advanced main).
  • Orphaned sandcastle/worker/* branches are swept or reported (never a blind delete of un-pushed work).
> *This was generated by AI during triage.* ## Triage: `bug` + `ready-for-human` Verified this is **not** an app report (no `<!-- origin: app-report -->` marker via `.sandcastle/body-marker-lib.sh`; body opens "Follow-up split from #1899"). It is an internal follow-up filed by the #1899 session, well-specified, with concrete acceptance. **Category — `bug`:** two defects in existing harness behaviour — a genuine (non-STATUS.md) merge conflict between concurrent workers strands the host workdir mid-merge (`MERGE_HEAD` live, no `--abort`), and orphaned `sandcastle/worker/*` branches are never swept. Same class as #1739 / #1717. ## Why human This is the **Ben's-eyes / watched-landing** residue, not an ADR 0174 two-way door: - **The fix is not idss-local.** Both options — (3) retry the merge onto the advanced `main`, or (4) re-serialise only the merge with a host-side flock — live in `Matou/dev-factory` (`@ai-hero/sandcastle` / the vendored harness). They reach this repo only via a `FACTORY_REF` bump + re-vendor, so a swarm worker (idss-only, reads `ready-for-agent`) cannot execute them. Not `ready-for-agent`. - **Adopting a merge-to-main change is the #1684-class watched operation.** #1684 established that pulling a harness-**core** change into idss's `FACTORY_REF` needs human eyes on the swarm as it lands: a regression in the merge-to-main path wedges every *unattended* host's swarm, and the revert mechanism itself (the swarm landing commits to `main`) is exactly what would be broken. That failure mode ("unattended hosts wedge in the field") is not provable by an existing test, so it is not a cleanly agent-revertible two-way door — it needs a watched landing. ## Suggested shape for the watched session 1. **dev-factory first (agent-doable there):** land option (3) or (4) in `Matou/dev-factory` behind a reproduction test — drive the run-32926 collision through a scratch repo (as #1899's `scripts/tests/status-md-union-merge-test.sh` does for the STATUS.md leg) and assert: a non-STATUS.md conflict fails loud but the workdir is restored (or the merge retries onto the advanced `main`); no work lost. The (3)-vs-(4) choice is a two-way design call the session can rule under ADR 0174. 2. **Adopt into idss (the watched step):** bump `FACTORY_REF`, `onboard.sh vendor`, reconcile any per-repo `.sandcastle` deltas, and **watch a swarm tick land green** before walking away. 3. **Sweep the orphans (needs host standing):** the three run-32926 branches on `elitebook-distributed-server-03`'s swarm workdir (`~/swarm/Matou/idss`) — `20260826-041808-6b0e8f`, `20260908-021709-1678bd`, `20260925-190818-d08c0b` — are safe (their work is on PRs #1898/#1897, per STATUS.md). Sweep guarded: report a branch holding un-pushed work, never blind-delete. ## Acceptance (from the issue) - A non-STATUS.md merge conflict between concurrent workers no longer leaves the host workdir mid-merge; the run fails loud with the conflict but the workdir is restored (or the merge is retried onto the advanced `main`). - Orphaned `sandcastle/worker/*` branches are swept or reported (never a blind delete of un-pushed work).
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/idss#1901
No description provided.