fix(runtime): cover MCP and plugin image delivery - #1372
Merged
Merged
Conversation
The host tool bridge only recognized a top-level `images` array, so MCP
results shaped as `content: [{ type: "image" }]` and plugin tools
returning a bare content-block array were flattened into JSON text;
vision models never saw the picture (#1360). Normalize both shapes:
render text blocks as text, emit well-formed image blocks when vision is
enabled, and carry imageCount in details. Apply the same restoration to
persisted bare arrays in toolResultFromUi so a restart keeps the image.
Validated: toolResultFromUi tests 3/3 in runtime.test.ts; remaining
agent-runtime tsc errors reproduce on pristine main (baseline noise).
The new bridge branches need direct coverage at the host tool boundary, not only persisted-row restoration. Exercise MCP and plugin result shapes through execution and restored history, and document the supported image contract.
This was referenced Oct 4, 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.
This follow-up carries yexisu's original #1367 commit and adds direct regression coverage for the bridge behavior it changes.
The reported gap is real: MCP
contentblocks and bare plugin content-block arrays previously fell through to JSON text. The original diff handled both shapes, but its new test covered only persisted-row restoration. This follow-up exercises each shape through host tool execution, confirms image blocks reach a vision model result, and verifies restored history keeps them. The supported bridge behavior is documented in the agent-runtime spec.Validation:
vitest run src/runtime.test.tspassed (275 tests), including the new MCP and plugin execution cases.git diff --checkpassed.origin/mainis an ancestor of this head.Supersedes #1367. Fixes #1360.