@@ -154,6 +154,52 @@ describe('switchboard resolveHarness — CLI precedence', () => {
154154 } ) ;
155155} ) ;
156156
157+ describe ( 'switchboard resolveHarness — pi flag is gated to posthog-integration' , ( ) => {
158+ it ( 'honours the pi flag for posthog-integration' , ( ) => {
159+ const pick = resolveHarness ( {
160+ program : 'posthog-integration' ,
161+ flags : { [ WIZARD_USE_PI_HARNESS_FLAG_KEY ] : 'true' } ,
162+ } ) ;
163+ expect ( pick ) . toEqual ( { harness : Harness . pi , model : GPT5_4_MODEL } ) ;
164+ } ) ;
165+
166+ it ( 'ignores the pi flag for self-driving — stays on the anthropic default' , ( ) => {
167+ const pick = resolveHarness ( {
168+ program : 'self-driving' ,
169+ flags : { [ WIZARD_USE_PI_HARNESS_FLAG_KEY ] : 'true' } ,
170+ } ) ;
171+ expect ( pick ) . toEqual ( {
172+ harness : Harness . anthropic ,
173+ model : DEFAULT_AGENT_MODEL ,
174+ } ) ;
175+ } ) ;
176+
177+ it ( 'ignores the pi flag for every non-posthog-integration program' , ( ) => {
178+ for ( const program of PROGRAM_IDS ) {
179+ if ( program === 'posthog-integration' ) continue ;
180+ expect (
181+ resolveHarness ( {
182+ program,
183+ flags : { [ WIZARD_USE_PI_HARNESS_FLAG_KEY ] : 'true' } ,
184+ } ) . harness ,
185+ ) . toBe ( Harness . anthropic ) ;
186+ }
187+ } ) ;
188+
189+ it ( 'leaves the sequence unclamped for a gated program (pi never selected)' , ( ) => {
190+ const ctx : SwitchboardCtx = {
191+ program : 'self-driving' ,
192+ flags : { [ WIZARD_USE_PI_HARNESS_FLAG_KEY ] : 'true' } ,
193+ } ;
194+ resolveBinding ( ctx ) ;
195+ expect ( ctx . trace ) . toEqual ( {
196+ harness : 'binding' ,
197+ model : 'binding' ,
198+ sequence : 'binding' ,
199+ } ) ;
200+ } ) ;
201+ } ) ;
202+
157203describe ( 'switchboard decision trace' , ( ) => {
158204 it ( 'stamps binding sources when nothing overrides' , ( ) => {
159205 const ctx : SwitchboardCtx = { program : 'posthog-integration' , flags : { } } ;
@@ -237,17 +283,38 @@ describe('switchboard modelCapabilities', () => {
237283} ) ;
238284
239285describe ( 'switchboard wizard-pi-effort flag' , ( ) => {
286+ const PI_ON = { [ WIZARD_USE_PI_HARNESS_FLAG_KEY ] : 'true' } ;
287+
240288 it ( 'overrides effort for reasoning models; ignores invalid; skips non-reasoning' , ( ) => {
241289 expect (
242- modelCapabilities ( GPT5_4_MODEL , { [ WIZARD_PI_EFFORT_FLAG_KEY ] : 'high' } )
243- . thinkingLevel ,
290+ modelCapabilities ( GPT5_4_MODEL , {
291+ ...PI_ON ,
292+ [ WIZARD_PI_EFFORT_FLAG_KEY ] : 'high' ,
293+ } ) . thinkingLevel ,
244294 ) . toBe ( 'high' ) ;
245295 expect (
246- modelCapabilities ( GPT5_4_MODEL , { [ WIZARD_PI_EFFORT_FLAG_KEY ] : 'banana' } )
247- . thinkingLevel ,
296+ modelCapabilities ( GPT5_4_MODEL , {
297+ ...PI_ON ,
298+ [ WIZARD_PI_EFFORT_FLAG_KEY ] : 'banana' ,
299+ } ) . thinkingLevel ,
248300 ) . toBe ( 'low' ) ;
249301 expect (
250302 modelCapabilities ( 'openai/gpt-4o' , {
303+ ...PI_ON ,
304+ [ WIZARD_PI_EFFORT_FLAG_KEY ] : 'high' ,
305+ } ) . thinkingLevel ,
306+ ) . toBeUndefined ( ) ;
307+ } ) ;
308+
309+ it ( 'is inert unless the pi-harness flag is on — effort cannot ride a non-pi pick' , ( ) => {
310+ // Effort set but the pi flag off: the override is ignored, so the model's
311+ // own table effort stands (gpt-5.4 → low) and anthropic keeps no effort.
312+ expect (
313+ modelCapabilities ( GPT5_4_MODEL , { [ WIZARD_PI_EFFORT_FLAG_KEY ] : 'high' } )
314+ . thinkingLevel ,
315+ ) . toBe ( 'low' ) ;
316+ expect (
317+ modelCapabilities ( DEFAULT_AGENT_MODEL , {
251318 [ WIZARD_PI_EFFORT_FLAG_KEY ] : 'high' ,
252319 } ) . thinkingLevel ,
253320 ) . toBeUndefined ( ) ;
0 commit comments