Repository navigation
支持同一 Run 内等待沙盒长命令 - #1225
Open
xerrors wants to merge 2 commits into
Open
支持同一 Run 内等待沙盒长命令#1225xerrors wants to merge 2 commits into
xerrors wants to merge 2 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
简介
构建和测试等命令可能长于一次模型工具调用的等待窗口。智能体在命令继续执行时可以推进独立工作,并通过
wait_command取得原命令的真实结果。execute在约 10 秒内已取得终态时直接返回结果。长命令返回命令 ID、执行状态和最近输出。只要同一 Run 还有待领取结果,运行图就暂缓发布模型正文。模型提前作答时,运行图要求通过新的工具调用读取命令结果。具体改动与影响
实现依据与设计取舍
关键行为与实现边界
执行器负责进程、期限和退出事实。Run attempt 负责同一次执行的等待与回收。工具审计的启动许可在 PostgreSQL 提交后才交给执行器。模型草稿在公开 item 写入前拦截。 工具审计 沙盒机制
决策记录
执行限定在原 Run 内,通过新工具调用领取结果。已知无法强制指定工具的模型沿用同步入口。兼容网关无法返回有效调用时,Run 失败并执行原有清理。 决策记录
验证情况
行为验证
Passed。隔离 Compose 中通过真实 HTTP、worker、Container 和 PostgreSQL 执行重放。命令超过软窗口,仅写一次文件,输出可辨认的失败信息并退出 7。审计证明模型实际流出「测试通过」。实时 SSE、游标续订与 Redis 游标过期后的公开快照均未出现误报。最终正文与退出码和输出一致。
Passed。仅在隔离 worker 中暂时关闭公开正文拦截,同一测试在活动 Items 快照中读到「测试通过」并于预期断言处失败。探针结束后恢复提交版。
Passed。同一 E2E 文件完整运行 10 项,覆盖快命令、待领期间执行独立工具、重复读取、输出截断、跨 Run 和错误用户或 attempt 的读取、硬超时、手动退出 124、用户取消、待领期间提问、首批并发提问以及混合审批。真实 worker 领取第二个 attempt 后拒绝重跑,Viewer 回读原副作用恰好一次。
Passed。真实 Docker 沙盒 integration 31 项。真实 PostgreSQL 工具结果 integration 12 项。两者分别核对执行器进度与停止,以及接续 Run 重放原执行许可。
Passed。重跑首轮远端发现的五项回归。两项生命周期用例回读快命令的大输出文件和原始审计,三项协作用例用新工具调用领取原命令结果并保留原断言。
提交检查
docker compose exec -T -e YUXI_KNOWLEDGE_ENABLED=true api uv run --no-sync --group test pytest test/unit -m "not slow" -p no:cacheprovider,4,154 项通过,128 项跳过,另有 7 个 subtests 通过。docker compose exec -T api uv run --no-sync --group test pytest -p no:cacheprovider test/integration/services/test_tool_result_projection.py -qdocker compose exec -T api uv run --no-sync --group test pytest -p no:cacheprovider test/e2e/test_container_agent_execution_e2e.py -q,通过隔离槽位注入测试账号和重放服务地址。SANDBOX_CONTAINER_TEST=1 uv run --project backend --group test pytest backend/test/integration/sandbox/test_container_sandbox.py -q的等价本地运行使用仓库固定依赖和已构建测试镜像。python3 scripts/ci/verify_engineering_contracts.py、python3 -m unittest scripts.ci.test_verify_engineering_contracts、Ruff 检查与格式、pnpm run build和git diff --check均通过。GitHub 检查记录
PR 汇总工作流未自动登记。下列检查均在提交
451f92b8通过。运行链路工作流的 Container Agent E2E 共 10 项通过。 工程契约 后端单测 Ruff 服务集成 运行链路 文档构建独立审阅、风险与事故反馈
独立审阅
全新上下文 Reviewer 对照原始需求、完整 diff 和证据。复核了待领取中断、worker 重试、混合审批、已观察终态和模型兼容性。最终复核无阻塞,独立运行相关单测 170 项通过。另一位全新 Reviewer 复核快命令双缓冲、摘要裁剪和协作重放修复,确认对应的负向覆盖及真实测试范围。
未验证范围与已知风险