Commit 9df32fa
committed
fix(server): Prevent error message on stream abort (complete fix)
Root Cause Analysis:
When user presses ESC to abort streaming, the AI SDK throws NoOutputGeneratedError
which propagates through TWO error handlers:
1. ai-orchestrator.ts: Stream error events (case "error")
2. stream-orchestrator.ts: Outer catch block for execution errors
Previously, both handlers unconditionally emitted error events, causing
"No output generated" to appear in UI on intentional abort.
Complete Fix:
1. ai-orchestrator.ts (lines 400-422):
- Stream error events now check if error contains "No output generated"
- Abort errors → set state.aborted, call onAbort() (no error emitted)
- Real errors → add error part, emit error event
2. stream-orchestrator.ts (lines 564-571):
- Outer catch block now checks errorMessage and state.aborted
- Abort errors → skip emitError(), only complete observer
- Real errors → emit error event normally
Architecture:
- Two-layer error detection prevents abort errors at both levels
- state.aborted provides additional signal for abort detection
- Error message pattern matching catches AI SDK abort errors
- Real errors still emit properly for debugging
Result: ESC abort now cleanly stops without error message or hanging.1 parent 4676f92 commit 9df32fa
File tree
2 files changed
+40
-9
lines changed- packages/code-server/src/services/streaming
2 files changed
+40
-9
lines changedLines changed: 20 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
409 | 421 | | |
410 | 422 | | |
411 | 423 | | |
| |||
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
564 | 583 | | |
565 | 584 | | |
566 | 585 | | |
| |||
0 commit comments