swarm harness: a worker works an UNCLAIMED ticket via the # Done staleness re-check — duplicate work, and the orphan commit poisons local main into a SyncError #1717
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1717
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Harness (factory-vendored fix — upstream
dev-factory, FACTORY_REF834ec681).A worker whose iteration-start claim came back EMPTY re-runs the listing
script on the "queue may be stale" path, finds a ticket another host already
claimed, and works it with no claim at all — burning a duplicate
implementation and poisoning the host's local
main, which reds the run'sMerging to mainsync.What happened (swarm run 29782, host
elitebook-distributed-server-03).sandcastle/logs/main-sandcastle-worker-20260922-034615-fddb1b-worker.log,iteration 1:
It then implemented #1713 for ~16 minutes. But #1713 was already claimed by the
OTHER pool host 19 s after this run started —
#1713carries exactly ONEswarm-claimcomment (id 53028,host=matou-dev-server-01 run=29782,03:46:34Z).
elitebook-...-03never posted a claim for #1713; its first claimthis run is on #1715 (id 53046, 04:11:32Z).
Consequences, in order:
matou-dev-server-01landed #1713 as66e6eb4c(04:05:17Z,closed 04:08:47Z).
elitebookcommitted its own rivalbe0ca791(04:02:25Z)— never pushed, superseded, ~16 min of worker slot wasted.
main. Sandcastle still fast-forwarded the shared workdir'smainonto the orphan (git reflog main:be0ca791 ... merge sandcastle/worker/20260922-034615-3c0f43: Fast-forward, 04:10:36).Local
mainbecameahead 1, behind 3oforigin/main.b4ab8902), andclosed the issue at 04:28:22 — then Sandcastle's
Merging to mainmergedthat branch (tip ==
origin/main) onto the poisoned localmain. Two rival#1713 implementations over the same 9 files + append-conflicting
STATUS.md/GOTCHAS.md ⇒
SyncError, exit 1, after all work had landed.Root cause
.sandcastle/prompts/prompt.md(FACTORY_MANIFEST line 43),# Done:list-ready-tasks.shlists; it does not claim. The prompt's own nextsentence is right — "otherwise end the iteration normally and the next
iteration will pick the fresh task up" (the next iteration re-enters via
claim-next-task.sh) — but the agent is handed a claimable-looking work orderand skips the stand-down. Nothing mechanical refuses work on a ticket this
run never claimed:
close-report.sh's claim check only runs at close time, soa worker that loses the push race (as here) never reaches a gate at all.
The same bypass is visible, harmless-by-luck, in the 21:03:36 run — re-check
returned
[], so no ticket was there to grab.Asks
whose
swarm-claim host=... run=$SWARM_RUN_IDcomment does not exist —fail loud, at the start of the work, not at close-report.
# Doneinstruction. The staleness re-check should not handthe agent a bare listing. Either re-run
claim-next-task.sh(which claims,and returns empty when another host owns it) or state the stand-down as the
only permitted action on a non-empty result.
mainonto an unpushed orphan. A worker committhat never reached
originmust not be merged into the shared workdir'smain; that is what converts a lost race into a red run.git-setup.sh'snext-tick
reset --hard origin/mainis what masks this most of the time.Not affected
No work or ticket was lost: #1713, #1715, #1716 are all closed and on
origin/main. The red is bookkeeping only.Healer incident: signature
2d4d471673eb, run 29782. The healer cleaned thestuck workdir state (
merge --abort+reset --hard origin/main; the orphan ispreserved as tag
heal/superseded-1713-be0ca791) and verified the failing mergenow reports
Already up to date.Ruled (Ben, 2026-09-22): all three asks approved
swarm-claim host=… run=$SWARM_RUN_IDcomment on it. The refusal fails loud at the START of work, not at close-report.# Donestaleness re-check goes throughclaim-next-task.sh, never a barelist-ready-tasks.shlisting. A result that another host owns means standing down.mainonto an unpushed orphan: a worker commit that is not onoriginis never merged into the shared workdir'smain.Protected harness paths, so this is session work, landed upstream in dev-factory and then vendored by FACTORY_REF bump, alongside #1732/#1733. Tests: a worker with no claim that tries to commit is refused; a re-check against a ticket another host claimed yields stand-down; a merge of an orphan branch not on origin is refused.
close-report — ruled and landed by agent under ADR 0174 (veto anytime)
What this ticket asked was a mechanical refusal so a worker can never work/land a ticket its run never claimed (ask 1), a corrected
# Donestaleness re-check (ask 2), and no fast-forward of localmainonto an unpushed orphan (ask 3).What landed (asks 1 + 2 — the two-way, offline-provable core):
git-hooks/commit-msg(vendored). It refuses a swarm worker's commit whose subject cites a#<n>carrying noswarm-claim host=… run=$SWARM_RUN_ID, at the first revertible moment — the commit, not at close. Built on a new pureclaim_owned_by_runinclaim-lib.sh(rc 0 owned / 1 tracker-read-but-no-claim → fail CLOSED, block / 3 tracker-unreachable → fail OPEN, so a forge blip never wedges an honestly-claimed worker). Inert whenSWARM_RUN_IDis unset (session-runner, human, host reconcile) or the subject cites no ticket. Because no orphan is ever committed, none can fast-forward localmaineither — the run-29782SyncError's true cause.prompts/prompt.md's# Donestaleness re-check is now stated as a COMPLETION TEST, never a work order — nothing the lister prints is the worker's to work; only theclaim-next-task.sh-claimed ticket may be worked; a non-empty re-run means stand down for the next iteration.Ask 3 (fast-forward-onto-orphan defense-in-depth): routed as follow-up #1739. That fast-forward is inside Sandcastle's own
merge-to-head(@ai-hero/sandcastle), between iterations, with no host hook to intercept — out of the vendored harness's reach, and moot now that asks 1+2 stop any unclaimed orphan from existing. Details + a proposed default in #1739.How it landed (all FACTORY_MANIFEST files → the dev-factory door):
main:dc9b3e0(full change).backport/1717-unclaimed-commit-gate:4616347(cheap backport onto idss's pin0c0cae34, no main catch-up — the #1733 pattern).cf0ed11fonorigin/main— re-vendoredFACTORY_REF 0c0cae34 → 4616347(2 added, 3 updated, 180 unchanged), re-rendered.sandcastle/prompt.md, STATUS.md.Proof (offline, red-before-green where applicable):
tests/commit-msg-gate-test.sh— 9 pass: realgit commits through the hook covering inert(no run)/owned/blocked/BLOCKED (#1717)loud/run-29782#1713shape/fail-open/no-ticket/run-0.tests/claim-lib-test.sh— 83 pass (+7 forclaim_owned_by_run: owned / read-but-unclaimed / no-comments / other-host / unreachable→rc3 / run-0).check-harness-drift.sh— OK against4616347;onboard-lib.shrender byte-identity re-proven (235 pass); vendor-manifest coverage green.This is a two-way door (revertible commit + config, proven by existing offline tests) — ruled and acted per ADR 0174. Veto anytime; a veto reverts these commits and re-pins.