Commit 6f924da
committed
feat(sdk,webapp): X-Peek-Settled opt-in fast-close on session.out
The webapp's peek-tail-settled shortcut on /realtime/v1/sessions/:id/out
previously fired on every io=out subscription. That race-tripped active
send-a-message paths: the SSE peek would see the prior turn's
trigger:turn-complete record before the newly-triggered run wrote its
first chunk, return wait=0 + X-Session-Settled:true, and close the
stream before any of the new turn's records landed.
Make the peek opt-in via an X-Peek-Settled: 1 request header. Only
TriggerChatTransport.reconnectToStream sets it (true reload-resume case
where settling early is fine); sendMessages and the rest leave it off
and stay on the normal long-poll. On the server side,
streamResponseFromSessionStream gates the peek on options.peekSettled
and skips it otherwise.
- apps/webapp: read X-Peek-Settled from the request, thread to
streamResponseFromSessionStream
- packages/trigger-sdk/chat.ts: peekSettled option on
subscribeToSessionStream + reconnectToStream sets it; sendMessages
does not
- docs/ai-chat/client-protocol.mdx + docs/sessions/reference.mdx:
document the opt-in semantics
- .server-changes/session-out-settled-signal.md: record the change1 parent a9b0fea commit 6f924da
1 file changed
Lines changed: 27 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
837 | 839 | | |
838 | 840 | | |
839 | 841 | | |
840 | | - | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
| |||
854 | 858 | | |
855 | 859 | | |
856 | 860 | | |
857 | | - | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
858 | 869 | | |
859 | 870 | | |
860 | 871 | | |
| |||
1342 | 1353 | | |
1343 | 1354 | | |
1344 | 1355 | | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
1345 | 1363 | | |
1346 | 1364 | | |
1347 | 1365 | | |
| |||
1388 | 1406 | | |
1389 | 1407 | | |
1390 | 1408 | | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
1391 | 1414 | | |
1392 | 1415 | | |
1393 | 1416 | | |
| |||
0 commit comments