fix: harden kimi structured output and replay#21943
Closed
themauveavenger wants to merge 3 commits intoanomalyco:devfrom
Closed
fix: harden kimi structured output and replay#21943themauveavenger wants to merge 3 commits intoanomalyco:devfrom
themauveavenger wants to merge 3 commits intoanomalyco:devfrom
Conversation
bc08904 to
874446c
Compare
|
why is this closed? |
Author
I modified the copilot sdk when it wasn't necessary. The kimi issue of not sending "auto" might still be a problem. But I'm testing that more myself before I try again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #15197
Closes #15226
Type of change
What does this PR do?
This fixes two Kimi-specific protocol mismatches in opencode's current
devbranch.First, it preserves
reasoning_content/reasoning_detailswhen prior assistant turns are replayed through the OpenAI-compatible chat path. That addresses the replay failure reported in #15197 and also helps with the broader replay-stripping problem discussed in #19081.Second, it stops forcing
tool_choice: "required"for Kimi structured-output requests. Kimi thinking mode rejects that combination, so structured output now usesautofor Kimi-family models instead. That addresses #15226.The fix is intentionally narrow:
ProviderTransformmodel.familyRelated upstream work:
In practice, this should make Kimi sessions more stable in two places that currently fail immediately: multi-turn replay after tool use, and JSON-schema/structured-output requests.
How did you verify your code works?
I tested the touched paths locally with:
bun test test/provider/copilot/convert-to-copilot-messages.test.tsbun test test/session/prompt.test.tsbun test test/provider/transform.test.tsbun test test/session/structured-output.test.tsI also ran diagnostics on the changed files before committing.
Screenshots / recordings
N/A — no UI changes.
Checklist