fix: skip streaming normalization on finish_reason length

Truncated tool calls (finish_reason: 'length') now preserve the raw
buffer instead of normalizing into executable commands, preventing
incomplete commands from becoming runnable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gnanam1990
2026-04-06 18:08:01 +05:30
parent b20d878b76
commit 50efbe5614
2 changed files with 14 additions and 8 deletions

View File

@@ -1420,7 +1420,7 @@ test('does not normalize incomplete streamed Bash commands when finish_reason is
.map(event => (event.delta as Record<string, unknown>).partial_json)
.join('')
expect(streamedInput).toBe('{"command":"rg --fi"}')
expect(streamedInput).toBe('rg --fi')
})
test('does not repair truncated Bash objects that do not contain command', async () => {