@@ -101,14 +101,14 @@ describe("buildProviderStatusIndex", () => {
101101 expect ( status ?. name ) . toBe ( "Work" ) ;
102102 } ) ;
103103
104- it ( "records accounts that throw during read-only resolution as not configured " , async ( ) => {
104+ it ( "keeps unresolved configured SecretRef accounts visible without exposing their refs " , async ( ) => {
105105 const plugin = {
106106 id : "quietchat" ,
107107 meta : { label : "QuietChat" } ,
108108 config : {
109109 listAccountIds : ( ) => [ "default" ] ,
110110 resolveAccount : ( ) => {
111- throw new Error ( "unresolved SecretRef" ) ;
111+ throw new Error ( "unresolved SecretRef: PRIVATE_PROVIDER_TOKEN " ) ;
112112 } ,
113113 } ,
114114 status : { } ,
@@ -123,13 +123,161 @@ describe("buildProviderStatusIndex", () => {
123123 "quietchat:default" ,
124124 {
125125 provider : "quietchat" ,
126+ providerLabel : "QuietChat" ,
126127 accountId : "default" ,
127- state : "not configured" ,
128- configured : false ,
128+ state : "configured unavailable" ,
129+ configured : true ,
130+ visibleInConfiguredLists : true ,
129131 } ,
130132 ] ,
131133 ] ) ,
132134 ) ;
135+ const statuses = await buildProviderStatusIndex ( { } as OpenClawConfig ) ;
136+ expect (
137+ listProvidersForAgent ( {
138+ summaryIsDefault : true ,
139+ cfg : { } as OpenClawConfig ,
140+ bindings : [ ] ,
141+ providerStatus : statuses ,
142+ providerMetadata : buildProviderSummaryMetadataIndex ( { } as OpenClawConfig ) ,
143+ } ) ,
144+ ) . toEqual ( [ "QuietChat default: configured unavailable" ] ) ;
145+ expect ( JSON . stringify ( [ ...statuses . values ( ) ] ) ) . not . toContain ( "PRIVATE_PROVIDER_TOKEN" ) ;
146+ } ) ;
147+
148+ it ( "keeps configured-but-unavailable Telegram-style accounts in default agent output" , async ( ) => {
149+ const account = {
150+ accountId : "default" ,
151+ enabled : true ,
152+ configured : true ,
153+ tokenStatus : "configured_unavailable" as const ,
154+ } ;
155+ const plugin = {
156+ id : "telegram" ,
157+ meta : { label : "Telegram" } ,
158+ config : {
159+ listAccountIds : ( ) => [ "default" ] ,
160+ inspectAccount : ( ) => account ,
161+ resolveAccount : ( ) => account ,
162+ describeAccount : ( ) => ( {
163+ accountId : "default" ,
164+ enabled : true ,
165+ configured : true ,
166+ tokenStatus : "configured_unavailable" as const ,
167+ } ) ,
168+ isConfigured : ( ) => false ,
169+ } ,
170+ status : { } ,
171+ } as never ;
172+ const cfg = {
173+ channels : {
174+ telegram : {
175+ enabled : true ,
176+ tokenFile : "/nonexistent/token" ,
177+ } ,
178+ } ,
179+ } as OpenClawConfig ;
180+ mocks . listReadOnlyChannelPluginsForConfig . mockReturnValue ( [ plugin ] ) ;
181+
182+ const statuses = await buildProviderStatusIndex ( cfg ) ;
183+
184+ expect ( statuses . get ( "telegram:default" ) ) . toMatchObject ( {
185+ configured : true ,
186+ state : "configured unavailable" ,
187+ } ) ;
188+ expect (
189+ listProvidersForAgent ( {
190+ summaryIsDefault : true ,
191+ cfg,
192+ bindings : [ ] ,
193+ providerStatus : statuses ,
194+ providerMetadata : buildProviderSummaryMetadataIndex ( cfg ) ,
195+ } ) ,
196+ ) . toEqual ( [ "Telegram default: configured unavailable" ] ) ;
197+ } ) ;
198+
199+ it ( "does not mark a healthy Slack account unavailable for an optional unresolved user token" , async ( ) => {
200+ const account = {
201+ accountId : "default" ,
202+ enabled : true ,
203+ configured : true ,
204+ botTokenStatus : "available" as const ,
205+ appTokenStatus : "available" as const ,
206+ userTokenStatus : "configured_unavailable" as const ,
207+ } ;
208+ const plugin = {
209+ id : "slack" ,
210+ meta : { label : "Slack" } ,
211+ config : {
212+ listAccountIds : ( ) => [ "default" ] ,
213+ inspectAccount : ( ) => account ,
214+ resolveAccount : ( ) => account ,
215+ describeAccount : ( ) => ( { accountId : "default" , enabled : true , configured : true } ) ,
216+ isConfigured : ( ) => true ,
217+ } ,
218+ status : { } ,
219+ } as never ;
220+ mocks . listReadOnlyChannelPluginsForConfig . mockReturnValue ( [ plugin ] ) ;
221+
222+ expect (
223+ ( await buildProviderStatusIndex ( { } as OpenClawConfig ) ) . get ( "slack:default" ) ,
224+ ) . toMatchObject ( { configured : true , state : "configured" } ) ;
225+ } ) ;
226+
227+ it ( "does not treat an incomplete Slack account as configured when a required token is missing" , async ( ) => {
228+ const account = {
229+ accountId : "default" ,
230+ enabled : true ,
231+ configured : false ,
232+ botTokenStatus : "configured_unavailable" as const ,
233+ appTokenStatus : "missing" as const ,
234+ userTokenStatus : "missing" as const ,
235+ } ;
236+ const plugin = {
237+ id : "slack" ,
238+ meta : { label : "Slack" } ,
239+ config : {
240+ listAccountIds : ( ) => [ "default" ] ,
241+ inspectAccount : ( ) => account ,
242+ resolveAccount : ( ) => account ,
243+ describeAccount : ( ) => ( { accountId : "default" , enabled : true , configured : true } ) ,
244+ isConfigured : ( ) => false ,
245+ } ,
246+ status : { } ,
247+ } as never ;
248+ mocks . listReadOnlyChannelPluginsForConfig . mockReturnValue ( [ plugin ] ) ;
249+
250+ expect (
251+ ( await buildProviderStatusIndex ( { } as OpenClawConfig ) ) . get ( "slack:default" ) ,
252+ ) . toMatchObject ( { configured : false , state : "not configured" } ) ;
253+ } ) ;
254+
255+ it ( "keeps a fully configured Slack account visible when a required token is unavailable" , async ( ) => {
256+ const account = {
257+ accountId : "default" ,
258+ enabled : true ,
259+ configured : true ,
260+ botTokenStatus : "configured_unavailable" as const ,
261+ appTokenStatus : "available" as const ,
262+ userTokenStatus : "missing" as const ,
263+ } ;
264+ const plugin = {
265+ id : "slack" ,
266+ meta : { label : "Slack" } ,
267+ config : {
268+ listAccountIds : ( ) => [ "default" ] ,
269+ inspectAccount : ( ) => account ,
270+ resolveAccount : ( ) => account ,
271+ describeAccount : ( ) => ( { accountId : "default" , enabled : true , configured : false } ) ,
272+ isConfigured : ( ) => false ,
273+ } ,
274+ status : { } ,
275+ } as never ;
276+ mocks . listReadOnlyChannelPluginsForConfig . mockReturnValue ( [ plugin ] ) ;
277+
278+ expect (
279+ ( await buildProviderStatusIndex ( { } as OpenClawConfig ) ) . get ( "slack:default" ) ,
280+ ) . toMatchObject ( { configured : true , state : "configured unavailable" } ) ;
133281 } ) ;
134282
135283 it ( "does not inspect linkage for an unconfigured account" , async ( ) => {
0 commit comments