Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(provider-share): 拒绝已就绪却缺少数据的响应

fmfsaisaice1d75dcce5d
diff --git a/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.ts b/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.ts
index 782c7a8d62..dff521d178 100644
--- a/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/providerShareInsights.test.ts
@@ -414,6 +414,10 @@ describe('provider share insights', () => {
const view = await read('peer', request);
expect(parseProviderShareInsights({ ...view, version: 2 })).toBeNull();
expect(parseProviderShareInsights({ version: 1, capabilities: view.capabilities })).toBeNull();
+ // #4317520064:ready+null 曾让已展开明细永久加载,原覆盖没有状态/数据矛盾。
+ for (const capability of ['quota', 'usage'] as const) {
+ expect(parseProviderShareInsights({ ...view, [capability]: null })).toBeNull();
+ }
const parsed = parseProviderShareInsights({
...view,
secret: 'no',
diff --git a/apps/desktop/src/shared/providerShareInsights.ts b/apps/desktop/src/shared/providerShareInsights.ts
index cf510f95df..fc0c568efb 100644
--- a/apps/desktop/src/shared/providerShareInsights.ts
+++ b/apps/desktop/src/shared/providerShareInsights.ts
@@ -151,6 +151,7 @@ export function parseProviderShareInsights(raw: unknown): ProviderShareInsights
value[key] = null;
value.status[key] = 'disabled';
} else if (value.status[key] !== 'ready') value[key] = null;
+ else if (value[key] === null) return null;
}
return value;
}