Commit 0a17bfa
committed
fix(llm): catch JSONDecodeError in LLM retry loop
Handle malformed JSON responses from LLM providers (e.g., OpenRouter
returning truncated JSON) by treating json.JSONDecodeError as a
retryable error. This allows 3 retry attempts with exponential backoff
instead of immediately crashing the run.
Previously, JSONDecodeError from the OpenAI SDK's response parsing
would escape all error handlers and kill the game run. Now it's
treated like APIConnectionError — logged and retried automatically.1 parent c5692b2 commit 0a17bfa
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
0 commit comments