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-group): 按模型隔离限额冷却

Dash7832800fbe76
diff --git a/apps/desktop/src/main/provider-group/__tests__/coolingStore.test.ts b/apps/desktop/src/main/provider-group/__tests__/coolingStore.test.ts
index 910069c61d..9198be4bf5 100644
--- a/apps/desktop/src/main/provider-group/__tests__/coolingStore.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/coolingStore.test.ts
@@ -38,13 +38,23 @@ describe('冷却记录的成员边界', () => {
describe('mergeCooling', () => {
const { mergeCooling } = coolingStore.__testing;
+ it('merges independent model limits without widening them, and bounds legacy records during migration', () => {
+ expect(mergeCooling(
+ { anthropic: { local: { 'claude:fable': 500_000, 'claude:opus': 500 } } },
+ { anthropic: { local: { 'claude:sonnet': 400_000, 'claude:fable': 300_000 } } },
+ 1_000,
+ )).toEqual({ anthropic: { local: { 'claude:fable': 500_000, 'claude:sonnet': 400_000 } } });
+ expect(mergeCooling({ anthropic: { local: 86_400_000 } }, {}, 1_000))
+ .toEqual({ anthropic: { local: { '': 121_000 } } });
+ });
+
it('keeps both members when they are in different snapshots', () => {
expect(mergeCooling(
- { anthropic: { 'device:mini:a': 1_000 } },
- { anthropic: { 'device:studio:a': 2_000 } },
+ { anthropic: { 'device:mini:a': { '': 1_000 } } },
+ { anthropic: { 'device:studio:a': { '': 2_000 } } },
0,
)).toEqual({
- anthropic: { 'device:mini:a': 1_000, 'device:studio:a': 2_000 },
+ anthropic: { 'device:mini:a': { '': 1_000 }, 'device:studio:a': { '': 2_000 } },
});
});
@@ -52,35 +62,35 @@ describe('mergeCooling', () => {
// 旧快照里这一台冷却到 5000,调用方这次只带着更早算出的 3000(比如基于稍旧的内存状态):
// 不应该把已经落地的更晚结束时间往回改。
expect(mergeCooling(
- { anthropic: { 'device:mini:a': 5_000 } },
- { anthropic: { 'device:mini:a': 3_000 } },
+ { anthropic: { 'device:mini:a': { '': 5_000 } } },
+ { anthropic: { 'device:mini:a': { '': 3_000 } } },
0,
)).toEqual({
- anthropic: { 'device:mini:a': 5_000 },
+ anthropic: { 'device:mini:a': { '': 5_000 } },
});
expect(mergeCooling(
- { anthropic: { 'device:mini:a': 3_000 } },
- { anthropic: { 'device:mini:a': 5_000 } },
+ { anthropic: { 'device:mini:a': { '': 3_000 } } },
+ { anthropic: { 'device:mini:a': { '': 5_000 } } },
0,
)).toEqual({
- anthropic: { 'device:mini:a': 5_000 },
+ anthropic: { 'device:mini:a': { '': 5_000 } },
});
});
it('merges across providers too', () => {
expect(mergeCooling(
- { anthropic: { a: 1 } },
- { openai: { b: 2 } },
+ { anthropic: { a: { '': 1 } } },
+ { openai: { b: { '': 2 } } },
0,
- )).toEqual({ anthropic: { a: 1 }, openai: { b: 2 } });
+ )).toEqual({ anthropic: { a: { '': 1 } }, openai: { b: { '': 2 } } });
});
it('到期条目从两份快照移除,未到期的并发冷却保留较晚结束时间', () => {
expect(mergeCooling(
- { anthropic: { old: 99, boundary: 100, active: 200 }, openai: { old: 1 } },
- { anthropic: { stale: 50, active: 150, fresh: 300 } },
+ { anthropic: { old: 99, boundary: 100, active: { '': 200 } }, openai: { old: 1 } },
+ { anthropic: { stale: 50, active: 150, fresh: { '': 300 } } },
100,
- )).toEqual({ anthropic: { active: 200, fresh: 300 } });
+ )).toEqual({ anthropic: { active: { '': 200 }, fresh: { '': 300 } } });
});
});
@@ -88,7 +98,7 @@ describe('writeProviderGroupCooling (real file)', () => {
it('512 个最长合法键的冷却全部写入并在重启读取后保留,文件大小预算也足够', async () => {
const providerId = 'p'.repeat(128);
const members = Object.fromEntries(Array.from({ length: PROVIDER_GROUP_STORAGE_MEMBER_CAP }, (_, i) => [
- `device:${String(i).padStart(164, 'd')}:${providerId}`, Number.MAX_VALUE,
+ `device:${String(i).padStart(164, 'd')}:${providerId}`, { 'claude:fable': Number.MAX_VALUE },
]));
coolingStore.writeProviderGroupCooling({ [providerId]: members });
const file = path.join(tmpDir, 'provider-group-cooling.json');
@@ -97,6 +107,7 @@ describe('writeProviderGroupCooling (real file)', () => {
});
expect(fs.statSync(file).size).toBeLessThan(1024 * 1024);
// 新实例没有旧 store 的缓存,直接从实际文件恢复。
+ // reset-modules: verify persisted cooldowns survive a fresh store instance.
vi.resetModules();
const restarted = await import('../coolingStore.js');
expect(restarted.readProviderGroupCooling()[providerId]).toEqual(members);
@@ -108,10 +119,10 @@ describe('writeProviderGroupCooling (real file)', () => {
const now = Date.now();
const studioUntil = now + 120_000;
const miniUntil = now + 60_000;
- coolingStore.writeProviderGroupCooling({ anthropic: { 'device:studio:a': studioUntil } });
- coolingStore.writeProviderGroupCooling({ anthropic: { 'device:mini:a': miniUntil } });
+ coolingStore.writeProviderGroupCooling({ anthropic: { 'device:studio:a': { '': studioUntil } } });
+ coolingStore.writeProviderGroupCooling({ anthropic: { 'device:mini:a': { '': miniUntil } } });
await vi.waitFor(() => {
- expect(coolingStore.readProviderGroupCooling().anthropic).toEqual({ 'device:studio:a': studioUntil, 'device:mini:a': miniUntil });
+ expect(coolingStore.readProviderGroupCooling().anthropic).toEqual({ 'device:studio:a': { '': studioUntil }, 'device:mini:a': { '': miniUntil } });
});
});
@@ -122,11 +133,12 @@ describe('writeProviderGroupCooling (real file)', () => {
// 模拟旧版已经写满的文件;当前新版写入不能再把过期条目并回来。
const current = coolingStore.readProviderGroupCooling();
fs.writeFileSync(file, JSON.stringify({ cooling: { ...current, openai: expired } }));
- const next = { 'device:new:openai': now + 60_000 };
+ const next = { 'device:new:openai': { '': now + 60_000 } };
coolingStore.writeProviderGroupCooling({ openai: next });
await vi.waitFor(() => {
expect(JSON.parse(fs.readFileSync(file, 'utf8')).cooling.openai).toEqual(next);
});
+ // reset-modules: verify persisted cooldowns survive a fresh store instance.
vi.resetModules();
const restarted = await import('../coolingStore.js');
expect(restarted.readProviderGroupCooling().openai).toEqual(next);
diff --git a/apps/desktop/src/main/provider-group/__tests__/failoverSessionClose.test.ts b/apps/desktop/src/main/provider-group/__tests__/failoverSessionClose.test.ts
index 0328f53072..bc42c62582 100644
--- a/apps/desktop/src/main/provider-group/__tests__/failoverSessionClose.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/failoverSessionClose.test.ts
@@ -521,7 +521,7 @@ describe('provider group failover vs. the terminal-error drain close (#5880)', (
const h = setup();
await h.failOnB(B_LIMITED);
await h.releaseAndSettle();
- expect(h.router.coolingUntil('anthropic', MAC_B.key)).not.toBeNull();
+ expect(h.router.coolingUntil('anthropic', MAC_B.key, MODEL)).not.toBeNull();
expect(h.markTried).toHaveBeenCalledWith(SID, MAC_B.key);
expectSwitchedToLocalAndContinued(h);
});
diff --git a/apps/desktop/src/main/provider-group/__tests__/guestRelay.test.ts b/apps/desktop/src/main/provider-group/__tests__/guestRelay.test.ts
index 4f6c9f387b..295769d3be 100644
--- a/apps/desktop/src/main/provider-group/__tests__/guestRelay.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/guestRelay.test.ts
@@ -115,7 +115,7 @@ describe('provider group guest relay planner', () => {
env.relay.noteStartFailure('anthropic', mini, new Error('[REMOTE_AGENT_DEVICE_UNREACHABLE] gone'));
expect(env.router.markCooling).not.toHaveBeenCalled();
env.relay.noteStartFailure('anthropic', mini, new Error('401 unauthorized'));
- expect(env.router.markCooling).toHaveBeenCalledWith('anthropic', MINI.key, expect.any(Number));
+ expect(env.router.markCooling).toHaveBeenCalledWith('anthropic', MINI.key, expect.any(Number), undefined);
expect(env.router.markCooling.mock.calls[0][2]).toBeLessThan(1_000 + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS);
});
@@ -166,8 +166,8 @@ describe('provider group guest relay planner', () => {
// 换到哪台都一样的失败:不冷却,也不换。
expect(env.relay.noteRunFailure('anthropic', mini, { message: 'prompt is too long', sdkError: 'invalid_request' })).toBe(false);
expect(env.router.markCooling).not.toHaveBeenCalled();
- expect(env.relay.noteRunFailure('anthropic', mini, { usageLimit: true, message: 'usage limit' })).toBe(true);
- expect(env.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 1_000 + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS);
+ expect(env.relay.noteRunFailure('anthropic', mini, { usageLimit: true, message: 'usage limit' }, 'claude-fable-5')).toBe(true);
+ expect(env.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 1_000 + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS, 'claude-fable-5');
// 连不上:照常换一台,但不记进组的状态。
const cooled = env.router.markCooling.mock.calls.length;
expect(env.relay.noteRunFailure('anthropic', mini, { reason: 'remote_agent_closed' })).toBe(true);
@@ -201,18 +201,18 @@ describe('provider group guest relay planner', () => {
log: { warn: vi.fn() },
});
const mini = { memberKey: MINI.key, agentDeviceId: 'mini', providerId: MINI.providerId, sameAccount: true };
- relay.noteRunFailure('anthropic', mini, { usageLimit: true });
- expect(router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, resetAt);
+ relay.noteRunFailure('anthropic', mini, { usageLimit: true }, 'claude-fable-5');
+ expect(router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, resetAt, 'claude-fable-5');
resetAt = 1_000 + 30 * 24 * 60 * 60_000;
- relay.noteRunFailure('anthropic', mini, { usageLimit: true });
- expect(router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 1_000 + PROVIDER_GROUP_MAX_REMOTE_COOLDOWN_MS);
+ relay.noteRunFailure('anthropic', mini, { usageLimit: true }, 'claude-fable-5');
+ expect(router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 1_000 + PROVIDER_GROUP_MAX_REMOTE_COOLDOWN_MS, 'claude-fable-5');
});
it('still cools the computer but offers no switch when the group has automatic switching turned off', () => {
const env = setup([MINI], { ...CONFIG, autoSwitch: false });
const mini = { memberKey: MINI.key, agentDeviceId: 'mini', providerId: MINI.providerId, sameAccount: true };
- expect(env.relay.noteRunFailure('anthropic', mini, { usageLimit: true, message: 'usage limit' })).toBe(false);
- expect(env.router.markCooling).toHaveBeenCalledWith('anthropic', MINI.key, expect.any(Number));
+ expect(env.relay.noteRunFailure('anthropic', mini, { usageLimit: true, message: 'usage limit' }, 'claude-fable-5')).toBe(false);
+ expect(env.router.markCooling).toHaveBeenCalledWith('anthropic', MINI.key, expect.any(Number), 'claude-fable-5');
});
it('counts the picked computer in the same step it is picked, when asked to', async () => {
diff --git a/apps/desktop/src/main/provider-group/__tests__/remoteGroup.test.ts b/apps/desktop/src/main/provider-group/__tests__/remoteGroup.test.ts
index 05920480da..bb065062a1 100644
--- a/apps/desktop/src/main/provider-group/__tests__/remoteGroup.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/remoteGroup.test.ts
@@ -296,7 +296,7 @@ describe('switching computers within a group on another computer', () => {
const h = bound({ picks: [OWNER_LOCAL] });
h.service.onTurnError('s1', { sdkError: 'rate_limit' }, 3);
await flush();
- expect(h.remote.cool).toHaveBeenCalledWith(OWNER, { providerId: 'anthropic', memberKey: STUDIO.key, cause: 'usage-limit', resetAt: 5_000 });
+ expect(h.remote.cool).toHaveBeenCalledWith(OWNER, { providerId: 'anthropic', memberKey: STUDIO.key, cause: 'usage-limit', resetAt: 5_000, model: MODEL });
expect(h.remote.pick).toHaveBeenCalledWith(OWNER, expect.objectContaining({ exclude: expect.arrayContaining([STUDIO.key]) }));
expect(h.deps.switchAgentLocation).toHaveBeenCalledWith('s1', expect.objectContaining({ agentDeviceId: OWNER, providerId: 'anthropic' }), expect.anything());
expect(h.deps.continueSession).toHaveBeenCalledWith('s1', 7, expect.objectContaining({
@@ -503,7 +503,7 @@ describe('old tasks already running on the group computer', () => {
const h = harness({ row: { sdkSessionId: 'native-1' }, picks: [STUDIO] });
h.service.onTurnError('s1', { sdkError: 'rate_limit' }, 3);
await flush();
- expect(h.remote.cool).toHaveBeenCalledWith(OWNER, { providerId: 'anthropic', memberKey: OWNER_LOCAL.key, cause: 'usage-limit', resetAt: 5_000 });
+ expect(h.remote.cool).toHaveBeenCalledWith(OWNER, { providerId: 'anthropic', memberKey: OWNER_LOCAL.key, cause: 'usage-limit', resetAt: 5_000, model: MODEL });
expect(h.deps.switchAgentLocation).toHaveBeenCalledWith(
's1',
expect.objectContaining({ agentDeviceId: 'studio', providerId: STUDIO.providerId }),
diff --git a/apps/desktop/src/main/provider-group/__tests__/remoteHandler.test.ts b/apps/desktop/src/main/provider-group/__tests__/remoteHandler.test.ts
index 74b8268bea..67955080f4 100644
--- a/apps/desktop/src/main/provider-group/__tests__/remoteHandler.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/remoteHandler.test.ts
@@ -165,14 +165,40 @@ describe('provider-group:remote', () => {
it('cools computers for usage limits up to a bounded reset time, and briefly for other causes', async () => {
const d = deps();
- await handleProviderGroupRemote(d, 'laptop', { action: 'cool', providerId: 'anthropic', memberKey: MINI.key, cause: 'usage-limit', resetAt: 50_000 });
- expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 50_000);
- await handleProviderGroupRemote(d, 'laptop', { action: 'cool', providerId: 'anthropic', memberKey: MINI.key, cause: 'usage-limit', resetAt: 10_000 + 365 * 86_400_000 });
- expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 10_000 + PROVIDER_GROUP_MAX_REMOTE_COOLDOWN_MS);
+ const client = createProviderGroupRemoteClient(async (_device, _channel, args) => ({
+ ok: true, result: await handleProviderGroupRemote(d, 'laptop', args[0]),
+ }));
+ const input = { providerId: 'anthropic', memberKey: MINI.key, cause: 'usage-limit' as const, model: 'claude-fable-5' };
+ await client.cool('owner', { ...input, resetAt: 50_000 });
+ expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 50_000, input.model);
+ await client.cool('owner', { ...input, resetAt: 10_000 + 365 * 86_400_000 });
+ expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 10_000 + PROVIDER_GROUP_MAX_REMOTE_COOLDOWN_MS, input.model);
+ await client.cool('owner', input);
+ expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 10_000 + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS, input.model);
await handleProviderGroupRemote(d, 'laptop', { action: 'cool', providerId: 'anthropic', memberKey: MINI.key, cause: 'usage-limit' });
- expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 10_000 + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS);
+ expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 10_000 + PROVIDER_GROUP_FAILURE_COOLDOWN_MS, undefined);
await handleProviderGroupRemote(d, 'laptop', { action: 'cool', providerId: 'anthropic', memberKey: MINI.key, cause: 'auth' });
- expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 10_000 + PROVIDER_GROUP_FAILURE_COOLDOWN_MS);
+ expect(d.router.markCooling).toHaveBeenLastCalledWith('anthropic', MINI.key, 10_000 + PROVIDER_GROUP_FAILURE_COOLDOWN_MS, undefined);
+ });
+
+ it('only falls back to a short cooldown when an old owner rejects model-scoped reports', async () => {
+ const invoke = vi.fn<ProviderGroupRemoteInvoke>()
+ .mockResolvedValueOnce({ ok: false, error: { code: 'INVALID_PARAMS', message: 'unknown provider group action' } })
+ .mockResolvedValueOnce({ ok: true, result: {} });
+ const now = Date.now();
+ await createProviderGroupRemoteClient(invoke).cool('owner', {
+ providerId: 'anthropic', memberKey: MINI.key, cause: 'usage-limit', model: 'fable', resetAt: now + 86_400_000,
+ });
+ expect(invoke.mock.calls[0][2][0]).toMatchObject({ action: 'cool-model', model: 'fable' });
+ const fallback = invoke.mock.calls[1][2][0] as { action: string; resetAt: number };
+ expect(fallback.action).toBe('cool');
+ expect(fallback.resetAt).toBeGreaterThanOrEqual(now);
+ expect(fallback.resetAt).toBeLessThanOrEqual(Date.now() + PROVIDER_GROUP_FAILURE_COOLDOWN_MS);
+ invoke.mockReset().mockResolvedValue({ ok: false, error: { message: 'offline' } });
+ await expect(createProviderGroupRemoteClient(invoke).cool('owner', {
+ providerId: 'anthropic', memberKey: MINI.key, cause: 'usage-limit', model: 'fable',
+ })).rejects.toThrow('offline');
+ expect(invoke).toHaveBeenCalledTimes(1);
});
it('refuses to cool computers outside the group and rejects causes it does not cool for', async () => {
diff --git a/apps/desktop/src/main/provider-group/__tests__/router.state.test.ts b/apps/desktop/src/main/provider-group/__tests__/router.state.test.ts
index 876d83cea7..ab1d999846 100644
--- a/apps/desktop/src/main/provider-group/__tests__/router.state.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/router.state.test.ts
@@ -65,11 +65,25 @@ const bothOk = async (): Promise<ResolvedProviderGroupMember[]> => [
];
describe('provider group state kept by the group computer', () => {
+ it('restores model scopes without blocking other models, and bounds legacy unscoped records', async () => {
+ const persisted = { value: {} as ProviderGroupPersistedCooling };
+ const router = harness(bothOk, persisted);
+ router.markCooling('anthropic', A.key, START + 86_400_000, 'claude-fable-5[1m]');
+ const restarted = harness(bothOk, persisted);
+ expect(restarted.coolingUntil('anthropic', A.key, 'fable')).toBe(START + 86_400_000);
+ expect(restarted.coolingUntil('anthropic', A.key, MODEL)).toBeNull();
+ expect((await restarted.view('anthropic')).members[0].state).toBe('available');
+ expect(await restarted.pick({ providerId: 'anthropic', agentKind: 'claude-code', model: MODEL }))
+ .toMatchObject({ kind: 'member', member: { key: A.key } });
+ const legacy = harness(bothOk, { value: { anthropic: { [A.key]: START + 86_400_000 } } });
+ expect(legacy.coolingUntil('anthropic', A.key)).toBe(START + 120_000);
+ });
+
it('remembers cooldowns across restarts and drops the ones that have ended', async () => {
const persisted = { value: {} as ProviderGroupPersistedCooling };
const router = harness(bothOk, persisted);
router.markCooling('anthropic', A.key, START + 3 * 60 * 60_000);
- expect(persisted.value).toEqual({ anthropic: { [A.key]: START + 3 * 60 * 60_000 } });
+ expect(persisted.value).toEqual({ anthropic: { [A.key]: { '': START + 3 * 60 * 60_000 } } });
const restarted = harness(bothOk, { value: { anthropic: { [A.key]: START + 60_000, [B.key]: START - 1 } } });
expect(restarted.coolingUntil('anthropic', A.key)).toBe(START + 60_000);
expect(restarted.coolingUntil('anthropic', B.key)).toBeNull();
diff --git a/apps/desktop/src/main/provider-group/__tests__/router.usage.test.ts b/apps/desktop/src/main/provider-group/__tests__/router.usage.test.ts
index 6d2e9aad34..413dc725c0 100644
--- a/apps/desktop/src/main/provider-group/__tests__/router.usage.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/router.usage.test.ts
@@ -42,6 +42,25 @@ function harness() {
}
describe('provider-group quota routing', () => {
+ it('isolates error cooldowns by model while total quota and account failures still block all models', async () => {
+ const h = harness();
+ h.config.strategy = 'order';
+ const remote = h.config.members[1].key;
+ h.router.markCooling('anthropic', 'local', NOW + 86_400_000, OPUS);
+ expect(await h.pick(OPUS)).toMatchObject({ member: { key: remote } });
+ expect(await h.pick(SONNET)).toMatchObject({ member: { key: 'local' } });
+ expect((await h.router.view('anthropic')).members[0].state).toBe('available');
+ expect((await h.router.view('anthropic', OPUS)).members[0].state).toBe('cooling');
+ h.usage.set('local', snapshot(0, 100));
+ expect(await h.pick(SONNET)).toMatchObject({ member: { key: remote } });
+ expect((await h.router.view('anthropic')).members[0].state).toBe('cooling');
+ h.usage.set('local', snapshot(0, 20));
+ h.router.markCooling('anthropic', 'local', NOW + 60_000);
+ expect(await h.pick(SONNET)).toMatchObject({ member: { key: remote } });
+ h.advance(60_001);
+ expect(await h.pick(SONNET)).toMatchObject({ member: { key: 'local' } });
+ expect(await h.pick(OPUS)).toMatchObject({ member: { key: remote } });
+ });
it.each(PROVIDER_GROUP_STRATEGIES)('gives own tasks the same %s choice as incoming tasks, apart from the external pause', async (strategy) => {
const remote = harness().config.members[1].key;
const choose = async (localTask: boolean, paused: boolean, localUsage: [number, number]) => {
diff --git a/apps/desktop/src/main/provider-group/__tests__/runtime.test.ts b/apps/desktop/src/main/provider-group/__tests__/runtime.test.ts
index 8bafe0877e..8112a903fc 100644
--- a/apps/desktop/src/main/provider-group/__tests__/runtime.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/runtime.test.ts
@@ -32,6 +32,15 @@ const { getProviderGroupDirectory, getProviderGroupOwnerScope, getProviderGroupR
afterEach(() => setProviderGroupClaudeUsageReader(null));
describe('provider group runtime', () => {
+ it('keeps the affected model through the runtime facade', () => {
+ owner = 'model-cooldown-owner';
+ const router = getProviderGroupRouter();
+ const until = Date.now() + 86_400_000;
+ router.markCooling('anthropic', 'local', until, 'claude-fable-5');
+ expect(router.coolingUntil('anthropic', 'local', 'fable')).toBe(until);
+ expect(router.coolingUntil('anthropic', 'local', 'opus')).toBeNull();
+ expect(router.coolingUntil('anthropic', 'local')).toBeNull();
+ });
it('does not return the previous owner’s details after an account change', async () => {
owner = 'detail-owner';
const scope = getProviderGroupOwnerScope();
diff --git a/apps/desktop/src/main/provider-group/__tests__/service.test.ts b/apps/desktop/src/main/provider-group/__tests__/service.test.ts
index 993c83bc12..85b6bd21c2 100644
--- a/apps/desktop/src/main/provider-group/__tests__/service.test.ts
+++ b/apps/desktop/src/main/provider-group/__tests__/service.test.ts
@@ -451,7 +451,8 @@ describe('onTurnError (automatic switch)', () => {
}));
expect(h.deps.fallback).not.toHaveBeenCalled();
// 撞到用量上限的那台进入冷却,新任务不会分到它。
- expect(h.router.coolingUntil('anthropic', 'local')).toBe(1_000_000 + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS);
+ expect(h.router.coolingUntil('anthropic', 'local', MODEL)).toBe(1_000_000 + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS);
+ expect(h.router.coolingUntil('anthropic', 'local', 'claude-sonnet-5')).toBeNull();
});
it('switches back to this computer with its provider when a remote member fails', async () => {
@@ -506,7 +507,7 @@ describe('onTurnError (automatic switch)', () => {
const h = harness({ row: { sdkSessionId: 'native-1' } });
h.service.onTurnError('s1', { sdkError: 'rate_limit' }, 7);
await flush();
- expect(h.router.coolingUntil('anthropic', 'local')).not.toBeNull();
+ expect(h.router.coolingUntil('anthropic', 'local', MODEL)).not.toBeNull();
expect(h.deps.switchAgentLocation).toHaveBeenCalledWith(
's1',
expect.objectContaining({ agentDeviceId: 'mini', providerId: MINI.providerId }),
@@ -685,7 +686,7 @@ describe('onTurnError (automatic switch)', () => {
h.bindings.set('s1', { providerId: 'anthropic', memberKey: MINI.key, at: 1 });
h.service.onTurnError('s1', { sdkError: 'rate_limit' }, 1);
await flush();
- expect(h.router.coolingUntil('anthropic', 'local')).not.toBeNull();
+ expect(h.router.coolingUntil('anthropic', 'local', MODEL)).not.toBeNull();
expect(h.router.coolingUntil('anthropic', MINI.key)).toBeNull();
expect(h.deps.switchAgentLocation).toHaveBeenCalledWith(
's1',
@@ -1159,6 +1160,17 @@ describe('beforeSend', () => {
expect(h.router.coolingUntil('anthropic', 'local')).toBeNull();
});
+ it('only moves before sending when the cooldown covers this task’s model', async () => {
+ const h = harness({ row: { sdkSessionId: 'native' } });
+ h.bindings.set('s1', { providerId: 'anthropic', memberKey: 'local', at: 1 });
+ h.router.markCooling('anthropic', 'local', 2_000_000, 'claude-fable-5');
+ await h.service.beforeSend('s1');
+ expect(h.deps.switchAgentLocation).not.toHaveBeenCalled();
+ h.router.markCooling('anthropic', 'local', 2_000_000, MODEL);
+ await h.service.beforeSend('s1');
+ expect(h.bindings.get('s1')?.memberKey).toBe(MINI.key);
+ });
+
it('moves a task off a computer that is cooling down', async () => {
const h = harness({ row: { sdkSessionId: 'native' } });
h.bindings.set('s1', { providerId: 'anthropic', memberKey: 'local', at: 1 });
diff --git a/apps/desktop/src/main/provider-group/cooling.ts b/apps/desktop/src/main/provider-group/cooling.ts
new file mode 100644
index 0000000000..f2d74b2d0e
--- /dev/null
+++ b/apps/desktop/src/main/provider-group/cooling.ts
@@ -0,0 +1,22 @@
+/** Cooldowns share the existing store; an error only proves that its task's model is limited. */
+import { claudeModelFamily } from '@cindy/maker-shared/subscription-usage';
+
+export const PROVIDER_GROUP_FAILURE_COOLDOWN_MS = 2 * 60_000;
+export const PROVIDER_GROUP_COOLING_SCOPE_CAP = 64;
+/** Empty scope means account-wide; numeric values are legacy records with unknown scope. */
+export type ProviderGroupCooling = number | Record<string, number>;
+export type ProviderGroupPersistedCooling = Record<string, Record<string, ProviderGroupCooling>>;
+
+export function coolingScope(model?: string): string {
+ if (!model) return '';
+ const family = claudeModelFamily(model);
+ return family ? `claude:${family}` : `model:${model}`;
+}
+
+/** Legacy records may be a model limit mistakenly applied to the whole account. Probe again shortly. */
+export function currentCooling(value: ProviderGroupCooling | undefined, now: number): Record<string, number> {
+ const scopes = typeof value === 'number'
+ ? { '': Math.min(value, now + PROVIDER_GROUP_FAILURE_COOLDOWN_MS) }
+ : value ?? {};
+ return Object.fromEntries(Object.entries(scopes).filter(([, until]) => until > now));
+}
diff --git a/apps/desktop/src/main/provider-group/coolingStore.ts b/apps/desktop/src/main/provider-group/coolingStore.ts
index 2b30704f5e..48d054b68f 100644
--- a/apps/desktop/src/main/provider-group/coolingStore.ts
+++ b/apps/desktop/src/main/provider-group/coolingStore.ts
@@ -7,7 +7,7 @@ import { activeOwnerScopeKey, ownerScopedUserDataPath } from '../appSessionState
import { desktopMakerLogger } from '../maker-host/logger-adapter.js';
import { createOverrideSettingsFile } from '../maker-host/override-settings-file.js';
import { isProviderGroupProviderId, PROVIDER_GROUP_STORAGE_MEMBER_CAP } from '../../shared/providerGroup.js';
-import type { ProviderGroupPersistedCooling } from './router.js';
+import { currentCooling, PROVIDER_GROUP_COOLING_SCOPE_CAP, type ProviderGroupCooling, type ProviderGroupPersistedCooling } from './cooling.js';
interface CoolingFile {
cooling: ProviderGroupPersistedCooling;
@@ -24,11 +24,19 @@ function normalize(raw: unknown): CoolingFile {
for (const [providerId, members] of Object.entries(source)) {
if (Object.keys(cooling).length >= MAX_PROVIDERS) break;
if (!isProviderGroupProviderId(providerId) || !members || typeof members !== 'object' || Array.isArray(members)) continue;
- const entries: Record<string, number> = {};
+ const entries: Record<string, ProviderGroupCooling> = {};
for (const [memberKey, until] of Object.entries(members as Record<string, unknown>)) {
if (Object.keys(entries).length >= PROVIDER_GROUP_STORAGE_MEMBER_CAP) break;
- if (!MEMBER_KEY_PATTERN.test(memberKey) || typeof until !== 'number' || !Number.isFinite(until) || until <= 0) continue;
- entries[memberKey] = until;
+ if (!MEMBER_KEY_PATTERN.test(memberKey)) continue;
+ if (typeof until === 'number' && Number.isFinite(until) && until > 0) {
+ entries[memberKey] = until;
+ } else if (until && typeof until === 'object' && !Array.isArray(until)) {
+ const scopes = Object.fromEntries(Object.entries(until).filter(([scope, end]) =>
+ (scope === '' || /^(claude|model):.{1,512}$/.test(scope))
+ && typeof end === 'number' && Number.isFinite(end) && end > 0,
+ ).sort(([a], [b]) => Number(b === '') - Number(a === '')).slice(0, PROVIDER_GROUP_COOLING_SCOPE_CAP));
+ if (Object.keys(scopes).length) entries[memberKey] = scopes;
+ }
}
if (Object.keys(entries).length > 0) cooling[providerId] = entries;
}
@@ -65,10 +73,13 @@ function mergeCooling(
for (const providerId of new Set([...Object.keys(current), ...Object.keys(next)])) {
const a = current[providerId] ?? {};
const b = next[providerId] ?? {};
- const entries: Record<string, number> = {};
+ const entries: Record<string, ProviderGroupCooling> = {};
for (const memberKey of new Set([...Object.keys(a), ...Object.keys(b)])) {
- const until = Math.max(a[memberKey] ?? 0, b[memberKey] ?? 0);
- if (until > now) entries[memberKey] = until;
+ const scopes = currentCooling(a[memberKey], now);
+ for (const [scope, until] of Object.entries(currentCooling(b[memberKey], now))) {
+ scopes[scope] = Math.max(scopes[scope] ?? 0, until);
+ }
+ if (Object.keys(scopes).length) entries[memberKey] = scopes;
}
if (Object.keys(entries).length > 0) merged[providerId] = entries;
}
diff --git a/apps/desktop/src/main/provider-group/guestRelay.ts b/apps/desktop/src/main/provider-group/guestRelay.ts
index b52e372b4a..c83e8898ce 100644
--- a/apps/desktop/src/main/provider-group/guestRelay.ts
+++ b/apps/desktop/src/main/provider-group/guestRelay.ts
@@ -130,7 +130,7 @@ export function createProviderGroupGuestRelay(deps: ProviderGroupGuestRelayDeps)
connect: (agentDeviceId) => deps.connect(agentDeviceId),
- noteStartFailure(providerId, member: GroupRelayMember, error) {
+ noteStartFailure(providerId, member: GroupRelayMember, error, model) {
const config = deps.readGroup(providerId);
if (!config?.members.some((m) => m.key === member.memberKey)) return false;
const message = errorText(error);
@@ -157,14 +157,15 @@ export function createProviderGroupGuestRelay(deps: ProviderGroupGuestRelayDeps)
deps.scope().router.markCooling(
providerId,
member.memberKey,
- now + (decision.cause === 'usage-limit' ? PROVIDER_GROUP_DEFAULT_COOLDOWN_MS : PROVIDER_GROUP_FAILURE_COOLDOWN_MS),
+ now + (decision.cause === 'usage-limit' && model ? PROVIDER_GROUP_DEFAULT_COOLDOWN_MS : PROVIDER_GROUP_FAILURE_COOLDOWN_MS),
+ decision.cause === 'usage-limit' ? model : undefined,
);
}
// 账号问题仍冷却,关闭自动换电脑时把原错误交给受邀者,与运行中的口径一致。
return config.autoSwitch;
},
- noteRunFailure(providerId, member: GroupRelayMember, failure) {
+ noteRunFailure(providerId, member: GroupRelayMember, failure, model) {
// 没有组,或那台已被移出组:已经在它上面的任务成为普通的远程 Agent 任务,不再自动换电脑(§9 #4)。
const config = deps.readGroup(providerId);
if (!config?.members.some((m) => m.key === member.memberKey)) return false;
@@ -186,7 +187,9 @@ export function createProviderGroupGuestRelay(deps: ProviderGroupGuestRelayDeps)
? Math.min(resetAt, now + PROVIDER_GROUP_MAX_REMOTE_COOLDOWN_MS)
: now + PROVIDER_GROUP_DEFAULT_COOLDOWN_MS)
: now + PROVIDER_GROUP_FAILURE_COOLDOWN_MS;
- deps.scope().router.markCooling(providerId, member.memberKey, until);
+ const scopedModel = decision.cause === 'usage-limit' ? model : undefined;
+ deps.scope().router.markCooling(providerId, member.memberKey,
+ scopedModel ? until : Math.min(until, now + PROVIDER_GROUP_FAILURE_COOLDOWN_MS), scopedModel);
}
// 冷却照常(之后的新任务避开它);组设置里关掉了自动换电脑时不发凭证,受邀者照现有方式看到错误(§6.1)。
return config.autoSwitch;
diff --git a/apps/desktop/src/main/provider-group/remoteClient.ts b/apps/desktop/src/main/provider-group/remoteClient.ts
index abb594bd63..4504ae2eb1 100644
--- a/apps/desktop/src/main/provider-group/remoteClient.ts
+++ b/apps/desktop/src/main/provider-group/remoteClient.ts
@@ -19,6 +19,7 @@ import {
type ProviderGroupView,
} from '../../shared/providerGroup.js';
import { throwIpcError } from '../utils/ipcValidate.js';
+import { PROVIDER_GROUP_FAILURE_COOLDOWN_MS } from './cooling.js';
/** 留出 invoke 路由头的空间,同时适配可靠传输和旧端普通帧;预算按 JSON 的 UTF-8 字节数计。 */
export const PROVIDER_GROUP_USAGE_REQUEST_MAX_BYTES = Math.min(MAX_FRAME_BYTES, MAX_TRANSPORT_MESSAGE_BYTES) - 64 * 1024;
@@ -43,6 +44,7 @@ export interface ProviderGroupRemoteClient {
memberKey: string;
cause: ProviderGroupRemoteCoolCause;
resetAt?: number | null;
+ model?: string;
}): Promise<void>;
leases(ownerDeviceId: string, seq: number, entries: readonly ProviderGroupRemoteLease[]): Promise<void>;
view(ownerDeviceId: string, providerId: string, modelOrOptions?: string | { model?: string; includeGuestSupport?: boolean }): Promise<ProviderGroupView>;
@@ -90,13 +92,23 @@ export function createProviderGroupRemoteClient(invoke: ProviderGroupRemoteInvok
},
async cool(ownerDeviceId, input) {
- await call(ownerDeviceId, {
- action: 'cool',
+ const scoped = input.cause === 'usage-limit' && !!input.model;
+ const request = {
+ action: scoped ? 'cool-model' : 'cool',
providerId: input.providerId,
memberKey: input.memberKey,
cause: input.cause,
+ ...(input.model ? { model: input.model } : {}),
...(typeof input.resetAt === 'number' ? { resetAt: input.resetAt } : {}),
- });
+ };
+ try {
+ await call(ownerDeviceId, request);
+ } catch (error) {
+ // Old owners reject unknown actions. A short legacy cooldown must not carry the model's weekly reset.
+ if (!scoped || !(error instanceof Error) || !/unknown provider group action/.test(error.message)) throw error;
+ await call(ownerDeviceId, { ...request, action: 'cool', model: undefined,
+ resetAt: Date.now() + PROVIDER_GROUP_FAILURE_COOLDOWN_MS });
+ }
},
async leases(ownerDeviceId, seq, entries) {
diff --git a/apps/desktop/src/main/provider-group/remoteHandler.ts b/apps/desktop/src/main/provider-group/remoteHandler.ts
index 30d6723d49..1a4e8e3a67 100644
--- a/apps/desktop/src/main/provider-group/remoteHandler.ts
+++ b/apps/desktop/src/main/provider-group/remoteHandler.ts
@@ -134,7 +134,8 @@ export async function handleProviderGroupRemote(
const { key, kind, agentDeviceId, providerId: memberProviderId } = pick.member;
return { kind: 'member', member: { key, kind, agentDeviceId, providerId: memberProviderId }, label: pick.label };
}
- case 'cool': {
+ case 'cool':
+ case 'cool-model': {
const config = deps.readGroup(request.providerId);
if (!config || !config.members.some((m) => m.key === request.memberKey)) return {};
const now = deps.now();
@@ -144,7 +145,10 @@ export async function handleProviderGroupRemote(
now + PROVIDER_GROUP_MAX_REMOTE_COOLDOWN_MS,
)
: now + PROVIDER_GROUP_FAILURE_COOLDOWN_MS;
- scope.router.markCooling(request.providerId, request.memberKey, until);
+ // Old controllers cannot identify the affected model: never turn their report into a week-long account ban.
+ const model = request.cause === 'usage-limit' ? request.model : undefined;
+ scope.router.markCooling(request.providerId, request.memberKey,
+ model ? until : Math.min(until, now + PROVIDER_GROUP_FAILURE_COOLDOWN_MS), model);
return {};
}
case 'leases':
diff --git a/apps/desktop/src/main/provider-group/router.ts b/apps/desktop/src/main/provider-group/router.ts
index 58f3244d7a..f091f06599 100644
--- a/apps/desktop/src/main/provider-group/router.ts
+++ b/apps/desktop/src/main/provider-group/router.ts
@@ -21,11 +21,11 @@ import type { ProviderGroupDirectory, ResolvedProviderGroupMember } from './dire
import { pickProviderGroupMember, type SchedulableMember } from './scheduler.js';
import { createGuestSupportReader } from './sharedStatus.js';
import { providerGroupUsageState } from './usage.js';
+import { coolingScope, currentCooling, PROVIDER_GROUP_COOLING_SCOPE_CAP, type ProviderGroupPersistedCooling } from './cooling.js';
+export { PROVIDER_GROUP_FAILURE_COOLDOWN_MS, type ProviderGroupPersistedCooling } from './cooling.js';
/** 撞到用量上限但拿不到重置时刻时,默认冷却多久。 */
export const PROVIDER_GROUP_DEFAULT_COOLDOWN_MS = 30 * 60_000;
-/** 连不上 / 登录失效等失败后,短时间内不再给它分新任务。 */
-export const PROVIDER_GROUP_FAILURE_COOLDOWN_MS = 2 * 60_000;
/**
* 「这一轮已试过」多久后作废:一轮里每台最多试一次;换过去之后正常跑了一阵再出错,算新的一轮。
*/
@@ -37,9 +37,6 @@ export const PROVIDER_GROUP_TURN_WINDOW_MS = 30 * 60_000;
*/
export const PROVIDER_GROUP_PICK_QUICK_MS = 3_000;
-/** 落盘的冷却:供应商 → 组内电脑 → 冷却到何时(unix ms)。 */
-export type ProviderGroupPersistedCooling = Record<string, Record<string, number>>;
-
export interface ProviderGroupRouterDeps {
directory: ProviderGroupDirectory;
/** 仅详情页按需读取;分配与普通状态查询不探测远端能力。 */
@@ -99,8 +96,8 @@ export interface ProviderGroupRouter {
view(providerId: string, options?: string | { model?: string; includeGuestSupport?: boolean }): Promise<ProviderGroupView>;
/** 经本组分到这台、正在运行的任务数。 */
running(providerId: string, memberKey: string): number;
- markCooling(providerId: string, memberKey: string, until: number): void;
- coolingUntil(providerId: string, memberKey: string): number | null;
+ markCooling(providerId: string, memberKey: string, until: number, model?: string): void;
+ coolingUntil(providerId: string, memberKey: string, model?: string): number | null;
/** 记一次「这一轮试过这台」,返回这一轮已试过的全部。 */
markTried(sessionId: string, memberKey: string): ReadonlySet<string>;
triedThisTurn(sessionId: string): ReadonlySet<string>;
@@ -114,11 +111,11 @@ function coolKey(providerId: string, memberKey: string): string {
export function createProviderGroupRouter(deps: ProviderGroupRouterDeps): ProviderGroupRouter {
const guestSupportReader = deps.readCaps ? createGuestSupportReader(deps.readCaps) : null;
- const cooling = new Map<string, number>();
+ const cooling = new Map<string, Record<string, number>>();
try {
for (const [providerId, members] of Object.entries(deps.coolingStore?.read() ?? {})) {
- for (const [memberKey, until] of Object.entries(members)) {
- if (until > deps.now()) cooling.set(coolKey(providerId, memberKey), until);
+ for (const [memberKey, value] of Object.entries(members)) {
+ cooling.set(coolKey(providerId, memberKey), currentCooling(value, deps.now()));
}
}
} catch {
@@ -129,10 +126,11 @@ export function createProviderGroupRouter(deps: ProviderGroupRouterDeps): Provid
if (!deps.coolingStore) return;
const now = deps.now();
const value: ProviderGroupPersistedCooling = {};
- for (const [key, until] of cooling) {
- if (until <= now) continue;
+ for (const [key, remembered] of cooling) {
+ const scopes = currentCooling(remembered, now);
+ if (Object.keys(scopes).length === 0) continue;
const split = key.indexOf('\u0000');
- (value[key.slice(0, split)] ??= {})[key.slice(split + 1)] = until;
+ (value[key.slice(0, split)] ??= {})[key.slice(split + 1)] = scopes;
}
try {
deps.coolingStore.write(value);
@@ -156,15 +154,15 @@ export function createProviderGroupRouter(deps: ProviderGroupRouterDeps): Provid
return entry.keys;
}
- function coolingUntil(providerId: string, memberKey: string): number | null {
+ function coolingUntil(providerId: string, memberKey: string, model?: string): number | null {
const key = coolKey(providerId, memberKey);
- const until = cooling.get(key);
- if (until === undefined) return null;
- if (until <= deps.now()) {
+ const scopes = currentCooling(cooling.get(key), deps.now());
+ if (Object.keys(scopes).length === 0) {
cooling.delete(key);
return null;
}
- return until;
+ const until = Math.max(scopes[''] ?? 0, scopes[coolingScope(model)] ?? 0);
+ return until || null;
}
function running(providerId: string, memberKey: string): number {
@@ -208,7 +206,7 @@ export function createProviderGroupRouter(deps: ProviderGroupRouterDeps): Provid
const config = deps.readGroup(input.providerId);
if (!config) return { kind: 'none' };
const usable = (r: ResolvedProviderGroupMember) =>
- offersModel(r, input.agentKind, input.model) && coolingUntil(input.providerId, r.member.key) === null
+ offersModel(r, input.agentKind, input.model) && coolingUntil(input.providerId, r.member.key, input.model) === null
&& !providerGroupUsageState(r.claudeUsage, input.model, deps.now()).limited;
// 「暂停对外分配」只拦本机以外的新任务;除此之外本机任务与其他使用方同一套组策略,不另设本机优先。
const paused = (r: ResolvedProviderGroupMember) =>
@@ -271,7 +269,7 @@ export function createProviderGroupRouter(deps: ProviderGroupRouterDeps): Provid
? (r.member.kind === 'local' || r.state === 'ok' ? await readSupport(r.member) : 'unknown' as const)
: undefined;
const quota = providerGroupUsageState(r.claudeUsage, model, deps.now());
- const remembered = coolingUntil(providerId, r.member.key);
+ const remembered = coolingUntil(providerId, r.member.key, model);
const until = quota.limited && quota.resetAtMs === null ? null
: remembered === null ? quota.resetAtMs
: quota.resetAtMs === null ? remembered : Math.max(remembered, quota.resetAtMs);
@@ -310,9 +308,14 @@ export function createProviderGroupRouter(deps: ProviderGroupRouterDeps): Provid
running,
- markCooling(providerId, memberKey, until) {
+ markCooling(providerId, memberKey, until, model) {
const key = coolKey(providerId, memberKey);
- cooling.set(key, Math.max(cooling.get(key) ?? 0, until));
+ const scopes = currentCooling(cooling.get(key), deps.now());
+ const scope = coolingScope(model);
+ // Always leave room for account-wide authentication/overload failures.
+ if (scope && !(scope in scopes) && Object.keys(scopes).length >= PROVIDER_GROUP_COOLING_SCOPE_CAP - 1) return;
+ scopes[scope] = Math.max(scopes[scope] ?? 0, until);
+ cooling.set(key, scopes);
persistCooling();
},
diff --git a/apps/desktop/src/main/provider-group/runtime.ts b/apps/desktop/src/main/provider-group/runtime.ts
index 6551649046..6bced8b2f7 100644
--- a/apps/desktop/src/main/provider-group/runtime.ts
+++ b/apps/desktop/src/main/provider-group/runtime.ts
@@ -125,8 +125,8 @@ const routerFacade: ProviderGroupRouter = {
return activeOwnerScopeKey() === runtime.owner ? view : { providerId, config: null, members: [] };
},
running: (providerId, memberKey) => runtimeForActiveOwner().router.running(providerId, memberKey),
- markCooling: (providerId, memberKey, until) => runtimeForActiveOwner().router.markCooling(providerId, memberKey, until),
- coolingUntil: (providerId, memberKey) => runtimeForActiveOwner().router.coolingUntil(providerId, memberKey),
+ markCooling: (providerId, memberKey, until, model) => runtimeForActiveOwner().router.markCooling(providerId, memberKey, until, model),
+ coolingUntil: (providerId, memberKey, model) => runtimeForActiveOwner().router.coolingUntil(providerId, memberKey, model),
markTried: (sessionId, memberKey) => runtimeForActiveOwner().router.markTried(sessionId, memberKey),
triedThisTurn: (sessionId) => runtimeForActiveOwner().router.triedThisTurn(sessionId),
resetTurn: (sessionId) => runtimeForActiveOwner().router.resetTurn(sessionId),
diff --git a/apps/desktop/src/main/provider-group/service.ts b/apps/desktop/src/main/provider-group/service.ts
index e35b4a0adc..6a59ee0844 100644
--- a/apps/desktop/src/main/provider-group/service.ts
+++ b/apps/desktop/src/main/provider-group/service.ts
@@ -129,6 +129,7 @@ export interface ProviderGroupRemoteGroups {
memberKey: string;
cause: ProviderGroupRemoteCoolCause;
resetAt: number | null;
+ model?: string;
}): Promise<void>;
view(ownerDeviceId: string, providerId: string, model?: string): Promise<ProviderGroupView>;
/** 忘掉组所在电脑目录的缓存(组员失败后下次现读)。 */
@@ -363,9 +364,9 @@ interface GroupSource {
exclude: ReadonlySet<string>;
}): Promise<SourcePick>;
/** 记进组的状态(只在判定说要记时调用:那台账号的问题)。 */
- cool(providerId: string, memberKey: string, cause: ProviderGroupFailureCause, resetAt: number | null): void;
+ cool(providerId: string, memberKey: string, cause: ProviderGroupFailureCause, resetAt: number | null, model: string): void;
/** 组的状态里这台现在冷却中(组所在电脑记着它账号的问题)。 */
- isKnownDown(providerId: string, memberKey: string): Promise<boolean>;
+ isKnownDown(providerId: string, memberKey: string, model?: string): Promise<boolean>;
/** 发送前:这台现在该不该换掉;null = 读不到,照常发送。 */
shouldMoveAway(providerId: string, config: ProviderGroupConfig, memberKey: string, model: string): Promise<{ reason: string } | false | null>;
invalidate(member: ProviderGroupMember): void;
@@ -577,8 +578,9 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
providerId: string,
memberKey: string,
route: ProviderGroupRoute,
+ model?: string,
): Promise<boolean> {
- if (source && (await withTimeout(source.isKnownDown(providerId, memberKey), PROVIDER_GROUP_BEFORE_SEND_TIMEOUT_MS))) {
+ if (source && (await withTimeout(source.isKnownDown(providerId, memberKey, model), PROVIDER_GROUP_BEFORE_SEND_TIMEOUT_MS))) {
return true;
}
if (!route.agentDeviceId || !deps.directory.offlineForMs) return false;
@@ -673,18 +675,18 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
},
};
},
- cool(providerId, memberKey, cause, resetAt) {
+ cool(providerId, memberKey, cause, resetAt, model) {
if (!isAccountCause(cause)) return;
- router.markCooling(providerId, memberKey, coolUntil(cause, resetAt));
+ router.markCooling(providerId, memberKey, coolUntil(cause, resetAt), cause === 'usage-limit' ? model : undefined);
},
- async isKnownDown(providerId, memberKey) {
- return router.coolingUntil(providerId, memberKey) !== null;
+ async isKnownDown(providerId, memberKey, model) {
+ return router.coolingUntil(providerId, memberKey, model) !== null;
},
async shouldMoveAway(providerId, config, memberKey, model) {
const resolved = await withTimeout(deps.directory.resolveMembers(providerId, config), PROVIDER_GROUP_BEFORE_SEND_TIMEOUT_MS);
const state = resolved?.find((r) => r.member.key === memberKey);
if (!state) return null;
- const cooling = router.coolingUntil(providerId, memberKey) !== null
+ const cooling = router.coolingUntil(providerId, memberKey, model) !== null
|| providerGroupUsageState(state.claudeUsage, model, deps.now()).limited;
if (state.state === 'ok' && !cooling) return false;
return { reason: cooling ? 'cooling' : state.state };
@@ -735,15 +737,15 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
?? { ...pick.member, limit: 1, weight: 1, paused: false };
return { kind: 'member', member, label: pick.label, labelOf };
},
- cool(providerId, memberKey, cause, resetAt) {
+ cool(providerId, memberKey, cause, resetAt, model) {
// 连不上、起不来只由发现它的这台电脑自己避开(这一轮已试过),不替全组判断:可能只是这台连不过去。
if (!isAccountCause(cause)) return;
- void remote.cool(ownerDeviceId, { providerId, memberKey, cause, resetAt }).catch((error) => {
+ void remote.cool(ownerDeviceId, { providerId, memberKey, cause, resetAt, ...(cause === 'usage-limit' ? { model } : {}) }).catch((error) => {
deps.log.warn('provider group: reporting a computer to cool down failed', { error: errorText(error) });
});
},
- async isKnownDown(providerId, memberKey) {
- const view = await remote.view(ownerDeviceId, providerId);
+ async isKnownDown(providerId, memberKey, model) {
+ const view = await remote.view(ownerDeviceId, providerId, model);
return view.members.find((m) => m.key === memberKey)?.state === 'cooling';
},
async shouldMoveAway(providerId, _config, memberKey, model) {
@@ -1054,7 +1056,7 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
hooks?.reconnecting?.(attempt, PROVIDER_GROUP_RECONNECT_MAX_ATTEMPTS);
}, {
connectionLost: decision.connection === 'lost',
- knownDown: () => knownDown(source, binding.providerId, current.key, route),
+ knownDown: () => knownDown(source, binding.providerId, current.key, route, row.model ?? undefined),
});
if (outcome === 'stopped') return;
if (outcome === 'back') {
@@ -1257,7 +1259,7 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
}): Promise<void> {
const { sessionId, signals, decision, binding, source, config, row, current, lease, isCurrent, handBack, hooks } = input;
const { cause } = decision;
- if (decision.cool) source.cool(binding.providerId, current.key, cause, deps.readResetAt(signals));
+ if (decision.cool) source.cool(binding.providerId, current.key, cause, deps.readResetAt(signals), row.model);
source.invalidate(current);
const tried = router.markTried(sessionId, current.key);
// 这条消息发出前刚换不过去的电脑不再重复去试、重复去等。
@@ -1324,7 +1326,7 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
error: errorText(error),
});
router.markTried(sessionId, pick.member.key);
- if (target.cool) source.cool(binding.providerId, pick.member.key, target.cause, null);
+ if (target.cool) source.cool(binding.providerId, pick.member.key, target.cause, null, row.model);
skipped.failed(pick.member, isUnreachableTarget(target));
continue;
}
@@ -1552,7 +1554,7 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
return null;
}
if (!config?.autoSwitch) return null;
- if (decision.cool) source.cool(context.groupProviderId, context.member.key, cause, null);
+ if (decision.cool) source.cool(context.groupProviderId, context.member.key, cause, null, context.model);
source.invalidate(context.member);
const tried = router.markTried(context.sessionId, context.member.key);
const pick = await source.pick({
@@ -1690,7 +1692,7 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
if (reason === 'offline') {
const outcome = await waitBeforeSend(
sessionId, currentRoute, current.key, checkFresh, options,
- () => knownDown(source, binding.providerId, current.key, currentRoute),
+ () => knownDown(source, binding.providerId, current.key, currentRoute, row.model ?? undefined),
);
if (outcome !== 'gone') return;
options?.progress?.('switching');
@@ -1760,7 +1762,7 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Prov
});
if (!failedTargets.includes(pick.member.key)) failedTargets.push(pick.member.key);
router.markTried(sessionId, pick.member.key);
- if (target.cool) source.cool(binding.providerId, pick.member.key, target.cause, null);
+ if (target.cool) source.cool(binding.providerId, pick.member.key, target.cause, null, row.model);
skipped.failed(pick.member, isUnreachableTarget(target));
}
}
diff --git a/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.ts b/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.ts
index edf504591b..bfc432e979 100644
--- a/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.ts
+++ b/apps/desktop/src/main/remote-agent/__tests__/groupRelay.test.ts
@@ -349,7 +349,7 @@ describe('provider group relay for shared users', () => {
const { client } = await openAsGuest(env, GUEST_A, openPayload(SESSION));
expect(env.memberStarted.mini).toHaveLength(0);
expect(env.memberStarted.studio).toHaveLength(1);
- expect(env.relay.noteStartFailure).toHaveBeenCalledWith('shared-provider', MEMBER_MINI, expect.any(Error));
+ expect(env.relay.noteStartFailure).toHaveBeenCalledWith('shared-provider', MEMBER_MINI, expect.any(Error), 'claude-opus');
expect(env.relay.plan).toHaveBeenLastCalledWith(expect.objectContaining({ exclude: new Set([MEMBER_MINI.memberKey]) }));
await client.close('close', 'navigation');
});
@@ -359,7 +359,7 @@ describe('provider group relay for shared users', () => {
const { client } = await openAsGuest(env, GUEST_A, openPayload(SESSION));
expect(env.memberStarted.mini).toHaveLength(1);
// 与组内电脑接不下同一个判定;换下一台时不再回到本机这一台。
- expect(env.relay.noteStartFailure).toHaveBeenCalledWith('shared-provider', expect.objectContaining({ memberKey: 'local' }), expect.any(Error));
+ expect(env.relay.noteStartFailure).toHaveBeenCalledWith('shared-provider', expect.objectContaining({ memberKey: 'local' }), expect.any(Error), 'claude-opus');
expect(env.relay.plan).toHaveBeenLastCalledWith(expect.objectContaining({ exclude: new Set(['local']) }));
await client.close('close', 'navigation');
});
@@ -688,6 +688,7 @@ describe('provider group "switch to another computer" for shared users', () => {
'shared-provider',
MEMBER_MINI,
expect.objectContaining({ usageLimit: true, message: 'You have hit your usage limit' }),
+ 'claude-opus',
);
expect(env.relay.plan).toHaveBeenLastCalledWith(expect.objectContaining({ exclude: new Set([MEMBER_MINI.memberKey]) }));
await first.client.close('close', 'navigation');
@@ -804,6 +805,7 @@ describe('provider group "switch to another computer" for shared users', () => {
expect(guest.stream).toContainEqual(expect.objectContaining({ t: 'event', event: expect.objectContaining({ type: 'error', data }) }));
expect(env.relay.noteRunFailure).toHaveBeenCalledWith(
'shared-provider', expect.anything(), expect.objectContaining({ sdkError: 'max_output_tokens' }),
+ 'claude-opus',
);
expect(switchTokenIn(guest.stream)).toBeUndefined();
expect(env.relay.plan).toHaveBeenCalledTimes(1);
@@ -826,6 +828,7 @@ describe('provider group "switch to another computer" for shared users', () => {
'shared-provider',
expect.objectContaining({ memberKey: 'local' }),
expect.objectContaining({ usageLimit: true }),
+ 'claude-opus',
);
await first.client.close('close', 'navigation');
@@ -851,6 +854,7 @@ describe('provider group "switch to another computer" for shared users', () => {
'shared-provider',
expect.objectContaining({ memberKey: 'local' }),
expect.objectContaining({ reason: 'remote_agent_closed' }),
+ 'claude-opus',
);
});
@@ -869,6 +873,7 @@ describe('provider group "switch to another computer" for shared users', () => {
'shared-provider',
MEMBER_MINI,
expect.objectContaining({ reason: 'remote_agent_closed' }),
+ 'claude-opus',
);
});
@@ -1061,7 +1066,7 @@ describe('provider group reshare consent', () => {
const { client } = await openAsGuest(env, C_AT_B, openPayload(SESSION));
expect(opened).toEqual(['mini']);
expect(env.memberStarted.studio).toHaveLength(0);
- expect(env.relay.noteStartFailure).toHaveBeenCalledWith('shared-provider', shared, expect.objectContaining({ message: expect.stringContaining('REMOTE_AGENT_PEER_TOO_OLD') }));
+ expect(env.relay.noteStartFailure).toHaveBeenCalledWith('shared-provider', shared, expect.objectContaining({ message: expect.stringContaining('REMOTE_AGENT_PEER_TOO_OLD') }), 'claude-opus');
await client.close('close', 'navigation');
});
diff --git a/apps/desktop/src/main/remote-agent/host/runHost.ts b/apps/desktop/src/main/remote-agent/host/runHost.ts
index aa3ee38554..248735d5ad 100644
--- a/apps/desktop/src/main/remote-agent/host/runHost.ts
+++ b/apps/desktop/src/main/remote-agent/host/runHost.ts
@@ -297,12 +297,12 @@ export interface RemoteAgentGroupRelayDeps {
* 那台在启动阶段没能接下任务:按组的口径判定(provider-group/failurePolicy),那台账号的问题冷却它。返回 true =
* 可以换下一台;false = 换到哪台都一样(模型停用、请求无效等),照原来的错误报给受邀者。
*/
- noteStartFailure(providerId: string, member: GroupRelayMember, error: unknown): boolean;
+ noteStartFailure(providerId: string, member: GroupRelayMember, error: unknown, model?: string): boolean;
/**
* 那台上的任务运行中失败(终态错误,或一轮进行中任务意外结束):问题出在那台电脑本身时按组的口径冷却它,组设置
* 允许自动换电脑时返回 true(可以换一台);用户停止、上下文超限等换到哪台都一样的失败返回 false。
*/
- noteRunFailure(providerId: string, member: GroupRelayMember, failure: RelayRunFailure): boolean;
+ noteRunFailure(providerId: string, member: GroupRelayMember, failure: RelayRunFailure, model?: string): boolean;
/** 计入那台组内电脑的负载(按它是否正在运行一轮)。 */
trackRun(providerId: string, memberKey: string): GroupRelayLoad;
/** 删掉受邀者后,请接过它任务的组内电脑清掉留下的会话记录与目录。 */
@@ -1122,7 +1122,7 @@ export function createRemoteAgentHost(deps: RemoteAgentHostDeps) {
if (!relayDeps || !start || !run.providerId || run.closing || run.handle) return false;
run.groupFreshStart = undefined;
const local = localGroupMember(run.providerId);
- if (!relayDeps.noteStartFailure(run.providerId, local, error)) return false;
+ if (!relayDeps.noteStartFailure(run.providerId, local, error, payload.options.model)) return false;
const tried = new Set<string>([...start.avoid, local.memberKey]);
const next = await relayDeps.plan({
kind: run.kind,
@@ -1280,8 +1280,8 @@ export function createRemoteAgentHost(deps: RemoteAgentHostDeps) {
const relayDeps = deps.groupRelay;
if (!relayDeps || !run.providerId || !run.hostSessionId) return null;
const canSwitch = phase === 'start'
- ? relayDeps.noteStartFailure(run.providerId, member, failure.message ?? '')
- : relayDeps.noteRunFailure(run.providerId, member, failure);
+ ? relayDeps.noteStartFailure(run.providerId, member, failure.message ?? '', model)
+ : relayDeps.noteRunFailure(run.providerId, member, failure, model);
if (!canSwitch) return null;
// 旧版受邀者不认识这个状态:照旧只转出原来的错误。
if (!run.acceptsGroupSwitch) return null;
@@ -1548,7 +1548,7 @@ export function createRemoteAgentHost(deps: RemoteAgentHostDeps) {
}
tried.add(current.memberKey);
// 与本机自己的任务同一个判定:换到哪台都一样的失败不再换,照原来的错误报给受邀者。
- if (!relayDeps.noteStartFailure(groupProviderId, current, error)) break;
+ if (!relayDeps.noteStartFailure(groupProviderId, current, error, backend.model ?? payload.options.model)) break;
deps.log?.warn('remote agent: provider group computer did not take the shared task; trying the next one', {
runId: run.id,
member: current.memberKey,
diff --git a/apps/desktop/src/shared/providerGroup.ts b/apps/desktop/src/shared/providerGroup.ts
index c65f63f027..2d5e675ebf 100644
--- a/apps/desktop/src/shared/providerGroup.ts
+++ b/apps/desktop/src/shared/providerGroup.ts
@@ -408,7 +408,7 @@ export type ProviderGroupRemoteRequest =
/** 新任务该用组里哪台;选中即给那台记一个短暂的占用,同时开的几个任务不会全落到同一台。 */
| { action: 'pick'; sessionId: string; providerId: string; agentKind: 'claude-code' | 'codex' | 'pi'; model: string; exclude: string[] }
/** 那台电脑出了问题(用量上限、登录失效、服务繁忙):组所在电脑冷却它,不再分新任务。 */
- | { action: 'cool'; providerId: string; memberKey: string; cause: ProviderGroupRemoteCoolCause; resetAt?: number }
+ | { action: 'cool' | 'cool-model'; providerId: string; memberKey: string; cause: ProviderGroupRemoteCoolCause; resetAt?: number; model?: string }
/** 这台电脑经组运行、正在跑的任务(整体替换上一份;seq 只增,乱序到达的旧份丢弃)。 */
| { action: 'leases'; seq: number; entries: ProviderGroupRemoteLease[] }
/** 组内电脑的状态(发送前检查、设置页展示)。 */
@@ -511,17 +511,21 @@ export function parseProviderGroupRemoteRequest(raw: unknown): ProviderGroupRemo
exclude: exclude.map(remoteMemberKey),
};
}
- case 'cool': {
+ case 'cool':
+ case 'cool-model': {
+ if (value.model !== undefined && (typeof value.model !== 'string' || !value.model.trim() || value.model.length > 512)) invalidRemote('invalid model');
+ if (value.action === 'cool-model' && (typeof value.model !== 'string' || value.cause !== 'usage-limit')) invalidRemote('invalid model cooldown');
const cause = value.cause;
if (!REMOTE_COOL_CAUSES.includes(cause as ProviderGroupRemoteCoolCause)) invalidRemote('invalid cause');
const resetAt = typeof value.resetAt === 'number' && Number.isFinite(value.resetAt) && value.resetAt > 0
? value.resetAt
: undefined;
return {
- action: 'cool',
+ action: value.action,
providerId: remoteProviderId(value.providerId),
memberKey: remoteMemberKey(value.memberKey),
cause: cause as ProviderGroupRemoteCoolCause,
+ ...(typeof value.model === 'string' ? { model: value.model } : {}),
...(resetAt !== undefined ? { resetAt } : {}),
};
}
diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.md
index 7cf1c9888d..1ea88e2391 100644
--- a/docs/dev-rules/protocol-compatibility.md
+++ b/docs/dev-rules/protocol-compatibility.md
@@ -1246,9 +1246,16 @@ B 上的 Worker 是一条普通任务,`sessions.orca_remote_lead`(migration 01
- `pick { sessionId, providerId, agentKind, model, exclude[] }` → `{ kind: 'member', member: { key, kind, agentDeviceId, providerId }, label }`
/ `{ kind: 'unavailable' }` / `{ kind: 'none' }`(没有组或供应商没开放远程调用)。组员坐标是 O 视角(`local` = O 自己),C 换算成
本机位置;选中即给那台记 30s 临时占用;
- - `cool { providerId, memberKey, cause: 'usage-limit' | 'auth' | 'overload', resetAt? }` → O 冷却那台(`resetAt` 最多信 8 天);
+ - `cool { providerId, memberKey, cause: 'usage-limit' | 'auth' | 'overload', resetAt? }` → O 短暂冷却那台,未带模型的旧报告最多信 2 分钟;
连不上不报,只由 C 自己避开(组内状态以 O 为准,C 那边的问题不记进组里,2026-10-11)。`exclude` 非空(C 这一轮试过
不行再来问)时 O 不用短时缓存、现读组内电脑的最新状态再选,请求格式不变;
+ - `cool-model { providerId, memberKey, cause: 'usage-limit', model, resetAt? }`(2026-10-17)→ O 只冷却对应模型,
+ `resetAt` 最多信 8 天,无时刻则 30 分钟;Claude 家族别名共用一个范围。新 C 连接旧 O 收到
+ `unknown provider group action` 时,只回退一次 `cool`,重置时刻压到未来最多 2 分钟;其他失败不回退。
+ 旧 C 连接新 O 的无模型报告只保留短冷却。完整模型隔离需 C/O 更新;手机仍由被控电脑执行,无新 channel 或服务端改动。
+ 本地 `provider-group-cooling.json` 的成员值从旧数字扩为范围到时刻的对象(空键是全账号);新版加载旧数字最多保留
+ 2 分钟,降级旧版忽略对象并依据配额/实际报错重新判断,不影响任务与组配置。回归见 `router.state.test.ts`、
+ `coolingStore.test.ts`、`remoteHandler.test.ts` 与 `remote-agent/__tests__/groupRelay.test.ts`。
- `leases { seq, entries: [{ sessionId, providerId, memberKey }] }` → 整体替换 C 正在运行的经组任务,`seq` 只增(C 按时间生成,
重启后仍增大),乱序旧包丢弃,150s 不刷新作废;只用于分摊负载;
- `view { providerId, model? }` → 组设置与组员状态(`ProviderGroupView`);省略 `model` 时只按组级状态返回,
diff --git a/docs/product-rules/provider-groups.md b/docs/product-rules/provider-groups.md
index 8d59c10bee..b7fd68feea 100644
--- a/docs/product-rules/provider-groups.md
+++ b/docs/product-rules/provider-groups.md
@@ -202,7 +202,7 @@
Claude Code 订阅另读已有的订阅用量快照,5 小时、总周额度或当前模型专属周额度任一用完,就不再分给它,
不必先运行失败一次。重置时刻与 [用量上限自动继续](usage-limit-auto-continue.md) 共用判定;已过重置时刻的旧窗口不再阻塞。
组状态把总窗口耗尽显示为冷却中;模型专属周额度只影响对应模型,不能把其他模型一起封住。快照判断不写入持久冷却,
- 原来由实际错误产生的冷却照旧保留。
+ 实际错误产生的冷却也按任务模型隔离,不能把分模型限额变成整台电脑的冷却。
- **配额先比**(2026-10-15 用户裁决:目的是尽快把快重置的配额用掉;不论选哪种组策略都先做这一步):先做上述排除,
再在未达到并发上限的候选里先保留用量完整的电脑(窗口有效性见第 2 条),然后依次筛;全部读不到用量时不比较重置时间,
也不按用量筛,原样交给组策略:
@@ -227,12 +227,16 @@
- 正常运行的任务不因用量差距而迁移;新任务和需要换电脑时才按此策略分配。
- 已经绑定的任务在发送前由组所在电脑按本次模型重新核对额度;总窗口或该模型专属周窗口耗尽时换电脑,
快照未知时不因额度判断阻塞发送。
-- **冷却**:组内电脑上的任务报用量上限时,这台电脑进入冷却,不再接新任务。重置时刻按
+- **冷却**:组内电脑上的任务报用量上限时,仅该任务模型进入冷却(Claude 按同一模型家族合并别名),其他模型仍可分配;
+ 可信快照显示 5 小时或总周额度耗尽时,仍对所有模型排除这台电脑。重置时刻按
[用量上限自动继续](usage-limit-auto-continue.md) 的口径取(不采用不带时区的钟点);取不到时默认冷却 30 分钟。
冷却不主动迁移这台电脑上正在运行的其他任务;它们自己撞到上限时再按 §6.1 换电脑。
同账号其他电脑直连时撞到用量上限、登录失效或服务繁忙,也报告给组所在电脑冷却那台(报来的重置时刻最多信 8 天);
连不上只由发现它的那台电脑自己在这一轮避开,不替全组判断——可能只是那台电脑自己连不过去;这一轮组里只剩这样的电脑时,
先等它恢复再换(§6.1)。
+ 登录失效、服务繁忙仍是整台电脑的 2 分钟短冷却。未指定模型的组状态只显示总额度与整台电脑的冷却,
+ 按模型查询、发送前检查与分配使用同一模型范围。旧版未记录模型的持久冷却在加载后最多保留 2 分钟;
+ 旧版控制端报告未带模型时也最多冷却 2 分钟,之后依靠实际额度和运行结果重新判断,避免延续旧版误封数天的问题。
- 组内电脑的在线状态、分享状态与模型目录定时核对;不可用的电脑在组里标出原因。
- **组内状态以组所在电脑为准**(2026-10-11 用户确认):组所在电脑有组内每台电脑的状态——在不在线、供应商开没开、提供哪些
模型、在跑几个、是否暂停分配,以及那台账号的问题(用量上限、登录失效、服务繁忙)记下的冷却——同步给所有使用方,使用方
diff --git a/scripts/test-hygiene-baseline.json b/scripts/test-hygiene-baseline.json
index bc883d9856..69e2f8bf7e 100644
--- a/scripts/test-hygiene-baseline.json
+++ b/scripts/test-hygiene-baseline.json
@@ -388,9 +388,6 @@
"apps/desktop/src/main/plugin-publisher/__tests__/host.test.ts": {
"resetModules": 1
},
- "apps/desktop/src/main/provider-group/__tests__/coolingStore.test.ts": {
- "resetModules": 2
- },
"apps/desktop/src/main/provider-group/__tests__/failoverSessionClose.test.ts": {
"sourceReads": 1
},