Skip to content

fix(conversation): prevent queue dequeue before status hydration#1984

Merged
piorpua merged 1 commit intoiOfficeAI:mainfrom
Ericwong5021:fix/queue-status-hydration
Mar 31, 2026
Merged

fix(conversation): prevent queue dequeue before status hydration#1984
piorpua merged 1 commit intoiOfficeAI:mainfrom
Ericwong5021:fix/queue-status-hydration

Conversation

@Ericwong5021
Copy link
Copy Markdown
Contributor

Summary

  • Prevent queued commands from auto-dequeuing before the conversation runtime status is restored after re-entering a conversation
  • Gate queue execution on runtime-status hydration across ACP, Codex, Gemini, Nanobot, and OpenClaw sendboxes
  • Add a regression test for restored queues during the pre-hydration window

Changes

  • Add an optional hydration gate to `useConversationCommandQueue`
  • Restore and pass runtime hydration state from platform send boxes/message hooks before allowing queue dequeue
  • Cover the re-entry timing bug with a DOM test

Test Plan

  • ./node_modules/.bin/oxfmt --check ...
  • ./node_modules/.bin/oxlint ...
  • ./node_modules/.bin/vitest run tests/unit/renderer/conversationCommandQueue.dom.test.tsx
  • ./node_modules/.bin/tsc --noEmit

@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 31, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

Code Review:fix(conversation): prevent queue dequeue before status hydration (#1984)

变更概述

本 PR 解决了切换会话时,命令队列在 runtime 状态(running/aiProcessing)尚未从后端恢复前就开始自动执行的时序 bug。在 useConversationCommandQueue 中新增 isHydrated 门控参数,并在 ACP、Codex、Gemini、Nanobot、OpenClaw 五个平台的 SendBox/message hook 中统一追踪 hydration 状态,传递给队列 hook。同时为各平台 effect 添加了 cleanup cancelled flag 防止组件卸载后更新状态,并新增回归测试。


方案评估

结论:✅ 方案合理

方案直接在队列消费侧增加 hydration 门控,是最小侵入性的修复方式。isHydrated 默认值为 true 保证了向后兼容——未传参的调用方行为不变。五个平台统一采用相同模式(useState(false) → IPC 回调后 setState(true) + cancelled flag cleanup),一致性好。effect cleanup 防止 stale 回调也是正确做法。


问题清单

✅ 未发现明显问题,代码质量良好。


汇总

# 严重级别 文件 问题

结论

  • 批准合并 — 方案合理,实现一致,包含回归测试,无阻塞性问题。

本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1984

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

✅ 已自动 review,无阻塞性问题,正在触发自动合并。

@piorpua piorpua merged commit 010e198 into iOfficeAI:main Mar 31, 2026
14 checks passed
@piorpua piorpua added bot:done Auto-merged by bot and removed bot:reviewing Review in progress (mutex) labels Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants