verdict_write: keep the EXIT trap alive when the errlog has no regex match (#154) #155

Merged
ben merged 1 commit from fix/154-verdict-no-match-trap into main 2026-09-20 20:27:57 +00:00
Owner

Closes #154.

verdict_write runs from an EXIT trap under set -euo pipefail. Its errlog greps had no || true, so a no-match (grep exit 1) propagated through pipefail and errexit killed the trap on that line — after the breadcrumb was erased — leaving neither breadcrumb nor verdict, and making the no-match fallback on the next line unreachable. The healer then keyed on a bare workflow name with Trigger error line: unknown.

What changed

  • verdict-lib.sh — || true on both errlog greps, with the reason recorded in-line so it reads as load-bearing.
  • tests/verdict-lib-test.sh — scenario 7 in the real caller posture (set -euo pipefail + trap 'verdict_write $?' EXIT + a no-match errlog): the verdict exists, carries exit=7, falls back to the log's own last lines, and seam_verdict_signal recovers stage :: line.
  • STATUS.md — header entry.

Verified

  • Red before green: with the fix reverted, scenario 7 fails with "a no-match errlog killed the EXIT trap — no verdict was written". With it, 7/7 pass.
  • Full offline suite (tests/*.sh + onboarding/tests/*.sh): green apart from one flake, tests/swarm-db-test.sh, which failed once inside the full run and then passed 3/3 standalone here and on a pristine 0d3f441 checkout. It shares no code with this change.
  • bash -n clean on both files.

Blast radius

Vendored file: every consumer picks this up at its next FACTORY_REF bump. Matou/matou-app carries the same fix already as local drift (9dd432e), which is what blocked an agent push on matou-app#186; its pin is bumped and re-vendored in the same arc, which ends that drift.

🤖 Generated with Claude Code

Closes #154. `verdict_write` runs from an EXIT trap under `set -euo pipefail`. Its errlog greps had no `|| true`, so a no-match (grep exit 1) propagated through pipefail and errexit killed the trap on that line — after the breadcrumb was erased — leaving neither breadcrumb nor verdict, and making the no-match fallback on the next line unreachable. The healer then keyed on a bare workflow name with `Trigger error line: unknown`. ## What changed - `verdict-lib.sh` — `|| true` on both errlog greps, with the reason recorded in-line so it reads as load-bearing. - `tests/verdict-lib-test.sh` — scenario 7 in the real caller posture (`set -euo pipefail` + `trap 'verdict_write $?' EXIT` + a no-match errlog): the verdict exists, carries `exit=7`, falls back to the log's own last lines, and `seam_verdict_signal` recovers `stage :: line`. - `STATUS.md` — header entry. ## Verified - Red before green: with the fix reverted, scenario 7 fails with *"a no-match errlog killed the EXIT trap — no verdict was written"*. With it, 7/7 pass. - Full offline suite (`tests/*.sh` + `onboarding/tests/*.sh`): green apart from one flake, `tests/swarm-db-test.sh`, which failed once inside the full run and then passed 3/3 standalone here and on a pristine `0d3f441` checkout. It shares no code with this change. - `bash -n` clean on both files. ## Blast radius Vendored file: every consumer picks this up at its next `FACTORY_REF` bump. `Matou/matou-app` carries the same fix already as local drift (`9dd432e`), which is what blocked an agent push on matou-app#186; its pin is bumped and re-vendored in the same arc, which ends that drift. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(verdict): keep the EXIT trap alive when the errlog has no regex match (#154)
All checks were successful
ci / test (pull_request) Successful in 3m30s
e53b98cc87
verdict_write greps VERDICT_ERRLOG for error-shaped lines. Callers run it from
an EXIT trap under `set -euo pipefail`, so a no-match grep (exit 1) propagates
through pipefail and errexit kills the trap on that line — after the breadcrumb
has already been erased. The run then leaves neither breadcrumb nor verdict, and
the no-match fallback on the next line is unreachable. The healer sees a bare
workflow-name signature with "Trigger error line: unknown".

Real trigger: host-slot-wait's "host capacity still busy after 1800s — giving
up" (matou-app ci run 21727) matches none of the regex words.

`|| true` on both greps, with the reason recorded in-line so it reads as
load-bearing rather than defensive noise.

tests/verdict-lib-test.sh scenario 7 reproduces the real caller posture
(set -euo pipefail + trap 'verdict_write $?' EXIT + a no-match errlog) and
asserts the verdict exists, carries exit=7, falls back to the log's own last
lines, and that seam_verdict_signal recovers "stage :: line". Red before green
against the pre-fix file.

Provenance: written and proven in Matou/matou-app (9dd432e) but landed in that
consumer's vendored copy, drifting it from FACTORY_REF cca3e27 and blocking an
agent push on matou-app#186. Landing it here ends the drift; matou-app bumps its
pin in the same arc.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ben merged commit a553c00f11 into main 2026-09-20 20:27:57 +00:00
Sign in to join this conversation.
No reviewers
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/dev-factory!155
No description provided.