Repository navigation
Conversation
The OpenRouter Responses adapter checked only that a call had started before emitting TOOL_CALL_ARGS for a function_call_arguments.delta, so a delta that arrived after function_call_arguments.done or output_item.done reached consumers as TOOL_CALL_ARGS after TOOL_CALL_END. Drop and log it, as openai-base's Responses adapter does since TanStack#2264. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: a109a76 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. |
🎯 Changes
The follow-up I mentioned in #2264: the OpenRouter Responses adapter has the same gap. Its
response.function_call_arguments.deltahandler only checkedmetadata.started, so a delta for a call already closed byfunction_call_arguments.doneor theoutput_item.donebackstop was emitted asTOOL_CALL_ARGSafterTOOL_CALL_END. Core ignores such events since #2274, but clients still receive them.The handler now drops a delta for an ended call and logs it through
logger.errors, with the same wording asopenai-base's Responses adapter.drops an arguments delta that arrives after the call endedinopenrouter-responses-adapter.test.tschecks the call's events are exactlySTART,ARGS,ENDand thatENDkeeps{ location: 'Berlin' }. It fails onmain;@tanstack/ai-openrouter: 425 passed.openrouter-responses-late-args-delta-wirestreams aget_weathercall throughcreateOpenRouterResponsesText(anHTTPClientfetcher), then one more}delta afterfunction_call_arguments.doneor afteroutput_item.done. It records the call's events fromchat(). Onmainboth cases endSTART, ARGS, END, ARGS; with this changeSTART, ARGS, END, and the tool runs once with{ city: 'Paris' }.Verified locally: the package's vitest run,
oxfmt --check,oxlint(no new findings), and the new route against the e2e dev server with and without the change. I did not run the fullpnpm run test:pr.The fix and tests were written with AI assistance (Claude); 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