Repository navigation
fix(agent-runtime): restore MCP resource text in toolResultFromUi - #1878
Merged
vastsa merged 2 commits intoOct 25, 2026
Merged
Conversation
Session restore copied only text and image blocks out of a persisted tool row. An MCP result that was only an embedded text resource came back as "[no tool result recorded]", and a status line plus a resource plus a resource_link kept the status and dropped the file body and the link. Live execution already keeps those through hostContentBlockText; restore now uses that same rule for both content shapes.
This was referenced Oct 31, 2026
Closed
This branch was previously deployed
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.
fix(agent-runtime): restore MCP resource text in toolResultFromUi
Fixes #1877
What
toolResultFromUinow runs persisted content blocks through the samehostContentBlockTextrule as live execution, for both the MCPcontentproperty shape and the plugin bare content-block array. Embedded text resources andresource_linkblocks are pushed as{ type: "text", text }; images stay as before; binary resources with no text are still ignored.Why
#1551 fixed the live path so MCP resource text reaches the model, but session restore still dropped those blocks. A resource-only row restored as
"[no tool result recorded]", and a status + resource + resource_link row kept only the status (and image).How tested
runtime.test.tsfail on unmodified main (resource-only → placeholder; mixed row loses body/link) and pass with this change.packages/agent-runtime:vitest run src/runtime.test.ts -t "toolResultFromUi"→ 15/15 pass (325 skipped);tsc -p tsconfig.json --noEmitclean.Scope
runtime.ts(toolResultFromUionly) and its tests. Live execute path unchanged. Note:delegation-history.tshas a private copy of the same helper that still only restores text/image; left out of this PR’s scope.