@@ -58,26 +58,35 @@ class SidebarAttention extends OpenClawLightDomContentsElement {
5858 autoRun : false ,
5959 // Gateway identity matters when a replacement source reuses the same client object.
6060 args : ( ) =>
61- [ null as ApplicationContext [ "gateway" ] | null , null as GatewayBrowserClient | null ] as const ,
62- task : async ( [ gateway , client ] , { signal } ) => {
61+ [
62+ null as ApplicationContext [ "gateway" ] | null ,
63+ null as GatewayBrowserClient | null ,
64+ true as boolean ,
65+ ] as const ,
66+ task : async ( [ gateway , client , refreshModelAuth ] , { signal } ) => {
6367 if ( ! gateway || ! client ) {
6468 return initialState ;
6569 }
6670 const cron = createInitialCronState ( { client, connected : true } ) ;
67- await Promise . allSettled ( [
71+ const loads : Promise < unknown > [ ] = [
6872 loadCronJobsPage ( cron ) . then ( ( ) => {
6973 if ( ! signal . aborted ) {
7074 this . cronJobs = cron . cronJobs ;
7175 }
7276 } ) ,
73- loadModelAuthStatus ( client , { signal } )
74- . catch ( ( ) => null )
75- . then ( ( modelAuthStatus ) => {
76- if ( ! signal . aborted ) {
77- this . modelAuthStatus = modelAuthStatus ;
78- }
79- } ) ,
80- ] ) ;
77+ ] ;
78+ if ( refreshModelAuth ) {
79+ loads . push (
80+ loadModelAuthStatus ( client , { signal } )
81+ . catch ( ( ) => null )
82+ . then ( ( modelAuthStatus ) => {
83+ if ( ! signal . aborted ) {
84+ this . modelAuthStatus = modelAuthStatus ;
85+ }
86+ } ) ,
87+ ) ;
88+ }
89+ await Promise . allSettled ( loads ) ;
8190 return true ;
8291 } ,
8392 onComplete : ( ) => {
@@ -94,6 +103,19 @@ class SidebarAttention extends OpenClawLightDomContentsElement {
94103 return gateway . subscribe ( ( ) => this . synchronize ( gateway ) ) ;
95104 } ,
96105 )
106+ . effect (
107+ ( ) => this . context ?. gateway ,
108+ ( gateway ) =>
109+ gateway . subscribeEvents ( ( event ) => {
110+ if ( this . context ?. gateway !== gateway || event . event !== "cron" ) {
111+ return ;
112+ }
113+ // The Automations page refreshes from the same event. Refresh this
114+ // independent snapshot too so its ambient alert cannot contradict it.
115+ this . loadedClient = null ;
116+ this . synchronize ( gateway , { refreshModelAuth : false } ) ;
117+ } ) ,
118+ )
97119 . watch (
98120 ( ) => this . context ?. overlays ,
99121 ( overlays , notify ) => overlays . subscribe ( ( ) => notify ( ) ) ,
@@ -136,21 +158,24 @@ class SidebarAttention extends OpenClawLightDomContentsElement {
136158 this . idleRefreshTimer = null ;
137159 }
138160 this . subscriptions . clear ( ) ;
139- void this . loadTask . run ( [ null , null ] ) ;
161+ void this . loadTask . run ( [ null , null , false ] ) ;
140162 this . loadedClient = null ;
141163 this . loadedGateway = null ;
142164 super . disconnectedCallback ( ) ;
143165 }
144166
145- private synchronize ( gateway : ApplicationContext [ "gateway" ] ) {
167+ private synchronize (
168+ gateway : ApplicationContext [ "gateway" ] ,
169+ options : { refreshModelAuth ?: boolean } = { } ,
170+ ) {
146171 const snapshot = gateway . snapshot ;
147172 const gatewayUrl = gateway . connection . gatewayUrl ;
148173 if ( gatewayUrl && gatewayUrl !== this . dismissedScope ) {
149174 this . dismissedScope = gatewayUrl ;
150175 this . dismissed = loadDismissals ( gatewayUrl ) ;
151176 }
152177 if ( snapshot . phase !== "connected" || ! snapshot . client ) {
153- void this . loadTask . run ( [ null , null ] ) ;
178+ void this . loadTask . run ( [ null , null , false ] ) ;
154179 this . loadedClient = null ;
155180 this . loadedGateway = null ;
156181 this . cronJobs = [ ] ;
@@ -162,7 +187,7 @@ class SidebarAttention extends OpenClawLightDomContentsElement {
162187 }
163188 this . loadedGateway = gateway ;
164189 this . loadedClient = snapshot . client ;
165- void this . loadTask . run ( [ gateway , snapshot . client ] ) ;
190+ void this . loadTask . run ( [ gateway , snapshot . client , options . refreshModelAuth !== false ] ) ;
166191 }
167192
168193 // Re-arm stale snoozes only right after this tab's own data refresh: fresh
0 commit comments