fix(provider): stub orphan MiniMax tool results#32609
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
2877df1 to
60b0b5e
Compare
|
I revised the PR to avoid the broad cache-breaking approach from the first version. New behavior is intentionally narrow:
This should preserve the normal cached transcript shape and only repair the invalid sequence that triggers MiniMax's strict |
60b0b5e to
8421e01
Compare
|
Revised again after reproducing the actual serialized provider request. The earlier orphan-result hypothesis was wrong. The failing request had matching I tested request-body variants directly against
So this version is much narrower: for MiniMax only, remove extra text parts from tool-result messages. It does not flatten history and does not drop valid tool call/result pairs. |
8421e01 to
17d55b8
Compare
|
Updated after narrowing the failure shape: the added regression test now starts with the minimal invalid MiniMax case, an orphan |
17d55b8 to
61effde
Compare
|
Updated again after direct MiniMax repro. Verified directly against
The PR now uses that approach: insert historical tool-call stubs for orphan/non-immediate results, keep valid immediate pairs, and split trailing text. |
61effde to
f17aed3
Compare
Issue for this PR
Closes #32608
Type of change
What does this PR do?
MiniMax rejects some existing sessions with:
I reproduced the minimal failing shapes directly against
opencode-go/minimax-m3:tool_resultwithout a preceding assistanttool_usefails withtool result's tool id ... not found (2013)tool call result does not follow tool call (2013)This PR sanitizes MiniMax-bound history by:
The transform is scoped to MiniMax model/provider IDs.
How did you verify your code works?
Direct provider repros:
200 OK400from MiniMax400from MiniMax200 OK200 OKLocal checks:
npx -y prettier@3.7.4 --check packages/opencode/src/provider/transform.ts packages/opencode/test/provider/transform.test.tstranspileModuleparse check for the two touched filescd packages/opencode && bun test test/provider/transform.test.ts -t 'MiniMax tool results'I pushed with
--no-verifybecause the repo pre-push hook currently fails in unrelated@opencode-ai/console-supportwith missing@solidjs/start/router.Screenshots / Recordings
Not applicable.
Checklist