fix(claude): log error and mark batch failed when stop_reason is max_tokens#78
Open
Valyrian-Code wants to merge 1 commit into
Open
fix(claude): log error and mark batch failed when stop_reason is max_tokens#78Valyrian-Code wants to merge 1 commit into
Valyrian-Code wants to merge 1 commit into
Conversation
scanBatchWithPrompt used max_tokens: 1024 but never checked
stop_reason on the response. When the API hit the token limit,
extractFindings found no tool_use block and returned { findings: [] }
— identical to a clean empty result. No error was logged, errorCount
stayed at zero, and findings were silently dropped.
Added stop_reason check before extractFindings: a max_tokens response
now returns { error: true } and logs an error, so the batch is counted
as failed and the caller knows findings may be incomplete.
3 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
max_tokenslimit,stop_reasonis'max_tokens'and the response content is truncated. The adapter passed this truncated content toextractFindings, which returned{ findings: [] }— identical to a clean scan with no findings.stop_reasoncheck before callingextractFindings. When truncated, the batch returns{ error: true }and logs an error, so the partial result is counted in the error tally instead of silently treated as clean.Test plan
console.erroris called with a message containingmax_tokenswhen the API returnsstop_reason: 'max_tokens'npm test— 635 tests, 0 failures