fix(adk): encode automatic transfer arguments as JSON - #1271
Open
ruirui6946 wants to merge 1 commit into
Open
Conversation
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.
What type of PR is this?
fix
Check the PR title.
Description
When an application collects supervisor runner events and sends those messages back in the next turn, the automatic transfer-back tool call contains a bare agent name (
MainAgent) inFunction.Arguments. Model adapters that decode arguments as a JSON object reject that history withinvalid character 'M' looking for beginning of value, as reported in #786.Encode generated transfer arguments as
{"agent_name":"MainAgent"}, matching the existing transfer tool schema. JSON marshaling also handles quotes, backslashes, control characters, and Unicode names. Update the existing history assertions to reflect the encoded arguments.The supervisor regression test collects the actual first-turn events, replays them in a second runner invocation, and uses a mock model that parses all historical tool arguments as JSON objects. Both this integration test and the new argument round-trip test fail before the fix and pass afterward; no external model credentials are required.
Related prior work: #741 proposed the same argument-format correction and was closed without merging. This PR ties the correction to the concrete two-turn failure in #786 and includes a regression for that path.
Validation
go test -race ./adk/...— all 16 packages passed.go test -race ./adk ./adk/prebuilt/...— passed.golangci-lint run --timeout 5m ./adk/...reports three gci formatting findings in unchanged files:adk/agent_tool.go,adk/call_option.go, andadk/callback.go.git diff --check— passed.Which issue(s) this PR fixes
Fixes #786