🧩 fix: Keep Streamed Parts Intact Across Replays and Early Completions - #16331
Merged
Merged
Conversation
- Carry the in-flight summary's agentId/groupId onto the finalized part when the completed summary omits them. - Write the incoming image_url into a new image slot instead of cloning the empty placeholder. - Leave a settled tool call alone when its tool_calls run step is announced again, as the resume path does for every known run step. - Buffer an ON_RUN_STEP_COMPLETED that arrives before its run step and apply it when the step lands, like the other pre-step events.
berry-13
marked this pull request as ready for review
September 24, 2026 22:56
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Sep 24, 2026
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.
Pull Request
Summary
The step reducer refactor (#16289, #16290) carried over four streaming defects unchanged on purpose. This change fixes all four in the reducer and its adapter hook. Each part still sits at its step index, and nothing is spliced mid-stream.
A finalized summary now keeps the
agentId/groupIdof its in-flight part when the completed summary omits them, so a parallel agent's summary stays in its column. The first streamedimage_urlpart now gets the incoming URL instead of an empty clone of the placeholder slot. Atool_callsrun step announced again after its call settled leaves the settled part alone. The resume path re-dispatches every known run step asON_RUN_STEP, and that used to reset a completed card to running. AnON_RUN_STEP_COMPLETEDthat arrives before its run step is now buffered like the other pre-step events, where it used to be dropped with a warning.berry-13#111
berry-13#113
berry-13#115
berry-13#116
Type of change
Testing
Each fix has a regression test that failed before the change: three reducer cases in
steps.spec.ts(summary metadata, first image URL, re-announced settled tool call) and one hook case inuseStepHandler.spec.ts(completion before its run step, including the skill-authoring signal firing once). The old test that asserted the drop warning is replaced by the buffering case.Tested environments/configuration:
lc(backend serving this branch'sclient/dist), headless Chromium, agents endpoint with a Claude Sonnet 4.6 agent carrying the Tavily search tool.@langchain/google-common, which turns GeminiinlineDataoutput into streamedimage_urlparts) and a summarize round (nothing in this configuration triggers agent compaction short of filling the context window). Both are covered by the reducer tests above.Automated tests:
cd client && npx jest hooks/SSE: 10 suites, 386 tests passedcd client && npm run typecheck: cleannpx eslint,npx prettier --check,node scripts/sort-imports.mts --checkon the six changed files: cleanScreenshots / recordings
No visual change. The attached captures are from the reconnect run on this branch: before the reload, right after the resume, and at the end of the stream.
Risk / compatibility
A completion whose run step never arrives now stays in the pending buffer until the next
clearStepMapsinstead of being dropped. The buffer is cleared at every run boundary, as it already is for buffered deltas.Checklist