fix: accumulate tool_call_message arguments across streaming chunks#55
Merged
fix: accumulate tool_call_message arguments across streaming chunks#55
Conversation
The CLI streams tool_call_message in chunks with partial `arguments`.
Previously, transformMessage() parsed each chunk independently, yielding
`toolInput: {}` from the first chunk. SDK consumers never saw the actual
tool call arguments.
Now the background pump buffers tool_call_message chunks by tool_call_id,
concatenating `arguments` across chunks. The complete message is flushed
and transformed when a different message type arrives or the pump ends.
Written by Cameron and Letta Code
"The best way to predict the future is to invent it." -- Alan Kay
cpacker
approved these changes
Feb 24, 2026
5 tasks
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.
Summary
SDKToolCallMessage.toolInputwas always{}(empty object) for tool calls streamed from the CLItool_call_messagein chunks with partialarguments. The SDK'stransformMessage()parsed each chunk independently --JSON.parse("{}")on the first chunk yielded{}, and subsequent chunks with partial JSON either threw or produced{ raw: "..." }tool_call_messagechunks bytool_call_id, concatenatingargumentsacross chunks. The complete message is flushed and transformed when a different message type arrives (e.g.,tool_return_message,assistant_message) or the pump endsBefore
After
Impact
Any SDK consumer that reads
toolInputnow gets the actual arguments. This was discovered while building tool call display in lettabot -- the display needed to show what arguments tools were called with, buttoolInputwas always empty.Test plan
bun test)bun run check)npm link, confirmedtoolInputnow populated for web_search, conversation_search, Bash, and other toolsWritten by Cameron and Letta Code
"The best way to predict the future is to invent it." -- Alan Kay