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): 修复 wake 桥接标记被主 turn Done 清除

Shinkua187363f4ab4
diff --git a/apps/desktop/src/renderer/__tests__/makerChatStoreTaskUpdates.test.ts b/apps/desktop/src/renderer/__tests__/makerChatStoreTaskUpdates.test.ts
index 84e3d11c64..058b22769f 100644
--- a/apps/desktop/src/renderer/__tests__/makerChatStoreTaskUpdates.test.ts
+++ b/apps/desktop/src/renderer/__tests__/makerChatStoreTaskUpdates.test.ts
@@ -302,7 +302,7 @@ describe('pendingTaskWake (唤醒桥接标记)', () => {
expect(completed.pendingTaskWake).toBe(false);
});
- it('turn 还在跑时任务 completed 不置位(无空窗可桥)', () => {
+ it('turn 还在跑时任务 completed 也置位——唤醒桥接不受主 turn 状态影响', () => {
const running = baseState({
agentStatus: { ...EMPTY_SESSION_STATE.agentStatus, isRunning: true },
});
@@ -311,7 +311,7 @@ describe('pendingTaskWake (唤醒桥接标记)', () => {
taskEvent({ taskId: 'task-1', status: 'running', taskType: 'local_agent' }),
);
const completed = handleStreamEvent(started, taskEvent({ taskId: 'task-1', status: 'completed' }));
- expect(completed.pendingTaskWake).toBe(false);
+ expect(completed.pendingTaskWake).toBe(true);
});
it('缺失 taskType(白名单外)不置位——宁可少转不可多转', () => {
diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.ts
index 5f88c32342..319091e9fb 100644
--- a/apps/desktop/src/renderer/lib/makerChatStore.ts
+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts
@@ -5603,10 +5603,11 @@ function handleStatusUpdate(
...state,
// 真实 turn 的起/止都把 side-task 标记复位(它只描述「最近一次 stop」)。
lastStopWasSideTask: false,
- // 真实 turn 的任意 status 都终结唤醒桥接:wake turn 启动(message_start 发
- // isRunning:true)是正常路径;wake turn 秒挂(只来 error + Done)也在这里
- // 收口,防止桥接标记漏网永久撑住 running 快照。skipTurnReset 已提前 return。
- pendingTaskWake: false,
+ // 唤醒桥接:只在 turn 启动(isRunning:true)时清除,不在 turn 完成
+ // (isRunning:false/Done)时清除。主 turn Done 后 wake turn 启动前必须
+ // 保留 pendingTaskWake,让 hasBackgroundAgentWork 阻止 ChatInput 用
+ // 不完整上下文发起预测。wake turn 启动(isRunning:true)时正常清除。
+ pendingTaskWake: isTurnStart ? false : state.pendingTaskWake,
turnStoppedByUser: isTurnStart ? false : state.turnStoppedByUser,
agentStatus: {
status: update.status,