Repository navigation
[Bug] History snapshots resend settled assistant stream payloads on every open/reconnect (~44% avoidable bytes) #13613
Replies: 1 comment
|
Cross-referencing a quantified reproduction that shows the resend is not just wasted bytes β combined with the default heartbeat it turns into a permanent reconnect loop. On
The reason retries never converge: Raising So trimming settled |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Opening a large session in the Web GUI sends a multi-megabyte
session/followsnapshot containing the full historical assistantstreamreplay trails. The same payload is sent again on reconnects. On a mobile connection this makes history opening take several seconds and repeatedly re-downloads data that is unnecessary for rendering settled history.The already-finished messages should not include their
streamtrails by default. The liveactiveAttemptstream can remain independent, and historical replay data could be fetched lazily only when a user actually requests replay.Environment
0.2.2-rc.3Reproduction
remote.muxWebSocket frames and thesession/followopen frame. The GUI sends parameters equivalent to:{ "activate": true, "assistantStream": true, "maxMessages": 500, "turnWindow": { "minMessages": 50, "minTurns": 2 } }session/followstream opened from Node on the same host.Measured impact
session/followopen to arrival of a 2,020,626-byte snapshot.permessage-deflateis enabled, but the browser still receives, parses, and retains the full multi-megabyte decoded JSON snapshot.Payload analysis
For one 2.73 MB snapshot with 508 event records:
recordsprojections, header, cursor, etc.Within
records:assistant/messagetool/resultA representative settled
assistant/messagerecord was 183,265 bytes, although its final visible reply was only 226 characters:message.content.reasoning.text: 47,735 charactersmessage.contentcontaining the visible reply and other parts: much smallerstream: 133,348 bytes, including approximately 81 KB ofreasoning-chunksand another approximately 48 KB raw reasoning chunkThus the final message and its replay trail duplicate much of the same long reasoning content. Large tool results add further payload.
assistantStreamdoes not control this historical dataI tested the request with
assistantStream: true,false, and completely omitted:assistantStream?: trueis the only accepted type;falseis not accepted.streampopulated, totaling 1,365,199 bytes β identical to thetruecase.assistantStreamfield only describes the liveactiveAttempt.Reducing
maxMessagesalone is not sufficient: in the same session,maxMessages: 50still produced about 1.78 MB, because individual messages and tool results are large.Proposal
For settled history:
data.streamfrom settled assistant records in the initial history snapshot (or make its inclusion an explicit opt-in).activeAttemptbaseline and streaming updates unchanged.In the measured snapshot, dropping only the settled
streamtrails would reduce it from 3,094,813 bytes to about 1.73 MB (~44% less) without affecting the live streaming experience.Acceptance criteria
All reactions