Commit c9e0d76
authored
fix(session): bound the retry loop, fix the doom-loop guard, treat abort as a clean stop (#124)
- Cap transient-error retries at MAX_RETRY_ATTEMPTS (10) per message
generation. The while(true) retry loop was unbounded, and retry.ts marks
any JSON body with an 'error' field as retryable, so a persistently-failing
provider (or a permanent error arriving as JSON) retried forever. (#7)
- Doom-loop detection now scans the last N *tool* parts (isDoomLoop helper)
instead of the last N raw parts. Reasoning models emit a reasoning part
before each tool call, so the last 3 raw parts were never 3 identical tool
parts and the guard never fired against a genuinely looping tool. (#10)
- A user-initiated abort no longer fires the session Error event: it's a clean
cancellation, so record it on the message (turn still stops) but don't
surface it as an error state in the UI. (#51)1 parent abe76c6 commit c9e0d76
2 files changed
Lines changed: 83 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
25 | 49 | | |
26 | 50 | | |
27 | 51 | | |
| |||
182 | 206 | | |
183 | 207 | | |
184 | 208 | | |
185 | | - | |
186 | 209 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
| 210 | + | |
197 | 211 | | |
198 | 212 | | |
199 | 213 | | |
| |||
419 | 433 | | |
420 | 434 | | |
421 | 435 | | |
422 | | - | |
| 436 | + | |
423 | 437 | | |
424 | 438 | | |
425 | 439 | | |
| |||
432 | 446 | | |
433 | 447 | | |
434 | 448 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
439 | 458 | | |
440 | 459 | | |
441 | 460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments