Skip to content

fix(cowork): 切换 Agent 时自动清空主页输入框内容#1707

Open
gongzhi-netease wants to merge 2 commits into
netease-youdao:mainfrom
gongzhi-netease:fix/agent-switch-clear-input
Open

fix(cowork): 切换 Agent 时自动清空主页输入框内容#1707
gongzhi-netease wants to merge 2 commits into
netease-youdao:mainfrom
gongzhi-netease:fix/agent-switch-clear-input

Conversation

@gongzhi-netease

Copy link
Copy Markdown

问题描述

在主页输入框输入内容后,切换到另一个 Agent,输入框中的文字和附件没有被自动清空。

复现步骤:

  1. main Agent 主页输入框输入内容(如 "111")
  2. 点击左侧切换到 Architect 或其他 Agent
  3. 输入框仍然显示之前输入的 "111"

根因分析:
输入框草稿存储在 Redux draftPrompts['__home__'] 中,所有 Agent 的主页共享同一个 key '__home__'switchAgent 方法中只调用了 clearCurrentSession() 清空会话状态,没有清空草稿内容。此外,CoworkPromptInput 组件的本地 state 同步逻辑仅在 draftKey 变化时触发,而切换 Agent 前后 draftKey 始终是 '__home__',导致即使 Redux 被清空,组件本地的输入值也不会更新。

影响:

  • 残留内容可能被提交给语义不匹配的新 Agent(如将"架构评审"的提示词发给"QA"Agent)
  • 残留附件(图片/文件)可能被无意中提交给不相关的 Agent
  • 用户体验上容易误以为仍在与之前的 Agent 对话

When switching agents, the draft prompt and attachments in the home input box were not cleared, causing residual content from the previous agent to persist. This could lead to semantic mismatch when the user submits to a different agent.
@github-actions

Copy link
Copy Markdown

This pull request has been inactive for 30 days. It will be automatically closed in 14 days unless there is new activity.

If you're still working on this, please leave a comment or push new commits to keep it open. Thank you!

@github-actions github-actions Bot added the stale label May 19, 2026
@gongzhi-netease

Copy link
Copy Markdown
Author

Keep the open state.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant