swarm harness: the stranded-close reconcile depends on a SANDCASTLE_ATTEMPT stdout line a worker's own | tail can swallow (#2099 lost in run 57327) #2105

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

Split from #2104 (the #445 protected-path boundary fix). #2104 fixed the two boundary defects; this is the third, separable defect its investigation surfaced.

Symptom

When a swarm run's land is rolled back (e.g. a protected-path breach, or a push parked on a rescue branch), every issue a sandbox close-report already closed against the un-pushed worker branch is a stranded close (#283): closed success, but its commits never reached main. landing_reopen_stranded_closes is meant to reopen and re-queue them.

That reconcile reads $EXECUTE_ATTEMPTS_FILE, which execute-lib.sh (around line 156) populates by grepping the sandcastle log for close-report.sh's SANDCASTLE_ATTEMPT issue=… outcome=… commits=… protocol line (close-report.sh ~line 411). In run 57327 the worker invoked close-report as:

bash .sandcastle/close-report.sh 2099 … 2>&1 | tail -40

close-report prints the SANDCASTLE_ATTEMPT line before its (long) envelope/verdict comment, so the worker's own | tail -40 dropped it off the top. The line never reached the sandcastle log the host greps, $EXECUTE_ATTEMPTS_FILE was empty, and landing_reopen_stranded_closes did not fire. #2099 had to be reopened and re-queued by hand.

Why this is a defect, not an incident

A reconcile whose only input is a single stdout line a worker can swallow with an ordinary | tail (or | head, or any truncation) is not a reconcile — the host cannot depend on the sandbox's arbitrary stdout shaping to preserve a control-plane fact.

Shapes a session might consider (not a decision)

  • Emit the SANDCASTLE_ATTEMPT protocol line last in close-report, after the envelope post, so a trailing | tail -N retains it. Cheap, but only defeats tail, not head/grep -v/other mangling.
  • Route the attempt record through a channel the worker cannot reshape — a host-visible append the host reads directly rather than scraping combined stdout (note: /run/host-signals is read-only to the sandbox today, so this needs a design).
  • Make the reconcile independent of the protocol line: after a rolled-back land, have the host enumerate issues closed during this run whose closing commit is not reachable from origin/main, and reopen those.

Touches .sandcastle/ protected machinery (close-report.sh / execute-lib.sh / landing-lib.sh), so ready-for-session per ADR 0174 / #445.

Ruled by agent under ADR 0174 — filed as a follow-up from #2104; veto anytime.

Split from #2104 (the #445 protected-path boundary fix). #2104 fixed the two boundary defects; this is the third, separable defect its investigation surfaced. ## Symptom When a swarm run's land is rolled back (e.g. a protected-path breach, or a push parked on a rescue branch), every issue a sandbox close-report already closed against the un-pushed worker branch is a **stranded close** (#283): closed `success`, but its commits never reached `main`. `landing_reopen_stranded_closes` is meant to reopen and re-queue them. That reconcile reads `$EXECUTE_ATTEMPTS_FILE`, which `execute-lib.sh` (around line 156) populates by grepping the sandcastle log for `close-report.sh`'s `SANDCASTLE_ATTEMPT issue=… outcome=… commits=…` protocol line (`close-report.sh` ~line 411). In run 57327 the worker invoked close-report as: ``` bash .sandcastle/close-report.sh 2099 … 2>&1 | tail -40 ``` close-report prints the `SANDCASTLE_ATTEMPT` line **before** its (long) envelope/verdict comment, so the worker's own `| tail -40` dropped it off the top. The line never reached the sandcastle log the host greps, `$EXECUTE_ATTEMPTS_FILE` was empty, and `landing_reopen_stranded_closes` did not fire. #2099 had to be reopened and re-queued by hand. ## Why this is a defect, not an incident A reconcile whose only input is a single stdout line a worker can swallow with an ordinary `| tail` (or `| head`, or any truncation) is not a reconcile — the host cannot depend on the sandbox's arbitrary stdout shaping to preserve a control-plane fact. ## Shapes a session might consider (not a decision) - Emit the `SANDCASTLE_ATTEMPT` protocol line **last** in close-report, after the envelope post, so a trailing `| tail -N` retains it. Cheap, but only defeats `tail`, not `head`/`grep -v`/other mangling. - Route the attempt record through a channel the worker cannot reshape — a host-visible append the host reads directly rather than scraping combined stdout (note: `/run/host-signals` is read-only to the sandbox today, so this needs a design). - Make the reconcile independent of the protocol line: after a rolled-back land, have the host enumerate issues closed during this run whose closing commit is not reachable from `origin/main`, and reopen those. Touches `.sandcastle/` protected machinery (`close-report.sh` / `execute-lib.sh` / `landing-lib.sh`), so `ready-for-session` per ADR 0174 / #445. Ruled by agent under ADR 0174 — filed as a follow-up from #2104; veto anytime.
Author
Member

Duplicate of #2106, which was filed by the session that landed the #2104 parent fix and describes the same stranded-close/ defect. Closing this in favour of #2106 (kept as the canonical follow-up). Filed by a concurrent session that raced the same #2104 ticket — see my audit note on #2104.

Ruled by agent under ADR 0174 — veto anytime.

Duplicate of #2106, which was filed by the session that landed the #2104 parent fix and describes the same stranded-close/ defect. Closing this in favour of #2106 (kept as the canonical follow-up). Filed by a concurrent session that raced the same #2104 ticket — see my audit note on #2104. Ruled by agent under ADR 0174 — veto anytime.
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#2105
No description provided.