fix(coding-agent): preserve custom fallback thinking

closes #5552
This commit is contained in:
Armin Ronacher
2026-06-12 17:26:42 +02:00
parent be7d5cf585
commit 1fc80f4f6c
3 changed files with 10 additions and 2 deletions

View File

@@ -6,6 +6,10 @@
- Added an experimental first-time setup flow behind `PI_EXPERIMENTAL=1` that asks for a dark/light theme choice (preselecting the detected appearance) and opt-in analytics data sharing on first launch with the default agent directory; opting in stores a `trackingId` in `settings.json`.
### Fixed
- Fixed custom fallback model IDs with `:<thinking>` suffixes to preserve the requested thinking level when the provider template model does not advertise reasoning ([#5552](https://github.com/earendil-works/pi/issues/5552)).
## [0.79.1] - 2026-06-09
### New Features

View File

@@ -340,7 +340,7 @@ export interface ResolveCliModelResult {
export function resolveCliModel(options: {
cliProvider?: string;
cliModel?: string;
cliThinking?: string;
cliThinking?: ThinkingLevel;
modelRegistry: ModelRegistry;
}): ResolveCliModelResult {
const { cliProvider, cliModel, cliThinking, modelRegistry } = options;
@@ -470,10 +470,13 @@ export function resolveCliModel(options: {
const fallbackModel = buildFallbackModel(provider, fallbackPattern, availableModels);
if (fallbackModel) {
const requestedThinking = cliThinking ?? fallbackThinking;
const model =
requestedThinking && requestedThinking !== "off" ? { ...fallbackModel, reasoning: true } : fallbackModel;
const fallbackWarning = warning
? `${warning} Model "${fallbackPattern}" not found for provider "${provider}". Using custom model id.`
: `Model "${fallbackPattern}" not found for provider "${provider}". Using custom model id.`;
return { model: fallbackModel, thinkingLevel: fallbackThinking, warning: fallbackWarning, error: undefined };
return { model, thinkingLevel: fallbackThinking, warning: fallbackWarning, error: undefined };
}
}

View File

@@ -403,6 +403,7 @@ describe("resolveCliModel", () => {
expect(result.model?.provider).toBe("neuralwatt");
// The :high suffix must NOT leak into the model id sent to the API
expect(result.model?.id).toBe("zai-org/GLM-5.1-FP8");
expect(result.model?.reasoning).toBe(true);
expect(result.thinkingLevel).toBe("high");
});