Merge remote-tracking branch 'origin/farm/342ec142/fix-model-scope-banner'

This commit is contained in:
can1357
2026-06-12 13:46:41 +02:00
3 changed files with 29 additions and 6 deletions
@@ -1,8 +1,8 @@
import { describe, expect, it } from "bun:test";
import { buildModel } from "@oh-my-pi/pi-catalog/build";
import type { ScopedModel } from "@oh-my-pi/pi-coding-agent/config/model-resolver";
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
import { buildModelScopeNotification } from "@oh-my-pi/pi-coding-agent/main";
function scopedModel(id: string): ScopedModel {
return {
model: buildModel({
@@ -32,4 +32,22 @@ describe("buildModelScopeNotification", () => {
message: "Model scope: claude-sonnet-4-5 (Ctrl+P to cycle)",
});
});
it("includes thinking suffix only when explicitly scoped", () => {
const withExplicit = { ...scopedModel("claude-sonnet-4-5"), thinkingLevel: "high" as ThinkingLevel, explicitThinkingLevel: true };
expect(buildModelScopeNotification([withExplicit], false)).toEqual({
kind: "info",
message: "Model scope: claude-sonnet-4-5:high (Ctrl+P to cycle)",
});
});
it("hides the suffix when the level was filled from the global default", () => {
// `applyRootSessionOptions` fills `sessionOptions.scopedModels[*].thinkingLevel`
// with the global default for Ctrl+P cycling — the banner must not surface that
// default as if the user had scoped `:high`.
const withDefault = { ...scopedModel("claude-sonnet-4-5"), thinkingLevel: "high" as ThinkingLevel, explicitThinkingLevel: false };
expect(buildModelScopeNotification([withDefault], false)).toEqual({
kind: "info",
message: "Model scope: claude-sonnet-4-5 (Ctrl+P to cycle)",
});
});
});