Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(provider-group): 保留未接管恢复与交接失败的产品回执
guyongd2a2d8823bdc
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.tsindex 2219e88d7d..67f0835cbc 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.ts@@ -11,6 +11,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { admitTaskAction, bindTaskActionInput, taskActionInputGuard } from '../taskActionAuthorization.js';import { AgentInputCoordinator } from '../agent-input-coordinator.js';import { ProviderGroupUsageLimitError } from '../../provider-group/failurePolicy.js';+import { createProviderGroupService, type ProviderGroupServiceDeps } from '../../provider-group/service.js';import { UsageLimitAutoResume, USAGE_LIMIT_MAX_CONSECUTIVE_RESUMES } from '../usageLimitAutoResume.js';import { MCP_APP_MESSAGE_CLIENT_PREFIX, MCP_APP_MESSAGE_GUARD } from '../../mcp-apps/message.js';import { hasAcceptedUserTaskInput } from '../pluginTaskInput.js';@@ -15048,6 +15049,55 @@ describe('provider group computer switch hold', () => {expect(h.onUsageLimitedTurnError).not.toHaveBeenCalled();});+ // Unit regression for #6671 review: use the real remote-binding candidate and+ // async configuration check. The old test's constant candidate never covered+ // autoSwitch=false; usage-limit fallback cannot recover upstream-overload.+ it.each([false, true])('restores overload retry after the remote group declines (pending persist: %s)', async pendingPersist => {+ const sid = 'remote-group-disabled';+ let group!: ReturnType<typeof createProviderGroupService>;+ const h = createHarness({ providerGroupSwitchCandidate: (id, signals) => group.mayHandleTurnError(id, signals) ? 'overload' : null });+ const fallback = vi.fn();+ const remoteRead = vi.fn(async () => ({ strategy: 'least', autoSwitch: false, members: [] }));+ group = createProviderGroupService({+ readBinding: () => ({ providerId: 'codex', memberKey: 'local', groupDeviceId: 'other', at: 1 }),+ remote: { readGroup: remoteRead },+ leaseRecovery: (id: string, token: number) => h.coordinator.leaseUsageLimitRecovery(id, token),+ readResetAt: () => null,+ fallback,+ log: mocks.logger,+ } as unknown as ProviderGroupServiceDeps);+ const takeover = { attempt: 1, maxAttempts: 5, sessionTotal: 1 };+ h.setResumableTurnErrorTakeover(takeover);+ h.setResumableTurnErrorCandidate(isInterruptedTurnError);+ const persisted = deferred<Record<string, never>>();+ if (pendingPersist) mocks.createMessage.mockImplementationOnce(() => persisted.promise);+ const adopted = vi.fn();+ let handling: Promise<void> | undefined;+ h.onUsageLimitedTurnError.mockImplementation((id, signals, _item, token) => {+ handling = group.onTurnError(id, signals, token, {+ notHandled: () => h.coordinator.resumeAfterProviderGroupDeclined(id, token, signals, adopted),+ });+ });+ h.coordinator.enqueue(sid, makeItem('capacity', 'finish the task'));+ await flush();+ h.setRunning(false);+ h.coordinator.onTurnEvent(sid, 'error', 'model at capacity', { reason: 'upstream-overload' });+ if (pendingPersist) persisted.resolve({});+ await flush();+ await handling;+ expect(remoteRead).toHaveBeenCalledExactlyOnceWith('other', 'codex');+ expect(h.onResumableTurnError).toHaveBeenCalledTimes(1);+ expect(adopted).toHaveBeenCalledExactlyOnceWith(1);+ expect(fallback).not.toHaveBeenCalled();+ expect(h.coordinator.getProviderGroupSwitchHoldId(sid)).toBeNull();+ expect(h.coordinator.getProjection(sid)).toMatchObject({ error: null, autoResumePending: takeover });+ expect(h.projections.every(projection => projection.error === null)).toBe(true);+ const token = h.onUsageLimitedTurnError.mock.calls[0]![3];+ // A duplicate/late callback no longer owns that failed turn.+ expect(h.coordinator.resumeAfterProviderGroupDeclined(sid, token, { reason: 'upstream-overload' }, adopted)).toBe(false);+ expect(adopted).toHaveBeenCalledTimes(1);+ });+async function failWhileSwitching(sid: string, cause: 'usage-limit' | 'unavailable' | null = 'usage-limit') {const candidate = vi.fn<NonNullable<AgentInputCoordinatorDeps['providerGroupSwitchCandidate']>>(() => cause,diff --git a/apps/desktop/src/main/maker-ipc/__tests__/autoResumeBookkeeping.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/autoResumeBookkeeping.test.tsindex 870e02e2b8..86626adfa4 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/autoResumeBookkeeping.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/autoResumeBookkeeping.test.ts@@ -512,7 +512,7 @@ describe('退避排期:必可撤销、必只认自己那次', () => {// with its error/Worker capture or a rejected handoff leaves the lane running// forever (PR #6671 review; bot-group-chat.md §4.4). Unit: use real bookkeeping// and hold release; earlier coverage only transferred the Worker terminal.- it.each(['continued', 'rejected'] as const)('transfers all deferred terminals and settles only a rejected handoff: %s', outcome => {+ it.each(['continued', 'rejected', 'declined'] as const)('transfers all deferred terminals and settles only final failure: %s', outcome => {const h = createHarness();const owner = { generation: 3, clientId: 'capacity-turn' };const detail = { reason: 'upstream-overload', message: 'model at capacity' };@@ -543,10 +543,23 @@ describe('退避排期:必可撤销、必只认自己那次', () => {});held.stash('s1', 1, deferred);if (outcome === 'continued') held.discard('s1', 1);+ if (outcome === 'declined') {+ const returned = held.takeForRecovery('s1', 1)!;+ h.book.beginAttempt('s1', 2);+ h.book.stashSuppressedError('s1', returned.detail, 2);+ h.book.stashOrcaSuppressedTerminal('s1', returned.orcaTerminal!);+ h.book.stashBotGroupSuppressedTerminal('s1', returned.groupTerminal!);+ }held.release('s1', 1);held.release('s1', 1);expect(h.orcaFinalized).toEqual(outcome === 'rejected' ? [{ sessionId: 's1', payload: orcaTerminal }] : []);expect(h.groupFinalized).toEqual(outcome === 'rejected' ? [groupTerminal] : []);+ if (outcome === 'declined') {+ h.book.surfaceSuppressedError('s1', { attemptToken: 2 });+ h.book.surfaceSuppressedError('s1', { attemptToken: 2 });+ expect(h.orcaFinalized).toEqual([{ sessionId: 's1', payload: orcaTerminal }]);+ expect(h.groupFinalized).toEqual([groupTerminal]);+ }});it('does not transfer a deferred error that a retry attempt already owns', () => {diff --git a/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts b/apps/desktop/src/main/maker-ipc/agent-input-coordinator.tsindex 6841b405fc..d1f506afb8 100644--- a/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts+++ b/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts@@ -6531,11 +6531,12 @@ export class AgentInputCoordinator {item: AgentInputQueuedMessage,message?: string,signals?: Omit<InterruptedTurnErrorSignals, 'message'>,+ preferProviderGroup = true,): AutoResumeInfo | null {if (!this.deps.onResumableTurnError) return null;// 容量错误已经走到终态:组能接管时直接交接,不再叠加主进程的同机重试。// 其他中断仍先走自愈(如断线后在原电脑恢复);不能交给组的输入也保持原有处理。- if (this.getProviderGroupSwitchCandidate(sessionId, item, message, signals) === 'overload') return null;+ if (preferProviderGroup && this.getProviderGroupSwitchCandidate(sessionId, item, message, signals) === 'overload') return null;try {return (this.deps.onResumableTurnError(sessionId, { ...(signals ?? {}), message }, item) ?? null@@ -6841,6 +6842,33 @@ export class AgentInputCoordinator {return state && isProviderGroupSwitchHoldLive(state) ? state.providerGroupSwitchHold!.id : null;}+ /** A synchronous group candidate was declined by its async configuration/eligibility check. */+ resumeAfterProviderGroupDeclined(+ sessionId: string,+ token: number,+ signals: InterruptedTurnErrorSignals,+ adoptError: (attemptToken: number) => void,+ ): boolean {+ const state = this.states.get(sessionId);+ if (!state || state.activeTurn || !isUsageLimitCandidateCurrent(state, token) || this.isExecutionPaused(sessionId)) return false;+ const recovery = state.recovery;+ const item = recovery?.kind === 'active-turn' ? recovery.item+ : recovery?.kind === 'queue-head' ? state.pendingQueue.find(queued => queued.clientId === recovery.clientId) : null;+ if (!item) return false;+ const takeover = this.notifyResumableTurnError(sessionId, item, signals.message, signals, false);+ if (!takeover) return false;+ state.autoResumePending = takeover;+ state.autoResumeAttemptToken = takeover.sessionTotal;+ state.usageLimitWait = null;+ state.providerGroupSwitchHold = null;+ state.error = null;+ clearErrorProjectionSignals(state);+ // Transfer suppressed details/terminals before observers see the new owner.+ adoptError(takeover.sessionTotal);+ this.emit(sessionId);+ return true;+ }+/*** 换电脑这一趟结束(没换成、交回原有处理,或已不再需要):撤掉那次先不呈现的登记(不传 id 时撤当前的)。* 错误仍是当前状态时投影随即带出红横幅,返回 true;已被续跑或用户接手换掉时只清登记,返回 false。diff --git a/apps/desktop/src/main/maker-ipc/productTurnFailureOwner.ts b/apps/desktop/src/main/maker-ipc/productTurnFailureOwner.tsindex 129072d4a4..a2b30ce637 100644--- a/apps/desktop/src/main/maker-ipc/productTurnFailureOwner.ts+++ b/apps/desktop/src/main/maker-ipc/productTurnFailureOwner.ts@@ -60,6 +60,8 @@ export interface ProductTurnFailureOwner {readonly instanceId: string;readonly generation: number;readonly fingerprint: ProductTurnFailureFingerprint;+ /** The product receipt still belongs to the failed execution after a runtime-only rebuild. */+ readonly originalExecution?: { readonly instanceId: string; readonly generation: number };}export function captureProductTurnFailureOwner(@@ -91,7 +93,7 @@ export interface DeferredProductTurnFailureGate {/** Remove only the exact owner captured by a terminal boundary. */clear(owner: ProductTurnFailureOwner): void;/** Remove owners belonging to a replaced Session instance. */- clearSession(sessionId: string, session?: Session): void;+ clearSession(sessionId: string, session?: Session, options?: { preserveRecovery: boolean }): void;/** Transfer a logical recovery owner to a replacement runtime for the same task. */rebindSession(sessionId: string, session: Session): void;/**@@ -140,7 +142,10 @@ export function createDeferredProductTurnFailureGate(): DeferredProductTurnFailuclear(owner) {removeOwner(owner.sessionId, (pending) => sameOwner(pending, owner));},- clearSession(sessionId, session) {+ clearSession(sessionId, session, options) {+ // A provider-group handoff owns the logical failure across its suppressed+ // close/bootstrap window. Explicit stop/dispatch still clear without a Session.+ if (session && options?.preserveRecovery) return;if (session === undefined) pendingOwners.delete(sessionId);else removeOwner(sessionId, (pending) => pending.session === session);},@@ -154,6 +159,10 @@ export function createDeferredProductTurnFailureGate(): DeferredProductTurnFailu? pending: {...pending,+ originalExecution: pending.originalExecution ?? {+ instanceId: pending.instanceId,+ generation: pending.generation,+ },session,instanceId: session.instanceId,generation: session.getTurnGeneration(),diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex f2e89da3c2..e4970ef7de 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -5831,9 +5831,13 @@ const sessionBindings = createSessionBindingLifecycle<WiredSession, WiredSessionbotCompactRuntimeRefreshCoordinator.clearForClosedSession(session);cancelDirectAbortReconciliation(session.id);pendingFailedTurnAssistantPersistId.delete(session.id);- // An explicit close has no replacement turn to inherit the deferred- // receipt. Retire it before late renderer callbacks can arrive.- deferredProductTurnFailureGate.clearSession(session.id, session);+ // A group recovery owns the logical failure until fallback or real dispatch.+ // Keep it through the exact close/bootstrap transaction, including a failed+ // bootstrap. User stop and a new dispatch still clear all deferred receipts.+ deferredProductTurnFailureGate.clearSession(session.id, session, {+ preserveRecovery: rehydrateCloseSuppression.isSuppressed(session.id) &&+ agentInputCoordinatorHolder?.getProviderGroupSwitchHoldId(session.id) != null,+ });},finalizeClosedSession: (session: WiredSession, context) => {// 关闭前固化 live 用量(见 sessionLastLiveUsage.ts):冷 Pi 切模的窗口核实@@ -5895,7 +5899,7 @@ async function interruptProductTurn(deferredProductTurnFailureGate.clear(owner);if (!isCurrentProductTurnFailureOwner(owner)) return;}- if (owner) notePluginTaskLifecycle(service => service.settle(sessionId, owner, 'failed'));+ if (owner) notePluginTaskLifecycle(service => service.settle(sessionId, owner.originalExecution ?? owner, 'failed'));await interruptUpstreamMergeTurn(sessionId);}@@ -18831,7 +18835,17 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)}, PROVIDER_GROUP_SWITCH_HOLD_MAX_MS);};// 协同 Worker 的终态与 error 行按同一次登记结算:换成了不回报这次异常终止,没换成才回报给 Lead。+ const recoveryOwner = activeOwnerScopeKey();hooks = {+ notHandled: () => recoveryOwner === activeOwnerScopeKey() && inputCoordinator.resumeAfterProviderGroupDeclined(+ sessionId, candidateToken, signals, (attemptToken) => {+ const detail = providerGroupHeldErrors.takeForRecovery(sessionId, holdId);+ if (detail) autoResumeBookkeeping.stashSuppressedError(sessionId, detail, attemptToken);+ const terminal = providerGroupHeldTerminals.takeForRecovery(sessionId, holdId);+ if (terminal?.orcaTerminal) autoResumeBookkeeping.stashOrcaSuppressedTerminal(sessionId, terminal.orcaTerminal);+ if (terminal?.groupTerminal) autoResumeBookkeeping.stashBotGroupSuppressedTerminal(sessionId, terminal.groupTerminal);+ },+ ),beforeFallback: () => releaseProviderGroupHeld(sessionId, holdId),resumed: () => discardProviderGroupHeld(sessionId, holdId),// 先等原电脑恢复时进行中行显示「重新连接中 n/5」,开始换电脑时改回「正在换一台电脑继续」。diff --git a/apps/desktop/src/main/provider-group/__tests__/heldTurnErrors.test.ts b/apps/desktop/src/main/provider-group/__tests__/heldTurnErrors.test.tsindex 0c5481cf34..931c897751 100644--- a/apps/desktop/src/main/provider-group/__tests__/heldTurnErrors.test.ts+++ b/apps/desktop/src/main/provider-group/__tests__/heldTurnErrors.test.ts@@ -7,6 +7,7 @@ import type { Session } from '@cindy/maker-core';import { createProviderGroupHeldTurnErrors } from '../heldTurnErrors';import { AutoResumeBookkeeping } from '../../maker-ipc/autoResumeBookkeeping';+import { createSessionBindingLifecycle } from '../../maker-ipc/sessionBindingLifecycle';import { captureProductTurnFailureOwner, createDeferredProductTurnFailureGate } from '../../maker-ipc/productTurnFailureOwner';interface Row {@@ -45,6 +46,18 @@ const META = { uuid: 'failed-turn' };const ROW: Row = { message: DATA.message, agentMeta: META, capturedAt: 1_000 };describe('provider group held turn errors', () => {+ it.each([false, true])('transfers the suppressed detail to recovery only within its account (account changed: %s)', changed => {+ const { held, deps, switchOwner } = harness();+ held.stash('s1', 1, DATA, META);+ if (changed) switchOwner('other-account');+ expect(held.takeForRecovery('s1', 1)).toEqual(changed ? null : DETAIL);+ expect(held.takeForRecovery('s1', 1)).toBeNull();+ held.release('s1', 1);+ expect(deps.persist).not.toHaveBeenCalled();+ expect(deps.surface).not.toHaveBeenCalled();+ expect(deps.settleFailure).not.toHaveBeenCalled();+ });+it('drops the error row when the task continued on another computer', () => {const { deps, held } = harness();expect(held.stash('s1', 1, DATA, META)).toBe(true);@@ -62,16 +75,36 @@ describe('provider group held turn errors', () => {// persistence leaves a deferred product receipt. Existing release tests only// checked the error row/Island, so the upstream/plugin caller could hang after// all alternate computers failed. Exercise real error transfer and release.- it('settles a transferred deferred product failure once when switching gives up', () => {- const session = { id: 's1', instanceId: 'instance', getTurnGeneration: () => 3 } as unknown as Session;+ it.each(['closed', 'replaced', 'new-dispatch'] as const)('settles the captured product receipt after handoff close, except a new dispatch: %s', outcome => {+ let closed!: () => void;+ const session = {+ id: 's1', instanceId: 'instance', getTurnGeneration: () => 3,+ setInteractionListener: vi.fn(),+ onStatusChange: (listener: (status: string) => void) => { closed = () => listener('closed'); return () => {}; },+ } as unknown as Session;const detail = { message: 'model at capacity', reason: 'upstream-overload' };const owner = captureProductTurnFailureOwner(session, {type: 'error', source: 'codex', data: detail,});const gate = createDeferredProductTurnFailureGate();const failed = vi.fn();+ // Real binding close -> gate teardown -> replacement bind, matching register.+ // The previous regression skipped close and could not expose lost ownership.+ const bindings = createSessionBindingLifecycle({+ log: { warn: vi.fn() }, restoreInteractionListener: vi.fn(), beforeReplace: vi.fn(),+ onBind: (runtime: Session) => gate.rebindSession(runtime.id, runtime),+ broadcastStatus: vi.fn(), captureCloseContext: () => null,+ cleanupClosedSession: vi.fn(), finalizeClosedSession: vi.fn(),+ beforeCloseTeardown: (runtime: Session) => gate.clearSession(runtime.id, runtime, { preserveRecovery: true }),+ });+ const registration = bindings.beginBinding(session)!;+ bindings.attachStatusListener(registration);const settleFailure = (sessionId: string) => {- gate.settle(sessionId, current => current === owner, failed);+ gate.settle(sessionId, current => {+ const bound = bindings.getSession(sessionId);+ return (!bound || bound === current.session) && current.instanceId === current.session.instanceId &&+ current.generation === current.session.getTurnGeneration();+ }, current => failed(current.originalExecution ?? current));};gate.defer(owner);const book = new AutoResumeBookkeeping({@@ -88,10 +121,21 @@ describe('provider group held turn errors', () => {h.held.stash('s1', 1, deferred.detail);expect(failed).not.toHaveBeenCalled();+ closed();+ if (outcome !== 'closed') {+ const replacement = { ...session, instanceId: 'replacement', getTurnGeneration: () => 0 } as Session;+ bindings.beginBinding(replacement);+ }+ if (outcome === 'new-dispatch') gate.clearSession('s1');+h.held.release('s1', 1);h.held.release('s1', 1);book.teardown('s1');- expect(failed).toHaveBeenCalledExactlyOnceWith(owner);+ if (outcome === 'new-dispatch') expect(failed).not.toHaveBeenCalled();+ else {+ expect(failed).toHaveBeenCalledTimes(1);+ expect(failed).toHaveBeenCalledWith(expect.objectContaining({ instanceId: 'instance', generation: 3 }));+ }expect(gate.pending('s1')).toBeUndefined();expect(h.deps.persist).toHaveBeenCalledTimes(1);});diff --git a/apps/desktop/src/main/provider-group/heldTurnErrors.ts b/apps/desktop/src/main/provider-group/heldTurnErrors.tsindex 2c4fe9072a..294a1ec3ea 100644--- a/apps/desktop/src/main/provider-group/heldTurnErrors.ts+++ b/apps/desktop/src/main/provider-group/heldTurnErrors.ts@@ -49,6 +49,8 @@ export interface ProviderGroupHeldTurnErrors {* 重复终态 error 返回 true(只留一行)。*/stash(sessionId: string, holdId: number, data: unknown, agentMeta?: unknown): boolean;+ /** Transfer this failure back to interrupted-turn recovery, without surfacing it. */+ takeForRecovery(sessionId: string, holdId: number): HeldTurnErrorDetail | null;/** 换成了:这次失败不再落库、不再呈现。 */discard(sessionId: string, holdId: number): void;/** 不再换了:撤掉登记并补落;错误仍是当前状态时一并呈现。重复调用无副作用。 */@@ -112,6 +114,11 @@ export function createProviderGroupHeldTurnErrors<Row>(return true;},+ takeForRecovery(sessionId, holdId) {+ const entry = take(sessionId, holdId);+ return entry?.owner === deps.ownerKey() ? entry.detail : null;+ },+discard(sessionId, holdId) {take(sessionId, holdId);deps.releaseHold(sessionId, holdId);diff --git a/apps/desktop/src/main/provider-group/heldWorkerTerminals.ts b/apps/desktop/src/main/provider-group/heldWorkerTerminals.tsindex 5ed429c16d..822ee751a7 100644--- a/apps/desktop/src/main/provider-group/heldWorkerTerminals.ts+++ b/apps/desktop/src/main/provider-group/heldWorkerTerminals.ts@@ -20,6 +20,8 @@ export interface ProviderGroupHeldWorkerTerminalsDeps<T> {export interface ProviderGroupHeldWorkerTerminals<T> {/** 暂存这次终态;同一次登记期间重复的终态也算已暂存(只回报一次)。 */stash(sessionId: string, holdId: number, terminal: T): void;+ /** Transfer the exact held terminal to another recovery owner. */+ takeForRecovery(sessionId: string, holdId: number): T | null;/** 换成了:这次终态不再回报。 */discard(sessionId: string, holdId: number): void;/** 不再换了:回报这次终态。重复调用无副作用。 */@@ -56,6 +58,11 @@ export function createProviderGroupHeldWorkerTerminals<T>(held.set(sessionId, entries);},+ takeForRecovery(sessionId, holdId) {+ const entry = take(sessionId, holdId);+ return entry?.owner === deps.ownerKey() ? entry.terminal : null;+ },+discard(sessionId, holdId) {take(sessionId, holdId);},diff --git a/apps/desktop/src/main/provider-group/service.ts b/apps/desktop/src/main/provider-group/service.tsindex 5eb1c02632..b1acf00072 100644--- a/apps/desktop/src/main/provider-group/service.ts+++ b/apps/desktop/src/main/provider-group/service.ts@@ -315,6 +315,8 @@ export interface ProviderGroupBeforeSendOptions {/** 一次终态错误的处理结局(调用方据此结算换电脑期间先不呈现的那次错误)。 */export interface ProviderGroupTurnErrorHooks {+ /** Async checks declined ownership before switching; true transfers back to interrupted-turn recovery. */+ notHandled?(): boolean;/** 不换了,马上交回原有处理(报错与额度重置后自动继续):先把错误放出来。 */beforeFallback?(): void;/** 已换到另一台电脑(或原电脑恢复后在原电脑)续上了这一轮。 */@@ -1846,6 +1848,7 @@ export function createProviderGroupService(deps: ProviderGroupServiceDeps): Provdeps.log.warn('provider group: automatic switch failed', { sessionId, error: errorText(error) });}if (handled) return;+ if (hooks?.notHandled?.()) return;hooks?.beforeFallback?.();deps.fallback(sessionId, signals, token);},diff --git a/docs/product-rules/provider-groups.md b/docs/product-rules/provider-groups.mdindex a6518aed29..4a1f768055 100644--- a/docs/product-rules/provider-groups.md+++ b/docs/product-rules/provider-groups.md@@ -316,6 +316,8 @@模型容量不足或服务过载(终态错误到达主进程时,组能接管就优先换电脑,不再叠加通用同机自动续跑;Agent 内部已有的有界重试保留);服务报错或超时(偶发一次先由中断自愈在同一台重试,重试用尽才到这里,即「同一台连续失败才算」);以及其他认不出的失败(活动记录写「{原电脑} 出了问题,已换到 {新电脑} 继续」)。+ 远端组随后核对配置、发现自动切换已关闭或不适用时,交回原有中断自愈,并移交暂存错误与终态;+ 已经接管、但组内备用电脑都失败时则照常放出失败,不重新叠加同机重试。- **换时先不先等**:只是连接断了(连续拉不到那台、对方 Cindy 重启后会话没了)先等它恢复,恢复了留在原电脑;可能连不上(读取放弃、分享连不上、太忙)先现读一次,确实连不上才等,连得上就直接换;其余不等。见下面「连不上先等它恢复」。- **记不记进组的状态**:只有那台账号的问题(用量上限、登录失效、服务繁忙)记进组的状态(冷却);连不上、起不来、其他失败只在