fix(driver): treat subtype:success + is_error:true as phase failure (#973) - #976
Merged
admarble merged 1 commit intoAug 29, 2026
Conversation
…973) The SDK emits subtype "success" with is_error:true when a turn ends on an API error (e.g. unrecognized model). The driver was returning success:true in this case, producing a zero-work "successful" phase. Guard the success branch on is_error and return an ApiError with terminal_reason and api_error_status in metadata when the flag is set. Entire-Checkpoint: 6d0539f77208
3 tasks
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
subtype: "success"withis_error: truewhen a turn ends on an API error (e.g. unrecognized model name). Previously the driver returnedsuccess: truein this case, silently producing a zero-work "successful" phase.subtype === "success"branch that checksis_errorand returnssuccess: falsewith anApiErrorcarryingterminal_reasonandapi_error_statusin its metadata.AC Verification
subtype:success+is_error:true→success:falsewith result text as errorclaude-code.ts:232–258; new test "treats subtype:success + is_error:true as a phase failure"structuredError.metadatacarriesterminal_reasonandapi_error_statusclaude-code.ts:237–243; new test "carries terminal_reason and api_error_status in structuredError metadata"Test plan
npx vitest run src/lib/workflow/drivers/claude-code.test.ts— 26/26 passnpm run build— no TypeScript errorsnpm run lint— 0 errors, 0 warningsCloses #973
🤖 Generated with Claude Code
Orchestrator verification (2026-08-29)
Independently re-executed in the worktree:
npx vitest run src/lib/workflow/drivers/claude-code.test.ts(26/26 pass),npm run build,npm run lint— all clean.Mutation-verified: AC-1 — disabled the
is_errorguard in claude-code.ts (if (resultMessage.is_error)→if (false)); test "treats subtype:success + is_error:true as a phase failure (AC-1)" failed; restored.Mutation-verified: AC-3 — same mutation; test "carries terminal_reason and api_error_status in structuredError metadata (AC-3)" failed; restored.