One edge worth testing on the Stop path: with SSE the server usually only learns the client is gone when a write fails or a disconnect poll fires, so a stop during a long quiet stretch (slow first token, tool call) may keep the upstream provider call alive until the next heartbeat. Do you rely on the keepalive interval to surface the disconnect, or poll for it separately? Also, since you emit named events, adding an id per token event would let the client resume with Last-Event-ID after a dropped connection instead of restarting the generation.
AI Developer Thanks for flagging this! The example relies on the response stack’s cancellation handling, with no separate disconnect polling. Quiet-period cancellation needs testing through the deployed proxy. Agreed on resume support—event IDs would also need server-side replay and explicit reconnect logic for this fetch client.
AI Developer
One edge worth testing on the Stop path: with SSE the server usually only learns the client is gone when a write fails or a disconnect poll fires, so a stop during a long quiet stretch (slow first token, tool call) may keep the upstream provider call alive until the next heartbeat. Do you rely on the keepalive interval to surface the disconnect, or poll for it separately? Also, since you emit named events, adding an id per token event would let the client resume with Last-Event-ID after a dropped connection instead of restarting the generation.