Skip to content

fix(mini-swe-agent): pin eval dependencies - #412

Merged
SigureMo merged 1 commit into
redai-studio:mainfrom
cattidea:fix/mini-swe-agent-eval-deps
Oct 5, 2026
Merged

SigureMo merged 1 commit into
redai-studio:mainfrom
cattidea:fix/mini-swe-agent-eval-deps

Conversation

@DrRyanHuang

@DrRyanHuang DrRyanHuang commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

Fix dependency compatibility in the Apptainer Mini SWE Agent evaluation example.

Why

Some evaluation images use Python 3.6, which cannot install chardet 5.2.0.
The existing reward code also imports APIs such as KEY_INSTANCE_ID that
are unavailable in swebench 5.0.2.

How

  • Pin host-side swebench to 4.1.0.
  • Use chardet 5.0.0 for evaluation and retain 5.2.0 for training.
  • Download both wheels separately for offline sandbox installation.

Testing

  • Shell syntax, YAML/version consistency, and git diff --check passed.
  • These dependency changes previously completed a 50-task Apptainer
    evaluation and one training rollout.
  • Real evaluation and multi-node GPU tests were not rerun in this checkout.
  • pre-commit run --all-files
  • Full test suite
  • Dependency documentation updated

Type of Change

  • Bug fix

# 🐛 Bug Fix

- Pin swebench to 4.1.0 for compatibility with the existing reward API.
- Use chardet 5.0.0 for Python 3.6 evaluation images and download its wheel.
- Keep chardet 5.2.0 for training environments.
@DrRyanHuang
DrRyanHuang requested a review from SigureMo October 5, 2026 12:45
@rai-studio-bot

Copy link
Copy Markdown
Contributor

Thanks for contributing to Relax, @DrRyanHuang! 感谢你为 Relax 做出贡献!

Contribution guide / 贡献指南

Describe the problem, your changes, and how you validated them. Keep each PR focused and run pre-commit run --all-files before submitting.

请说明问题、改动和验证方式,保持 PR 聚焦,并在提交前运行 pre-commit run --all-files。

English contribution guide · 中文贡献指南

CI commands / CI 指令
Command / 指令 Usage / 用途
/rerun Retry failed CI / 重跑失败的 CI
/rerun <target> Rerun a workflow or check / 重跑指定 workflow 或检查
/cancel <workflow> Cancel an entire workflow / 取消整个 workflow
/help Show commands and targets / 查看指令和 target
/review Request a code review / 请求代码 review

Put one command on the first line of a new PR comment. Rerun/cancel require PR authorship or repository write access.

在新 PR 评论的首行写一条指令。PR 作者或有仓库写权限的贡献者可以重跑、取消 CI。

CI usage and targets · CI 用法与 target

@SigureMo
SigureMo marked this pull request as ready for review October 5, 2026 12:47
@SigureMo
SigureMo enabled auto-merge (squash) October 5, 2026 12:47
@rai-studio-bot

rai-studio-bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Nyanpasu 审查看板

审查状态: ✅ 已通过

审查版本: 010efab

目标分支: main

示例依赖固定变更审查完成:README 将宿主侧 swebench 固定为 4.1.0,eval 沙箱改用 chardet 5.0.0 并离线下载两个 wheel。逐条核对 agent_server.py 的 swebench 导入在 4.1.0 中全部可用、在 5.0.2 中缺失,chardet 版本与 Python 3.6 镜像兼容。未发现阻塞或非阻塞缺陷,建议批准。未独立验证:作者报告的一次 50 任务评测与一次训练 rollout 未在本检出中重跑。

审查阶段进度范围与结果
常规审查 ✅ 已完成 已通读全部 3 个改动文件,并与 agent_server.py:507-540 的 swebench 导入、agent_config.yaml 的 wheel_mount/setup_commands 调用链交叉核对;确认宿主 venv 与沙箱 eval 两条路径一致,仓库内无其它 swebench/chardet 固定点或文档副本遗漏,未发现缺陷。
深度审查 ✅ 已完成 已完成生产/测试必要性审计:在隔离 venv 中安装 swebench==4.1.0 后逐条执行 _swebench_reward 的导入与映射查找(全部成功),核对 5.0.2 wheel 缺少 test_spec 模块与 KEY_INSTANCE_ID/MAP_REPO_VERSION_TO_SPECS,核对 chardet 两版本的 Requires-Python 与 wheel 形态,并实测合并 pip download 会失败。无 justified 精简建议,也无适用的测试精简范围。

没有未解决的审查问题。

提交范围 · 接收 3 · 建议移出 0 · 待确认 0

接收 3 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。

文件结论仓库维护必要性依据替代去向或方案
examples/mini_swe_agent/README.md
接收 该示例的宿主侧 venv 安装说明必须与 agent_server.py 实际导入的 swebench API 保持一致;未固定版本会装到 5.0.2,而 5.0.2 已无 test_spec 模块与 KEY_INSTANCE_ID。 examples/mini_swe_agent/agent_server.py:507-540 的 swebench 导入;仓库 examples/ 为用户级示例目录(AGENTS.md) 仅把该改动留作 PR 证据会让文档中的安装步骤继续装到不兼容版本,示例无法按文档跑通。
examples/mini_swe_agent/agent_config.yaml
examples/mini_swe_agent/setup_r2e_data_and_sifs.sh
接收 沙箱 eval 安装命令与一次性 wheel 下载脚本必须同时改动:eval 镜像为 Python 3.6 时装不上 chardet 5.2.0,故 eval 用 5.0.0、train 保留 5.2.0,并离线下载两个 wheel 供 --no-index 安装。 agent_config.yaml:62,78-82 的 wheel_mount/setup_commands;PyPI 元数据 chardet 5.2.0 Requires-Python >=3.7、5.0.0 >=3.6 把 wheel 准备放到外部制品库会破坏该脚本一次性离线准备本地数据与镜像的既定职责。
精简审查与验证依据
审查范围进度结论
生产代码 ✅ 已完成 审计范围为本 PR 改动的 3 个示例文件;三处改动各自承担必需职责,未发现可删除、合并或替换的机制。
测试 ➖ 无需执行 本次变更未新增或修改任何测试文件,且不存在可精简的测试范围:仓库内 tests/examples/test_mini_swe_agent_server.py 覆盖的是 _tracked_run 与 instance owner pid 辅助函数,与依赖版本无关;_swebench_reward 在函数内惰性导入 swebench,因此该测试无需 swebench。依赖版本正确性需要联网与重型依赖(docker/modal/datasets),不适合作为仓库内回归测试。

生产代码的必要性与替代方案

范围必须保留的契约更简单的方案结论依据与限制
examples/mini_swe_agent/README.md 中 swebench 未固定 → swebench==4.1.0 宿主 venv 中 agent_server.py 的 _swebench_reward 依赖 swebench.harness.constants/grading/log_parsers 以及 swebench.harness.test_spec.test_spec 的具体符号;未固定版本时装到 5.0.2。 保持不固定;或改写 _swebench_reward 以适配 5.x(make_test_spec 已迁至 swebench.harness.utils,constants 中不再有 KEY_INSTANCE_ID/MAP_REPO_VERSION_TO_SPECS)。 保留 在 Python 3.12 隔离 venv 安装 swebench==4.1.0 后,逐条执行 agent_server.py:508-523 的导入,并检查 MAP_REPO_VERSION_TO_SPECS['django/django']['4.2']['test_cmd'] 与 MAP_REPO_TO_PARSER['django/django'],全部成功;5.0.2 的 wheel 中不存在 swebench/harness/test_spec/ 目录,constants/__init__.py 无 KEY_INSTANCE_ID 与 MAP_REPO_VERSION_TO_SPECS。改写奖励代码适配 5.x 超出本次修复范围。限制:未在真实 SWE-Bench-Lite 任务上端到端重跑评分。
examples/mini_swe_agent/agent_config.yaml 的 eval chardet 5.2.0→5.0.0,以及 setup_r2e_data_and_sifs.sh 新增的 chardet 5.0.0 wheel 下载 eval 沙箱的 setup_commands 需在 Python 3.6 的 testbed 环境离线安装 chardet;train 侧仍需 5.2.0,两版本须同时存在于 ${R2E_DATA_PATH}/wheels。 把两次 pip download 合并成一条命令;或只下载一个版本 / 依赖镜像内已有 chardet。 保留 PyPI 元数据:chardet 5.2.0 Requires-Python >=3.7,5.0.0 >=3.6;两者 wheel 均为 py3-none-any,因此宿主 3.12 上 --only-binary=:all: 的下载结果与 3.6 沙箱安装都成立。实测单条 `pip download --only-binary=:all: chardet==5.2.0 chardet==5.0.0` 报 ResolutionImpossible,故必须保留两次独立下载调用;不固定版本会让 3.6 镜像的 setup 步骤失败(set -e)。限制:未在真实 Python 3.6 镜像中执行安装。
Powered by Nyanpasu with deepseek-v4.1-flash-ali xhigh, please check the suggestions carefully.

@rai-studio-bot rai-studio-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

审查结论:批准

本 PR 将 mini_swe_agent 示例的依赖固定为与代码实际使用一致的版本:宿主 venv 的 swebench 固定为 4.1.0,eval 沙箱改用 chardet==5.0.0,并在一次性 setup 脚本中离线下载两个 chardet wheel。已在隔离环境中逐条执行 agent_server.py 使用的 swebench 导入,确认 4.1.0 全部可用(5.0.2 已移除 harness/test_spec 模块与 KEY_INSTANCE_ID),并核对 chardet 5.0.0 / 5.2.0 的 Requires-Python 分别为 >=3.6 / >=3.7,与 eval 镜像的 Python 3.6 及 train 环境相容。仓库内没有其它 swebench/chardet 固定点或文档副本需要同步,未发现需要修改的问题。

审查范围与必要性审计记录:#412 (comment)

未独立验证:作者报告的一次 50 任务评测与一次训练 rollout 未在本检出中重跑。

Powered by Nyanpasu with deepseek-v4.1-flash-ali xhigh, please check the suggestions carefully.

@SigureMo
SigureMo merged commit c00a696 into redai-studio:main Oct 5, 2026
12 checks passed
@SigureMo
SigureMo deleted the fix/mini-swe-agent-eval-deps branch October 5, 2026 13:00
Mukayi added a commit to Mukayi/Relax that referenced this pull request Oct 12, 2026
…er-profiler

Brings in upstream/main 653c43c..dce533b (redai-studio#257, redai-studio#258, redai-studio#285, redai-studio#323, redai-studio#330,
redai-studio#335, redai-studio#408, redai-studio#409, redai-studio#412, redai-studio#414, redai-studio#416, redai-studio#417, redai-studio#419-redai-studio#421, redai-studio#424, redai-studio#426, redai-studio#427,
redai-studio#430, and 42 commits synced on 10-12 without PR numbers).

The only conflict is relax/utils/env.py: cc4b052 adds the DeepSeek-V4
MXFP4 QAT variables at the same spot where this branch adds the straggler
profiler variables. Resolved by keeping both blocks, straggler first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants