Skip to content

[Feature][CI/CD] Support agent runtime env auto deploy - #410

Open
SJTUyh wants to merge 10 commits into
AISBench:masterfrom
SJTUyh:agent_deploy
Open

SJTUyh wants to merge 10 commits into
AISBench:masterfrom
SJTUyh:agent_deploy

Conversation

@SJTUyh

@SJTUyh SJTUyh commented Jul 23, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks for your contribution; we appreciate it a lot. The following instructions will make your pull request healthier and help you get feedback more easily. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
感谢您的贡献,我们非常重视。以下说明将使您的拉取请求更健康,更易于获得反馈。如果您不理解某些项目,请不要担心,只需提交拉取请求并从维护人员那里寻求帮助即可。

PR Type / PR类型

  • Feature(功能新增)
  • Bugfix(Bug 修复)
  • Docs(文档更新)
  • CI/CD(持续集成/持续部署)
  • Refactor(代码重构)
  • Perf(性能优化)
  • Dependency(依赖项更新)
  • Test-Cases(测试用例更新)
  • Other(其他)

Related Issue | 关联 Issue
Fixes #(issue ID / issue 编号) / Relates to #(issue ID / issue 编号)
Fixes #390

🔍 Motivation / 变更动机

Please describe the motivation of this PR and the goal you want to achieve through this PR.
请描述您的拉取请求的动机和您希望通过此拉取请求实现的目标。
支持docker in docker的方案能够一键部署

📝 Modification / 修改内容

Please briefly describe what modification is made in this PR.
请简要描述此拉取请求中进行的修改。
支持docker in docker的方案能够一键部署
补充对应的Dockerfile,脚本,文档,以及部分配置文件的修改

📐 Associated Test Results / 关联测试结果

Please provide links to the related test results, such as CI pipelines, test reports, etc.
请提供相关测试结果的链接,例如 CI 管道、测试报告等。

在 docker 20.0.0+ 环境使用模式A 部署 terminal-bench 2 测试

执行如下一键部署命令

bash ais_bench_agent_bootstrap.sh \
	--datasets /path/to/terminal-bench-2-offline-mini/terminal-bench-2-offline-selected_0.10/ \
	--runtime-tar /path/to/agent_runtime_image_v3.1-20260701-master-ubuntu24.04-py312-aarch64.tar.gz \
	--case-tar /path/to/terminal-bench-2-offline-prepared-images-selected-0.10_aarch64.tar \
	--container-name test_agent_run
image 进入容器执行检查: image 执行`ais_bench ais_bench/configs/agent_example/harbor_terminal_bench_2_task.py --debug` image

在docker version < 20.0.0的环境使用模式B部署SWEBench Pro测试

image 执行如下一键部署命令 ``` bash ais_bench_agent_bootstrap.sh \ --datasets /path/to/SWE-Bench_Pro_mini/SWE-Bench_Pro_selected_0.05/ \ --runtime-tar /path/to/agent_runtime_image_v3.1-20260701-master-ubuntu24.04-py312-aarch64.tar.gz \ --container-name test_agent_run2 \ --host-path /path/to/test_wkp2/ ``` image 进入容器执行检查: image 执行`ais_bench ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py --debug` image

⚠️ BC-breaking (Optional) / 向后不兼容变更(可选)

Does the modification introduce changes that break the backward compatibility of the downstream repositories? If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
是否引入了会破坏下游存储库向后兼容性的更改?如果是,请描述它如何破坏兼容性,以及下游项目应该如何修改其代码以保持与此 PR 的兼容性。

⚠️ Performance degradation (Optional) / 性能下降(可选)

If the modification introduces performance degradation, please describe the impact of the performance degradation and the expected performance improvement.
如果引入了性能下降,请描述性能下降的影响和预期的性能改进。

🌟 Use cases (Optional) / 使用案例(可选)

If this PR introduces a new feature, it is better to list some use cases here and update the documentation.
如果此拉取请求引入了新功能,最好在此处列出一些用例并更新文档。

✅ Checklist / 检查列表

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues. / 使用预提交或其他 linting 工具来修复潜在的 lint 问题。
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests. / 修复的 Bug 已完全由单元测试覆盖,导致 Bug 的情况应在单元测试中添加。
  • The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness. / 此拉取请求中的修改已完全由单元测试覆盖。如果不是,请添加更多单元测试以确保正确性。
  • All relevant documentation (API docs, docstrings, example tutorials) has been updated to reflect these changes. / 所有相关文档(API 文档、文档字符串、示例教程)已更新以反映这些更改。

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects. / 如果此拉取请求对下游或其他相关项目有潜在影响,应在那些项目中测试此 PR。
  • CLA has been signed and all committers have signed the CLA in this PR. / CLA 已签署,且本 PR 中的所有提交者均已签署 CLA。

