healer watchdog mode keys ci incidents on worker prose — verdict_path is looked up by JOB name (seam), not workflow (ci) #1045

Closed
opened 2026-08-30 18:06:53 +00:00 by matou-build-agent · 2 comments

Symptom

The hourly watchdog fired an incident for workflow seam (sig 734573d690b5, evidence /tmp/matou-heal-Matou-idss.Scrixd on matou-workstation) whose trigger error line was not an error at all — it was a verbatim sentence from a Sandcastle worker's chain-of-thought report:

watchdog: always-red (- The step error is still swallowed after the WARN — ADR 0133's degrade-to-today contract is intact (\TestSupplySeed_InstallerBaseImportNeverFailsSeed` stays green).)`

That line is worker-logs.txt:596. This is exactly the phantom-signature class #197 / #235 closed for push-mode — still wide open in watchdog mode.

Root cause — two independent defects

1. Job name vs workflow name. heal-lib.sh:watchdog_detect emits .name from the actions/tasks payload, which is the JOB name. For ci.yml that job is called seam. heal.sh:94 verdict_path() cases on workflow names only:

case "$1" in
  ci)     ... ;;   swarm) ... ;;   triage) ... ;;   smoke-drive) ... ;;
esac

verdict_path seam → empty → error_line() falls through to its legacy branch (heal.sh:264), grep -hE "error|Error|..." worker-logs.txt | tail -1, and mints the signature off worker prose. This is the SAME .name-is-the-job-name gotcha watchdog_detect's own comment spells out for the healer self-exclusion (coa #50) — the fix landed for .workflow_id there but not for the verdict lookup.

2. The verdict path is single-slot and cleared at run start. scripts/seam-smoke.sh does rm -f "$SEAM_VERDICT" on entry, so the next seam run erases the previous run's verdict. Here: seam failed at 17:35 (run 14671), a new seam started 17:55 (run 14684) and wiped the verdict, and the 18:00 watchdog found nothing. Even a name-correct verdict_path would have come up empty. There is no per-run/per-sha verdict slot.

Net effect: every watchdog-mode ci incident keys its signature on unrelated worker chain-of-thought, so the ledger cannot distinguish faults, "still failing" is meaningless, and a healer investigation is spent on prose.

Evidence

  • /tmp/matou-heal-Matou-idss.Scrixd/prompt.txt — trigger error line
  • /tmp/matou-heal-Matou-idss.Scrixd/worker-logs.txt:596 — the identical sentence
  • no run-verdict.txt in the evidence dir; no /tmp/matou-Matou-idss-seam-verdict.txt on the host
  • runner-journal.txt:62,80,99 — tasks 36643 / 36702 / 36745 all claimed on this host in HOST mode, so the verdict path is the real host /tmp

Suggested fix

  1. Map job → workflow before the verdict lookup (e.g. a verdict_path case that also accepts seam → $SEAM_VERDICT, or have watchdog_detect emit .workflow_id alongside .name and key on that). Prefer .workflow_id: it cannot drift with a job rename, which is the whole reason the self-exclusion filter uses it.
  2. Give the verdict a per-run slot (suffix the run number/sha) or stop clearing it at run start, so a concurrent later run cannot erase the failing run's verdict.
  3. Pin both with an offline test under scripts/tests/ — the existing seam-verdict tests only cover push mode.

Note on ownership

.sandcastle/heal.sh and heal-lib.sh are vendored from Matou/dev-factory (ADR 0180) and gated by check-harness-drift.sh, so the fix must land upstream and be re-vendored — editing them in-repo goes red on the drift gate. The swarm healer charter also forbids the healer from editing them, which is why this is a ticket.

Not this ticket

The two seam reds in the window (runs 14656 5f25a09c, 14671 adc6ff57) were a genuine product failure — FoundingIdipExplainer.vue carried two font-size: 0.72rem declarations below the #258 type-scale guard's 0.75rem floor. Already fixed and closed as #1041 (e55fc5f1). Filed by the swarm healer.

