@@ -120,74 +120,74 @@ describe("getThinkingPolicyForModel", () => {
120120 } ) ;
121121} ) ;
122122
123- // describe("enforceThinkingPolicy", () => {
124- // describe("single-option policy models (gpt-5-pro)", () => {
125- // test("enforces high for any requested level", () => {
126- // expect(enforceThinkingPolicy("openai:gpt-5-pro", "off")).toBe("high");
127- // expect(enforceThinkingPolicy("openai:gpt-5-pro", "low")).toBe("high");
128- // expect(enforceThinkingPolicy("openai:gpt-5-pro", "medium")).toBe("high");
129- // expect(enforceThinkingPolicy("openai:gpt-5-pro", "high")).toBe("high");
130- // });
131-
132- // test("enforces high for versioned gpt-5-pro", () => {
133- // expect(enforceThinkingPolicy("openai:gpt-5-pro-2025-10-06", "low")).toBe("high");
134- // });
135- // });
136-
137- // describe("multi-option policy models", () => {
138- // test("allows requested level if in allowed set", () => {
139- // expect(enforceThinkingPolicy("anthropic:claude-opus-4", "off")).toBe("off");
140- // expect(enforceThinkingPolicy("anthropic:claude-opus-4", "low")).toBe("low");
141- // expect(enforceThinkingPolicy("anthropic:claude-opus-4", "medium")).toBe("medium");
142- // expect(enforceThinkingPolicy("anthropic:claude-opus-4", "high")).toBe("high");
143- // });
144-
145- // test("falls back to medium when requested level not allowed", () => {
146- // // Simulating behavior with gpt-5-pro (only allows "high")
147- // // When requesting "low", falls back to first allowed level which is "high"
148- // expect(enforceThinkingPolicy("openai:gpt-5-pro", "low")).toBe("high");
149- // });
150- // });
151-
152- // describe("Opus 4.5 (all levels supported)", () => {
153- // test("allows all levels including off", () => {
154- // expect(enforceThinkingPolicy("anthropic:claude-opus-4-5", "off")).toBe("off");
155- // expect(enforceThinkingPolicy("anthropic:claude-opus-4-5", "low")).toBe("low");
156- // expect(enforceThinkingPolicy("anthropic:claude-opus-4-5", "medium")).toBe("medium");
157- // expect(enforceThinkingPolicy("anthropic:claude-opus-4-5", "high")).toBe("high");
158- // });
159-
160- // test("allows off for versioned model", () => {
161- // expect(enforceThinkingPolicy("anthropic:claude-opus-4-5-20251101", "off")).toBe("off");
162- // });
163- // });
164-
165- // describe("GPT-5.1-Codex-Max (5 levels including xhigh)", () => {
166- // test("allows all 5 levels including xhigh", () => {
167- // expect(enforceThinkingPolicy("openai:gpt-5.1-codex-max", "off")).toBe("off");
168- // expect(enforceThinkingPolicy("openai:gpt-5.1-codex-max", "low")).toBe("low");
169- // expect(enforceThinkingPolicy("openai:gpt-5.1-codex-max", "medium")).toBe("medium");
170- // expect(enforceThinkingPolicy("openai:gpt-5.1-codex-max", "high")).toBe("high");
171- // expect(enforceThinkingPolicy("openai:gpt-5.1-codex-max", "xhigh")).toBe("xhigh");
172- // });
173-
174- // test("allows xhigh for versioned model", () => {
175- // expect(enforceThinkingPolicy("openai:gpt-5.1-codex-max-2025-12-01", "xhigh")).toBe("xhigh");
176- // });
177- // });
178-
179- // describe("xhigh fallback for non-codex-max models", () => {
180- // test("falls back to medium when xhigh requested on standard model", () => {
181- // // Standard models don't support xhigh, so fall back to medium (preferred fallback)
182- // expect(enforceThinkingPolicy("anthropic:claude-opus-4-5", "xhigh")).toBe("medium");
183- // });
184-
185- // test("falls back to high when xhigh requested on gpt-5-pro", () => {
186- // // gpt-5-pro only supports high, so xhigh falls back to high
187- // expect(enforceThinkingPolicy("openai:gpt-5-pro", "xhigh")).toBe("high");
188- // });
189- // });
190- // });
123+ describe ( "enforceThinkingPolicy" , ( ) => {
124+ describe ( "single-option policy models (gpt-5-pro)" , ( ) => {
125+ test ( "enforces high for any requested level" , ( ) => {
126+ expect ( enforceThinkingPolicy ( "openai:gpt-5-pro" , "off" ) ) . toBe ( "high" ) ;
127+ expect ( enforceThinkingPolicy ( "openai:gpt-5-pro" , "low" ) ) . toBe ( "high" ) ;
128+ expect ( enforceThinkingPolicy ( "openai:gpt-5-pro" , "medium" ) ) . toBe ( "high" ) ;
129+ expect ( enforceThinkingPolicy ( "openai:gpt-5-pro" , "high" ) ) . toBe ( "high" ) ;
130+ } ) ;
131+
132+ test ( "enforces high for versioned gpt-5-pro" , ( ) => {
133+ expect ( enforceThinkingPolicy ( "openai:gpt-5-pro-2025-10-06" , "low" ) ) . toBe ( "high" ) ;
134+ } ) ;
135+ } ) ;
136+
137+ describe ( "multi-option policy models" , ( ) => {
138+ test ( "allows requested level if in allowed set" , ( ) => {
139+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4" , "off" ) ) . toBe ( "off" ) ;
140+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4" , "low" ) ) . toBe ( "low" ) ;
141+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4" , "medium" ) ) . toBe ( "medium" ) ;
142+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4" , "high" ) ) . toBe ( "high" ) ;
143+ } ) ;
144+
145+ test ( "falls back to medium when requested level not allowed" , ( ) => {
146+ // Simulating behavior with gpt-5-pro (only allows "high")
147+ // When requesting "low", falls back to first allowed level which is "high"
148+ expect ( enforceThinkingPolicy ( "openai:gpt-5-pro" , "low" ) ) . toBe ( "high" ) ;
149+ } ) ;
150+ } ) ;
151+
152+ describe ( "Opus 4.5 (all levels supported)" , ( ) => {
153+ test ( "allows all levels including off" , ( ) => {
154+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4-5" , "off" ) ) . toBe ( "off" ) ;
155+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4-5" , "low" ) ) . toBe ( "low" ) ;
156+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4-5" , "medium" ) ) . toBe ( "medium" ) ;
157+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4-5" , "high" ) ) . toBe ( "high" ) ;
158+ } ) ;
159+
160+ test ( "allows off for versioned model" , ( ) => {
161+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4-5-20251101" , "off" ) ) . toBe ( "off" ) ;
162+ } ) ;
163+ } ) ;
164+
165+ describe ( "GPT-5.1-Codex-Max (5 levels including xhigh)" , ( ) => {
166+ test ( "allows all 5 levels including xhigh" , ( ) => {
167+ expect ( enforceThinkingPolicy ( "openai:gpt-5.1-codex-max" , "off" ) ) . toBe ( "off" ) ;
168+ expect ( enforceThinkingPolicy ( "openai:gpt-5.1-codex-max" , "low" ) ) . toBe ( "low" ) ;
169+ expect ( enforceThinkingPolicy ( "openai:gpt-5.1-codex-max" , "medium" ) ) . toBe ( "medium" ) ;
170+ expect ( enforceThinkingPolicy ( "openai:gpt-5.1-codex-max" , "high" ) ) . toBe ( "high" ) ;
171+ expect ( enforceThinkingPolicy ( "openai:gpt-5.1-codex-max" , "xhigh" ) ) . toBe ( "xhigh" ) ;
172+ } ) ;
173+
174+ test ( "allows xhigh for versioned model" , ( ) => {
175+ expect ( enforceThinkingPolicy ( "openai:gpt-5.1-codex-max-2025-12-01" , "xhigh" ) ) . toBe ( "xhigh" ) ;
176+ } ) ;
177+ } ) ;
178+
179+ describe ( "xhigh fallback for non-codex-max models" , ( ) => {
180+ test ( "falls back to medium when xhigh requested on standard model" , ( ) => {
181+ // Standard models don't support xhigh, so fall back to medium (preferred fallback)
182+ expect ( enforceThinkingPolicy ( "anthropic:claude-opus-4-5" , "xhigh" ) ) . toBe ( "medium" ) ;
183+ } ) ;
184+
185+ test ( "falls back to high when xhigh requested on gpt-5-pro" , ( ) => {
186+ // gpt-5-pro only supports high, so xhigh falls back to high
187+ expect ( enforceThinkingPolicy ( "openai:gpt-5-pro" , "xhigh" ) ) . toBe ( "high" ) ;
188+ } ) ;
189+ } ) ;
190+ } ) ;
191191
192192// Note: Tests for invalid levels removed - TypeScript type system prevents invalid
193193// ThinkingLevel values at compile time, making runtime invalid-level tests unnecessary.
0 commit comments