Skip to content

[P1][产品] 点击 Copilot 建议问题应发送选中文字,避免读取旧输入状态 #329

Open

Description

@helsome

用户场景

首次进入 Copilot 的用户点击建议问题,期待启动对应研究;已有草稿时也不应误发旧草稿。

代码审计发现

AgentPanel handleSend 读取当前 render 闭包中的 input;建议 onPick 先 setInput(text) 再立即 handleSend()。React 状态更新不会改变这个旧闭包,可能只填入而未运行,或发送旧草稿。

这是源码推演,尚未执行真实组件交互复现;实现前先加入下面的行为测试。

最小范围

明确选择“一键发送”或“仅填入供编辑”。若维持当前一键发送意图,发送函数显式接收选中 text,不依赖刚 set 的状态;普通手动发送逻辑保持。

验收

  • 空会话点击建议,恰好一次 startRun,参数为选中文字。
  • 输入框有草稿时点击另一建议,不得发送旧草稿。
  • loading 时不重复启动;失败保留选中问题便于重试。
  • 测试真实渲染组件交互,而非仅测试独立字符串函数。

不同于 #34 已发送消息的编辑/重试/分支,聚焦首次提问入口。

Activity

  1. RXQ6 commented on Oct 18, 2026

    @RXQ6
    Contributor

    assign

  2. RXQ6 commented on Oct 18, 2026

    @RXQ6
    Contributor

    认领

  3. added
    claimed
    on Oct 18, 2026
  4. github-actions commented on Oct 18, 2026

    @github-actions

    @RXQ6 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #329。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions