Skip to content

fix(chat,shell): resolve stop mismatch and enforce workspace venv#4028

Open
argueddd wants to merge 1 commit intoagentscope-ai:mainfrom
MindForge-Harvey:fix/chat-stop-and-venv-only
Open

fix(chat,shell): resolve stop mismatch and enforce workspace venv#4028
argueddd wants to merge 1 commit intoagentscope-ai:mainfrom
MindForge-Harvey:fix/chat-stop-and-venv-only

Conversation

@argueddd
Copy link
Copy Markdown

@argueddd argueddd commented May 4, 2026

Description

修复两个稳定性 bug:

  • 关联issues 4027
  1. 会话中断命中不稳定
    增强 /console/chat/stop 的停止匹配逻辑,支持 chat_id + session_id + session->chat_id 多键兜底,降低“中断无效/会话卡住后无法继续”的概率。

  2. skills Python 解释器选择不稳定
    execute_shell_command 中优先探测并注入工作区 .venv/venv,设置 PATHVIRTUAL_ENV,确保脚本执行优先命中项目虚拟环境。

Related Issue: Fixes #<issue_number>
Security Considerations: 未引入新的高危权限;仅增强 stop 命中与本地 Python 环境选择逻辑。

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

For Channel Changes (DingTalk, Feishu, QQ, Console, etc.)

  • I ran ./scripts/check-channels.sh (or ./scripts/check-channels.sh --changed) and it passes
  • Contract test exists in tests/contract/channels/test_<channel>_contract.py (REQUIRED)
  • Contract test implements create_instance() with proper channel initialization
  • All 19 contract verification points pass (see tests/contract/channels/__init__.py)
  • Optional: Unit tests in tests/unit/channels/test_<channel>.py for complex internal logic

Testing

  1. 启动会话并触发长耗时处理,点击中断,确认 stop 返回 stopped,并可继续发送新消息。
  2. 在 skills 中执行 python,打印 sys.executable,确认落在工作区 .venv
  3. 验证前端 cancel 流程可附带 session_id,后端可输出 tried_keys/active_tasks 便于排查。

Local Verification Evidence

pre-commit run --all-files
# (待补充你的本地执行结果)

pytest
# (待补充你的本地执行结果)

Additional Notes

本 PR 仅聚焦上述两个 bug 修复,不包含其他业务功能变更。

@github-project-automation github-project-automation Bot moved this to Todo in QwenPaw May 4, 2026
@github-actions github-actions Bot added the first-time-contributor PR created by a first time contributor label May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Welcome to QwenPaw! 🐾

Hi @argueddd, thank you for your first Pull Request! 🎉

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.


Tip

⭐ If you find QwenPaw useful, please give us a Star!

Star QwenPaw

Staying ahead

Star QwenPaw on GitHub and be instantly notified of new releases.

Your star helps more developers discover this project! 🐾

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

Labels

first-time-contributor PR created by a first time contributor

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant