fix: WebChat子代理后台结果自动显示#9322
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a polling mechanism in useMessages.ts to periodically fetch session messages when a session is not actively running. The reviewer pointed out that using setInterval for asynchronous polling can lead to overlapping requests and race conditions if responses are delayed. They recommended refactoring the polling logic to use a recursive setTimeout approach instead, ensuring each request completes before the next one is scheduled.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
修复 Issue #9321:在 WebChat 中使用后台子代理执行任务时,后台任务虽然能够完成,结果也已经保存到会话历史,但用户必须再次发送消息才能看到结果。
本次修改让当前 WebChat 会话定期检查新的历史消息,使后台子代理完成后,结果能够自动显示给用户。
Modifications / 改动点
dashboard/src/composables/useMessages.ts。Screenshots or Test Results / 运行截图或测试结果
修改前使用webchat调用后台子代理,图中可见时隔3分钟也没有主动消息发出:

修改后使用webchat调用后台子代理,图中可见在同一分钟内ai主动发出结论:

Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Poll WebChat session messages so background sub-agent results appear automatically in the current conversation.
New Features:
Enhancements: