Persist tool call error state in session messages#1711
Merged
rumpl merged 1 commit intodocker:mainfrom Feb 12, 2026
Merged
Conversation
When a tool call fails (either from execution error or user rejection), the IsError flag was only sent in the streaming SSE event but never stored on the tool response message in the session. This means that when a session is reloaded, the error state is lost and failed tool calls appear as if they succeeded. Add an IsError field to chat.Message and populate it from the tool execution result in both executeToolWithHandler and addToolErrorResponse. Also pass the persisted value through to the Anthropic provider instead of hardcoding false, so that the model receives accurate error context on session resumption.
There was a problem hiding this comment.
Review Summary
✅ No issues found - The implementation looks solid!
This PR correctly adds persistence for the tool call error state. The changes properly:
- Add the
IsErrorfield tochat.Messagewith appropriate JSON serialization - Populate it from
res.IsErrorinexecuteToolWithHandler - Set it to
trueinaddToolErrorResponsefor explicit error cases - Pass the persisted value to the Anthropic provider instead of hardcoding
false
The error handling paths ensure res is always initialized before accessing res.IsError, and the bool field defaults to false for existing messages, maintaining backward compatibility.
Great work! 🚀
rumpl
approved these changes
Feb 12, 2026
Member
rumpl
left a comment
There was a problem hiding this comment.
Neat!
Could use a test somewhere
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.
When a tool call fails (either from execution error or user rejection), the IsError flag was only sent in the streaming SSE event but never stored on the tool response message in the session. This means that when a session is reloaded, the error state is lost and failed tool calls appear as if they succeeded.
This PR adds an IsError field to chat.Message and populate it from the tool execution result in both executeToolWithHandler and addToolErrorResponse. Also pass the persisted value through to the Anthropic provider instead of hardcoding false, so that the model receives accurate error context on session resumption.