-
Notifications
You must be signed in to change notification settings - Fork 939
fix: resolve and synchronize thinking effort #1625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e01ac3b
fix: preserve provider thinking effort values
RealKai42 2c7ff32
fix: resolve Kimi thinking effort fallbacks
RealKai42 495d07d
Merge remote-tracking branch 'origin/main' into fix-reasoning-effort
RealKai42 ab12dc4
fix: use resolved Kimi effort in v2 requests
RealKai42 02bbcbb
fix: align Kimi effort resolution paths
RealKai42 58d5197
fix: synchronize forced Kimi effort state
RealKai42 5f4ad40
fix: synchronize forced Kimi effort in v2 state
RealKai42 6ce4b2c
fix: tolerate unresolved models in v2 status
RealKai42 6b092b8
Merge remote-tracking branch 'origin/main' into fix-reasoning-effort
RealKai42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Fix Thinking effort routing so non-Kimi providers preserve configured values for upstream validation, while Kimi models validate runtime selections, fall back safely during model resolution, and synchronize the effective effort back to clients. |
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,38 @@ | ||
| /** | ||
| * `profile` domain (L4) — `thinking` config-section env bindings. | ||
| * | ||
| * Declares the `KIMI_MODEL_THINKING_EFFORT` environment binding (gated on | ||
| * `KIMI_MODEL_NAME`). Applied to the effective `thinking` value by `config`. | ||
| * Declares the env-only `KIMI_MODEL_THINKING_EFFORT` force override. Applied | ||
| * to the effective `thinking` value by `config` and stripped before | ||
| * persistence. | ||
| */ | ||
|
|
||
| import { z } from 'zod'; | ||
|
|
||
| import { envBindings } from '#/app/config/config'; | ||
| import { type ConfigStripEnv, envBindings } from '#/app/config/config'; | ||
| import { registerConfigSection } from '#/app/config/configSectionContributions'; | ||
|
|
||
| export const THINKING_SECTION = 'thinking'; | ||
|
|
||
| export const ThinkingConfigSchema = z.object({ | ||
| enabled: z.boolean().optional(), | ||
| effort: z.string().optional(), | ||
| forcedEffort: z.string().optional(), | ||
| keep: z.string().optional(), | ||
| }); | ||
|
|
||
| export type ThinkingConfig = z.infer<typeof ThinkingConfigSchema>; | ||
|
|
||
| export const thinkingEnvBindings = envBindings(ThinkingConfigSchema, { | ||
| effort: 'KIMI_MODEL_THINKING_EFFORT', | ||
| forcedEffort: 'KIMI_MODEL_THINKING_EFFORT', | ||
| }); | ||
|
|
||
| export const stripThinkingEnv: ConfigStripEnv<ThinkingConfig> = (value) => { | ||
| const result = { ...value }; | ||
| delete result.forcedEffort; | ||
| return result; | ||
| }; | ||
|
|
||
| registerConfigSection(THINKING_SECTION, ThinkingConfigSchema, { | ||
| env: thinkingEnvBindings, | ||
| stripEnv: stripThinkingEnv, | ||
| }); |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In an active session with
KIMI_MODEL_THINKING_EFFORTset,session.getStatus()returns the provider-effective effort, including the env-only forced value. PassingeffectiveEffortintopersistModelSelectionmakes/modelsave that env override intoconfig.tomlwhen the user chooses to persist the selection, so a temporary shell override such asmaxbecomes the permanent default even if the user selected a different supported effort. Keep using the effective value for display/state, but persist the selected/base effort with Kimi fallback applied before env forcing.Useful? React with 👍 / 👎.