Repository navigation
Conversation
A Mistral stream that sent an arguments delta for a tool call after its finish_reason had closed it reached consumers as TOOL_CALL_ARGS after TOOL_CALL_END. Drop such deltas and log them, as openai-base's Responses adapter does since TanStack#2264. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 97dd734 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:
|
🎯 Changes
The Mistral adapter emitted
TOOL_CALL_ARGSfor a tool call it had already closed. When a chunk withfinish_reason: "tool_calls"ends a call (TOOL_CALL_END,ended = true) and a later chunk carries an arguments delta for the sameindex, theargsDelta !== undefined && toolCall.startedbranch never checkedended. Core ignores such events since #2274, but they still reach clients asTOOL_CALL_ARGSafterTOOL_CALL_END.The adapter now drops an arguments delta for a call that has ended and logs it through
logger.errors, the same as the openai-base Responses adapter since #2264.mistral-adapter.test.tscloses a call withfinish_reason: "tool_calls", then sends a late}delta, and checks the call's events are exactlySTART,ARGS,END, thatENDkeeps{"city":"Paris"}, and that the error is logged. It fails onmain(an extraTOOL_CALL_ARGS);@tanstack/ai-mistral: 146 passed.late-tool-args-wiregets amistralcase that drivescreateMistralTextthroughwrapFetchwith the same stream, next to the existingfakecase. Thefakecase still sees the late delta on the client; themistralcase must not, and the tool part endscompletewith the original input.docs/adapters/mistral.md.Verified locally: the package's vitest run and typecheck,
oxfmt --check,oxlint, and both Playwright cases of the spec. I did not run the fullpnpm run test:pr.The fix and tests were written with AI assistance (Codex, 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