Commit f796421
committed
fix(sdk): fail faster when json.loads encounters non-JSON content
When the buffer contains non-JSON content (e.g., control characters like \a from
shell hooks), json.loads fails and the code continues waiting indefinitely for
valid JSON, causing 10+ minute timeouts.
This fix detects when the buffer contains non-JSON content at the start (after
stripping whitespace) and raises SDKJSONDecodeError immediately instead of
waiting forever.
Fixes anthropics#6781 parent 15b5ece commit f796421
1 file changed
Lines changed: 12 additions & 2 deletions
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
560 | | - | |
561 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
562 | 572 | | |
563 | 573 | | |
564 | 574 | | |
| |||
0 commit comments