Skip to content

feat(conversation): implement command queue workflow#1856

Merged
piorpua merged 11 commits intoiOfficeAI:mainfrom
Ericwong5021:feat/conversation-command-queue-pr
Mar 30, 2026
Merged

feat(conversation): implement command queue workflow#1856
piorpua merged 11 commits intoiOfficeAI:mainfrom
Ericwong5021:feat/conversation-command-queue-pr

Conversation

@Ericwong5021
Copy link
Copy Markdown
Contributor

@Ericwong5021 Ericwong5021 commented Mar 28, 2026

Summary

  • Add a full command queue workflow for conversation sessions, so newly submitted commands can be queued instead of being sent immediately while the current turn is still running
  • Introduce a compact Codex-style queue panel with single-line task cards, drag-to-reorder, inline edit, remove, and clear interactions
  • Integrate queue execution control into Codex, ACP, Gemini, Nanobot, and OpenClaw send flows, so queued commands follow a consistent renderer-side scheduling model across supported conversation platforms
  • Harden queue execution around stop/recovery, dequeue timing, persistence restore, invalid payload filtering, and drag interaction edge cases to prevent duplicate dispatch, skipped commands, or stuck queue state
  • Remove deprecated queue controls, obsolete pause/cancel paths, and related i18n leftovers so the final implementation matches the current product behavior and keeps the branch clean

Scope

  • Add shared queue state management, enqueue/dequeue gating, persistence normalization, and execution recovery in useConversationCommandQueue
  • Add a dedicated CommandQueuePanel for queue rendering and user interaction
  • Update sendbox.tsx and platform-specific send boxes so queue behavior is applied consistently in actual conversation send flows
  • Update queue-related conversation locale resources and regenerated i18n typings
  • Add queue logic, DOM interaction, drag behavior, platform integration, and regression coverage for the new workflow

Functional Boundary

  • Included in this PR:
    • Queue commands while the current conversation task is still running
    • Automatically release queued commands one-by-one when the conversation returns to idle
    • Edit pending queued commands before execution
    • Remove a single queued command or clear remaining queued commands
    • Drag-sort pending queued commands in the queue panel
    • Recover correctly when the user manually stops the current output
    • Restore valid queued items from persisted state after reload
  • Not included in this PR:
    • Cross-conversation shared queues
    • Parallel execution of multiple queued commands
    • Queue scheduling across different assistant sessions or windows
    • A persistent pause/resume queue mode
    • Any backend-side global scheduler outside the current renderer conversation flow

