fix(kimi-k25): emit images inline in tool-response content#30
Merged
hallerite merged 1 commit intoMay 13, 2026
Merged
Conversation
Thread ``emit_image`` from ``render()`` and ``bridge_to_next_turn()`` through ``_render_tool_body`` so image parts inside ``tool`` message content (browser-agent screenshots, etc.) render as ``<|media_begin|>image<|media_content|><|media_pad|><|media_end|>`` inline instead of being silently dropped by ``_emit_content``. Same bug class as Qwen3.5 (PR #25). Affects both Kimi K2.5 and K2.6 since they share ``KimiK25Renderer``. Extends the ``_supports_tool_message_images`` gate in the multimodal suite so ``test_tool_response_image_byte_parity`` exercises Kimi K2.5/K2.6 against the HF processor — 8/8 Kimi multimodal cases pass. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
7c70310
into
fix/qwen35-tool-response-images
1 of 2 checks passed
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
KimiK25Renderer(which serves both Kimi K2.5 and K2.6).emit_imagefromrender()andbridge_to_next_turn()through_render_tool_bodyinto_emit_content, so images insidetoolmessage content render inline instead of being silently dropped._supports_tool_message_imagessotest_tool_response_image_byte_parityexercises Kimi K2.5/K2.6.Why the existing tests didn't catch this
Two compounding gaps. First,
_emit_contentsilently drops image parts whenemit_imageisNone— that fallback was meant for assistant-body text rewriting but doubled as a backdoor for callers that simply forgot to plumb it (i.e._render_tool_body). Second, every existing multimodal test put images onusermessages; nothing exercised thetoolpath. #25 is the first test that does — this PR extends its gate to flag (and now cover) Kimi.Stacking
Based on #25 (whose tests this PR uses to assert byte-parity). GitHub will auto-retarget the base to
mainonce #25 merges.Test plan
pytest tests/test_multimodal.py::test_tool_response_image_byte_parity— bothmoonshotai/Kimi-K2.5andmoonshotai/Kimi-K2.6PASS against the HF processor across all three cases (single tool image, multi-turn tool images, consecutive tools with mixed media + text-only).pytest tests/test_multimodal.py -k Kimi→ 8/8 pass (3 pre-existing byte-parity / placeholders / bridge tests × 2 Kimi variants + 2 new tool-response tests).🤖 Generated with Claude Code