Preserve MCP tool error outcomes#2135
Closed
xeophon wants to merge 1 commit into
Closed
Conversation
xeophon
force-pushed
the
agent/preserve-mcp-tool-errors
branch
from
July 26, 2026 11:31
0a85961 to
a88d1c2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a88d1c2. Configure here.
xeophon
force-pushed
the
agent/preserve-mcp-tool-errors
branch
from
July 26, 2026 15:40
2e08cf1 to
1e47ec2
Compare
Member
Author
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.

Overview
Preserves MCP tool-declared outcome semantics across harness execution, typed messages, traces, replay, and provider conversion.
This PR is stacked on #2134, which owns the shared null/bash MCP client and its session lifecycle and replay-safety behavior.
Details
MCP
CallToolResultcontains both model-visible content and anisErroroutcome. The shared MCP client now returns both values, and the harness program carries the outcome intoToolMessage.is_error.The typed outcome participates in graph identity and trace serialization, so success and failure results with identical content remain distinguishable after persistence and resume.
For chat-compatible providers, the localhost harness handoff uses a private marker that is removed before the provider request while adding a readable failure label to the model-visible content. Anthropic-native
tool_result.is_errormaps directly into the same typed representation.Note
Preserve MCP tool error outcomes through the verifier pipeline
is_errorfield toToolMessagein types.py and propagates it fromcall_mcpthrough the bash/null harness programs and into parsed messages._vf_is_erroras an internal wire flag in chat.py; when serializing for external consumption the flag is replaced with a"Tool execution failed:\n"content prefix, while internal paths (harness launch) preserve the machine-readable flag viainclude_internal=True.is_errorfromtool_resultblocks, andmessage_hashin graph.py incorporates error vs. success into the digest so error and success tool messages hash differently.ChatDialect.apply_overridesrewrites messages containing_vf_is_errorto error-prefixed content before forwarding upstream.Macroscope summarized 1e47ec2.