run-triage.sh deletes the triage log before exit 1 — the EXIT-trap verdict records empty error lines (run 19) #18

Closed
opened 2026-08-22 11:55:23 +00:00 by ben · 4 comments
Owner

Filed from the healer's dry-run diagnosis of triage run 19 (2026-08-22, the factory's first self-run) — the healer could not act because HEAL_DRY_RUN was still set (retired in c27ad6f).

Symptom

Run 19 (triage.yml) reddened at stage=triage skill (claude -p /triage), exit=1, and run-verdict.txt recorded an empty --- error lines --- block; agent-out.log, worker-logs.txt, runner-journal.txt were all 0 bytes. The real claude error is unrecoverable.

Cause

run-triage.sh:81 runs rm -f "$triage_log" immediately before exit 1; the verdict is written by the EXIT trap (trap 'verdict_write $?' EXIT, line 29) which fires AFTER the rm, so it reads a deleted file. Same on the limit-park path (line 77). This defeats the whole point of the stage/exit/error verdict.

Fix

  • Remove the log in the EXIT trap after verdict_write (or leave it on the failure path; mktemp files are cheap). Preserve the limit-park path's exit-0 semantics.
  • tests/run-triage-test.sh (add if absent; shim claude to exit 1 with a known error line): the verdict's error lines contain that line after a failing triage.

Acceptance

  • A shimmed failing claude -p /triage leaves run-verdict.txt with the shim's error line; full offline suite green.
  • After re-vendor, re-run triage.yml by hand to capture run 19's real error (separate follow-up if it is not the missing docs/agents/triage-labels.md, which is being added directly).
_Filed from the healer's dry-run diagnosis of triage run 19 (2026-08-22, the factory's first self-run) — the healer could not act because `HEAL_DRY_RUN` was still set (retired in `c27ad6f`)._ ## Symptom Run 19 (`triage.yml`) reddened at `stage=triage skill (claude -p /triage)`, `exit=1`, and `run-verdict.txt` recorded an **empty** `--- error lines ---` block; `agent-out.log`, `worker-logs.txt`, `runner-journal.txt` were all 0 bytes. The real claude error is unrecoverable. ## Cause `run-triage.sh:81` runs `rm -f "$triage_log"` immediately before `exit 1`; the verdict is written by the EXIT trap (`trap 'verdict_write $?' EXIT`, line 29) which fires AFTER the rm, so it reads a deleted file. Same on the limit-park path (line 77). This defeats the whole point of the stage/exit/error verdict. ## Fix - Remove the log in the EXIT trap **after** `verdict_write` (or leave it on the failure path; `mktemp` files are cheap). Preserve the limit-park path's exit-0 semantics. - `tests/run-triage-test.sh` (add if absent; shim `claude` to exit 1 with a known error line): the verdict's error lines contain that line after a failing triage. ## Acceptance - A shimmed failing `claude -p /triage` leaves `run-verdict.txt` with the shim's error line; full offline suite green. - After re-vendor, re-run `triage.yml` by hand to capture run 19's real error (separate follow-up if it is not the missing `docs/agents/triage-labels.md`, which is being added directly).

