@@ -311,20 +311,24 @@ class OpenClawShell
311311 outboxScopeHost : StoredOutboxScopeHost ,
312312 ) : string {
313313 const sessionKey = this . activeSessionKey ;
314- const row = context . sessions . state . result ?. sessions . find (
315- ( session ) => session . key === sessionKey ,
316- ) ;
317314 // An agent's main chat is its identity, so use its roster label when available.
318315 const parsed = parseAgentSessionKey ( sessionKey ) ;
319316 const mainAgentId = isUiGlobalSessionKey ( sessionKey )
320317 ? resolveUiKnownSelectedGlobalAgentId ( outboxScopeHost )
321318 : parsed ?. rest === resolveUiConfiguredMainKey ( outboxScopeHost )
322319 ? normalizeAgentId ( parsed . agentId )
323320 : undefined ;
324- const agent = context . agents . state . agentsList ?. agents . find (
325- ( candidate ) => normalizeAgentId ( candidate . id ) === mainAgentId ,
326- ) ;
327- return agent ? normalizeAgentLabel ( agent ) : resolveSessionDisplayName ( sessionKey , row ) ;
321+ const agent = mainAgentId
322+ ? context . agents . state . agentsList ?. agents . find (
323+ ( candidate ) => normalizeAgentId ( candidate . id ) === mainAgentId ,
324+ )
325+ : undefined ;
326+ return agent
327+ ? normalizeAgentLabel ( agent )
328+ : resolveSessionDisplayName (
329+ sessionKey ,
330+ context . sessions . state . result ?. sessions . find ( ( session ) => session . key === sessionKey ) ,
331+ ) ;
328332 }
329333
330334 constructor ( ) {
@@ -638,17 +642,18 @@ class OpenClawShell
638642 return ;
639643 }
640644 const outboxScopeHost = this . storedOutboxScopeHost ( context ) ;
641- let primaryContext = titleForRoute ( routeId ) ;
645+ let primaryContext = routeId === "custodian" ? t ( "nav.askOpenClaw" ) : titleForRoute ( routeId ) ;
642646 if ( isSessionRouteId ( routeId ) && this . activeSessionKey ) {
643647 primaryContext = this . chatTitleContext ( context , outboxScopeHost ) || primaryContext ;
644- } else if ( routeId === "custodian" ) {
645- primaryContext = t ( "nav.askOpenClaw" ) ;
646648 }
649+ const offline = context . gateway . snapshot . phase !== "connected" ;
647650 let title = formatDocumentTitle ( {
648651 context : primaryContext ,
649652 attentionCount : context . overlays . snapshot . approvalQueue . length ,
650- offline : context . gateway . snapshot . phase !== "connected" ,
651- queuedCount : this . outboxStoreRuntime ?. summarizeStoredChatOutboxes ( outboxScopeHost ) . total ?? 0 ,
653+ offline,
654+ ...( offline && {
655+ queuedCount : this . outboxStoreRuntime ?. summarizeStoredChatOutboxes ( outboxScopeHost ) . total ,
656+ } ) ,
652657 } ) ;
653658 const environment = context . config ?. current . environment ;
654659 if ( environment ) {
0 commit comments