👥 Collaboration Info / 协作信息

  • Suggested Reviewers / 建议审核人: @xxx
  • Relevant Module Owners / 相关模块负责人: @xxx
  • Other Collaboration Notes / 其他协作说明:

🌟 Useful CI Command / 实用的CI命令

Command / 命令 Introduction / 介绍
/gemini review Performs a code review for the current pull request in its current state by Gemini. / 对当前拉取请求在当前状态下由 Gemini 执行代码审核。
/gemini summary Provides a summary of the current pull request in its current state by Gemini. / 对当前拉取请求在当前状态下由 Gemini 提供摘要。
/gemini help Displays a list of available commands of Gemini. / 显示 Gemini 可用命令的列表。
/readthedocs build Triggers a build of the documentation for the current pull request in its current state by Read the Docs. / 触发当前拉取请求在当前状态下由 Read the Docs 构建文档。

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@SJTUyh
SJTUyh temporarily deployed to smoke-test-approval July 23, 2026 06:30 — with GitHub Actions Inactive
@SJTUyh SJTUyh closed this Jul 23, 2026
@SJTUyh SJTUyh reopened this Jul 23, 2026
@SJTUyh

SJTUyh commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

处理结论

已对照 PR 描述与仓库现有 agent-runtime 体系核对。本 PR 把「runtime 镜像导入 + 容器启动 + 数据集/用例镜像挂载」收敛为一条 ais_bench_agent_bootstrap.sh 命令,方向和 #390 的诉求一致;但合并前还有几处必须补齐:分支冲突、脚本前置校验、双模式验证记录、文档与 CI 覆盖。以下建议以现有仓库约定为依据,正式评审仍以 diff 为准。

一、现状核对

  1. 仓库已有一套等价能力与既定约定(docker/agent_runtime/USAGE.md):start_agent_runtime.sh 提供 socket(DooD,默认)与 dind 两种模式;dind 需要 --privileged、宿主 cgroup v2,并等待内层 dockerd 就绪(180s);socket 模式要求数据集 / agent-deps 按宿主机原路径透传(容器内外同路径),否则 harbor 为 trial 容器生成的 bind mount 在宿主 daemon 上解析不到。
  2. 因此新的 bootstrap 脚本应复用同一套约束与术语,避免仓库里出现两个行为不一致的入口;否则文档读者无法判断该用哪一个。
  3. PR 描述里的 --runtime-tar / --case-tar / --host-path / --container-name 目前没有对应文档说明,建议同步 docker/agent_runtime/USAGE.md(或该目录 README)。
  4. 关于模式 B 的阈值:PR 写「docker version < 20.0.0」,而 docker/OVERVIEW.zh.md 中模式 B 的适用条件是 Docker < 20.10 或 cgroup v2 不可用。建议脚本按实际能力探测(Docker 版本 + cgroup 版本)而不是只比版本号,并把文档口径统一到 20.10,避免用户误判。
  5. 平台最近一次同步(2026-08-11)该 PR 的 mergeableState=dirty,即与基线分支存在冲突。