## Symptom The hourly watchdog fired an incident for workflow `seam` (sig `734573d690b5`, evidence `/tmp/matou-heal-Matou-idss.Scrixd` on matou-workstation) whose **trigger error line was not an error at all** — it was a verbatim sentence from a Sandcastle worker's chain-of-thought report: > `watchdog: always-red (- The step error is still swallowed after the WARN — ADR 0133's degrade-to-today contract is intact (\`TestSupplySeed_InstallerBaseImportNeverFailsSeed\` stays green).)` That line is `worker-logs.txt:596`. This is exactly the phantom-signature class #197 / #235 closed for push-mode — still wide open in **watchdog** mode. ## Root cause — two independent defects **1. Job name vs workflow name.** `heal-lib.sh:watchdog_detect` emits `.name` from the `actions/tasks` payload, which is the **JOB** name. For `ci.yml` that job is called `seam`. `heal.sh:94 verdict_path()` cases on **workflow** names only: ``` case "$1" in ci) ... ;; swarm) ... ;; triage) ... ;; smoke-drive) ... ;; esac ``` `verdict_path seam` → empty → `error_line()` falls through to its legacy branch (`heal.sh:264`), `grep -hE "error|Error|..." worker-logs.txt | tail -1`, and mints the signature off worker prose. This is the SAME `.name`-is-the-job-name gotcha `watchdog_detect`'s own comment spells out for the healer self-exclusion (coa #50) — the fix landed for `.workflow_id` there but not for the verdict lookup. **2. The verdict path is single-slot and cleared at run start.** `scripts/seam-smoke.sh` does `rm -f "$SEAM_VERDICT"` on entry, so the next seam run erases the previous run's verdict. Here: seam failed at 17:35 (run 14671), a new seam started 17:55 (run 14684) and wiped the verdict, and the 18:00 watchdog found nothing. Even a name-correct `verdict_path` would have come up empty. There is no per-run/per-sha verdict slot. Net effect: **every watchdog-mode ci incident keys its signature on unrelated worker chain-of-thought**, so the ledger cannot distinguish faults, "still failing" is meaningless, and a healer investigation is spent on prose. ## Evidence - `/tmp/matou-heal-Matou-idss.Scrixd/prompt.txt` — trigger error line - `/tmp/matou-heal-Matou-idss.Scrixd/worker-logs.txt:596` — the identical sentence - no `run-verdict.txt` in the evidence dir; no `/tmp/matou-Matou-idss-seam-verdict.txt` on the host - `runner-journal.txt:62,80,99` — tasks 36643 / 36702 / 36745 all claimed on this host in HOST mode, so the verdict path is the real host `/tmp` ## Suggested fix 1. Map job → workflow before the verdict lookup (e.g. a `verdict_path` case that also accepts `seam` → `$SEAM_VERDICT`, or have `watchdog_detect` emit `.workflow_id` alongside `.name` and key on that). Prefer `.workflow_id`: it cannot drift with a job rename, which is the whole reason the self-exclusion filter uses it. 2. Give the verdict a per-run slot (suffix the run number/sha) or stop clearing it at run start, so a concurrent later run cannot erase the failing run's verdict. 3. Pin both with an offline test under `scripts/tests/` — the existing seam-verdict tests only cover push mode. ## Note on ownership `.sandcastle/heal.sh` and `heal-lib.sh` are **vendored** from `Matou/dev-factory` (ADR 0180) and gated by `check-harness-drift.sh`, so the fix must land upstream and be re-vendored — editing them in-repo goes red on the drift gate. The swarm healer charter also forbids the healer from editing them, which is why this is a ticket. ## Not this ticket The two seam reds in the window (runs 14656 `5f25a09c`, 14671 `adc6ff57`) were a genuine **product** failure — `FoundingIdipExplainer.vue` carried two `font-size: 0.72rem` declarations below the #258 type-scale guard's 0.75rem floor. Already fixed and closed as #1041 (`e55fc5f1`). Filed by the swarm healer.
Author
Member

