swarm harness: the #283 stranded-close reconcile can be swallowed by a worker's own ` #2106

Closed
opened 2026-10-30 11:08:48 +00:00 by matou-build-agent · 1 comment

tailon close-report (run 57327 left #2099 stranded)|Split from #2104 (the #445 boundary straddle). Observed on run 57327: a worker invokedbash .sandcastle/close-report.sh 2099 … 2>&1 | tail -40, so the SANDCASTLE_ATTEMPT issue=… outcome=… commits=…protocol line (close-report.sh ~411) was pushed out of the last-40 window and never reached the sandcastle log thatexecute-lib.shgreps into$EXECUTE_ATTEMPTS_FILE. That left the capture empty, so landing_reopen_stranded_closes` did not fire when the protected-path rollback stranded #2099's close (the close-report had closed it against the pushed worker branch; the land never happened). The healer reopened/re-queued #2099 by hand.

A reconcile that depends on a protocol line a worker's own | tail/| head can swallow is not a reconcile. The record of a run's attempts must reach the host independently of how the worker pipes close-report's stdout (e.g. a host-readable sink the worker cannot munge, or emitting the line where a trailing-pipe cannot drop it). Needs a design choice about reliable sandbox→host signalling; close-report.sh / execute-lib.sh are factory-vendored, so the fix lands via dev-factory (ADR 0180). This is a distinct mechanism from #2104's boundary fix.

tail` on close-report (run 57327 left #2099 stranded)|Split from #2104 (the #445 boundary straddle). Observed on run 57327: a worker invoked `bash .sandcastle/close-report.sh 2099 … 2>&1 | tail -40`, so the `SANDCASTLE_ATTEMPT issue=… outcome=… commits=…` protocol line (close-report.sh ~411) was pushed out of the last-40 window and never reached the sandcastle log that `execute-lib.sh` greps into `$EXECUTE_ATTEMPTS_FILE`. That left the capture empty, so `landing_reopen_stranded_closes` did not fire when the protected-path rollback stranded #2099's close (the close-report had closed it against the pushed worker branch; the land never happened). The healer reopened/re-queued #2099 by hand. A reconcile that depends on a protocol line a worker's own `| tail`/`| head` can swallow is not a reconcile. The record of a run's attempts must reach the host independently of how the worker pipes close-report's stdout (e.g. a host-readable sink the worker cannot munge, or emitting the line where a trailing-pipe cannot drop it). Needs a design choice about reliable sandbox→host signalling; `close-report.sh` / `execute-lib.sh` are factory-vendored, so the fix lands via dev-factory (ADR 0180). This is a distinct mechanism from #2104's boundary fix.
Author
Member

✅ Closed — landed on main (push mode). Commit c9ac8704.

What landed. The #283 stranded-close reconcile no longer depends on a channel a worker's own | tail/| head can swallow. The SANDCASTLE_ATTEMPT line now crosses the sandbox→host boundary two ways: the existing stdout echo (captured into the sandcastle log), AND a host-mounted WRITABLE sink that close-report.sh appends to directly — a file write no trailing pipe on its stdout can drop.

  • close-report.sh (~L411): appends the line to ${SANDCASTLE_ATTEMPT_SINK:-/run/host-attempts/attempts.log} when the sink dir exists + is writable; best-effort, falls back to the stdout echo. One short line via a single >> append is atomic under PIPE_BUF, so the two concurrent workers ADR 0184 admits never interleave.
  • main.mts: a run-scoped WRITABLE HOST_ATTEMPTS_DIR mounted at /run/host-attempts (symmetric to the read-only host-signals mount; removed on exit the same way).
  • run-swarm.sh: exports SWARM_HOST_ATTEMPTS_DIR (shared with main.mts) + EXECUTE_ATTEMPTS_SINK (the host side of the mount).
  • execute-lib.sh: the capture now UNIONs the sandcastle-log grep with the sink and sort -us them — a line on both channels dedupes to one row; a run with no sink wired degrades to the old log grep exactly as before.

Why this is the robust shape and not "emit the line last". Moving the protocol line to close-report's last line defeats | tail but not | head (and vice-versa); the ticket named both. Only a channel independent of the worker's stdout piping — the sink — actually satisfies "the record must reach the host independently of how the worker pipes close-report's stdout". That was the design choice the ticket asked for.

Proof (red-before-green, vendored offline suites).

  • execute-lib-test.sh 1d — a tail-swallowed attempt line (absent from the log) recovered from the sink; 1e — a line on both channels deduped. (18 groups pass.)
  • close-report-test.sh T1b — the line lands in the sink file, stdout echo retained. (139 checks pass.)
  • landing-lib-test.sh (121), run-swarm-landing-test.sh (13), run-swarm-stages-test.sh (13), close-report-lib-test.sh (77) all green. Pre-push ts-gate (eslint over the tree) green.

Factory-vendored path (ADR 0180). All touched files are vendored. Fix landed on dev-factory cheap-backport branch backport/idss-2106 (SHA edde808, off the current pin 06f6576), then re-vendored here: .sandcastle/FACTORY_REF 06f6576→edde808, the 6 files updated byte-identical, FACTORY_MANIFEST no churn, check-harness-drift.sh OK inline. (The "~533 behind main" advisory is the standing #1684 job, unchanged.)

Follow-ups filed (out of scope here).

  • #2110 — #574's swarm.db attempt-telemetry parse (record-run-result.sh via main.mts, pairing SANDCASTLE_ATTEMPT lines out of result.stdout) has the SAME stdout fragility, but it is attempts/spend accounting (no landed work lost), lower-stakes, so not folded in.
  • OWED (the #2053 debt): forward-port backport/idss-2106 onto dev-factory main as a reviewed PR (dev-factory is LANDING=pr).

Ruled by agent under ADR 0174 — veto anytime. Revertible: git revert c9ac8704 + reset the backport branch. Provable: the vendored red-before-green suites above.

:white_check_mark: **Closed — landed on `main` (push mode).** Commit `c9ac8704`. **What landed.** The #283 stranded-close reconcile no longer depends on a channel a worker's own `| tail`/`| head` can swallow. The `SANDCASTLE_ATTEMPT` line now crosses the sandbox→host boundary two ways: the existing stdout echo (captured into the sandcastle log), AND a host-mounted WRITABLE sink that `close-report.sh` appends to directly — a file write no trailing pipe on its stdout can drop. - `close-report.sh` (~L411): appends the line to `${SANDCASTLE_ATTEMPT_SINK:-/run/host-attempts/attempts.log}` when the sink dir exists + is writable; best-effort, falls back to the stdout echo. One short line via a single `>>` append is atomic under PIPE_BUF, so the two concurrent workers ADR 0184 admits never interleave. - `main.mts`: a run-scoped WRITABLE `HOST_ATTEMPTS_DIR` mounted at `/run/host-attempts` (symmetric to the read-only host-signals mount; removed on exit the same way). - `run-swarm.sh`: exports `SWARM_HOST_ATTEMPTS_DIR` (shared with main.mts) + `EXECUTE_ATTEMPTS_SINK` (the host side of the mount). - `execute-lib.sh`: the capture now UNIONs the sandcastle-log grep with the sink and `sort -u`s them — a line on both channels dedupes to one row; a run with no sink wired degrades to the old log grep exactly as before. **Why this is the robust shape and not "emit the line last".** Moving the protocol line to close-report's last line defeats `| tail` but not `| head` (and vice-versa); the ticket named both. Only a channel independent of the worker's stdout piping — the sink — actually satisfies "the record must reach the host independently of how the worker pipes close-report's stdout". That was the design choice the ticket asked for. **Proof (red-before-green, vendored offline suites).** - `execute-lib-test.sh` 1d — a tail-swallowed attempt line (absent from the log) recovered from the sink; 1e — a line on both channels deduped. (18 groups pass.) - `close-report-test.sh` T1b — the line lands in the sink file, stdout echo retained. (139 checks pass.) - `landing-lib-test.sh` (121), `run-swarm-landing-test.sh` (13), `run-swarm-stages-test.sh` (13), `close-report-lib-test.sh` (77) all green. Pre-push ts-gate (eslint over the tree) green. **Factory-vendored path (ADR 0180).** All touched files are vendored. Fix landed on dev-factory cheap-backport branch `backport/idss-2106` (SHA `edde808`, off the current pin `06f6576`), then re-vendored here: `.sandcastle/FACTORY_REF` `06f6576`→`edde808`, the 6 files updated byte-identical, `FACTORY_MANIFEST` no churn, `check-harness-drift.sh` OK inline. (The "~533 behind main" advisory is the standing #1684 job, unchanged.) **Follow-ups filed (out of scope here).** - **#2110** — #574's swarm.db attempt-telemetry parse (`record-run-result.sh` via main.mts, pairing `SANDCASTLE_ATTEMPT` lines out of `result.stdout`) has the SAME stdout fragility, but it is attempts/spend accounting (no landed work lost), lower-stakes, so not folded in. - OWED (the #2053 debt): forward-port `backport/idss-2106` onto dev-factory `main` as a reviewed PR (dev-factory is `LANDING=pr`). Ruled by agent under ADR 0174 — veto anytime. Revertible: `git revert c9ac8704` + reset the backport branch. Provable: the vendored red-before-green suites above.
matou-build-agent 2026-10-30 11:48:29 +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/idss#2106
No description provided.