@@ -112,8 +112,7 @@ describeControlUiE2e("Control UI chat composer redesign", () => {
112112
113113 try {
114114 await page . goto ( `${ server . baseUrl } chat` ) ;
115- await gateway . waitForRequest ( "chat.metadata" ) ;
116- expect ( await gateway . getRequests ( "models.list" ) ) . toHaveLength ( 0 ) ;
115+ await gateway . waitForRequest ( "chat.startup" ) ;
117116
118117 const composer = page . locator ( ".agent-chat__input" ) ;
119118 const composerShell = page . locator ( ".agent-chat__composer-shell" ) ;
@@ -133,6 +132,8 @@ describeControlUiE2e("Control UI chat composer redesign", () => {
133132 const voice = page . getByRole ( "button" , { name : "Start voice input" } ) ;
134133
135134 await expect . poll ( ( ) => model . isVisible ( ) ) . toBe ( true ) ;
135+ expect ( await gateway . getRequests ( "chat.metadata" ) ) . toHaveLength ( 0 ) ;
136+ expect ( await gateway . getRequests ( "models.list" ) ) . toHaveLength ( 0 ) ;
136137 await expect . poll ( ( ) => contextUsage . isVisible ( ) ) . toBe ( true ) ;
137138 await expect . poll ( ( ) => usage . isVisible ( ) ) . toBe ( false ) ;
138139 await expect . poll ( ( ) => settings . isVisible ( ) ) . toBe ( true ) ;
@@ -705,17 +706,10 @@ describeControlUiE2e("Control UI chat composer redesign", () => {
705706
706707 try {
707708 await page . goto ( controlUiSessionUrl ( server . baseUrl , "agent:work:main" ) ) ;
708- await expect
709- . poll (
710- async ( ) => {
711- const requests = await gateway . getRequests ( "chat.metadata" ) ;
712- return requests . some (
713- ( request ) => ( request . params as { agentId ?: string } | undefined ) ?. agentId === "work" ,
714- ) ;
715- } ,
716- { timeout : 10_000 } ,
717- )
718- . toBe ( true ) ;
709+ await gateway . waitForRequest ( "chat.startup" ) ;
710+ // The initial work-agent catalog is complete in chat.startup, so only the
711+ // later switch to the other agent should require chat.metadata.
712+ expect ( await gateway . getRequests ( "chat.metadata" ) ) . toHaveLength ( 0 ) ;
719713
720714 const composer = page . locator ( ".agent-chat__input" ) ;
721715 await expect
@@ -729,23 +723,28 @@ describeControlUiE2e("Control UI chat composer redesign", () => {
729723 await expect
730724 . poll ( async ( ) => {
731725 const requests = await gateway . getRequests ( "chat.metadata" ) ;
732- return requests . some (
726+ return requests . filter (
733727 ( request ) => ( request . params as { agentId ?: string } | undefined ) ?. agentId === "other" ,
734- ) ;
728+ ) . length ;
735729 } )
736- . toBe ( true ) ;
730+ . toBe ( 1 ) ;
737731 await expect
738732 . poll ( ( ) => composer . locator ( '[data-chat-model-option="anthropic/other-model"]' ) . count ( ) )
739733 . toBe ( 1 ) ;
740734 await expect
741735 . poll ( ( ) => composer . locator ( '[data-chat-model-option="openai/work-model"]' ) . count ( ) )
742736 . toBe ( 0 ) ;
737+ const metadataRequests = await gateway . getRequests ( "chat.metadata" ) ;
738+ expect ( metadataRequests ) . toHaveLength ( 1 ) ;
739+ expect ( ( metadataRequests [ 0 ] ?. params as { agentId ?: string } | undefined ) ?. agentId ) . toBe (
740+ "other" ,
741+ ) ;
743742 } finally {
744743 await context . close ( ) ;
745744 }
746745 } ) ;
747746
748- it ( "keeps startup models when the metadata refresh fails" , async ( ) => {
747+ it ( "keeps startup models when an explicit metadata refresh fails" , async ( ) => {
749748 const context = await browser . newContext ( { viewport : { width : 1280 , height : 900 } } ) ;
750749 const page = await context . newPage ( ) ;
751750 const gateway = await installMockGateway ( page , {
@@ -755,12 +754,23 @@ describeControlUiE2e("Control UI chat composer redesign", () => {
755754
756755 try {
757756 await page . goto ( `${ server . baseUrl } chat` ) ;
757+ await gateway . waitForRequest ( "chat.startup" ) ;
758+ const composer = page . locator ( ".agent-chat__input" ) ;
759+ await expect
760+ . poll ( ( ) => composer . locator ( '[data-chat-model-provider-group="openai"]' ) . textContent ( ) )
761+ . toContain ( "GPT-5.5" ) ;
762+ expect ( await gateway . getRequests ( "chat.metadata" ) ) . toHaveLength ( 0 ) ;
763+
764+ // Startup metadata now owns the initial catalog, so there is no unconditional
765+ // parallel refresh. Exercise the same-agent pane refresh path explicitly.
766+ await page . locator ( "openclaw-chat-pane" ) . evaluate ( ( pane ) => {
767+ ( pane as HTMLElement & { sessionKey : string } ) . sessionKey = "agent:main:refreshed" ;
768+ } ) ;
758769 await gateway . waitForRequest ( "chat.metadata" ) ;
759770 await gateway . rejectDeferred ( "chat.metadata" , {
760771 code : "UNAVAILABLE" ,
761772 message : "metadata unavailable" ,
762773 } ) ;
763- const composer = page . locator ( ".agent-chat__input" ) ;
764774 await expect
765775 . poll ( ( ) => composer . locator ( '[data-chat-model-provider-group="openai"]' ) . textContent ( ) )
766776 . toContain ( "GPT-5.5" ) ;
0 commit comments