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(chat): 根据失败输入确定续跑资格并保留配置恢复门禁

Dashf50c074496ed
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.ts
index 00a3000f94..29b09aab37 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
@@ -12038,6 +12038,7 @@ describe('AgentInputCoordinator scheduler 排队心跳(review 反馈回归)', ()
await flush();
expect(latestProjection(h.projections).recovery).toBeNull();
+ expect(latestProjection(h.projections).errorCanContinue).toBe(true);
expect(
h.coordinator.hasQueuedItemWhere(sid, (item) => item.clientId === 'c1', {
includeRecovery: true,
@@ -12899,7 +12900,9 @@ describe('AgentInputCoordinator 中断自动续跑', () => {
h.coordinator.abandonAutoResume(sid, truncationMessage, TAKEOVER_INFO.sessionTotal);
- expect(h.coordinator.getProjection(sid)).toMatchObject({ error: truncationMessage, recovery: null });
+ expect(h.coordinator.getProjection(sid)).toMatchObject({
+ error: truncationMessage, recovery: null, errorCanContinue: true,
+ });
expect(h.coordinator.isAutoResumePending(sid)).toBe(false);
expect(h.coordinator.hasQueuedItemWhere(sid, item => item.clientId === 'failed', {
includeRecovery: true,
@@ -12934,12 +12937,40 @@ describe('AgentInputCoordinator 中断自动续跑', () => {
expect(h.coordinator.shouldQueueNewTurn(sid)).toBe(false);
expect(h.coordinator.getProjection(sid).error).toBe(truncationMessage);
+ expect(h.coordinator.getProjection(sid).errorCanContinue).toBe(true);
h.coordinator.enqueue(sid, makeItem('next', 'next hourly run', {
origin: { ...origin, runId: 'run-2' },
}));
await flush();
expect(h.sendToAgent).toHaveBeenCalledTimes(2);
expect(h.sendToAgent.mock.calls[1]?.[1]).toEqual({ type: 'user', content: 'next hourly run' });
+ expect(h.coordinator.getProjection(sid).errorCanContinue).not.toBe(true);
+ });
+
+ // #7119: historical user rows cannot authorize continuation of /compact.
+ // Real coordinator settlement must revoke the previous scheduler eligibility,
+ // for both rejected dispatch and thrown send errors (unit, no real timers).
+ it.each(['rejected', 'thrown'] as const)('does not continue old work after %s compact dispatch', async (outcome) => {
+ vi.useFakeTimers();
+ const h = createHarness();
+ const sid = 'scheduler-then-compact-error';
+ h.setResumableTurnErrorTakeover(TAKEOVER_INFO);
+ await failAfterDispatch(h, sid, makeItem('failed', 'failed heartbeat', {
+ origin: { kind: 'scheduler', scheduleId: 'sch', scheduleName: 'check', runId: 'run' },
+ }));
+ h.coordinator.onTurnEvent(sid, 'done');
+ h.coordinator.abandonAutoResume(sid, truncationMessage, TAKEOVER_INFO.sessionTotal);
+ await vi.advanceTimersByTimeAsync(250);
+ expect(h.coordinator.getProjection(sid).errorCanContinue).toBe(true);
+ h.sendToAgent.mockImplementationOnce(async () => {
+ if (outcome === 'thrown') throw new Error('compact failed');
+ return sessionDispatchFailure('compact failed');
+ });
+ await h.coordinator.compact(sid, makeItem('compact', '/compact').createOpts);
+ const projection = h.coordinator.getProjection(sid);
+ expect(projection.error).toContain('compact failed');
+ expect(projection.errorRetryText).toBeNull();
+ expect(projection.errorCanContinue).not.toBe(true);
});
it.each(['pause', 'interaction', 'running'] as const)(
diff --git a/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts b/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts
index d25c045055..68b2b5e4f9 100644
--- a/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts
+++ b/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts
@@ -766,6 +766,8 @@ interface SessionInputState {
error: string | null;
/** Stable error reason for live projections; null when no terminal error is active. */
errorReason: string | null;
+ /** The failed scheduled input was persisted before its recovery was released. */
+ errorCanContinue: boolean;
/** Bounded structured details for tool-loop terminal errors. */
toolLoop: AgentInputToolLoopDetails | null;
stickyError: string | null;
@@ -903,6 +905,7 @@ function createInitialInputState(
activeTurn: null,
error: null,
errorReason: null,
+ errorCanContinue: false,
toolLoop: null,
stickyError: null,
autoResumePending: null,
@@ -1140,19 +1143,21 @@ function recordPendingTerminalEvent(active: ActiveTurn, event: ActiveTurnTermina
}
function clearErrorProjectionSignals(
- state: Pick<SessionInputState, 'errorReason' | 'toolLoop'>,
+ state: Pick<SessionInputState, 'errorReason' | 'toolLoop' | 'errorCanContinue'>,
): void {
state.errorReason = null;
state.toolLoop = null;
+ state.errorCanContinue = false;
}
function setErrorProjectionSignals(
- state: Pick<SessionInputState, 'errorReason' | 'toolLoop'>,
+ state: Pick<SessionInputState, 'errorReason' | 'toolLoop' | 'errorCanContinue'>,
signals?: Omit<InterruptedTurnErrorSignals, 'message'>,
): void {
state.errorReason =
typeof signals?.reason === 'string' && signals.reason.length > 0 ? signals.reason : null;
state.toolLoop = parseAgentInputToolLoopDetails(signals?.toolLoop) ?? null;
+ state.errorCanContinue = false;
}
function isActiveTurnDispatched(active: ActiveTurn): boolean {
@@ -4024,6 +4029,7 @@ export class AgentInputCoordinator {
if (outcome === 'dropped-scheduler') {
state.error = message ?? state.error;
setErrorProjectionSignals(state, signals);
+ state.errorCanContinue = true;
// **紧随的 done 必须被配对吃掉。**各 agent 的失败收尾都是 terminal error 后再补
// 一个 done;普通用户项靠下方"!active && recovery.kind==='active-turn'"那道守卫
// 挡住它,而 scheduler 项恰恰没有 recovery 可挡 —— done 会一路落到方法尾部的
@@ -4057,6 +4063,7 @@ export class AgentInputCoordinator {
// 限额失败保留 Retry 与等待;其它确定性错误仍交给 runner 收口。
if (schedulerItem && !scheduledQuota) {
state.recovery = null;
+ state.errorCanContinue = true;
this.markPendingExternalTerminalDone(sessionId, state);
this.emit(sessionId);
this.scheduleDrainAfterExternalTurnSettles(
@@ -4506,6 +4513,7 @@ export class AgentInputCoordinator {
queueEditLocks: [...state.queueEditLocks],
queueAbortPending: state.queueAbortPending,
error,
+ ...(error && state.errorCanContinue ? { errorCanContinue: true } : {}),
...(error && state.errorReason ? { errorReason: state.errorReason } : {}),
...(error && state.toolLoop ? { toolLoop: state.toolLoop } : {}),
recovery,
@@ -7108,6 +7116,7 @@ export class AgentInputCoordinator {
// that attempt ends, the runner settles the failed run; keeping Retry
// here would block every later fire (and replay outside run accounting).
this.setActiveTurnRecovery(state, state.recovery.item);
+ state.errorCanContinue = true;
// Reuse normal scheduler failure settlement, including its bounded wait
// for a paired done, so an old terminal cannot clear the next turn.
this.markPendingExternalTerminalDone(sessionId, state);
diff --git a/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx b/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx
index de68a5f360..2cc0441848 100644
--- a/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/errorBannerCodexXaiAuth.test.tsx
@@ -10,6 +10,7 @@ const { useCodexRuntimeRouteMock } = vi.hoisted(() => ({
vi.mock('react-i18next', () => ({
useTranslation: () => ({
+ i18n: { exists: () => true },
// 插值参数拼进返回值,让进度类文案能断言实际传入的 attempt/maxAttempts。
t: (key: string, options?: { attempt?: number; maxAttempts?: number }) =>
options?.attempt && options.maxAttempts
@@ -157,6 +158,8 @@ describe('ErrorBanner overload guidance', () => {
it.each([
{ error: CAPACITY, isRecoverable: true },
{ error: 'thread not found', agentKind: 'codex' as const },
+ { error: '[REMOTE_LOCAL_ONLY_PROVIDER] local provider' },
+ { error: '[DEVICE_LINK_CONTROL_DISABLED] disabled' },
])('does not bypass running or configuration recovery gates: $error', (props) => {
render(createElement(ErrorBanner, {
...props, onRetry: vi.fn(), onContinueAfterError: vi.fn(async () => {}),
diff --git a/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts b/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts
index 04c0adeadc..cbae256a7d 100644
--- a/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts
+++ b/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts
@@ -524,6 +524,21 @@ const flushPromises = async () => {
};
describe('makerChatStore text delta batching', () => {
+ // #7119: UI eligibility must survive the actual projection -> light subscriber
+ // path and disappear when an older host omits the optional field (unit).
+ it('projects host continuation eligibility to light subscribers and revokes missing eligibility', () => {
+ const notify = vi.fn();
+ const unsubscribe = makerChatStore.subscribeLight(SESSION_ID, notify);
+ const failed = projection(SESSION_ID, { error: 'capacity', errorCanContinue: true });
+ onInputProjection?.(failed);
+ expect(makerChatStore.getLightSnapshot(SESSION_ID).errorCanContinue).toBe(true);
+ const afterEligible = notify.mock.calls.length;
+ onInputProjection?.(projection(SESSION_ID, { error: 'capacity' }));
+ expect(makerChatStore.getLightSnapshot(SESSION_ID).errorCanContinue).toBe(false);
+ expect(notify.mock.calls.length).toBeGreaterThan(afterEligible);
+ unsubscribe();
+ });
+
it.each(['local', 'remote'])('retains IM completion provenance through %s ingress and resets it for App turns', (source) => {
if (source === 'remote') remoteProjectsStore.pinSessionOrigin('device-1', SESSION_ID);
const emit = (event: unknown) => {
diff --git a/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx b/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx
index 5419447683..48187b57fd 100644
--- a/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx
+++ b/apps/desktop/src/renderer/components/chat/ErrorBanner.tsx
@@ -27,6 +27,7 @@ import {
isCindyGatewayProxyTokenInvalidError,
isResponsesLiteParallelToolCallsError,
parseAgentErrorCode,
+ requiresAgentErrorConfigurationChange,
} from '@cindy/maker-shared/error-redaction';
import { chatRemoteErrorGuidanceKey } from '@/lib/autoReviewUnavailableGuidance';
import { AlertCircle, Check, Split, Play, RotateCcw, RefreshCw, Timer, Wallet } from 'lucide-react';
@@ -424,7 +425,8 @@ export function ErrorBanner({
const safeRetryText = !hideRetry && retryText ? retryText : null;
const retryAction = safeRetryText
? () => onRetry(safeRetryText)
- : !hideRetry && !isRecoverable ? onContinueAfterError : undefined;
+ : !hideRetry && !isRecoverable && !requiresAgentErrorConfigurationChange(error)
+ ? onContinueAfterError : undefined;
const retryInFlight = useRef(false);
const [retrying, setRetrying] = useState(false);
const handleRetry = async () => {
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
index 28066c1e7e..6ca3b7afd3 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
@@ -1845,6 +1845,7 @@ function CCAgentSessionContent({
cancelUsageLimitWait,
errorIsRecoverable,
errorRetryText,
+ errorCanContinue,
disposedErrorPersistId,
credentialSwitchWait,
continuationInFlightClientId,
@@ -4640,7 +4641,7 @@ function CCAgentSessionContent({
error,
retryText: errorRetryText,
running: isAgentBusy || errorIsRecoverable || !!credentialSwitchWait || syntheticContinuationPending,
- hasUserInput: !!error && messages.some((message) => message.role === 'user'),
+ hostCanContinue: errorCanContinue === true,
});
const handleContinueAfterError = useCallback(async () => {
if (!sessionId || !canContinueError || isHistoryRecoveryPending()) return;
diff --git a/apps/desktop/src/renderer/hooks/useCCAgentChat.ts b/apps/desktop/src/renderer/hooks/useCCAgentChat.ts
index 8321e8eabe..71284a3c62 100644
--- a/apps/desktop/src/renderer/hooks/useCCAgentChat.ts
+++ b/apps/desktop/src/renderer/hooks/useCCAgentChat.ts
@@ -203,6 +203,7 @@ interface UseCCAgentChatReturn {
errorIsRecoverable: boolean;
/** Explicit retry target for ErrorBanner; null means retry is unsafe or unavailable. */
errorRetryText: string | null;
+ errorCanContinue?: boolean;
/** live 终态错误绑定的持久化 error 行 clientId;无则没有 persist 续跑依据。 */
errorPersistId: string | null;
/** 本视图已处置的 persistId;尾部横幅跳过,避免同一错误再弹。 */
@@ -900,6 +901,7 @@ export function useCCAgentChat(
// ErrorBanner 网络分支据此显示「正在自动重试…」而非「可点击重试」。
errorIsRecoverable: !lightState.error && lightState.recoverableError != null,
errorRetryText: lightState.errorRetryText,
+ errorCanContinue: lightState.errorCanContinue,
errorPersistId: lightState.errorPersistId,
disposedErrorPersistId: lightState.disposedErrorPersistId,
credentialSwitchWait: lightState.credentialSwitchWait,
diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.ts
index 34f3ec21a7..fd9b4c2138 100644
--- a/apps/desktop/src/renderer/lib/makerChatStore.ts
+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts
@@ -2645,6 +2645,7 @@ export interface SessionChatState {
* 这里把“能不能重试、重试哪条”收口到 store,避免展示层猜错。
*/
errorRetryText: string | null;
+ errorCanContinue?: boolean;
/**
* 当前 live 终态错误预留的持久化 error 行 clientId。广播 payload.persistId
* 写入;无可靠恢复依据(计划内升级关闭 / 自愈压住)时为 null。同一 turn 的重复
@@ -2960,6 +2961,7 @@ export type SessionChatLightState = Pick<
| 'toolLoop'
| 'recoverableError'
| 'errorRetryText'
+ | 'errorCanContinue'
| 'errorPersistId'
| 'disposedErrorPersistId'
| 'credentialSwitchWait'
@@ -5020,6 +5022,7 @@ function applyInputProjection(
recoverableError:
projection.error || projection.credentialSwitchWait ? null : s.recoverableError,
errorRetryText: projection.errorRetryText,
+ errorCanContinue: projection.errorCanContinue === true,
errorPersistId: projection.error ? s.errorPersistId : null,
credentialSwitchWait: projection.credentialSwitchWait ?? null,
usageLimitWait:
@@ -9970,6 +9973,7 @@ function selectLightState(state: SessionChatState): SessionChatLightState {
toolLoop: state.toolLoop,
recoverableError: state.recoverableError,
errorRetryText: state.errorRetryText,
+ errorCanContinue: state.errorCanContinue,
errorPersistId: state.errorPersistId,
disposedErrorPersistId: state.disposedErrorPersistId,
credentialSwitchWait: state.credentialSwitchWait,
@@ -10022,6 +10026,7 @@ function lightStateEquals(a: SessionChatLightState, b: SessionChatLightState): b
a.toolLoop === b.toolLoop &&
a.recoverableError === b.recoverableError &&
a.errorRetryText === b.errorRetryText &&
+ a.errorCanContinue === b.errorCanContinue &&
a.errorPersistId === b.errorPersistId &&
a.disposedErrorPersistId === b.disposedErrorPersistId &&
a.credentialSwitchWait === b.credentialSwitchWait &&
diff --git a/apps/desktop/src/shared/agentInputQueue.ts b/apps/desktop/src/shared/agentInputQueue.ts
index 7a6d386750..8a1c92a1fc 100644
--- a/apps/desktop/src/shared/agentInputQueue.ts
+++ b/apps/desktop/src/shared/agentInputQueue.ts
@@ -537,6 +537,9 @@ export interface AgentInputProjection {
* resending this string through the normal composer path.
*/
errorRetryText: string | null;
+ /** Host confirms this error belongs to a persisted scheduled input whose recovery ended.
+ * Missing on older hosts means unavailable; never infer it from conversation history. */
+ errorCanContinue?: boolean;
/**
* 凭证切换等待态:发送需要重启共享 codex 进程,但被列出的会话(其它本地 Codex
* 任务)挡住。等待中的那条消息保留在队首,挡路任务结束后 main 自动重发;renderer
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsx
index 0f4a6fa9f1..86c265b864 100644
--- a/apps/mobile/app/sessions/[sessionId].tsx
+++ b/apps/mobile/app/sessions/[sessionId].tsx
@@ -7994,7 +7994,7 @@ function SessionScreenContent({ beforeSessionSwitchRef, newSessionActionRef }: S
running: isSessionStreaming || inputProjection.queueAbortPending
|| !!inputProjection.credentialSwitchWait || inputProjection.pendingQueue.length > 0
|| settlingItemsForRender.length > 0,
- hasUserInput: !!inputProjection.error && messages.some((message) => message.role === 'user'),
+ hostCanContinue: inputProjection.errorCanContinue === true,
});
const continueQueueError = () => {
if (!canContinueError || queueAvailabilityReason || isHistoryRecoveryPending()) return;
diff --git a/apps/mobile/src/__tests__/inputProjection.test.ts b/apps/mobile/src/__tests__/inputProjection.test.ts
index d238848617..0539db1b94 100644
--- a/apps/mobile/src/__tests__/inputProjection.test.ts
+++ b/apps/mobile/src/__tests__/inputProjection.test.ts
@@ -79,6 +79,15 @@ describe('inputProjection', () => {
await i18n.changeLanguage('zh-CN');
});
+ // #7119: only the host may identify a failed input as continuable. Older or
+ // malformed projections must not restart a completed historical task.
+ it('normalizes explicit continuation eligibility without inferring legacy errors', () => {
+ for (const flag of [undefined, false, 'true', 1, true]) {
+ const projection = normalizeInputProjection({ error: 'capacity', errorCanContinue: flag });
+ expect(projection.errorCanContinue).toBe(flag === true);
+ }
+ });
+
it('builds a text-only queued message that matches the desktop coordinator payload shape', () => {
vi.setSystemTime(new Date('2026-01-01T00:00:03.000Z'));
const queued = buildQueuedTextMessage(session(), ' hello mobile ', new Date(), 'q-1');
diff --git a/apps/mobile/src/session/agentErrorI18n.ts b/apps/mobile/src/session/agentErrorI18n.ts
index f632d27550..9ab212e764 100644
--- a/apps/mobile/src/session/agentErrorI18n.ts
+++ b/apps/mobile/src/session/agentErrorI18n.ts
@@ -1,4 +1,5 @@
import { isResponsesLiteParallelToolCallsError, parseAgentErrorCode } from '@cindy/maker-shared/error-redaction';
+export { requiresAgentErrorConfigurationChange } from '@cindy/maker-shared/error-redaction';
import { i18n } from '@/i18n';
export type MobileToolLoopErrorKind = 'consecutive' | 'pingpong' | 'rotation' | 'contract';
@@ -96,12 +97,3 @@ export function remoteActionErrorI18nKey(message: string): string | null {
export function localizeUnclassifiedAgentError(message: string, sessionSource?: unknown): string {
return i18n.t(unclassifiedAgentErrorI18nKey(message, sessionSource));
}
-
-/** Resending unchanged content cannot fix these explicit configuration failures. */
-export function requiresAgentErrorConfigurationChange(message: string): boolean {
- const code = parseAgentErrorCode(message)?.code;
- return code === 'REMOTE_LOCAL_ATTACHMENT_UNSUPPORTED'
- || code === 'REMOTE_COMPAT_MODE_UNSUPPORTED'
- || code === 'REMOTE_LOCAL_ONLY_PROVIDER'
- || code === 'DEVICE_LINK_CONTROL_DISABLED';
-}
diff --git a/apps/mobile/src/session/inputProjection.ts b/apps/mobile/src/session/inputProjection.ts
index 8a298e039c..a1e94869a4 100644
--- a/apps/mobile/src/session/inputProjection.ts
+++ b/apps/mobile/src/session/inputProjection.ts
@@ -102,6 +102,7 @@ export function normalizeInputProjection(value: unknown, fallbackSessionId = '')
toolLoop: parseMobileToolLoopErrorDetails(record?.toolLoop),
recovery: record?.recovery,
errorRetryText: readString(record?.errorRetryText),
+ errorCanContinue: record?.errorCanContinue === true,
autoResumePending: readRecord(record?.autoResumePending),
continuationTurnClientId: readString(record?.continuationTurnClientId),
continuationInFlightProjectionCapability,
diff --git a/apps/mobile/src/session/types.ts b/apps/mobile/src/session/types.ts
index 0c104113bc..788a68db7c 100644
--- a/apps/mobile/src/session/types.ts
+++ b/apps/mobile/src/session/types.ts
@@ -292,6 +292,8 @@ export interface InputProjection {
toolLoop?: MobileToolLoopErrorDetails | null;
recovery?: unknown;
errorRetryText: string | null;
+ /** Explicit failed-turn continuation eligibility; absent on older hosts. */
+ errorCanContinue?: boolean;
autoResumePending?: Record<string, unknown> | null;
/** Current vendor-turn owner for an auto-resume continuation, when supported by the host. */
continuationTurnClientId?: string | null;
diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.md
index 35e04bc09f..596500d1c4 100644
--- a/docs/dev-rules/protocol-compatibility.md
+++ b/docs/dev-rules/protocol-compatibility.md
@@ -1,5 +1,13 @@
# 跨端协议兼容
+## 失败自动任务的人工续跑依据
+
+既有输入队列投影增量携带可选 `errorCanContinue: true`:只由宿主确认当前错误属于
+已落库且已释放恢复记录的自动任务输入。新控制端不再从历史用户消息推断,旧宿主缺省
+该字段时不提供此 fallback;原有 retry token 与历史错误卡仍沿用旧路径。
+旧控制端忽略新增字段。标记仅随当前错误存在,清错、下一轮输入和控制操作失败都会清除,
+不落盘、不保留旧 run,不新增 channel、权限、服务端或原生指纹变更。
+
## 手机经电脑确认群消息已读
群 Remote Resource 投影新增可选 `supportsReadReceipts`,仅云端群声明。
diff --git a/docs/product-rules/core-product-principles.md b/docs/product-rules/core-product-principles.md
index 1c822779a1..a7c6eb443b 100644
--- a/docs/product-rules/core-product-principles.md
+++ b/docs/product-rules/core-product-principles.md
@@ -131,7 +131,8 @@ Cindy 应让用户方便地接入、选择和使用不同 Agent 与模型,同
删除目标以及伙伴、协作工作任务的服务侧生命周期仍遵循各自规则。
自动任务失败后的调度收口,不应取消用户手动继续原任务的入口。原恢复记录已释放、
-任务已停止且有对话上下文时,桌面与手机复用隐藏续跑指令,从失败处继续;不重放旧
+宿主确认该错误属于已落库的自动任务输入且任务已停止时,桌面与手机复用隐藏续跑指令,
+从失败处继续;不能仅凭历史中有用户消息就续跑,`/compact` 等控制操作失败不符合条件。不重放旧
调度、不阻塞下一次定时触发。认证或配置错误仍使用各自的恢复入口,续跑发送失败保留
错误与重试操作。共同判据见 `packages/maker-shared/src/syntheticTrigger.ts` 的
`canContinueFailedTurn`。
diff --git a/packages/maker-shared/src/__tests__/syntheticTrigger.test.ts b/packages/maker-shared/src/__tests__/syntheticTrigger.test.ts
index 25b0ac5f39..07532d6ee4 100644
--- a/packages/maker-shared/src/__tests__/syntheticTrigger.test.ts
+++ b/packages/maker-shared/src/__tests__/syntheticTrigger.test.ts
@@ -12,10 +12,12 @@ import {
describe('synthetic trigger detection', () => {
// Both clients must offer manual continuation for a settled scheduler error,
// but never race ongoing work or fabricate context for a rejected first send.
- it('offers continuation only for a stopped error with conversation context and no retry record', () => {
- const input = { error: 'Selected model is at capacity', retryText: null, running: false, hasUserInput: true };
+ it('requires host-confirmed failed input rather than arbitrary historical context', () => {
+ const input = { error: 'Selected model is at capacity', retryText: null, running: false, hostCanContinue: true };
expect(canContinueFailedTurn(input)).toBe(true);
- for (const patch of [{ error: null }, { retryText: 'original' }, { running: true }, { hasUserInput: false }]) {
+ for (const patch of [{ error: null }, { retryText: 'original' }, { running: true }, { hostCanContinue: false },
+ { error: '[REMOTE_LOCAL_ONLY_PROVIDER] local provider' },
+ { error: '[DEVICE_LINK_CONTROL_DISABLED] disabled' }]) {
expect(canContinueFailedTurn({ ...input, ...patch })).toBe(false);
}
});
diff --git a/packages/maker-shared/src/errorRedaction.ts b/packages/maker-shared/src/errorRedaction.ts
index 67b7f994b9..1a5b7eea7a 100644
--- a/packages/maker-shared/src/errorRedaction.ts
+++ b/packages/maker-shared/src/errorRedaction.ts
@@ -243,3 +243,12 @@ export function parseAgentErrorCode(message: string): { code: string; fallback:
}
return { code: match[1], fallback: match[2] || message };
}
+
+/** Resending unchanged content cannot fix these explicit configuration failures. */
+export function requiresAgentErrorConfigurationChange(message: string): boolean {
+ const code = parseAgentErrorCode(message)?.code;
+ return code === 'REMOTE_LOCAL_ATTACHMENT_UNSUPPORTED'
+ || code === 'REMOTE_COMPAT_MODE_UNSUPPORTED'
+ || code === 'REMOTE_LOCAL_ONLY_PROVIDER'
+ || code === 'DEVICE_LINK_CONTROL_DISABLED';
+}
diff --git a/packages/maker-shared/src/syntheticTrigger.ts b/packages/maker-shared/src/syntheticTrigger.ts
index 367161b08c..6c2e8a2614 100644
--- a/packages/maker-shared/src/syntheticTrigger.ts
+++ b/packages/maker-shared/src/syntheticTrigger.ts
@@ -7,6 +7,8 @@
* 隐藏、会话列表预览排除、排队区显示替代标签。漏一处就会把隐藏英文指令暴露给
* 用户(桌面 review P2 口径,手机端 2026-07 实踩:续跑 prompt 直接显示在会话里)。
*/
+import { requiresAgentErrorConfigurationChange } from './errorRedaction.js';
+
export const UI_ACTION_TRIGGER_PREFIX = '[UI_ACTION_TRIGGER]';
/**
@@ -23,9 +25,10 @@ export function canContinueFailedTurn(input: {
error: string | null;
retryText: string | null;
running: boolean;
- hasUserInput: boolean;
+ hostCanContinue: boolean;
}): boolean {
- return Boolean(input.error && !input.retryText && !input.running && input.hasUserInput);
+ return Boolean(input.error && !input.retryText && !input.running && input.hostCanContinue
+ && !requiresAgentErrorConfigurationChange(input.error));
}
/** 已解析出的 user 文本是否是合成 UI 指令(所有面向用户的文本消费的统一判定)。 */