fix(gateway): key native image handoff by the same resolved session key (#48912) - #57648
Merged
Conversation
…e buffering The cherry-picked #48919 fix resolved next_session_key AFTER _prepare_inbound_message_text had already buffered native image paths under the stale key. Reorder so the write key and the consume key are the same resolved key.
Collaborator
Core-team salvage (@teknium1) folding #48922 (@tt-a1i) and #48919 (@LeonSGP43) with authorship preserved, plus a follow-up reorder so queued follow-up turns buffer under the consumed key. Closes #48912. Related, not duplicate — this is the canonical version; the salvaged PRs #48922/#48919 can be closed in its favor by a maintainer. |
This was referenced Jul 3, 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.
Summary
Gateway native-image handoff no longer drops user images when the buffered write key and the consume key disagree (issue #48912). Two salvaged fixes plus a follow-up reorder make the pending-native-image buffer use the same resolved session key at SET and CONSUME.
Root cause:
_prepare_inbound_message_textbuffered native image paths under_session_key_for_source(source)while the run site consumed them undersession_entry.session_key; after compression-continuation healing / thread-anchor remapping the keys differ,pop()returns[], and the model receives a text-only turn even though the log said "attached inline".Changes
_prepare_inbound_message_textaccepts the caller's resolvedsession_key(falls back to deriving from source) — cherry-picked from fix(gateway): keep native images on resolved session key #48922 (@tt-a1i)next_session_keyfrom the pending event's source — cherry-picked from fix(gateway): preserve queued native image attachments #48919 (@LeonSGP43)next_session_keyBEFORE_prepare_inbound_message_textso the queued follow-up's buffered images are written under the key the recursive_run_agentconsumestest_native_image_buffer_isolation.py+ newtest_queued_native_image_session_key.pyValidation
Closes #48912. Salvages #48922 and #48919 with both contributors' authorship preserved.
Infographic