harness: a 5xx from Mattermost reds the whole swarm run — run-swarm.sh:304 is the only unguarded notify call site #1424
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#1424
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?
Symptom
Swarm run 22284 died with
an empty verdict error block:
…but the host runlog proves the listing succeeded:
ready_numsis only assigned afterschedule_list_ready_or_verdictreturns 0,and
[1410,1409]is non-empty — so the lister worked and two real tickets werein hand. Compare the genuine listing failure in the same window, which looks
completely different (
Matou/dev-factory, 05:57Z):exit=1with a populatederror line, because
schedule_list_ready_or_verdictcallsverdict_errorandrun-swarm.shthenexit 1s.Cause
exit=22iscurl -sf's "HTTP response >= 400". Between the successful listingand the next
verdict_stage(provision_env_materialize,provision-lib.sh:54)there is exactly one curl in the whole path:
notify-mattermost.shisset -euo pipefailand ends incurl -sf --max-time 30 -X POST … "$MATTERMOST_URL/api/v4/posts", so a 5xx fromthe chat front door exits 22 — and that call site is unguarded, so
set -ekills the whole run.
This is the only unguarded notify call site in the harness apart from one
sibling. Every other caller already treats a chat post as best-effort:
preflight-lib.sh:31_preflight_notify|| truereport-lib.sh:34_report_notify|| trueexecute-lib.sh:59_execute_notify|| truelanding-lib.sh:318_landing_notify|| trueverify-lib.sh:43_verify_notify|| trueheal.sh:302|| truerehearsal-report.sh:203|| truesession-runner.sh:136|| printf …scheduler-canary.sh:106|| truerun-swarm.sh:304run-triage.sh:317The
.forgejo/workflows/*.ymlinline Mattermost posts all carry|| truetoo.Two consequences, both bad:
that had claimable work. The run never provisioned, never spawned a worker;
#1410 and #1409 went unworked for that tick.
VERDICT_STAGEisstill the stale
"list ready tasks"(nothing re-keys it between the listingand
provision_env_materialize) andverdict_stageclearedVERDICT_ERROR,so
verdict_writeemits nothing. The healer keys its signature on a stagethat succeeded. This is GOTCHAS #7's implicit-
set -esibling one hoplater than #52 fixed, and the same shape as the preflight case at GOTCHAS
line 6989.
Trigger: the matou.nz front door was 5xx-ing in that window — the healer's
probe recorded
api_seconds=26,workflow_runscame back empty, and manualprobes at 06:1xZ returned
502/503three-for-three ongit.matou.nz(recovered to 200 by 06:2xZ). Three repos recorded
died-in:list ready tasksin the same window (
Matou/coa,Matou/dev-factory,Matou/idss). The outageis transient and self-heals; the unguarded notify is the durable defect that
turned it into a red instead of a shrug.
Fix
run-swarm.sh:304andrun-triage.sh:317.verdict_stage "notify + provision"right after the listing, or have the (now non-fatal) notify not leave the
stale stage standing — so the next fault in that window is not attributed to
a stage that passed.
Where the fix goes
run-swarm.shandrun-triage.share factory-vendored(
.sandcastle/FACTORY_MANIFESTlines 54 / ‹run-triage.sh›, pinFACTORY_REF=26f142c). Verified:git show 26f142c:run-swarm.shinMatou/dev-factoryhas the identical unguarded line 304 — this is an upstreamdefect, not local drift. A hand-edit here would trip
check-harness-drift.sh(the #932 pre-push drift gate) and red every subsequent run.
So: fix upstream in
Matou/dev-factory, then bumpFACTORY_REFand re-vendor —the pattern of
6e26d903,9d5bd2b0,8734b3a1. All four consumers(
idss,matou-app,coa,matou-website) carry the bug.Acceptance
run-swarm.sh/run-triage.shsurvive a Mattermost POST that returns 5xx:the run logs the failed notice and proceeds to provision/execute.
NOTIFYto a script thatexit 22s, assertthe run continues) —
.sandcastle/tests/already has the shim seams(
EXECUTE_NOTIFY,REPORT_NOTIFY, …) for exactly this.FACTORY_REFbumped inMatou/idss;bash .sandcastle/check-harness-drift.shgreen.
Filed by the swarm healer — incident signature
a64670d097e9, heal runheal-Matou-idss-1789193216-2342186, evidence/tmp/matou-heal-Matou-idss.8dal9Lonbens-mac-04.Blocked for a sandcastle worker — needs
ready-for-sessionThis ticket is entirely a change to protected
.sandcastle/machinery, so a sandcastle swarm worker cannot implement it (this is the fifth consecutive claim — runs 22291, 22287, 22303, 22305, 22323 — all looping because there is nothing here a worker is permitted to touch).Why it cannot be done by a worker:
.sandcastle/run-swarm.sh:304and.sandcastle/run-triage.sh:317..sandcastle/is a fingerprinted protected root (protected-paths-lib.sh,PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo", #445): any edit is fingerprinted, rolled back, and reds the run.Matou/dev-factoryatFACTORY_REF(.sandcastle/FACTORY_MANIFEST). As the ticket itself notes, a hand-edit tripscheck-harness-drift.sh(the #932 pre-push drift gate). The real fix must go upstream inMatou/dev-factory, thenFACTORY_REFbumped and re-vendored — an upstream repo not reachable from the worker sandbox.This is precisely the escape path spelled out verbatim in
protected-paths-lib.sh(PP_ESCAPE_PATH) and rule 9 / ADR 0174 / #445: a protected.sandcastle/machinery change needs an interactive session's standing (a session escalates toready-for-humanitself only if it finds a genuine one-way door). The fix here is a two-way door (a|| trueguard + a factory unit test), so it is a session's call, not Ben's.What a session must do (already fully specified in the issue body)
Matou/dev-factory: guard both notify call sites with the settled|| trueidiom (run-swarm.sh:304,run-triage.sh:317), and optionally re-keyVERDICT_STAGEafter the listing so a later fault in the same window is not mis-attributed to a stage that passed.NOTIFYtoexit 22, assert the run proceeds — the.sandcastle/tests/shim seams already exist).FACTORY_REFand re-vendor into all four consumers (idss,matou-app,coa,matou-website); confirmbash .sandcastle/check-harness-drift.shgreen — the pattern of6e26d903/9d5bd2b0/8734b3a1.Relabelling
ready-for-agent→ready-for-sessionso it stops re-entering the swarm queue.Close report — landed & proven (ADR 0174)
Ruled by agent under ADR 0174 — veto anytime. A two-way door: a revertible best-effort guard + verdict re-key on a vendored harness script, plus a FACTORY_REF pin bump — proven red-before-green offline, no security-posture or credential change. The notify is informational, so losing it must cost nothing.
What landed
The two unguarded notify call sites are now best-effort, matching all nine siblings:
run-swarm.sh— the "Swarm picking up N task(s)" post is guarded|| true, and the stage is re-keyedverdict_stage "notify + provision"before the post (nothing re-keyed it between the listing and provision, so a fault in that window was mis-attributed to thelist ready tasksstage that had passed, withVERDICT_ERRORcleared → the empty error block this ticket opened on).run-triage.sh— the "Triage needs you" digest post is guarded|| true. It already keyed"human-gate digest + notify"before the post, so it needed only the guard.SWARM_NOTIFY/TRIAGE_NOTIFYenv seam (theEXECUTE_NOTIFY/REPORT_NOTIFYpattern) so a 5xx post is shim-able offline.Where it landed (factory-vendored, as the ticket called out)
run-swarm.sh/run-triage.share FACTORY_MANIFEST-vendored — a hand-edit here would trip the #932 drift gate. So the fix landed upstream inMatou/dev-factory(72496a4) and was re-vendored:72496a4— guard + re-key + seams + tests; dev-factory GOTCHAS 56.1f116eb0—FACTORY_REF 26f96ce → 72496a4, re-vendored byte-identical;bash .sandcastle/check-harness-drift.shOK; STATUS.md updated.The bump also adopts the intervening dev-factory #142 / #1425 / #1426 (all offline-test-green), exactly as prior re-vendors did.
Proof (acceptance)
tests/run-swarm-notify-guard-test.sh(2 scenarios, a symlink-farm whole-script run):exit 22→ the run reaches provision at exit 0, no verdict (the guard);notify + provision, never the stalelist ready tasks(the re-key).tests/run-triage-test.shgains a#1424scenario: a 5xx digest post leaves the tick green (exit 0).|| trueremoved). Full dev-factory offline suite green (80 files). Affected idss vendored tests re-run green post-vendor.Follow-up filed (not this ticket)
The pin bump adopted dev-factory's
run-swarm-ready-list-test.sh, which has a pre-existing flaky race in its curl-shim countdown file (a concurrent 503→200 flip). It is inert in idss (idss does not run.sandcastle/tests/in CI; only the pre-push drift gate). Filed upstream as Matou/dev-factory#144.Closing: work landed and proven.