Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 修复 review P2 反馈——continuation wake 桥接清空与终末消息轮次复核
Shinku278f5095be07
diff --git a/apps/desktop/src/main/maker-ipc/promptPrediction.ts b/apps/desktop/src/main/maker-ipc/promptPrediction.tsindex 43a9013b1f..9ca02cdd16 100644--- a/apps/desktop/src/main/maker-ipc/promptPrediction.ts+++ b/apps/desktop/src/main/maker-ipc/promptPrediction.ts@@ -217,6 +217,7 @@ export async function generatePromptPrediction(remoteHostId: sessions.remoteHostId,providerId: sessions.providerId,workingDir: sessions.workingDir,+ updatedAt: sessions.updatedAt,}).from(sessions).where(eq(sessions.id, sessionId))@@ -264,6 +265,7 @@ export async function generatePromptPrediction(remoteHostId: sessions.remoteHostId,providerId: sessions.providerId,workingDir: sessions.workingDir,+ updatedAt: sessions.updatedAt,}).from(sessions).where(eq(sessions.id, sessionId))@@ -280,6 +282,10 @@ export async function generatePromptPrediction(// 中止,避免用旧 provider 凭证外发付费调用。if (finalRow.providerId == null && row.providerId != null) return false;if (finalRow.workingDir !== (params.workingDir ?? null)) return false;+ // 终末复核消息轮次:用户在 drain 后、provider/凭证解析期间发送了新消息,+ // touchUserSendInDb 会推进 sessions.updatedAt。若 updatedAt 已变化说明+ // 会话已进入新轮次,当前预测素材已过期,按 fail-closed 中止。+ if (finalRow.updatedAt !== row.updatedAt) return false;return true;} catch {// 复查失败按 fail-closed 处理:宁可漏掉一次推荐,也不在归属不确定时外发付费调用。diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.tsindex 523bae40d4..743863274a 100644--- a/apps/desktop/src/renderer/lib/makerChatStore.ts+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts@@ -5857,7 +5857,7 @@ function handleStatusUpdate(// (pendingTaskWakeDuringTurn),不清除:桥接必须跨过主 turn 自己的 Done 继续// 存活,直到 wake turn 启动或失败。仅靠 agentStatus.isRunning 判断会把「主轮// Done 前 SDK 先推了 isRunning=false 的中间 status」误判成 wake 失败。- pendingTaskWake: isTurnStart ? Math.max(0, state.pendingTaskWake - 1) :+ pendingTaskWake: isTurnStart ? 0 :(isTurnComplete && state.pendingTaskWake > 0 && !state.agentStatus.isRunning && state.pendingTaskWakeDuringTurn === 0) ? 0 :state.pendingTaskWake,// 跨主 turn 标记:主 turn 自己的 Done 越过(标记仍为 true 时到达的首个 Done)后,@@ -5865,7 +5865,7 @@ function handleStatusUpdate(// 时,终态 Done 会因 !pendingTaskWakeDuringTurn 恒为 false 而永远无法清除// pendingTaskWake,会话永久卡在 running/Stop 态。退休只清标记、不清桥接:// 桥接(pendingTaskWake)仍存活,直到 wake turn 真正启动或失败。- pendingTaskWakeDuringTurn: isTurnStart ? Math.max(0, state.pendingTaskWakeDuringTurn - 1) :+ pendingTaskWakeDuringTurn: isTurnStart ? 0 :(isTurnComplete && state.pendingTaskWakeDuringTurn > 0) ? 0 :state.pendingTaskWakeDuringTurn,turnStoppedByUser: isTurnStart ? false : state.turnStoppedByUser,