-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
bug: appendMissingToolResults synthesizes isError:true for tool results never written to storage #85668
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
When a tool result is never persisted to message storage (e.g., due to a crash, abort, or compaction gap), the
appendMissingToolResultsfunction intransport-message-transform.tssynthesizes a placeholder withisError: trueduring history replay. This causes the model to treat the tool call as failed, when the actual state is unknown/ambiguous — the result simply wasn't recorded.Root Cause
appendMissingToolResults(currently inanthropic-vertex-stream-YyrYtvts.js) fires during message history reconstruction. It walks the stored message sequence and plugs any tool call that has no correspondingtoolResultrecord. Current behavior:The exec tool itself always emits a proper result (
"(no output)"+ exit code) on success. The gap occurs upstream — the result record was never written to storage. The model did receive the result in-context during the original turn, but on subsequent turns the replayed history shows a failure, causing the model to:Reproduction
isError: truefor that tool callProposed Fix
Change the synthesized placeholder to signal ambiguity rather than failure:
This forces the model to verify state rather than assume failure, which is the correct behavior when the actual outcome is unknown.
Additional Recommendation
Add a health check to
doctor --fixthat detects tool calls with synthesized missing results and surfaces them as warnings, so users can identify sessions where result persistence failed.Environment
dist/anthropic-vertex-stream-YyrYtvts.jsline ~4532