Files
claude-desktop-debian/.github
Aaddrick 82908fbe64 fix(triage): harden Investigate step against hangs and parser drift (#461)
Three failure modes surfaced in the first round of dispatches against
real issues, all in the Stage 4 Investigate step:

- #394 hung for 9 min (the Claude CLI wedged; no per-call timeout);
  user had to cancel manually. Step log was silent because
  `2>/dev/null` swallowed stderr.
- #424 and #442 both ran to CLI completion but the payload's jq
  presence-check rejected the output. Raw response wasn't archived,
  so the specific rejection cause was unknowable post-hoc.

## Fix

- `timeout 300s claude -p ...` — bounds the step at 5 min; exit 124
  routes to 8b no-findings gracefully via the existing warning branch.
- `2>/tmp/triage/investigate-stderr.log` instead of `2>/dev/null` —
  CLI diagnostics ride along in the run's uploaded artifact bundle,
  available for post-mortem without a re-dispatch.
- Raw CLI response archived as `investigate-raw.json` before any
  parsing. Extracted payload archived as `investigate-payload.txt`
  before schema checks. Schema-reject no longer loses the evidence.
- Fence-strip + jq-presence-check replaced with
  `.claude/scripts/triage/extract-json.py`, which uses
  `json.JSONDecoder.raw_decode` to handle leading OR trailing prose
  around the JSON body. Addresses PR #459 review item 6.
- The shape check now verifies each of the four required fields is
  an `array`, not just present — `{"findings": "oops"}` would pass
  presence and explode downstream. Addresses PR #459 review item 7.

## Testing

`extract-json.py` exercised locally against: bare JSON, leading
prose, trailing prose, fence-wrapped JSON, pure prose (exit 1),
malformed JSON (exit 2). All cases produce the expected output or
exit code.

`actionlint -shellcheck` clean on the workflow.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 19:08:58 -04:00
..