Skip to content

fix(responses): recover from malformed function call arguments - #218

Open
gruffwy wants to merge 1 commit into
caigee-cmd:mainfrom
gruffwy:fix/responses-invalid-function-arguments
Open

gruffwy wants to merge 1 commit into
caigee-cmd:mainfrom
gruffwy:fix/responses-invalid-function-arguments

Conversation

@gruffwy

@gruffwy gruffwy commented Sep 20, 2026

Copy link
Copy Markdown

Problem

A malformed historical Responses function_call.arguments value currently rejects the entire follow-up request. Malformed ordinary tool-call arguments can also reach generated non-streaming or streaming Responses output.

A real failure used an argument string similar to:

{"path":"x","error_retry:: 240}

Behavior

  • Skip a malformed historical ordinary function call and its matching output so later conversation turns can continue.
  • Drop malformed ordinary tool calls from non-streaming Responses output.
  • Validate accumulated ordinary tool-call arguments before streaming terminal events are emitted.
  • Preserve custom-tool behavior, whose input is not governed by ordinary function-call JSON rules.
  • Normalize empty ordinary arguments to {}.

The implementation deliberately does not guess how to repair malformed JSON.

Tests

  • go test ./internal/translate ./internal/gateway
  • GOFLAGS=-buildvcs=false go test ./internal/app -run 'TestImportConstraints|TestDutyBoundaries' -count=1
  • git diff --check

The architecture test needed -buildvcs=false in this Windows worktree because Go VCS stamping could not inspect the linked worktree metadata.

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