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): 预测门禁 device-link 归属未决时 fail-closed

Shinku637c8f644f5f
diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
index 159fffc5bf..ee2bf5bbc7 100644
--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
@@ -1182,13 +1182,13 @@ export function ChatInput({
wasTurnStoppedByUserRef.current = false;
}
// device-link 远程会话 & SSH 远程会话:maker:predict-prompt 不在 allowlist,且远程对话内容
- // 不应送到控制端本地 provider/凭证 —— 跳过预测。deviceLinkDeviceId 为 null(已确认
- // 本地会话)或 undefined(所有权未解析)时允许预测,非空字符串(远程会话)时拦截。
- // deviceLinkDeviceId 语义(来自 CCAgentSessionView):
+ // 不应送到控制端本地 provider/凭证 —— 跳过预测。deviceLinkDeviceId 语义(来自
+ // CCAgentSessionView):
// null = 已确认本地会话 → 允许预测
- // undefined = 所有权尚未解析 → 允许预测(remoteHostId 门禁会拦截 SSH 远程)
- // string = 远程会话 → 被下面 !deviceLinkDeviceId 拦截
- if (wasRunning && !showStopButton && recommendationEnabled && sessionId && !deviceLinkDeviceId && !remoteHostId) {
+ // undefined = 所有权尚未解析 → 跳过预测(device-link 引导/重连窗口期归属未定,
+ // 远程转写可能被误送到本地 provider,故 fail-closed)
+ // string = 远程会话 → 被下面 deviceLinkDeviceId === null 拦截
+ if (wasRunning && !showStopButton && recommendationEnabled && sessionId && deviceLinkDeviceId === null && !remoteHostId) {
// 当 composer 被禁用时(如 reviewer 任务完成后 read-only),不应触发
// 预测:用户无法 Tab 填入或发送,发起 provider 调用是浪费。
// 读取 disabled prop 而非 disabledRef:disabledRef 由后续 effect 刷新,