二、可执行的修复 / 验证建议

  1. 先 rebase 到最新 main 解决冲突,确认 mergeableState 变为 clean。
  2. 给 bootstrap 脚本补前置校验(与 start_agent_runtime.sh 对齐):
    • set -euo pipefail,并通过 bash -n / shellcheck;
    • 宿主检查:docker info 可用、cgroup 版本、uname -m 与 runtime tar 架构一致(示例 tar 为 aarch64);
    • --datasets / --host-path 必须是已存在的绝对路径,socket 模式下保持容器内外同路径;
    • runtime 镜像已存在时跳过 docker load;case 镜像包缺失时显式 WARN 而不是静默继续;
    • 内层 dockerd 启动失败时输出容器内 dockerd 日志并给出可操作提示;
    • 幂等:容器名已存在时提示复用或 --recreate,不要直接报错退出。
  3. 在 PR 描述中补一张验证矩阵(建议按下面四组各贴一次关键输出):
    • aarch64 + Docker ≥ 20.10 + cgroup v2 → 模式 A,terminal-bench-2,执行 ais_bench ais_bench/configs/agent_example/harbor_terminal_bench_2_task.py --debug,容器内 docker info / docker images 正常;
    • Docker < 20.10 或 cgroup v1 → 模式 B,SWE-Bench Pro mini,执行 ais_bench ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py --debug,并确认配置里硬编码的 /opt/src/SWE-bench_Pro-os/run_scripts 路径存在;
    • x86_64 宿主:明确说明不支持或需要对应架构镜像,否则会因镜像架构不符失败;
    • 断网环境:确认 case 镜像 tar 全量导入,运行期不发生拉取。
  4. CI:当前只有 pr_run_test 与 readthedocs 为 success,bootstrap 脚本没有覆盖。建议加一个最小 job 做 bash -n / shellcheck 与 --help 冒烟(不需要特权),成本低且能防止脚本语法级回归。
  5. PR 模板的 Checklist 目前全部未勾选(lint / 单测 / 文档),请按实际情况勾选,并在「修改内容」中列出实际改动的脚本、Dockerfile 与文档文件。

三、小结

方案与现有 agent-runtime 能力一致,属于可合入方向;但需要先解冲突,并补齐脚本前置校验、双模式验证记录、文档同步和最小的脚本 CI 覆盖。


本评论由 Agent「我的 Agent」生成(模型:trae-agent),经 @SJTUyh 审核后以本人身份发布。

@SJTUyh SJTUyh left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

处理结论

本轮复核针对当前 head c6d95b8。上一轮已给出方向性建议(脚本前置校验、文档同步、CI 覆盖),此处不重复,只列当前仍阻断合并的问题和需要作者确认的高风险点。

一、阻断项(必须修复)

  1. 提交里残留未解决的冲突标记,这会让代码直接不可用:

    • ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_full.py:SWEBP_SCRIPT_PATH_ABS / SWEBP_DOCKER_PATH_ABS 定义处仍保留 <<<<<<< HEAD、=======、>>>>>>> master_center。
    • ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py:同上,同样位置。
    • docker/OVERVIEW.zh.md:模式 A 的示意图之前仍保留 <<<<<<< HEAD / ======= / >>>>>>> master_center。

    Python 配置一旦含 <<<<<<< 会直接 SyntaxError,任何执行该配置的流程(包括 --debug)都会在加载阶段失败;Markdown 里则会打乱模式 A/B 的说明顺序。请搜索全仓 ^<<<<<<< / ^>>>>>>> 并清理干净(包括 docker/OVERVIEW.en.md 等同类文档)。

  2. 分支仍不可合并:平台同步的 mergeableState=dirty,需 rebase/merge 到最新 main,确认冲突解决方式与上面两处配置的最终版本一致(不要只是把标记删掉,两种写法的注释也要合并成一个)。

