fix: don't drop empty tool results from working memory - #41
Merged
Conversation
…memory A completed tool call with empty output (e.g. a delegate_to_* call whose sub-agent produced no final text) was silently skipped, leaving its assistant tool_calls id unpaired in the message history. Providers like Bedrock/Anthropic reject that payload on the next turn with "Expected toolResult blocks ... for the following Ids".
msardara
force-pushed
the
fix/empty-tool-result-orphan
branch
from
August 26, 2026 13:59
d3c6f59 to
8070a91
Compare
msardara
marked this pull request as ready for review
August 26, 2026 16:39
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.
Completed tool calls with empty output (e.g. a delegate_to_* call whose sub-agent returns no final text) were silently skipped when syncing tool results into working memory, leaving the assistant's tool_calls id unpaired. That malformed history causes providers (Bedrock/Anthropic) to reject the next request with "Expected toolResult blocks ... for the following Ids: call_N". Removed the empty-text guard in _sync_tool_result_memory; the existing call_id check already covers the genuine "nothing to sync" case.
Added a regression test driving a full kernel turn with a tool returning an empty string, asserting every declared tool_calls id has a matching tool-role message. Full test suite passes.