Skip to content

fix(runtime): cover MCP and plugin image delivery - #1372

Merged
vastsa merged 3 commits into
mainfrom
codex/fix-pr1367-tool-image-restore
Oct 4, 2026
Merged

vastsa merged 3 commits into
mainfrom
codex/fix-pr1367-tool-image-restore

Conversation

@vastsa

@vastsa vastsa commented Oct 4, 2026

Copy link
Copy Markdown
Owner

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 content blocks 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.ts passed (275 tests), including the new MCP and plugin execution cases.
  • git diff --check passed.
  • origin/main is an ancestor of this head.
  • A live MCP image-server round trip was not run; the test uses the host tool boundary fixture and no paid provider.

Supersedes #1367. Fixes #1360.

yexisu and others added 2 commits October 4, 2026 10:41
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.
Copilot AI balanced review requested due to automatic review settings October 4, 2026 02:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MCP / 插件工具返回的图片被拍平成 JSON 文本,视觉模型收不到图像块

3 participants