@@ -6,7 +6,12 @@ import type { KeyEvent } from "@opentui/core";
66import type { CostSummary } from "../cost/cost-summary.js" ;
77import type { SubAgentSession } from "../subagent/session-store.js" ;
88import { createHarness } from "./harness.js" ;
9- import { acceptOverlaySelection , closeInsetOverlay , runOverlayAction } from "./shell.js" ;
9+ import {
10+ acceptOverlaySelection ,
11+ closeInsetOverlay ,
12+ moveOverlaySelection ,
13+ runOverlayAction ,
14+ } from "./shell.js" ;
1015import {
1116 mountRunnerHost ,
1217 observeSessionFromSubAgents ,
@@ -443,6 +448,55 @@ describe("bottom border cost run", () => {
443448 }
444449 } ) ;
445450
451+ test ( "selecting a Codex model hides prompt $ without waiting for inference" , async ( ) => {
452+ const harness = await createHarness ( { width : 80 , height : 24 } ) ;
453+ let provider = "xai" ;
454+ const host = await mountRunnerHost ( {
455+ title : "test" ,
456+ eventEmitter : new EventEmitter ( ) ,
457+ send : ( ) => { } ,
458+ interrupt : ( ) => { } ,
459+ providers : {
460+ xai : { models : [ "grok-4" ] } ,
461+ "codex/abk-labs" : { models : [ "gpt-5.5" ] } ,
462+ } ,
463+ onModelSelect : ( id ) => {
464+ const sep = id . indexOf ( ":" ) ;
465+ if ( sep <= 0 ) return ;
466+ provider = id . slice ( 0 , sep ) ;
467+ } ,
468+ commands : [ ] ,
469+ onCommand : ( ) => { } ,
470+ chrome : ( ) => ( { agents : [ ] } ) ,
471+ subscribeChrome : ( ) => ( ) => { } ,
472+ subAgentSessions : ( ) => [ ] ,
473+ createRenderer : async ( ) => harness . renderer ,
474+ readCostSummary : ( ) => ( {
475+ ...fakeCostSummary ( ) ,
476+ costHiddenReason : provider . startsWith ( "codex/" ) ? "chatgpt-subscription" : null ,
477+ } ) ,
478+ showPromptCost : ( ) => true ,
479+ } ) ;
480+ try {
481+ expect ( ruleOf ( host . shell . promptBottomRule ) ) . toContain ( "$0.42" ) ;
482+
483+ expect ( host . openSurface ( "models" ) ) . toBe ( true ) ;
484+ const items = host . shell . overlayItems ;
485+ const codexIndex = items . findIndex ( ( label ) => label . includes ( "codex/abk-labs" ) ) ;
486+ expect ( codexIndex ) . toBeGreaterThanOrEqual ( 0 ) ;
487+ moveOverlaySelection ( host . shell , codexIndex ) ;
488+ acceptOverlaySelection ( host . shell ) ;
489+
490+ expect ( provider ) . toBe ( "codex/abk-labs" ) ;
491+ expect ( ruleOf ( host . shell . promptBottomRule ) ) . not . toContain ( "$0.42" ) ;
492+ expect ( host . shell . costContext ?. costLabel ?? null ) . toBeNull ( ) ;
493+ expect ( ruleOf ( host . shell . promptBottomRule ) ) . toContain ( "10%" ) ;
494+ } finally {
495+ host . dispose ( ) ;
496+ harness . destroy ( ) ;
497+ }
498+ } ) ;
499+
446500 test ( "session.clear paints the context meter unknown immediately" , async ( ) => {
447501 const harness = await createHarness ( { width : 80 , height : 24 } ) ;
448502 const emitter = new EventEmitter ( ) ;
0 commit comments