Repository navigation
Conversation
Zh-XuH40
marked this pull request as ready for review
October 10, 2026 08:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
执行长时间 shell 命令时点击停止,Agent 的异步等待被取消,但默认
aexecute()在线程中运行的同步 GEM 请求仍可持续到原始超时。runtime 删除等待代理请求排空,同一会话的新消息继续排队;前端轮询只看到 Run 已终态,会提前显示结束。bug-fix。主要改动:异步创建独立 shell session、启动命令并以短请求等待;取消先收敛启动再显式 kill,并处理重复取消。provisioner 锁等待最多 5 秒,忙碌返回可重试 503;等待 pin 时取消也归还晚取得的 pin。健康检查独立于同步线程池。当前运行接口和 Web 看门狗/断线/刷新恢复保留尚未清理的终态 Run。清理日志补齐 Run 身份和 traceback。
工程主张与 Owner
ProvisionerSandboxBackend.aexecute()与_terminate_command()拥有;硬超时缺少退出码时报告失败码 124。SandboxOperationPins拥有;失败的并发删除不能释放其他删除者的栅栏。runtime_cleanup_pending继续拥有持久清理意图。终态事务可先于 runtime 删除;只有清理成功后才解除同一会话 FIFO fence、发布end。useAgentRunStream消费这项数据库事实;HTTP、数据库、generation、PID/文件和 Redis 事件是观察边界。验证情况
取消传递与结果投影
python -m pytest test/unit/backends/test_sandbox_command_cancellation.py test/unit/backends/test_sandbox_provisioner_config.py test/unit/services/test_agent_run_service.py test/unit/services/test_run_worker.py -q,198 项通过;node --test test/unit/agentRequestQueue.test.js,36 项通过。繁忙删除有界,其他 runtime 和健康检查可用
python -m pytest test/integration/services/test_sandbox_cancel_lifecycle.py -k busy_proxy -q和-k health_responds -q各 1 项通过。使用真实 GEM/HTTP:繁忙删除返回 503 后,其他沙盒继续执行;同步线程池全部占用时健康检查仍响应。完整取消与 FIFO 清理链路
test_http_stop_kills_gem_before_worker_releases_fifo,在 PostgreSQL 隔离 Schema 中验证实际 PID、文件、清理标记、lease、generation 和 end 事件。当前上游 PostgreSQL 环境未提供,暂未运行该用例。通用检查
python -m pytest test/unit -m "not slow" -q,2520 项通过;python scripts/verify_engineering_contracts.py,检查 184 份文档;python -m unittest scripts.test_verify_engineering_contracts,63 项通过;改动文件 Ruff check、Web ESLint、Vite build、VitePress build 与独立索引git diff --check通过。简化 / 删除验收
不涉及。
独立语义 Review
Not run:尚无全新上下文 Reviewer 的独立结论。此 PR 拟以 Draft 提交,等待独立语义审查和完整运行链路验证;测试结果不能代替独立代码 Review。
未验证范围与风险
main复现,位于agentRuntimeConfigVisibility.test.js、chatStartScreen.test.js和modelProviderSaveActions.test.js。这些文件与其业务实现不在本 PR 修改范围。事故反馈
长命令取消后 runtime 清理阻塞。记录已确认的长调用残留和清理阻塞,并区分没有现场线程栈支持的线程池耗尽推断;包含 reproducer、直接 oracle、负向案例和未验证范围。
界面变更
调整运行状态与恢复行为,无布局或视觉样式变化。截图/录屏为 Not run。
关联事项
无。已搜索上游相关 sandbox/cancel PR。
补充说明
补丁基于官方
main的031e2c72681edb8f95f71b60ceb66881f7915b8d,范围为沙盒命令取消、runtime 清理、运行状态投影及对应测试和文档。保持该基线的 PostgreSQL 与 SDK 依赖,无 schema、迁移或新增产品依赖。后端全量初次运行 2517 项通过,3 项因复用运行环境缺少上游声明的
xlrd而失败;将锁定版本xlrd==2.0.2安装到独立临时测试目录后,全量复验 2520 项通过。测试目录通过PYTHONPATH装配,没有修改正在运行的应用依赖。