@@ -2270,7 +2270,9 @@ describeControlUiE2e("Control UI mocked Gateway E2E", () => {
22702270 await page . goto ( `${ server . baseUrl } chat` ) ;
22712271 await gateway . waitForRequest ( "chat.startup" ) ;
22722272 expect ( await gateway . getRequests ( "agents.list" ) ) . toHaveLength ( 0 ) ;
2273- expect ( await gateway . getRequests ( "chat.metadata" ) ) . toHaveLength ( 1 ) ;
2273+ // chat.startup owns the initial metadata load; the old parallel
2274+ // chat.metadata request was only a synchronization point for this test.
2275+ expect ( await gateway . getRequests ( "chat.metadata" ) ) . toHaveLength ( 0 ) ;
22742276 expect ( await gateway . getRequests ( "commands.list" ) ) . toHaveLength ( 0 ) ;
22752277 expect ( await gateway . getRequests ( "models.list" ) ) . toHaveLength ( 0 ) ;
22762278
@@ -2316,24 +2318,45 @@ describeControlUiE2e("Control UI mocked Gateway E2E", () => {
23162318 } ,
23172319 messages : [ ] ,
23182320 metadata : {
2319- models : [ ] ,
2321+ commands : [
2322+ {
2323+ acceptsArgs : false ,
2324+ description : "Loaded after startup completes" ,
2325+ name : "startup-ready" ,
2326+ scope : "text" ,
2327+ source : "native" ,
2328+ } ,
2329+ ] ,
2330+ models : [
2331+ {
2332+ available : true ,
2333+ id : "startup-model" ,
2334+ name : "Startup Model" ,
2335+ provider : "openai" ,
2336+ } ,
2337+ ] ,
23202338 } ,
23212339 sessionId : "control-ui-e2e-session" ,
23222340 thinkingLevel : null ,
23232341 } ) ;
23242342 await page . locator ( ".chat-thread" ) . getByText ( prompt ) . waitFor ( { timeout : 10_000 } ) ;
23252343 await page . getByText ( "First token visible." ) . waitFor ( { timeout : 10_000 } ) ;
2326- await gateway . waitForRequest ( "chat.metadata" ) ;
2327- expect ( await gateway . getRequests ( "chat.metadata" ) ) . toHaveLength ( 1 ) ;
2328- expect ( await gateway . getRequests ( "models.list" ) ) . toHaveLength ( 0 ) ;
2329- expect ( await gateway . getRequests ( "commands.list" ) ) . toHaveLength ( 0 ) ;
2344+ await expect
2345+ . poll ( ( ) => page . locator ( '[data-chat-model-option="openai/startup-model"]' ) . count ( ) )
2346+ . toBe ( 1 ) ;
23302347 await gateway . emitChatFinal ( { runId, text : "History race stayed visible." } ) ;
23312348 await page
23322349 . locator ( ".chat-thread-inner" )
23332350 . getByText ( "History race stayed visible." )
23342351 . waitFor ( { timeout : 10_000 } ) ;
23352352 await page . locator ( ".agent-chat__composer-combobox textarea" ) . fill ( "/" ) ;
2336- expect ( await gateway . getRequests ( "commands.list" ) ) . toHaveLength ( 0 ) ;
2353+ await page . getByRole ( "option" , { name : / \/ s t a r t u p - r e a d y / } ) . waitFor ( { timeout : 10_000 } ) ;
2354+ // Check after both controls render so no late fallback RPC supplied either catalog.
2355+ expect ( {
2356+ commands : ( await gateway . getRequests ( "commands.list" ) ) . length ,
2357+ metadata : ( await gateway . getRequests ( "chat.metadata" ) ) . length ,
2358+ models : ( await gateway . getRequests ( "models.list" ) ) . length ,
2359+ } ) . toEqual ( { commands : 0 , metadata : 0 , models : 0 } ) ;
23372360 expect ( await gateway . getRequests ( "agents.list" ) ) . toHaveLength ( 0 ) ;
23382361 } finally {
23392362 await closeBrowserContext ( context ) ;
0 commit comments