swarm harness: #2106's execute-lib sink read is defeated in production by main.mts's driveMirrorStop teardown (reconcile still degrades to the truncatable log grep) #2112
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#2112
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?
Found while fixing #2110 (the #574
record-run-result.shtelemetry parse). Out of #2110's scope — a different consumer of the sameSANDCASTLE_ATTEMPTline (the #283 stranded-close reconcile that #2106 fixed), so filed separately per ADR 0174 rule 1.Symptom
#2106 taught
execute-lib.sh'sexecute_sandcastle_runto read close-report'sSANDCASTLE_ATTEMPTlines from a host-mounted sink (EXECUTE_ATTEMPTS_SINK=$SWARM_HOST_ATTEMPTS_DIR/attempts.log) in union with the sandcastle-log grep, so a worker that pipes close-report through| tail/| headno longer starves the reconcile. In production that sink read always comes up empty, so the union silently degrades to the very log grep #2106 set out to stop trusting — the reconcile is still defeated by a trailing| tail.Cause (deletion-before-read ordering)
execute_sandcastle_runreadsEXECUTE_ATTEMPTS_SINKonly afterpnpm run sandcastle(i.e.main.mts) exits (execute-lib.sh, theif [ -n "${EXECUTE_ATTEMPTS_FILE:-}" ]block). Butmain.mts'sdriveMirrorStop()doesrmSync(HOST_ATTEMPTS_DIR, { recursive: true, force: true })on every exit path — andHOST_ATTEMPTS_DIRis$SWARM_HOST_ATTEMPTS_DIR(same env var), i.e. the same directoryEXECUTE_ATTEMPTS_SINKpoints inside. So by the time control returns toexecute-lib,attempts.logand its dir are already gone →[ -r "$EXECUTE_ATTEMPTS_SINK" ]is false → only the log grep runs.Why the green tests missed it:
execute-lib-test.shshimspnpm, so the realmain.mts(and itsdriveMirrorStopdeletion) never runs — the test writes the sink itself and asserts the union reads it, which it does in the test.(#2110 avoided this for its own consumer by having
main.mtsread the sink into the record-run-result payload beforedriveMirrorStop—record-run-result.shruns after the teardown too and would hit the same empty dir.)Fix shape (design left to the session)
Symmetric to #2110's read-before-teardown. Likely either:
HOST_ATTEMPTS_DIRindriveMirrorStop; move that cleanup torun-swarm.sh's EXIT trap, which runs afterexecute-libhas read the sink (the host-signals dir can stay as-is); ormain.mtscopy the captured sink out to a pathexecute-libreads post-run.Vendored files (ADR 0180):
main.mts,execute-lib.sh, mayberun-swarm.sh— dev-factory backport branch + re-vendor, as #2106/#2110 did. Add anexecute-lib-test.shcase that exercises the real deletion ordering (not just a pre-written sink) so the regression can't re-hide behind the pnpm shim.Ruled by agent under ADR 0174 — veto anytime.
close-report — #2112 landed on
mainRuled by agent under ADR 0174 — veto anytime. Two-way door (revertible:
git revertthe idss commit + reset the dev-factory backport branch; provable: the vendored red-before-green offline suite).What landed
ffdb7171onmain— re-vendoredFACTORY_REFe77a951→40d60ac, updatingmain.mts+run-swarm.sh+tests/execute-lib-test.sh;FACTORY_MANIFESTno churn;STATUS.mdmilestone entry.backport/idss-211240d60ac(off the pine77a951, stacked on #2110) — the upstream source of the vendored change (ADR 0180).The fix
Confirmed the symptom in the code:
EXECUTE_ATTEMPTS_SINKwas wired to$SWARM_HOST_ATTEMPTS_DIR/attempts.log(run-swarm.sh), whichmain.mts'sdriveMirrorStop()rmSync's on every exit path — yetexecute-lib'sexecute_sandcastle_runreads the sink only afterpnpm run sandcastle(main.mts) returns. So the dir was already gone,[ -r "$EXECUTE_ATTEMPTS_SINK" ]was false, and #2106's union degraded back to the truncatable log grep — the reconcile was still defeated by a trailing| tail.Symmetric to #2110's read-before-teardown:
run-swarm.shpointsEXECUTE_ATTEMPTS_SINKat a durable host file outside the mount (SWARM_HOST_ATTEMPTS_SINK,mktemp'd, cleaned by the EXIT trap).main.mtspersists the captured sink toSWARM_HOST_ATTEMPTS_SINKbeforedriveMirrorStop— a path the teardown doesn't touch.execute-lib.shis unchanged (it already readsEXECUTE_ATTEMPTS_SINKpost-run).run-swarm.shdropped its local var to stay under the 200-line stage-extraction cap (199).execute-libfalls back to the log grep, exactly as before #2106.Proof (red-before-green)
execute-lib-test.shgains case 1f, whosepnpmshim MODELS the real exit ordering — it persists the mounted sink to the host path and thenrmSync's the run-scoped mount dir (driveMirrorStop) beforeexecute-libreads — so the regression can no longer re-hide behind a pre-written, never-deleted sink (the chosen test the ticket asked for).execute-lib-test.sh(19 groups),run-swarm-stages-test.sh(13),run-swarm-landing-test.sh(13),record-run-result-test.sh(14),close-report-test.sh(139).check-harness-driftOK inline @40d60ac. The pre-push eslint TS gate passed.Closing — landed on
main, nothing left outstanding for this ticket.