Commit f8f9898
committed
fix(core,sdk,cli): handover-hang, buffer-seq desync, MCP legacy filter
Three follow-ups from PR review.
`chat-server.ts stitchHandoverStream` was blocking ~60s after turn-
complete because control records never enqueue into the SSE data
stream, so the `for await` loop had no way to wake up and S2's long-
poll held the connection open until it timed out. A dedicated
`subscriptionAbort` AbortController is now aborted from `onControl`
when turn-complete fires, the for-await exits via AbortError, and the
catch treats that as the expected exit path so the surrounding
session-state emission and close still run.
`SessionStreamManager` was breaking its parallel-array invariant on
the (theoretical) `undefined`-seqNum path: a record with NaN-parsing
`part.id` would push to `buffer` but skip `bufferSeqNums`, drifting
the arrays so the next `once()` / `shiftBuffer` shifted a stale
seqNum into `lastDispatchedSeqNum`. `bufferSeqNums` now stores
`number | undefined` and always pushes; the shift sites already gate
the cursor advance on `seqNum !== undefined`.
`cli-v3/mcp/tools/agentChat.ts` picks up the same belt-and-suspenders
filter the dashboard's `AgentView.tsx` already carries: skip any
data chunk whose `type` starts with `trigger:`. Covers any in-flight
session whose `.out` was populated by an older SDK that emitted
turn-complete / upgrade-required as data records.1 parent 0dc7142 commit f8f9898
3 files changed
Lines changed: 50 additions & 16 deletions
File tree
- packages
- cli-v3/src/mcp/tools
- core/src/v3/sessionStreams
- trigger-sdk/src/v3
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
446 | 455 | | |
447 | 456 | | |
448 | 457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
| |||
503 | 509 | | |
504 | 510 | | |
505 | 511 | | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
513 | 516 | | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
514 | 522 | | |
515 | 523 | | |
516 | 524 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
570 | 577 | | |
571 | 578 | | |
572 | 579 | | |
573 | 580 | | |
574 | 581 | | |
575 | 582 | | |
576 | 583 | | |
577 | | - | |
| 584 | + | |
578 | 585 | | |
579 | 586 | | |
580 | 587 | | |
| |||
589 | 596 | | |
590 | 597 | | |
591 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
592 | 604 | | |
593 | 605 | | |
594 | 606 | | |
595 | 607 | | |
596 | 608 | | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
604 | 621 | | |
605 | 622 | | |
606 | 623 | | |
| |||
0 commit comments