Skip to content

fix(acp): slash commands not showing during bootstrap#1949

Merged
piorpua merged 1 commit intomainfrom
fix/issue-1882
Mar 30, 2026
Merged

fix(acp): slash commands not showing during bootstrap#1949
piorpua merged 1 commit intomainfrom
fix/issue-1882

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

Summary

  • During ACP agent bootstrap, agent_status stream events are suppressed to prevent sidebar spinner noise, but this also prevents the frontend acpStatus from updating
  • Without acpStatus updates, useSlashCommands never re-fetches after its initial empty result, so the slash command autocomplete menu stays empty
  • Added a dedicated slash_commands_updated IPC event emitted from onAvailableCommandsUpdate that bypasses the bootstrap filter and triggers the frontend to re-fetch commands

Related Issues

Closes #1882

Test Plan

  • Unit tests pass (acpSlashCommandsUpdatedEvent.test.ts)
  • Type check passes
  • Lint and format pass

…mmands after bootstrap

During ACP agent bootstrap, agent_status stream events are suppressed to
prevent sidebar spinner noise. This also prevents the frontend acpStatus
from updating, which means useSlashCommands never re-fetches after the
initial empty result. Users see no slash command autocomplete until after
their first message.

Emit a dedicated slash_commands_updated event from onAvailableCommandsUpdate
that bypasses the bootstrap filter. The frontend handler updates acpStatus
to trigger a re-fetch of slash commands.
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 30, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

Code Review:fix(acp): slash commands not showing during bootstrap (#1949)

变更概述

本 PR 修复 ACP 平台在 bootstrap 阶段 slash 命令不显示的问题。由于 bootstrap 期间 agent_status 流事件被抑制,acpStatus 始终为 null,useSlashCommands 从未触发重新拉取。修复方案在 onAvailableCommandsUpdate 中新增一个专用 slash_commands_updated IPC 事件,绕过 bootstrap 过滤器,前端接收后将 acpStatus 从 null 更新为 'session_active',从而触发 useSlashCommands 重新拉取。涉及 AcpAgentManager.tsuseAcpMessage.ts 及新增的单元测试文件。


方案评估

结论:✅ 方案合理

方案准确定位了根本原因(bootstrap 期间 agent_status 被抑制导致 acpStatus 永远为 null),选用了最小侵入性的修复路径——增加一个专用事件而非修改现有抑制逻辑。前端 setAcpStatus((prev) => prev ?? 'session_active') 的 guard 确保只在 acpStatus 为 null 时才更新状态,避免在正常运行阶段触发不必要的重新渲染;由于 React 的 bail-out 机制,当 prev 非 null 时状态不变,useSlashCommands 不会额外重拉,设计合理。与项目 IPC 架构一致,IResponseMessage.type: string 接口允许新事件类型。


问题清单

无阻塞性问题。


汇总

# 严重级别 文件 问题
未发现问题

结论

批准合并 — 实现正确,测试覆盖了后端发射逻辑及命令去重、过滤边界情况,代码干净无冗余。


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

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

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

@piorpua piorpua merged commit f7ab015 into main Mar 30, 2026
17 checks passed
@piorpua piorpua deleted the fix/issue-1882 branch March 30, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:reviewing Review in progress (mutex)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 自带命令无法启动

2 participants