Repository navigation
Commit ca0d7ff
fix(llm): prevent infinite loop when finish_reason missing in stream
In web mode some providers omit `finish_reason` on the final SSE chunk.
`finishEvents()` left `reason` undefined in that case, the `step-finish`
event was never emitted, and `processor.ts` returned `"continue"`
indefinitely.
When `finishReason` is undefined and no pending tools exist, default
to `"stop"`. Pending (unfinished) tool calls still keep the error
behavior to avoid emitting a false `"stop"` for interrupted tool calls.
Fixes anomalyco#378551 parent 76361ca commit ca0d7ff
2 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
484 | 487 | | |
485 | 488 | | |
486 | 489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
723 | 738 | | |
724 | 739 | | |
725 | 740 | | |
| |||
0 commit comments