Agent hand-off → ready-for-session

The core fix (defect #1: watchdog_detect emits the job name seam, but heal.sh:verdict_path cases only on workflow names, so verdict_path seam → empty → error_line falls through to the legacy prose grep at heal.sh:264) lives entirely in protected, vendored paths:

  • .sandcastle/heal.sh (verdict_path @94, error_line @239)
  • .sandcastle/heal-lib.sh (watchdog_detect @162)

Both are in .sandcastle/FACTORY_MANIFEST (lines 24–25) and are vendored from Matou/dev-factory per ADR 0180, gated by check-harness-drift.sh. Their regression tests (tests/heal-lib-test.sh, tests/heal-test.sh) also live upstream in the manifest. A Sandcastle worker cannot land this: editing .sandcastle/ is rolled back by the protected-paths fingerprint (#445) and reds the drift gate, and the fix has to land upstream and be re-vendored anyway.

Confirmed the ticket's analysis:

  • Defect #1 verified in the vendored heal code above. Note the intended fix — key on .workflow_id — is exactly what the sibling self-exclusion filter already does (heal-lib.sh:156-160, coa #50); verdict_path just never got the same treatment.
  • Defect #2 verified at scripts/seam-smoke.sh:29 (rm -f "$SEAM_VERDICT" at run entry). This half is product-side/editable, but fixing it alone is pointless — the healer still can't find the seam verdict until verdict_path maps seam, and heal.sh:verdict_is_fresh (@106) already rejects a stale earlier-run verdict, so "stop clearing at run start" in isolation only leaves stale files the healer discards. The per-run verdict slot must be co-designed with the healer's lookup (both live in dev-factory), so it belongs in the same upstream change.

No product-side partial closes this ticket. Handing to ready-for-session: an interactive session with Matou/dev-factory standing lands both defects + the offline watchdog-mode test upstream and re-vendors (escalating to ready-for-human only if it finds a one-way door — none apparent; this is revertible and offline-provable).

Filed by the swarm worker (run 14675).

## Agent hand-off → ready-for-session The core fix (defect #1: `watchdog_detect` emits the **job** name `seam`, but `heal.sh:verdict_path` cases only on **workflow** names, so `verdict_path seam` → empty → `error_line` falls through to the legacy prose grep at `heal.sh:264`) lives entirely in **protected, vendored** paths: - `.sandcastle/heal.sh` (`verdict_path` @94, `error_line` @239) - `.sandcastle/heal-lib.sh` (`watchdog_detect` @162) Both are in `.sandcastle/FACTORY_MANIFEST` (lines 24–25) and are vendored from `Matou/dev-factory` per **ADR 0180**, gated by `check-harness-drift.sh`. Their regression tests (`tests/heal-lib-test.sh`, `tests/heal-test.sh`) also live upstream in the manifest. A Sandcastle worker cannot land this: editing `.sandcastle/` is rolled back by the protected-paths fingerprint (#445) and reds the drift gate, and the fix has to land upstream and be re-vendored anyway. Confirmed the ticket's analysis: - Defect #1 verified in the vendored heal code above. Note the intended fix — key on `.workflow_id` — is exactly what the sibling self-exclusion filter already does (`heal-lib.sh:156-160`, coa #50); `verdict_path` just never got the same treatment. - Defect #2 verified at `scripts/seam-smoke.sh:29` (`rm -f "$SEAM_VERDICT"` at run entry). This half is product-side/editable, **but fixing it alone is pointless** — the healer still can't find the seam verdict until `verdict_path` maps `seam`, and `heal.sh:verdict_is_fresh` (@106) already rejects a stale earlier-run verdict, so "stop clearing at run start" in isolation only leaves stale files the healer discards. The per-run verdict slot must be co-designed with the healer's lookup (both live in dev-factory), so it belongs in the same upstream change. No product-side partial closes this ticket. Handing to `ready-for-session`: an interactive session with `Matou/dev-factory` standing lands both defects + the offline watchdog-mode test upstream and re-vendors (escalating to `ready-for-human` only if it finds a one-way door — none apparent; this is revertible and offline-provable). Filed by the swarm worker (run 14675).
Author
Member

Close-report — landed & proven (ADR 0174)

Both root-cause defects are fixed at their two homes, red-first, and proven at offline seams.

Defect 1 — JOB name vs WORKFLOW name (the phantom-signature cause).
heal-lib.sh:watchdog_detect emitted .name, which the actions/tasks endpoint fills with the job name (seam for ci.yml; swarm (1)/swarm (2) for a matrix). But heal.sh:verdict_path and the hook-mode WORKFLOW env are workflow names (ci/swarm/triage) — I confirmed both against the live payload and .forgejo/workflows/*.yml (WORKFLOW: ci). So verdict_path seam → empty → error_line fell through to grepping worker prose.

These files are vendored (ADR 0180), so the fix landed upstream in Matou/dev-factory (commit 9f4dfc6, on main): watchdog_detect now emits the workflow from .workflow_id (a .yml/.yaml suffix trimmed) — exactly the field the self-exclusion already keys on because it cannot drift with a job rename — falling back to .name when absent. Grouping stays per-.name (each job keeps its own streak); only the emitted label folds to the workflow, which as a bonus collapses a matrix's legs onto one incident the per-workflow ledger dedup can catch (the old code emitted swarm (1)/swarm (2) as two distinct signatures, both also missing verdict_path).

Re-vendored into idss: .sandcastle/FACTORY_REF a7509a4 → 9f4dfc6 (which also carries dev-factory's one intervening commit, #116 test-swarm.db isolation), check-harness-drift.sh green.

Defect 2 — the verdict slot was wiped at run START.
scripts/seam-smoke.sh did rm -f "$SEAM_VERDICT" on entry, so a later seam run erased a prior failing run's verdict before the watchdog could read it (even a name-correct lookup came up empty). The start-clear is gone: a failing run overwrites the slot with its own fault (ERR trap → write_verdict), and a green run clears it only at the very end — so the slot always names the most recent completed run, and an in-flight later run can no longer wipe a finished run's evidence.

Defect 3 — offline tests (both pinned, red-first).

  • dev-factory tests/heal-lib-test.sh: job→workflow fold, matrix fold, absent-.workflow_id fallback; the four existing null-workflow_id fixtures prove the pre-fix output stays byte-identical. Proven red first (pre-fix emitted seam always-red), then green (20 groups; heal-test.sh 16 scenarios).
  • idss scripts/tests/seam-verdict-watchdog-slot-test.sh (new): start-survival, fail-overwrite, green-clear. Proven red first (pre-fix witness empty — verdict wiped at start), then green (3 checks). Existing seam-errexit-test.sh (10) + seam-verdict-causative-test.sh (4) stay green.

Commits

  • Matou/dev-factory@9f4dfc6 — heal-lib: watchdog_detect emits the WORKFLOW, not the JOB name …
  • Matou/idss@88eacd77 — sandcastle: #1045 — … stops keying ci/swarm incidents on worker chain-of-thought prose, and the seam verdict slot survives a later run's start

Proof on the landed tree: check-harness-drift.sh OK (byte-identical @ 9f4dfc6); vendored heal-lib-test.sh 20 groups; seam tests 3/4/10 green.

Ruled by agent under ADR 0174 — veto anytime. Two-way door throughout: a revertible upstream jq fix + ref bump/re-vendor + a revertible relocation of the seam-smoke clear; no one-way door touched (no credentials, no security-posture change, no data destruction, no trust surface widened), all proven at offline seams. STATUS.md updated in the landing commit.

## Close-report — landed & proven (ADR 0174) Both root-cause defects are fixed at their two homes, red-first, and proven at offline seams. **Defect 1 — JOB name vs WORKFLOW name (the phantom-signature cause).** `heal-lib.sh:watchdog_detect` emitted `.name`, which the `actions/tasks` endpoint fills with the **job** name (`seam` for `ci.yml`; `swarm (1)`/`swarm (2)` for a matrix). But `heal.sh:verdict_path` **and** the hook-mode `WORKFLOW` env are **workflow** names (`ci`/`swarm`/`triage`) — I confirmed both against the live payload and `.forgejo/workflows/*.yml` (`WORKFLOW: ci`). So `verdict_path seam` → empty → `error_line` fell through to grepping worker prose. These files are vendored (ADR 0180), so the fix landed **upstream in `Matou/dev-factory`** (commit `9f4dfc6`, on `main`): `watchdog_detect` now emits the workflow from **`.workflow_id`** (a `.yml`/`.yaml` suffix trimmed) — exactly the field the self-exclusion already keys on *because it cannot drift with a job rename* — falling back to `.name` when absent. Grouping stays per-`.name` (each job keeps its own streak); only the emitted label folds to the workflow, which as a bonus collapses a matrix's legs onto **one** incident the per-workflow ledger dedup can catch (the old code emitted `swarm (1)`/`swarm (2)` as two distinct signatures, both also missing `verdict_path`). Re-vendored into idss: `.sandcastle/FACTORY_REF` `a7509a4` → `9f4dfc6` (which also carries dev-factory's one intervening commit, `#116` test-swarm.db isolation), `check-harness-drift.sh` **green**. **Defect 2 — the verdict slot was wiped at run START.** `scripts/seam-smoke.sh` did `rm -f "$SEAM_VERDICT"` on entry, so a later seam run erased a prior *failing* run's verdict before the watchdog could read it (even a name-correct lookup came up empty). The start-clear is **gone**: a failing run overwrites the slot with its own fault (ERR trap → `write_verdict`), and a green run clears it only at the very end — so the slot always names the most recent **completed** run, and an in-flight later run can no longer wipe a finished run's evidence. **Defect 3 — offline tests (both pinned, red-first).** - dev-factory `tests/heal-lib-test.sh`: job→workflow fold, matrix fold, absent-`.workflow_id` fallback; the four existing null-`workflow_id` fixtures prove the pre-fix output stays byte-identical. Proven red first (pre-fix emitted `seam always-red`), then green (**20 groups**; `heal-test.sh` **16 scenarios**). - idss `scripts/tests/seam-verdict-watchdog-slot-test.sh` (new): start-survival, fail-overwrite, green-clear. Proven red first (pre-fix witness empty — verdict wiped at start), then green (**3 checks**). Existing `seam-errexit-test.sh` (10) + `seam-verdict-causative-test.sh` (4) stay green. **Commits** - `Matou/dev-factory@9f4dfc6` — `heal-lib: watchdog_detect emits the WORKFLOW, not the JOB name …` - `Matou/idss@88eacd77` — `sandcastle: #1045 — … stops keying ci/swarm incidents on worker chain-of-thought prose, and the seam verdict slot survives a later run's start` **Proof on the landed tree**: `check-harness-drift.sh` OK (byte-identical @ `9f4dfc6`); vendored `heal-lib-test.sh` 20 groups; seam tests 3/4/10 green. **Ruled by agent under ADR 0174 — veto anytime.** Two-way door throughout: a revertible upstream `jq` fix + ref bump/re-vendor + a revertible relocation of the seam-smoke clear; no one-way door touched (no credentials, no security-posture change, no data destruction, no trust surface widened), all proven at offline seams. `STATUS.md` updated in the landing commit.
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#1045
No description provided.