Impacted Areas

  • src/renderer/pages/conversation/platforms/useConversationCommandQueue.ts
  • src/renderer/components/chat/CommandQueuePanel.tsx
  • src/renderer/components/chat/sendbox.tsx
  • src/renderer/pages/conversation/platforms/codex/CodexSendBox.tsx
  • src/renderer/pages/conversation/platforms/acp/AcpSendBox.tsx
  • src/renderer/pages/conversation/platforms/gemini/GeminiSendBox.tsx
  • src/renderer/pages/conversation/platforms/nanobot/NanobotSendBox.tsx
  • src/renderer/pages/conversation/platforms/openclaw/OpenClawSendBox.tsx
  • src/renderer/pages/conversation/Messages/hooks.ts
  • src/renderer/services/i18n/locales/*/conversation.json
  • tests/unit/renderer/conversationCommandQueue.test.ts
  • tests/unit/renderer/conversationCommandQueue.dom.test.tsx
  • tests/unit/renderer/conversationCommandQueue.drag.dom.test.tsx
  • tests/unit/sendboxQueue.dom.test.tsx
  • tests/unit/renderer/platformSendBoxes.dom.test.tsx
  • tests/unit/renderer/useGeminiInitialMessage.dom.test.tsx
  • tests/unit/renderer/messageHooks.dom.test.tsx

Test plan

  • Verified commands are enqueued instead of being sent immediately while a conversation is busy
  • Verified queued commands are released strictly one-by-one when the conversation returns to idle
  • Verified drag reorder, inline edit, remove, and clear interactions in renderer DOM tests
  • Verified stop/recovery behavior, including the case where the user manually interrupts output and the next queued command continues correctly
  • Verified invalid persisted queue entries are filtered and valid stored items are normalized on restore
  • Verified blank edits, oversized payloads, duplicate dequeue timing, and burst-send edge cases are covered by tests
  • Verified platform queue integration paths for Codex, ACP, Gemini, Nanobot, and OpenClaw in dedicated DOM tests
  • Verified Gemini initial-message queue-related behavior and message hook regression paths in dedicated tests
  • Verified tsc --noEmit passes locally
  • Verified queue-related Vitest suites pass locally
  • Verified targeted patch coverage for queue-related changes is above the merge target locally

@Ericwong5021 Ericwong5021 changed the title feat(conversation): add command queue workflow feat(conversation): implement command queue workflow Mar 28, 2026
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 29, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 29, 2026

合并冲突(无法自动解决)

本 PR 与目标分支存在冲突,自动 rebase 未能干净解决。请手动 rebase 后重新 push:

git fetch origin
git rebase origin/main
# 解决冲突后
git push --force-with-lease

@piorpua piorpua added bot:needs-human-review Blocking issues — human must intervene and removed bot:reviewing Review in progress (mutex) labels Mar 29, 2026
…d validation

- Added editing functionality to the conversation command queue, allowing users to edit queued commands.
- Implemented validation to prevent empty command inputs and deduplicate files during updates.
- Introduced new i18n strings for editing actions in the zh-TW locale.
- Created a new utility function `assertBridgeSuccess` to handle bridge response validation.
- Added unit tests for the new editing features and bridge success assertions.
- Developed comprehensive DOM tests for the SendBox component, including interaction behaviors and mobile focus handling.
@Ericwong5021 Ericwong5021 force-pushed the feat/conversation-command-queue-pr branch from 7f02e4d to 2c80bcd Compare March 29, 2026 15:44
@piorpua piorpua added bot:reviewing Review in progress (mutex) and removed bot:needs-human-review Blocking issues — human must intervene labels Mar 30, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

Code Review:feat(conversation): implement command queue workflow (#1856)

变更概述

此 PR 为所有支持平台(Codex、ACP、Gemini、Nanobot、OpenClaw)实现了完整的对话命令队列工作流,新增 useConversationCommandQueue 核心 Hook 和 CommandQueuePanel 展示组件,支持排队、拖拽排序、编辑、删除和自动执行。同时增加了 assertBridgeSuccess 工具、更新 i18n 资源,并补充了覆盖主要场景的单元测试和 DOM 测试。


方案评估

结论:✅ 方案合理

方案通过 renderer-side SWR + sessionStorage 实现轻量持久化,与项目架构保持一致,没有跨进程通信的额外复杂度。执行控制采用 ref 跟踪 waiting 状态并结合 executionGateVersion 触发重试的设计有效解决了 stop/recovery 的竞态问题。CommandQueuePanel 组件职责单一,dnd-kit 集成规范。整体方案没有明显设计盲点。


问题清单

🟠 HIGH — sendbox.tsx:isBtwInput 声明未使用

文件src/renderer/components/chat/sendbox.tsx,第 241 行

问题代码

const isBtwInput = enableBtw && btwQuestion !== null;

问题说明:此 PR 删除了 isBtwInput 在 JSX 中的引用(原为 isLoading || (loading && !isBtwInput) 的条件判断),但未同步删除变量声明。oxlint no-unused-vars 已标记此警告。

修复建议:删除第 241 行的 isBtwInput 声明。


🔵 LOW — AcpSendBox.tsx:TMessage 导入未使用(存量问题)

文件src/renderer/pages/conversation/platforms/acp/AcpSendBox.tsx,第 3 行

问题代码

import type { TMessage } from '@/common/chat/chatLib';

问题说明TMessage 在此文件中未被引用,oxlint 已标记。这是 main 分支上的存量问题,本 PR 修改了此文件但未清理。

修复建议:删除该导入行。


汇总

# 严重级别 文件 问题
1 🟠 HIGH src/renderer/components/chat/sendbox.tsx:241 isBtwInput 声明未使用,lint 警告
2 🔵 LOW src/renderer/pages/conversation/platforms/acp/AcpSendBox.tsx:3 TMessage 导入未使用,存量问题

结论

⚠️ 有条件批准 — 存在一处 lint 警告(isBtwInput 未使用变量),处理后可合并。


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

CONCLUSION: CONDITIONAL
IS_CRITICAL_PATH: true
PR_NUMBER: 1856

@piorpua piorpua added bot:ready-to-fix CONDITIONAL review done, waiting for bot fix bot:fixing Fix in progress (mutex) and removed bot:reviewing Review in progress (mutex) bot:ready-to-fix CONDITIONAL review done, waiting for bot fix labels Mar 30, 2026
- Remove unused `isBtwInput` declaration that triggered oxlint no-unused-vars warning

Review follow-up for iOfficeAI#1856
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

PR Fix 验证报告

原始 PR: #1856
修复方式: 直接推送到 feat/conversation-command-queue-pr

# 严重级别 文件 问题 修复方式 状态
1 🟠 HIGH src/renderer/components/chat/sendbox.tsx:241 isBtwInput 声明未使用,触发 oxlint no-unused-vars 警告 删除未使用的变量声明 ✅ 已修复

总结: ✅ 已修复 1 个 | ❌ 未能修复 0 个

🔵 LOW 级别问题(AcpSendBox.tsx TMessage 导入)已跳过(不阻塞合并,存量问题)。

@piorpua piorpua added bot:ready-to-merge Bot done, code is clean — human just needs to confirm and merge and removed bot:fixing Fix in progress (mutex) labels Mar 30, 2026
@piorpua piorpua enabled auto-merge (squash) March 30, 2026 14:37
@piorpua piorpua merged commit e9a72a9 into iOfficeAI:main Mar 30, 2026
12 of 14 checks passed
@Ericwong5021 Ericwong5021 deleted the feat/conversation-command-queue-pr branch March 31, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:ready-to-merge Bot done, code is clean — human just needs to confirm and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants