Commit 4a8fca8
fix: [AI-6771] cancel() race condition and idle state on normal loop exit (#845)
* fix: [AI-6771] cancel() race condition and idle state on normal loop exit
Fix B1: Remove premature SessionStatus.set(idle) from cancel() main path.
On abort, the processor catch block publishes session.error then sets idle,
preserving correct event ordering. The !match fallback still sets idle
directly since no processor is running in that case.
Fix B2: Add SessionStatus.set(idle) after the while loop exits normally
so callers waiting on session.status:idle receive the event on clean completion.
* feat: [AI-6771] add telemetry for streaming error scenarios
Add Telemetry.track({ type: "error", context: "streaming" }) in the
non-retry, non-overflow branch of the processor.ts streaming catch block.
Covers:
- MessageAbortedError (Stop button / dispose)
- UnknownError (SSE chunk timeout after retry exhaustion)
- APIError (provider failures after retry exhaustion)
- AuthError and any other unhandled streaming error
Event fields: session_id, error_name, error_message, context
* fix: reword cancel() comment to avoid false-positive in SessionStatus guard test
---------
Co-authored-by: saravmajestic <saravmajestic@altimate.ai>
Co-authored-by: altimate-harness-bot[bot] <274995457+altimate-harness-bot[bot]@users.noreply.github.com>1 parent bc50b59 commit 4a8fca8
2 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
536 | 548 | | |
537 | 549 | | |
538 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
310 | 311 | | |
311 | | - | |
312 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
313 | 315 | | |
314 | 316 | | |
315 | 317 | | |
| |||
1110 | 1112 | | |
1111 | 1113 | | |
1112 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1113 | 1120 | | |
1114 | 1121 | | |
1115 | 1122 | | |
| |||
0 commit comments