Skip to content

Answer undeliverable client tool results with an error result - #7

Merged
Him188 merged 1 commit into
mainfrom
fix/client-tool-result-delivery
Sep 5, 2026
Merged

Him188 merged 1 commit into
mainfrom
fix/client-tool-result-delivery

Conversation

@Him188

@Him188 Him188 commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

When a client tool handler returned a value that could not be sent (serialized above the ~64 KB data-channel limit, non-JSON-serializable, or a transport error on send), the SDK emitted tool_failed but the agent never received a client_tool.result, so it waited out its server-side tool timeout (30 s by default) before recovering.

  • Oversized (over MAX_CLIENT_TOOL_RESULT_BYTES, 60 000 bytes serialized) and non-serializable results are replaced by an error result that tells the agent why.
  • If sending a result throws, an error result is sent in its place; if that fails too, the failure is reported once and not retried.
  • MAX_CLIENT_TOOL_RESULT_BYTES is exported and documented in docs/client-tools.md.

Tests added; full suite passes. Patch changeset included.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

…esult

A result above the realtime message size limit, a non-serializable value,
or a transport error on send used to leave the agent waiting on its
server-side tool timeout. The dispatcher now sends a short error result
in its place and exposes the limit as MAX_CLIENT_TOOL_RESULT_BYTES.
@Him188
Him188 merged commit e258acc into main Sep 5, 2026
2 checks passed
@Him188
Him188 deleted the fix/client-tool-result-delivery branch September 5, 2026 09:06
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.

1 participant