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(desktop): turn 收尾兜底 + rehydrate 不取消输入 + queue-head recovery 解锁 (#2041)

yand4b2b84f59a9
diff --git a/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts b/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts
index 76cf082302..b7b5e01598 100644
--- a/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts
+++ b/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts
@@ -385,7 +385,28 @@ describe('maker:event hot path ordering', () => {
expect(closedBlock).toContain('gitSnapshotCoordinator?.onSessionClosed(session.id);');
expectOrder(
closedBlock,
- 'agentInputCoordinatorHolder?.onSessionClosed(session.id);',
+ 'agentInputCoordinatorHolder?.onSessionClosed(session.id, {',
+ 'gitSnapshotCoordinator?.onSessionClosed(session.id);',
+ );
+ });
+
+ it('preserves coordinator input boundary inside the rehydrate suppression window (#1930)', () => {
+ const wireSessionSource = extractWireSessionSource();
+ const closedBlock = wireSessionSource.slice(wireSessionSource.indexOf("if (status === 'closed') {"));
+
+ // rehydrate / 凭证切换 close-rebuild 期间同一逻辑会话进程内重建:窗口内
+ // onSessionClosed 传 preserveInputBoundary(true)保留 input boundary(不 abort
+ // 驱动本次重建的 signal → #1930),但**其余清理必须照常执行**(不能整体跳过
+ // onSessionClosed,否则 rebuild 失败/close 后不 rebuild 时 coordinator 残留)。
+ expect(closedBlock).toContain(
+ 'agentInputCoordinatorHolder?.onSessionClosed(session.id, {',
+ );
+ expect(closedBlock).toContain(
+ 'preserveInputBoundary: rehydrateCloseSuppression.isSuppressed(session.id),',
+ );
+ expectOrder(
+ closedBlock,
+ 'agentInputCoordinatorHolder?.onSessionClosed(session.id, {',
'gitSnapshotCoordinator?.onSessionClosed(session.id);',
);
});
diff --git a/apps/desktop/src/main/maker-host/__tests__/withRehydrateCloseSuppressed.test.ts b/apps/desktop/src/main/maker-host/__tests__/withRehydrateCloseSuppressed.test.ts
index 97845bcb8f..8594b8f355 100644
--- a/apps/desktop/src/main/maker-host/__tests__/withRehydrateCloseSuppressed.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/withRehydrateCloseSuppressed.test.ts
@@ -86,6 +86,27 @@ describe('withRehydrateCloseSuppressed', () => {
expect(sideEffect).toHaveBeenCalledTimes(1);
});
+ it('isSuppressed reflects the suppression window (register closed-cleanup guard contract)', async () => {
+ const suppression = createRehydrateCloseSuppression(makeLog());
+ const sideEffect = vi.fn(async () => undefined);
+
+ // 窗口外:未抑制 → register 的 onSessionClosed 会照常执行。
+ expect(suppression.isSuppressed('session-1')).toBe(false);
+ await suppression.runOnCloseSideEffects('session-1', sideEffect);
+ expect(sideEffect).toHaveBeenCalledTimes(1);
+
+ // 窗口内:抑制 → register 跳过 coordinator.onSessionClosed(#1930 修复点)。
+ await suppression.withSuppressed('session-1', async () => {
+ expect(suppression.isSuppressed('session-1')).toBe(true);
+ await suppression.runOnCloseSideEffects('session-1', sideEffect);
+ });
+
+ // 窗口结束:恢复放行。
+ expect(suppression.isSuppressed('session-1')).toBe(false);
+ await suppression.runOnCloseSideEffects('session-1', sideEffect);
+ expect(sideEffect).toHaveBeenCalledTimes(2);
+ });
+
it('releases suppression after timeout', async () => {
vi.useFakeTimers();
const log = makeLog();
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 3913516c5e..db254ea72b 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
@@ -2698,6 +2698,41 @@ describe('AgentInputCoordinator send transaction', () => {
expect(h.onUiRetry).not.toHaveBeenCalled();
});
+ it('ui continue with a queue-head recovery resends the failed head, skips onUiRetry, and drops the synthetic continue', async () => {
+ const h = createHarness();
+ const sid = 'ui-continue-queue-head';
+ h.sendToAgent.mockResolvedValueOnce(hostSendFailure('SEND_FAILED', 'boom'));
+
+ h.coordinator.enqueue(sid, makeItem('q-head', 'never dispatched'));
+ await flush();
+ expect(latestProjection(h.projections).recovery).toEqual({
+ kind: 'queue-head',
+ clientId: 'q-head',
+ });
+
+ // UI「继续」按钮(sendUiTrigger → enqueue CONTINUE_AFTER_ERROR_PROMPT):
+ // 等价 retryLastError 重发队首 A,合成 continue 项不入队/不派发;
+ // queue-head 从未成为 turn,与 retryLastError 同口径**不**发 onUiRetry。
+ h.sendToAgent.mockResolvedValueOnce(sendSuccess());
+ // text 是 CONTINUE_AFTER_ERROR_PROMPT → enqueue 入口 captureOriginalSyntheticTrigger
+ // 自动识别为 'continue'(isUiContinuationItem 判定),无需也不能显式赋值。
+ const continueItem = makeItem('q-continue', CONTINUE_AFTER_ERROR_PROMPT);
+ h.coordinator.enqueue(sid, continueItem);
+ await flush();
+
+ const projection = latestProjection(h.projections);
+ expect(projection.recovery).toBeNull();
+ expect(projection.pendingQueue.map((q) => q.clientId)).toEqual([]);
+ // 第二次派发的是队首 A(never dispatched),不是 continue 项。
+ expect(h.sendToAgent).toHaveBeenCalledTimes(2);
+ expect(h.sendToAgent.mock.calls[1]?.[1]).toEqual({
+ type: 'user',
+ content: 'never dispatched',
+ });
+ // queue-head 从不发 onUiRetry(与 retryLastError 语义一致)。
+ expect(h.onUiRetry).not.toHaveBeenCalled();
+ });
+
it('queue-head retry never substitutes the continue prompt and redrains the original head', async () => {
const h = createHarness();
const sid = 'retry-continue-queue-head';
@@ -2756,9 +2791,9 @@ describe('AgentInputCoordinator send transaction', () => {
expect(h.sendToAgent).toHaveBeenCalledTimes(2);
});
- it('enqueue keeps a queue-head recovery blocked (no silent resend of the failed head)', async () => {
+ it('explicit user input abandons a queue-head recovery and dispatches the new message', async () => {
const h = createHarness();
- const sid = 'enqueue-preserves-queue-head-recovery';
+ const sid = 'enqueue-unlocks-queue-head-recovery';
h.sendToAgent.mockResolvedValueOnce(hostSendFailure('SEND_FAILED', 'boom'));
h.coordinator.enqueue(sid, makeItem('q-head', 'never dispatched'));
@@ -2768,15 +2803,56 @@ describe('AgentInputCoordinator send transaction', () => {
clientId: 'q-head',
});
- // queue-head recovery 语义不变:失败消息还躺在队首,新消息只排队,
- // 不触发对失败队首的静默重发。
+ // 用户显式新输入 = 表态「不重试旧消息」(2026-07-13 口径,与 active-turn 对齐):
+ // 放弃从未 accepted 的队首 A(摘除 + onDiscardedQueuedMessage 可见化),B 正常派发。
+ const discarded: string[] = [];
+ h.onDiscardedQueuedMessage.mockImplementation((_sid, item) => {
+ discarded.push(item.clientId);
+ });
+ h.sendToAgent.mockResolvedValueOnce(sendSuccess());
h.coordinator.enqueue(sid, makeItem('q-second', 'later message'));
await flush();
+ const projection = latestProjection(h.projections);
+ expect(projection.recovery).toBeNull();
+ expect(projection.pendingQueue.map((q) => q.clientId)).toEqual([]);
+ expect(discarded).toEqual(['q-head']);
+ // 新消息 B 派发(而非静默重发 A):sendToAgent 第二次收到的是 B 的正文。
+ expect(h.sendToAgent).toHaveBeenCalledTimes(2);
+ expect(h.sendToAgent.mock.calls[1]?.[1]).toEqual({
+ type: 'user',
+ content: 'later message',
+ });
+ });
+
+ it.each([
+ { kind: 'scheduler', scheduleId: 's1', scheduleName: 's1' } as const,
+ { kind: 'orca', senderLabel: 'worker-1' } as const,
+ ])('automatic input ($kind) does not unlock a queue-head recovery', async (origin) => {
+ const h = createHarness();
+ const sid = `automatic-preserves-queue-head-recovery-${origin.kind}`;
+ h.sendToAgent.mockResolvedValueOnce(hostSendFailure('SEND_FAILED', 'boom'));
+
+ h.coordinator.enqueue(sid, makeItem('q-head', 'never dispatched'));
+ await flush();
+ expect(latestProjection(h.projections).recovery).toEqual({
+ kind: 'queue-head',
+ clientId: 'q-head',
+ });
+
+ // 自动来源(scheduler / orca)不代表用户表态,维持「不清」语义。
+ const autoItem = makeItem(`q-${origin.kind}`, `${origin.kind} prompt`);
+ autoItem.origin = origin as never;
+ h.coordinator.enqueue(sid, autoItem);
+ await flush();
+
const projection = latestProjection(h.projections);
expect(projection.recovery).toEqual({ kind: 'queue-head', clientId: 'q-head' });
+ expect(projection.pendingQueue.map((q) => q.clientId)).toEqual([
+ 'q-head',
+ `q-${origin.kind}`,
+ ]);
expect(h.sendToAgent).toHaveBeenCalledTimes(1);
- expect(projection.pendingQueue.map((q) => q.clientId)).toEqual(['q-head', 'q-second']);
});
it('does not clear a queue-head recovery when compact is requested', async () => {
@@ -2879,6 +2955,60 @@ describe('AgentInputCoordinator send transaction', () => {
expect(h.sendToAgent.mock.calls[1]?.[1]).toEqual({ type: 'user', content: 'next' });
});
+ it('preserveInputBoundary keeps the input signal alive but still clears active state (#1930)', async () => {
+ const h = createHarness();
+ const sid = 'session-close-preserve-input-boundary';
+ const sendStarted = deferred<void>();
+ const sendGate = deferred<AgentInputSendResult>();
+ let capturedSignal: AbortSignal | undefined;
+ h.sendToAgent.mockImplementationOnce(async (_sid, _msg, _createOpts, sendOpts) => {
+ capturedSignal = sendOpts?.signal;
+ sendStarted.resolve();
+ return sendGate.promise;
+ });
+
+ // 发送进行中(activeTurn 非空,持有 input boundary signal)。
+ const sendPromise = h.coordinator.enqueue(sid, makeItem('q-1', 'first'));
+ await sendStarted.promise;
+ await flush();
+ expect(h.sendToAgent).toHaveBeenCalledTimes(1);
+
+ // rehydrate 窗口内 close:preserveInputBoundary=true → signal 不被 abort。
+ h.coordinator.onSessionClosed(sid, { preserveInputBoundary: true });
+ await flush();
+ expect(capturedSignal?.aborted).toBe(false);
+
+ // 但其余清理照常:activeTurn 已清,新消息可排队。
+ h.sendToAgent.mockResolvedValueOnce(sendSuccess());
+ h.coordinator.enqueue(sid, makeItem('q-2', 'second'));
+ sendGate.resolve(sendSuccess());
+ await sendPromise;
+ await flush();
+ expect(h.sendToAgent).toHaveBeenCalledTimes(2);
+ });
+
+ it('aborts the input boundary on plain session close (no preserve flag)', async () => {
+ const h = createHarness();
+ const sid = 'session-close-aborts-input-boundary';
+ const sendStarted = deferred<void>();
+ let capturedSignal: AbortSignal | undefined;
+ h.sendToAgent.mockImplementationOnce(async (_sid, _msg, _createOpts, sendOpts) => {
+ capturedSignal = sendOpts?.signal;
+ sendStarted.resolve();
+ return new Promise<AgentInputSendResult>(() => undefined); // 永不 resolve
+ });
+
+ h.coordinator.enqueue(sid, makeItem('q-1', 'first'));
+ await sendStarted.promise;
+ await flush();
+ expect(capturedSignal?.aborted).toBe(false);
+
+ // 普通 close(无 preserve)→ abort input boundary。
+ h.coordinator.onSessionClosed(sid);
+ await flush();
+ expect(capturedSignal?.aborted).toBe(true);
+ });
+
it('releases compact active turn when close races before dispatch outcome', async () => {
const h = createHarness();
const sid = 'compact-close-before-dispatch-outcome';
@@ -3118,9 +3248,9 @@ describe('AgentInputCoordinator send transaction', () => {
);
});
- it('does not auto-retry a failed queue head from later enqueue or Cancel', async () => {
+ it('abandons a failed queue head on explicit user enqueue and dispatches the new message', async () => {
const h = createHarness();
- const sid = 'send-rollback-blocks-auto-drain';
+ const sid = 'send-rollback-user-input-unlocks';
const first = makeItem('q-1', 'first');
const second = makeItem('q-2', 'second');
@@ -3130,14 +3260,20 @@ describe('AgentInputCoordinator send transaction', () => {
await flush();
h.coordinator.clearError(sid);
+ h.sendToAgent.mockResolvedValueOnce(sendSuccess());
h.coordinator.enqueue(sid, second);
await flush();
const projection = latestProjection(h.projections);
- expect(h.sendToAgent).toHaveBeenCalledTimes(1);
+ // 用户显式新输入 = 表态「不重试旧消息」:放弃 q-1,派发 q-2。
+ expect(h.sendToAgent).toHaveBeenCalledTimes(2);
expect(projection.error).toBeNull();
- expect(projection.recovery).toEqual({ kind: 'queue-head', clientId: 'q-1' });
- expect(projection.pendingQueue.map((q) => q.text)).toEqual(['first', 'second']);
+ expect(projection.recovery).toBeNull();
+ expect(projection.pendingQueue.map((q) => q.text)).toEqual([]);
+ expect(h.onDiscardedQueuedMessage).toHaveBeenCalledWith(
+ sid,
+ expect.objectContaining({ clientId: 'q-1' }),
+ );
});
it('ignores late done wakeups after a pre-accept rollback', async () => {
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 2dd0ad6a4e..b089018960 100644
--- a/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts
+++ b/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts
@@ -1310,7 +1310,15 @@ export class AgentInputCoordinator {
this.cancelPreparedAutoResume(sessionId, state);
}
if (isUiContinuationItem(item)) {
- this.deps.onUiRetry?.(sessionId, item.clientId, 'manual');
+ // queue-head recovery 时**跳过** onUiRetry:那条消息在派发前就失败了,
+ // 从未成为一个 turn,与之前失败的 hook turn 无关(与 retryLastError 对
+ // queue-head 刻意不发 onUiRetry 的语义一致,见 performRetryLastError 注释)。
+ // 下方 queue-head 特判分支会清 recovery 重发队首 A,合成 continue 项不入队;
+ // 若在这里发 onUiRetry(无论用哪个 clientId)会让无关的排队桌面消息认领
+ // 并改写旧 hook/channel 的待续跑记账。
+ if (state.recovery?.kind !== 'queue-head') {
+ this.deps.onUiRetry?.(sessionId, item.clientId, 'manual');
+ }
} else if (automaticOrigin && !schedulerOrigin) {
this.deps.onAutomaticEnqueue?.(sessionId);
} else if (!automaticOrigin) {
@@ -1341,6 +1349,53 @@ export class AgentInputCoordinator {
this.abandonActiveTurnRecoveryForUserAction(state);
this.clearErrorUnlessQueueHeadBlocked(state);
}
+ // —— queue-head recovery 解锁(2026-08 事故复盘)——
+ // queue-head recovery 表示队首消息从未跨过 accepted 边界(派发前失败 /
+ // cancelled-before-dispatch)。getDrainableHead 见 recovery 即返回 null,
+ // 队列永久静止,后续所有消息(含用户新输入)全部排队不派发。
+ // 用户显式动作按 2026-07-13 口径表态(与 active-turn 对齐:「新消息 = 不重试旧消息」):
+ // - 普通新消息(composer 直发,非 scheduler/orca/自愈续跑):放弃从未 accepted
+ // 的队首消息 A(摘除 + 清理回调),让 B 正常派发——无静默重发、无静默丢失;
+ // - UI 续跑(「继续」按钮,sendUiTrigger):等价 retryLastError——清 recovery
+ // 重发队首 A(原样重发是既有 retryLastError 对 queue-head 的语义),合成
+ // continue 项不入队,避免 A 与 continue 双发。
+ // 自动来源(scheduler / orca)与 resume(继续队列)维持既有「不清」语义:
+ // 自动化项不代表用户表态,resume 是机械放行,显式点重试/删除仍是唯一出路。
+ if (state.recovery?.kind === 'queue-head' && !automaticOrigin) {
+ const abandonedClientId = state.recovery.clientId;
+ if (isUiContinuationItem(item)) {
+ state.error = null;
+ state.stickyError = null;
+ state.recovery = null;
+ log.info('ui continue resets queue-head recovery; resending failed head', {
+ sessionId,
+ clientId: abandonedClientId,
+ });
+ // 手动「继续」是真人介入,与 retryLastError 同口径刷新 userSendAt(否则
+ // 会话活跃信号 / 列表排序不会反映这次人工动作)。
+ this.touchUserSend(sessionId, opts?.sendAtMs);
+ this.emit(sessionId);
+ this.scheduleDrain(sessionId, 'ui-continue-queue-head-unlock');
+ return this.getProjection(sessionId);
+ }
+ const abandoned = state.pendingQueue.find((q) => q.clientId === abandonedClientId);
+ if (abandoned) {
+ state.pendingQueue = state.pendingQueue.filter((q) => q.clientId !== abandonedClientId);
+ this.removePendingCompactWaitClientId(state, abandonedClientId);
+ // 与 remove() 同口径:摘除消息时同步清其 edit lock,否则留下指向不存在
+ // clientId 的孤儿锁,shouldQueueNewTurn 会把后续新输入误导向排队。
+ state.queueEditLocks = state.queueEditLocks.filter((id) => id !== abandonedClientId);
+ this.deps.onDiscardedQueuedMessage?.(sessionId, abandoned);
+ // 脱敏:只记 id/布尔,不记消息文本(白名单方向,见 log-upload-and-redaction)。
+ log.info('explicit user input abandoned queue-head message (never accepted)', {
+ sessionId,
+ clientId: abandonedClientId,
+ });
+ }
+ state.error = null;
+ state.stickyError = null;
+ state.recovery = null;
+ }
// 用户点「继续任务」表达的是恢复刚才中断/失败的 turn,必须先于此前
// 已排队的新任务执行;普通 composer / Orca / scheduler 输入仍保持 FIFO。
// 复用 prepend helper 同时把本项加入 pending compact 的等待集合,避免
@@ -2720,7 +2775,17 @@ export class AgentInputCoordinator {
this.scheduleDrain(sessionId, 'turn-done');
}
- onSessionClosed(sessionId: string): void {
+ /**
+ * @param opts.preserveInputBoundary 为 true 时跳过 abortInputBoundary。
+ * 用于 rehydrate / 凭证切换 close-rebuild 窗口:abort 会取消驱动本次重建的
+ * input signal(#1930),但**其余清理必须照常**(activeTurn / steer / queue
+ * 状态不能残留,否则 rebuild 失败或 close 后不 rebuild 时 coordinator
+ * 残留旧状态阻塞后续发送)。
+ */
+ onSessionClosed(
+ sessionId: string,
+ opts?: { preserveInputBoundary?: boolean },
+ ): void {
const state = this.getState(sessionId);
this.supersedePendingAutoResumeRecoveries(sessionId);
const releasedAbortLock = state.queueAbortPending;
@@ -2728,7 +2793,7 @@ export class AgentInputCoordinator {
this.clearAbortReconcileRetry(state);
this.clearSessionRunningRetry(state);
this.clearPendingExternalTerminalDone(state);
- this.abortInputBoundary(sessionId);
+ if (!opts?.preserveInputBoundary) this.abortInputBoundary(sessionId);
this.abortSteerTransactions(sessionId);
const active = state.activeTurn;
if (active && !isActiveTurnDispatched(active)) {
diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.ts
index 56d94fc994..4939abeca8 100644
--- a/apps/desktop/src/main/maker-ipc/register.ts
+++ b/apps/desktop/src/main/maker-ipc/register.ts
@@ -286,7 +286,10 @@ import {
applyNewMakerWorktreeBranchPreference,
getNewMakerWorktreeBranchPreference,
} from '../maker-host/newMakerWorktreeBranchPreferenceCache.js';
-import { withRehydrateCloseSuppressed } from '../maker-host/rehydrateCloseSuppression.js';
+import {
+ rehydrateCloseSuppression,
+ withRehydrateCloseSuppressed,
+} from '../maker-host/rehydrateCloseSuppression.js';
import { handleCloseSessionRequest } from './closeSessionRequest.js';
import {
createOrcaIdleReleaseWatcher,
@@ -3430,6 +3433,15 @@ export function wireSessionToIpc(session: ReturnType<Maker['getSession']>): void
let shouldMarkTurnStatusIdleAfterBroadcast = false;
let shouldMarkTurnTerminalIdleAfterBroadcast = false;
const isContinuationBoundary = isTurnContinuationBoundaryEvent(event);
+ // 探针:continuation 边界命中会跳过 status idle / ended 写 / tracker idle,
+ // 若 claim 悬挂会导致 UI 永久「正在生成」。区分「claim 悬挂」与「done 未到达」。
+ if (isContinuationBoundary && (event.type === 'done' || event.type === 'status')) {
+ log.debug('turn continuation boundary event skipped from turn-finalize', {
+ sessionId: session.id,
+ eventType: event.type,
+ turnContinuationId: event.turnContinuationId,
+ });
+ }
if (event.type === 'account_usage' && event.source === 'codex' && !session.remoteHostId) {
pendingCodexAccountUsageSnapshot = event.data;
}
@@ -4634,7 +4646,16 @@ export function wireSessionToIpc(session: ReturnType<Maker['getSession']>): void
// 补发会把用户关掉的会话重新拉起来),后者会把结果错绑到下一个会话实例(codex P1)。
interruptedTurnAutoResumeGuard.noteSessionReset(session.id);
autoResumeBookkeeping.teardown(session.id);
- agentInputCoordinatorHolder?.onSessionClosed(session.id);
+ // rehydrate / 凭证切换 close-rebuild 窗口:同一逻辑会话进程内重建,
+ // 协调器状态应连续。窗口内保留 input boundary(不 abort,避免取消
+ // 驱动本次重建的 signal → #1930 cancelled-before-dispatch),但
+ // **其余清理必须照常执行**(activeTurn / steer / queue 状态不能残留,
+ // 否则 rebuild 失败或 close 后不 rebuild 时 coordinator 残留旧状态
+ // 阻塞后续发送)。其余清理(凭证切换 / git snapshot / Orca hydration
+ // 标记 / wiring teardown)照常。
+ agentInputCoordinatorHolder?.onSessionClosed(session.id, {
+ preserveInputBoundary: rehydrateCloseSuppression.isSuppressed(session.id),
+ });
// 会话关闭:兑现延迟凭证切换(直接写 route),并唤醒被它挡住的等待者。
pendingCredentialSwitchHolder?.onSessionClosed(session.id);
deferredCodexRestartHolder?.onSessionSettled();
diff --git a/packages/maker-core/src/agents/claude-code/index.ts b/packages/maker-core/src/agents/claude-code/index.ts
index 62e3a2278c..1a2fec2336 100644
--- a/packages/maker-core/src/agents/claude-code/index.ts
+++ b/packages/maker-core/src/agents/claude-code/index.ts
@@ -3118,6 +3118,16 @@ export class ClaudeCodeAgent extends BaseAgent {
continuationClaims.set(claim.id, claim);
activeContinuationId = claim.id;
event.turnContinuationId = claim.id;
+ // 探针:claim 创建是「continuation 悬挂」vs「done 未到达」的关键区分点。
+ // 只记 id / taskId / state 枚举,不记消息文本与 task prompt(脱敏红线)。
+ log.info('turn continuation claim created', {
+ continuationId: claim.id,
+ carriedTasks: [...carriedTasks.entries()].map(([taskId, state]) => ({
+ taskId,
+ state,
+ })),
+ wasActiveContinuation,
+ });
return false;
};
const reconcileActiveContinuation = (): ContinuationClaim | null => {