二、需要作者确认的高风险点

  1. {{$AISBENCH_AGENT_DATASET_PATH:...}} 的默认值语法是否真的生效
    这批配置统一改成 DEFAULT_DATASET_PATH = '{{$AISBENCH_AGENT_DATASET_PATH:}}'(如 ais_bench/configs/swe_bench_examples/mini_swe_agent_swe_bench_full.py)或带兜底路径的形式(ais_bench/configs/agent_example/harbor_terminal_bench_2_task.py)。这里依赖 mmengine 的 use_env 环境变量替换,建议实测两点:

    • 配置加载链路是否以 use_env=True 读取配置;
    • 冒号后的默认值是否被支持。若正则实际把 AISBENCH_AGENT_DATASET_PATH:... 整体当作变量名,缺省时会得到空串或直接报错,而不是注释里写的兜底值;对 HF 无源的 mini 数据集(mini_swe_agent_swe_bench_multilingual_mini.py、mini_swe_agent_swe_bench_pro_mini.py)会表现为运行期才失败,较难排查。

    验证命令示例(容器内或本地均可):

    # 未设置变量
    python -c "from mmengine.config import Config; c=Config.fromfile('ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py'); print(c.datasets[0]['path'])"
    # 设置变量
    AISBENCH_AGENT_DATASET_PATH=/data/datasets/swebench_pro/xxx \
      python -c "from mmengine.config import Config; c=Config.fromfile('ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py'); print(c.datasets[0]['path'])"

    若默认值语法不被支持,建议改为在 bootstrap 脚本里注入环境变量 + 配置里只保留占位符,或在配置中用 os.environ.get(...) 显式读取,二者选一并在注释中写明。

  2. 公共配置的默认行为变化
    这些配置是面向所有用户的原生示例。把 path 从显式占位串改成 env 变量后,未使用 bootstrap 的用户在未设置变量时行为会改变:harbor_terminal_bench_2_task.py 的兜底路径 /data/datasets/harbor/mini-0.10/... 是特定环境路径,默认指向不存在目录反而比原来的 /path/to/terminal-bench-2/ 更难理解。建议要么默认留空并在文档说明必须注入,要么保留清晰占位串,避免“看起来能跑但实际读不到数据”。

  3. 文档口径不一致

    • PR 描述写「docker version < 20.0.0 使用模式 B」,docker/OVERVIEW.zh.md / docker/OVERVIEW.en.md 写模式 A 需要 Docker ≥ 20.10 + cgroup v2;docker/agent_runtime/README.md 的快速入门又写「针对物理机 20.0.0 以下版本 docker 环境」。三处阈值应统一为 20.10(或按能力探测),并在脚本里按 Docker 版本 + cgroup 版本判断,而不是只比较版本号。
    • 脚本名称不统一:PR 描述用 ais_bench_agent_bootstrap.sh,README 与配置注释用 bootstrap.sh。请确认实际提交的文件名,并让三处一致。
  4. 配置注释里写死了数据集路径清单(如 harbor_terminal_bench_2_task.py 的 full / mini-0.10 / mini-0.14 / mini-0.20),与 README 中「不预置数据集、由用户准备」的设计原则略冲突。建议只保留 1 个示例路径,其余放到 README,减少配置文件的维护面。

三、验证建议(合并前请补齐)

  1. bash -n + shellcheck 全量检查 bootstrap 脚本;脚本需 set -euo pipefail,并对 --datasets / --host-path 做绝对路径存在性校验。
  2. 双模式验证矩阵,各贴关键输出:
    • aarch64 + Docker ≥ 20.10 + cgroup v2 → 模式 A,terminal-bench-2,ais_bench ais_bench/configs/agent_example/harbor_terminal_bench_2_task.py --debug;
    • Docker < 20.10 或 cgroup v1 → 模式 B,SWE-Bench Pro mini,ais_bench ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py --debug;
    • x86_64 宿主:明确说明不支持或需要对应架构镜像;
    • 断网环境:case 镜像 tar 全量导入,运行期无拉取。
  3. 建议加一个最小 CI job:脚本 bash -n / shellcheck + --help 冒烟(不需要特权),可防止本次这种“标记进主干”的语法级回归。
  4. PR 模板 Checklist 目前全未勾选,请按实际情况补;「修改内容」里建议列全实际改动的脚本、Dockerfile 与文档。

四、小结

方向可合入,但当前提交存在冲突标记、分支 dirty,属于必须先修的硬阻断;环境变量占位符方案与默认路径行为需实测确认后,再补充双模式验证记录和最小脚本 CI。


本评论由 Agent「我的 Agent」生成,待人工审核后发布。


本评论由 Agent「我的 Agent」生成(模型:trae-agent),经 @SJTUyh 审核后以本人身份发布。

)
]

<<<<<<< HEAD

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处仍残留未解决的冲突标记 <<<<<<< HEAD / ======= / >>>>>>> master_center,Python 配置会直接 SyntaxError,请先清理并确认保留哪一版注释。

)
]

<<<<<<< HEAD

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处同样残留冲突标记 <<<<<<< HEAD / ======= / >>>>>>> master_center,加载该配置会直接失败。

Comment thread docker/OVERVIEW.zh.md
镜像预装了 Docker Engine(≥ 20.0)与 Docker Compose v2(≥ 2.0.0)。在容器内启动 Docker 有两种模式,请根据宿主 Docker 版本与隔离需求二选一。

### 模式 A:Docker-in-Docker(推荐,真嵌套容器,要求宿主 Docker ≥ 20.10 + cgroup v2)
<<<<<<< HEAD

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

模式 A 示意图之前仍保留 <<<<<<< HEAD / >>>>>>> master_center 冲突标记,会打乱模式 A/B 的说明顺序,请清理。

This branch was previously deployed

1 inactive (outdated) deployment
smoke-test-approval — 72fa6efa Deployed Jul 23, 2026 by SJTUyh via run_smoke_test_cases #487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[需求] AISBench镜像支持测评agent数据集

1 participant