Skip to content

fix(adk): preserve empty tool call arguments - #3013

Closed
Ryounsk wants to merge 1 commit into
kagent-dev:mainfrom
Ryounsk:fix/2851-empty-tool-call-args
Closed

Ryounsk wants to merge 1 commit into
kagent-dev:mainfrom
Ryounsk:fix/2851-empty-tool-call-args

Conversation

@Ryounsk

@Ryounsk Ryounsk commented Sep 30, 2026

Copy link
Copy Markdown

Fixes #2851.

Problem

An empty FunctionCall.Args map is omitted when ADK history is persisted and returns as nil after reload. OpenAI-shaped request converters marshalled that nil map as the string "null", which providers that require a JSON object reject on the next turn.

Fix

  • Normalize nil function-call arguments to an empty map at the model-provider boundary.
  • Apply the same rule to OpenAI Chat Completions, OpenAI Responses, SAP AI Core, and the existing Bedrock path.
  • Add regression coverage for each previously affected OpenAI-shaped converter. Non-empty arguments are unchanged.

Validation

  • go test ./adk/pkg/models -count=1
  • go test ./adk/... -count=1
  • go vet ./adk/pkg/models
  • make lint (0 issues)
  • git diff --check

@github-actions github-actions Bot added the bug Something isn't working label Sep 30, 2026
@Ryounsk

Ryounsk commented Sep 30, 2026

Copy link
Copy Markdown
Author

@EItanya This is ready for review. GitHub is holding the full CI workflow for first-time-contributor approval; local ADK tests, vet, and repository Go lint are listed in the PR description.

@alexdarbyshire

Copy link
Copy Markdown
Contributor

Thanks - there is an existing PR #2852 (maintainer approved) for Issue #2851

Existing PR #2852 hasn't been merged.

PRs #2852 and #3013 are functionally the same.

@EItanya

EItanya commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks - there is an existing PR #2852 (maintainer approved) for Issue #2851

Existing PR #2852 hasn't been merged.

PRs #2852 and #3013 are functionally the same.

Sorry about that. Tests on main changed, if you could rebase we can get your PR in

@alexdarbyshire

Copy link
Copy Markdown
Contributor

No worries. #2852 rebased

@EItanya

EItanya commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

🤖 AI-generated review.

Thanks for working on this, and sorry for the duplicate effort! #2852 has now merged and normalizes empty tool-call arguments through nonNilFunctionCallArgs in all four adapters: OpenAI Chat, Responses, SAP AI Core, and Bedrock. That covers the behavior in this PR, so closing as superseded by #2852.

@EItanya EItanya closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Zero-argument tool calls serialize as "null" after session reload in OpenAI-shaped adapters

3 participants