@@ -459,7 +459,7 @@ test("context closes the side region only when its button opened it", async ({ p
459459 await expect ( panel . locator ( "#session-side-panel-review-tab" ) ) . toHaveAttribute ( "aria-selected" , "true" )
460460} )
461461
462- test ( "context hides free-model cost but keeps paid-model zero cost" , async ( { page } ) => {
462+ test ( "context hides zero cost for Go and free models but keeps paid-model cost" , async ( { page } ) => {
463463 const cases = [
464464 { id : "ses_context_free" , title : "Free model" , model : "free" , cost : 0 , usage : false , text : "0" } ,
465465 { id : "ses_context_paid" , title : "Paid model" , model : "paid" , cost : 0 , usage : false , text : "0·$0.00" } ,
@@ -468,24 +468,48 @@ test("context hides free-model cost but keeps paid-model zero cost", async ({ pa
468468 { id : "ses_context_mixed" , title : "Previously paid" , model : "free" , cost : 1.25 , usage : true , text : "2k·$1.25" } ,
469469 { id : "ses_context_unknown" , title : "Unknown pricing" , model : "missing" , cost : 0 , usage : false , text : "0·$0.00" } ,
470470 { id : "ses_context_output" , title : "Output pricing" , model : "output" , cost : 0 , usage : false , text : "0·$0.00" } ,
471+ {
472+ id : "ses_context_go" ,
473+ title : "Covered by Go" ,
474+ providerID : "opencode-go" ,
475+ model : "paid" ,
476+ cost : 0 ,
477+ usage : true ,
478+ text : "2k" ,
479+ } ,
480+ {
481+ id : "ses_context_go_spend" ,
482+ title : "Go with charges" ,
483+ providerID : "opencode-go" ,
484+ model : "paid" ,
485+ cost : 0.38 ,
486+ usage : true ,
487+ text : "2k·$0.38" ,
488+ } ,
471489 // The root's model is free, but its subagent spent on a paid model: the family total shows.
472490 { id : "ses_context_family" , title : "Paid subagent" , model : "free" , cost : 0 , usage : true , text : "2k·$1.25" } ,
473491 // A completed compaction resets the context until the next reply reports usage, as in the TUI.
474492 { id : "ses_context_compacted" , title : "Compacted" , model : "paid" , cost : 1.25 , usage : true , text : "0·$1.25" } ,
475493 ]
476494
495+ const catalog = provider (
496+ { id : "free" , name : "Free" , cost : { input : 0 , output : 0 } } ,
497+ { id : "paid" , name : "Paid" , cost : { input : 1 , output : 3 } } ,
498+ { id : "output" , name : "Output" , cost : { input : 0 , output : 1 } } ,
499+ )
500+
477501 await openSession ( page , {
478502 name : "ContextPricing" ,
479- provider : provider (
480- { id : "free" , name : "Free" , cost : { input : 0 , output : 0 } } ,
481- { id : "paid " , name : "Paid" , cost : { input : 1 , output : 3 } } ,
482- { id : "output" , name : "Output" , cost : { input : 0 , output : 1 } } ,
483- ) ,
503+ provider : {
504+ ... catalog ,
505+ all : [ ... catalog . all , { ... catalog . all [ 0 ] , id : "opencode-go " , name : "OpenCode Go" } ] ,
506+ connected : [ ... catalog . connected , "opencode-go" ] ,
507+ } ,
484508 sessions : [
485509 ...cases . map ( ( item ) => ( {
486510 id : item . id ,
487511 title : item . title ,
488- model : { id : item . model , providerID : "opencode" } ,
512+ model : { id : item . model , providerID : item . providerID ?? "opencode" } ,
489513 cost : item . cost ,
490514 } ) ) ,
491515 {
@@ -504,7 +528,7 @@ test("context hides free-model cost but keeps paid-model zero cost", async ({ pa
504528 id : `msg_${ item . id } ` ,
505529 type : "assistant" ,
506530 agent : "build" ,
507- model : { id : item . model , providerID : "opencode" } ,
531+ model : { id : item . model , providerID : item . providerID ?? "opencode" } ,
508532 tokens : { input : 1500 , output : 500 , reasoning : 0 , cache : { read : 0 , write : 0 } } ,
509533 content : [ { type : "text" , text : "Done." } ] ,
510534 time : { created : 1 , completed : 2 } ,
@@ -533,6 +557,15 @@ test("context hides free-model cost but keeps paid-model zero cost", async ({ pa
533557 await page . locator ( "[data-titlebar-tab-slot]" , { hasText : item . title } ) . click ( )
534558 await expectSessionTitle ( page , item . title )
535559 await expect ( button ) . toHaveText ( item . text )
560+
561+ if ( item . providerID === "opencode-go" ) {
562+ await button . click ( )
563+ const panel = page . locator ( '[data-slot="session-usage-content"]' )
564+
565+ await expect ( panel . getByText ( "OpenCode Go" , { exact : true } ) ) . toBeVisible ( )
566+ await expect ( panel . getByText ( "Total Cost" , { exact : true } ) ) . toBeVisible ( { visible : item . cost > 0 } )
567+ await button . click ( )
568+ }
536569 }
537570} )
538571
0 commit comments