fix(agent-claude-code): handle missing result line gracefully #576

Merged
xiaonuo merged 1 commits from fix/574-silent-fail-handling into main 2026-05-30 05:52:55 +00:00
Owner

What

Handle the case where Claude Code exits without producing a result line in its stream-json output (timeout, OOM, signal kill).

Why

Previously, when uwf-claude-code spawned Claude Code and it exited prematurely, parseClaudeCodeStreamOutput() returned null and the adapter threw a misleading "unparseable output" error. This caused background workflow threads to get stuck silently.

Changes

  • Add "incomplete" as new ClaudeCodeResultSubtype value
  • Extract output from last assistant turn when no result line exists (best-effort)
  • Enhanced error messages distinguish incomplete vs unparseable output
  • Store incomplete results in CAS with appropriate metadata
  • Add 10 comprehensive test cases for incomplete result handling

Test Results

All 27 tests pass (including 10 new tests)
bun run check passes (TypeScript + Biome lint + log tag validation)
Backwards compatibility maintained (existing tests continue to pass)

Ref

Fixes #574

## What Handle the case where Claude Code exits without producing a result line in its stream-json output (timeout, OOM, signal kill). ## Why Previously, when `uwf-claude-code` spawned Claude Code and it exited prematurely, `parseClaudeCodeStreamOutput()` returned `null` and the adapter threw a misleading "unparseable output" error. This caused background workflow threads to get stuck silently. ## Changes - Add `"incomplete"` as new `ClaudeCodeResultSubtype` value - Extract output from last assistant turn when no result line exists (best-effort) - Enhanced error messages distinguish incomplete vs unparseable output - Store incomplete results in CAS with appropriate metadata - Add 10 comprehensive test cases for incomplete result handling ## Test Results ✅ All 27 tests pass (including 10 new tests) ✅ `bun run check` passes (TypeScript + Biome lint + log tag validation) ✅ Backwards compatibility maintained (existing tests continue to pass) ## Ref Fixes #574
xiaoju added 1 commit 2026-05-30 05:38:07 +00:00
fix(agent-claude-code): handle missing result line gracefully
CI / check (pull_request) Successful in 1m44s
53fa4d8972
Handle the case where Claude Code exits without producing a result line
(timeout, OOM, signal kill). Previously returned null and threw an error;
now returns incomplete result with best-effort output extraction.

Changes:
- Add "incomplete" as new ClaudeCodeResultSubtype value
- Extract output from last assistant turn when no result line exists
- Enhanced error messages distinguish incomplete vs unparseable output
- Store incomplete results in CAS with appropriate metadata
- Add 10 comprehensive test cases for incomplete result handling

Fixes #574

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiaonuo merged commit 15dcdee1cb into main 2026-05-30 05:52:55 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#576