Skip to content

Only send the delta on the partial tool call#2105

Merged
dgageot merged 1 commit intodocker:mainfrom
rumpl:partial-tool-call
Mar 18, 2026
Merged

Only send the delta on the partial tool call#2105
dgageot merged 1 commit intodocker:mainfrom
rumpl:partial-tool-call

Conversation

@rumpl
Copy link
Member

@rumpl rumpl commented Mar 15, 2026

Only sends the delta arguments received on each partial tool call. We used to send the whole accumulated tool call arguemnts, which is dumb, the clients should handle accumulation if they care.

Also added sending the tool definition only on the first partial too call

@rumpl rumpl requested a review from a team as a code owner March 15, 2026 08:28
docker-agent[bot]

This comment was marked as outdated.

@rumpl rumpl force-pushed the partial-tool-call branch 2 times, most recently from 06ef911 to ad83fb8 Compare March 18, 2026 21:09
@rumpl rumpl changed the title [DNM] Only send the delta on the partial tool call Only send the delta on the partial tool call Mar 18, 2026
@rumpl
Copy link
Member Author

rumpl commented Mar 18, 2026

/review

Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

This PR correctly implements delta-only transmission for partial tool call events. The changes include:

  1. Normalization logic in streaming.go that correctly detects whether providers send full buffers or deltas by checking if the new chunk starts with the accumulated buffer
  2. Delta extraction that properly calculates the new bytes and updates the accumulated state
  3. TUI component updates that accumulate deltas when status is "pending"
  4. Comprehensive tests verifying both delta-only and full-buffer normalization scenarios

The code correctly handles:

  • Providers that send true deltas (concatenates to accumulated buffer)
  • Providers that resend full buffers (detects prefix, extracts delta, updates buffer)
  • First event emission with tool name and definition
  • Subsequent events with only argument deltas (no definition)
  • Proper accumulation in TUI components

No bugs found in the changed code.

@rumpl
Copy link
Member Author

rumpl commented Mar 18, 2026

I'm not so sure about the normalization in streaming.go, I'll remove it, it doesn't make sense

@rumpl rumpl force-pushed the partial-tool-call branch from ad83fb8 to 1593e05 Compare March 18, 2026 21:29
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@rumpl rumpl force-pushed the partial-tool-call branch from 1593e05 to cd4b350 Compare March 18, 2026 21:34
@dgageot dgageot merged commit b05f598 into docker:main Mar 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants