Repository navigation
fix(openai-base): ignore arguments deltas after a tool call ended - #2264
Conversation
A response.function_call_arguments.delta that arrived after function_call_arguments.done or output_item.done was emitted as TOOL_CALL_ARGS after TOOL_CALL_END, so it was appended to the finalized arguments and the tool failed to parse them. Drop and log it instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 57589cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Thanks for the PR, @canblmz1! 🙌 @tombeckenham will take a look. Automated pre-review checks
Automated triage — a human review follows. |
|
View your CI Pipeline Execution ↗ for commit 57589cd
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-cartesia
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-cloudflare
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-computer-local
@tanstack/ai-computer-playwright
@tanstack/ai-computer-sandbox
@tanstack/ai-computer-use
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-effect
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-harness
@tanstack/ai-harness-cli
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-e2b
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-mcp-sandbox
@tanstack/ai-memory
@tanstack/ai-meshy
@tanstack/ai-mistral
@tanstack/ai-muse
@tanstack/ai-neon
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-ollaya
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-optimize
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-reactor
@tanstack/ai-remix
@tanstack/ai-sandbox
@tanstack/ai-sandbox-blaxel
@tanstack/ai-sandbox-boxd
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-e2b
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-railway
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-upstash-box
@tanstack/ai-sandbox-vercel
@tanstack/ai-skills
@tanstack/ai-solid
@tanstack/ai-svelte
@tanstack/ai-tripo
@tanstack/ai-typesafe
@tanstack/ai-uthana
@tanstack/ai-utils
@tanstack/ai-vercel-compat
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-worldlabs
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit: |
🎯 Changes
In the OpenAI Responses adapter (
@tanstack/openai-base), aresponse.function_call_arguments.deltathat arrives after the call has already ended, viaresponse.function_call_arguments.doneor theresponse.output_item.donebackstop, was still emitted asTOOL_CALL_ARGSafterTOOL_CALL_END. Core appends it to the finalized arguments, so{"city":"Paris"}plus a late}fails to parse and the tool never runs (Failed to parse tool arguments as JSON).The delta handler already guards
metadata.started(no ARGS before START). This adds the matchingmetadata.endedguard (no ARGS after END) and logs the dropped delta throughlogger.errors, like the existing orphan-delta branch. The.donehandler already skips onmetadata.ended, so the two now agree.mainand passes here.openai-late-args-delta-wirereplays the raw SSE throughcreateOpenaiChatand asserts that the server tool runs once with{ city: 'Paris' }. Onmain, both cases fail with the parse error above.Not in this PR:
@tanstack/ai-openrouter's Responses adapter has the same delta handler. I can send the same guard there separately if you'd like.Verified locally:
@tanstack/openai-basetest:lib(508 passed),test:typesandtest:oxlint(no new warnings);@tanstack/ai-e2etest:types; the new Playwright spec (2 passed; both fail without the fix);oxfmt --check. I did not run the fullpnpm run test:pr.The fix and tests were written with AI assistance (Claude, reviewed with Codex and Antigravity); I reviewed and verified them as above.
✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request. (Ran the affected package and E2E checks listed above, not the fulltest:pr.)docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
Summary by CodeRabbit