Preserve live stream output across session switches#3427
Open
t3chn0pr13st wants to merge 1 commit into
Open
Conversation
50f7e3c to
861a675
Compare
861a675 to
b1d6f51
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
What Changed
GET /api/sessioncan restore already-visible assistant text and live tool cards./api/file/rawto serve session-referenced absolute attachment paths under the WebUI attachment root, including legacy[Attached files: ...]markers.Why It Matters
Users often leave a long-running turn open while the agent is still working. The visible progress text and tool activity are part of the conversation timeline, not disposable local UI state. After this change, switching sessions, refreshing, or opening the same active session from another browser/device can recover the already-emitted work instead of showing only new events.
This also prevents uploaded screenshots from degrading into broken image previews after reload/session switches when the original attachment path was only available before finalization.
Contract Routing
Task type: runtime / streaming / recovery / replay / attachment recovery.
Touched areas:
api/routes.pyapi/streaming.pyapi/helpers.pystatic/messages.jsstatic/sessions.jsstatic/ui.jsRelevant public docs:
CONTRIBUTING.mddocs/CONTRACTS.mddocs/rfcs/README.mddocs/rfcs/webui-run-state-consistency-contract.mdState layers affected:
Evidence used:
No intentional contract change is made. This PR preserves the existing run-state consistency invariant that replay/reconnect must not silently lose already-visible active-turn content.
Verification
After rebasing on upstream
v0.51.230/2d20d336:Result:
159 passed, 2 skipped.Manual checks performed locally:
Risks / Follow-ups
/api/file/rawattachment fallback remains constrained to session-referenced paths under the WebUI attachment root and has traversal rejection coverage.Model Used