swarm-claim host=matou-dev-server-01 run=81
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=81 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #18 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit 561957d3 is not a valid commit object (fabricated, or never pushed)
  • changed_files: 'run-triage.sh' is not in the diff of the claimed commits
  • changed_files: 'tests/run-triage-test.sh' is not in the diff of the claimed commits
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
envelope
{
  "issue": 18,
  "status": "success",
  "commits": [
    "561957d3"
  ],
  "changed_files": [
    "run-triage.sh",
    "tests/run-triage-test.sh",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash tests/run-triage-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "run-triage.sh no longer rm's the triage log before exit — cleanup moved into the EXIT trap after verdict_write, so the verdict reads the live log": "run-triage.sh: trap 'verdict_write $?; [ -n \"${triage_log:-}\" ] && rm -f \"$triage_log\"' EXIT; the two premature `rm -f \"$triage_log\"` on the fail/limit-park paths removed (commit 561957d)",
    "limit-park path keeps its exit-0 semantics": "the limit-park branch still `exit 0` after claude_limit_park; verdict_write no-ops on exit 0, then the trap removes the log — asserted green by tests/claude-call-guards-test.sh (unchanged, still passing)",
    "A shimmed failing `claude -p /triage` leaves run-verdict.txt with the shim's error line": "new tests/run-triage-test.sh shims claude to exit 1 with a known error line and asserts the verdict carries stage=triage skill, exit=1, and that error line; verified RED against the pre-fix code (empty error block) and GREEN against the fix",
    "full offline suite green": "the full loop `for t in tests/*.sh onboarding/tests/*.sh ...` prints no FAIL after the change (exit 0)"
  },
  "summary": "run-triage.sh's EXIT-trap verdict now reads the claude log before it is removed, so a failing triage records the real error lines instead of an empty block.",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #18 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit 561957d3 is not a valid commit object (fabricated, or never pushed) - changed_files: 'run-triage.sh' is not in the diff of the claimed commits - changed_files: 'tests/run-triage-test.sh' is not in the diff of the claimed commits - changed_files: 'STATUS.md' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 18, "status": "success", "commits": [ "561957d3" ], "changed_files": [ "run-triage.sh", "tests/run-triage-test.sh", "STATUS.md" ], "tests": [ { "command": "bash tests/run-triage-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done", "exit_code": 0 } ], "criteria": { "run-triage.sh no longer rm's the triage log before exit — cleanup moved into the EXIT trap after verdict_write, so the verdict reads the live log": "run-triage.sh: trap 'verdict_write $?; [ -n \"${triage_log:-}\" ] && rm -f \"$triage_log\"' EXIT; the two premature `rm -f \"$triage_log\"` on the fail/limit-park paths removed (commit 561957d)", "limit-park path keeps its exit-0 semantics": "the limit-park branch still `exit 0` after claude_limit_park; verdict_write no-ops on exit 0, then the trap removes the log — asserted green by tests/claude-call-guards-test.sh (unchanged, still passing)", "A shimmed failing `claude -p /triage` leaves run-verdict.txt with the shim's error line": "new tests/run-triage-test.sh shims claude to exit 1 with a known error line and asserts the verdict carries stage=triage skill, exit=1, and that error line; verified RED against the pre-fix code (empty error block) and GREEN against the fix", "full offline suite green": "the full loop `for t in tests/*.sh onboarding/tests/*.sh ...` prints no FAIL after the change (exit 0)" }, "summary": "run-triage.sh's EXIT-trap verdict now reads the claude log before it is removed, so a failing triage records the real error lines instead of an empty block.", "blockers": [], "no_code_change": "" } ``` </details>

close-report for #18 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 18,
  "status": "success",
  "commits": [
    "561957d057ec24cf4da2e115342d67f929c07f91"
  ],
  "changed_files": [
    "run-triage.sh",
    "tests/run-triage-test.sh",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash tests/run-triage-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "run-triage.sh no longer rm's the triage log before exit — cleanup moved into the EXIT trap after verdict_write, so the verdict reads the live log": "run-triage.sh: trap 'verdict_write $?; [ -n \"${triage_log:-}\" ] && rm -f \"$triage_log\"' EXIT; the two premature `rm -f \"$triage_log\"` on the fail/limit-park paths removed (commit 561957d)",
    "limit-park path keeps its exit-0 semantics": "the limit-park branch still `exit 0` after claude_limit_park; verdict_write no-ops on exit 0, then the trap removes the log — asserted green by tests/claude-call-guards-test.sh (unchanged, still passing)",
    "A shimmed failing `claude -p /triage` leaves run-verdict.txt with the shim's error line": "new tests/run-triage-test.sh shims claude to exit 1 with a known error line and asserts the verdict carries stage=triage skill, exit=1, and that error line; verified RED against the pre-fix code (empty error block) and GREEN against the fix",
    "full offline suite green": "the full loop `for t in tests/*.sh onboarding/tests/*.sh ...` prints no FAIL after the change (exit 0)"
  },
  "summary": "run-triage.sh's EXIT-trap verdict now reads the claude log before it is removed, so a failing triage records the real error lines instead of an empty block.",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #18 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 18, "status": "success", "commits": [ "561957d057ec24cf4da2e115342d67f929c07f91" ], "changed_files": [ "run-triage.sh", "tests/run-triage-test.sh", "STATUS.md" ], "tests": [ { "command": "bash tests/run-triage-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done", "exit_code": 0 } ], "criteria": { "run-triage.sh no longer rm's the triage log before exit — cleanup moved into the EXIT trap after verdict_write, so the verdict reads the live log": "run-triage.sh: trap 'verdict_write $?; [ -n \"${triage_log:-}\" ] && rm -f \"$triage_log\"' EXIT; the two premature `rm -f \"$triage_log\"` on the fail/limit-park paths removed (commit 561957d)", "limit-park path keeps its exit-0 semantics": "the limit-park branch still `exit 0` after claude_limit_park; verdict_write no-ops on exit 0, then the trap removes the log — asserted green by tests/claude-call-guards-test.sh (unchanged, still passing)", "A shimmed failing `claude -p /triage` leaves run-verdict.txt with the shim's error line": "new tests/run-triage-test.sh shims claude to exit 1 with a known error line and asserts the verdict carries stage=triage skill, exit=1, and that error line; verified RED against the pre-fix code (empty error block) and GREEN against the fix", "full offline suite green": "the full loop `for t in tests/*.sh onboarding/tests/*.sh ...` prints no FAIL after the change (exit 0)" }, "summary": "run-triage.sh's EXIT-trap verdict now reads the claude log before it is removed, so a failing triage records the real error lines instead of an empty block.", "blockers": [], "no_code_change": "" } ``` </details>
Author
Owner

Closed by hand (Ben's session): 561957d verified on main (CI 84 green). Close PATCH failed for the machines-team permission gap (#19/#20/#11 same). Note the author on this commit is still the host gitconfig's — the worker ran the pinned copy that predates #19's identity fix; cleared by the next self-pin bump.

Closed by hand (Ben's session): `561957d` verified on main (CI 84 green). Close PATCH failed for the `machines`-team permission gap (#19/#20/#11 same). Note the author on this commit is still the host gitconfig's — the worker ran the pinned copy that predates #19's identity fix; cleared by the next self-pin bump.
ben closed this issue 2026-08-22 14:50:42 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#18
No description provided.