Skip to content

[examples] fix: support task-shaped SWE-rebench in Claude Code training - #102

Open
Mengyuyang wants to merge 2 commits into
verl-project:mainfrom
Mengyuyang:codex/fix-claude-code-swe-rebench
Open

[examples] fix: support task-shaped SWE-rebench in Claude Code training#102
Mengyuyang wants to merge 2 commits into
verl-project:mainfrom
Mengyuyang:codex/fix-claude-code-swe-rebench

Conversation

@Mengyuyang

@Mengyuyang Mengyuyang commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the Claude Code blackbox training recipe so that it can consume the
task-shaped SWE-rebench dataset already produced and selected by current
Uni-Agent main.

The current Claude Code training script defaults to
swe_rebench_filtered.parquet, while the recipe still reads the legacy
tools_kwargs.reward / tools_kwargs.env shape and rejects every reward
data source other than swe_bench.

The canonical SWE-rebench preprocessor stores the task name, metadata, and
sandbox image under extra_info.tools_kwargs.task. As a result, the
default training configuration and the recipe data contract are currently
inconsistent.

Changes

  • Teach the Claude Code dataset adapter to read task name and metadata from
    tools_kwargs.task, while preserving the legacy tools_kwargs.reward
    format.
  • Teach the runner to read task metadata and sandbox configuration from
    tools_kwargs.task.
  • Route SWE-rebench evaluation to the existing
    uni_agent.tasks.swe_rebench.reward.compute_reward implementation.
  • Preserve the existing SWE-bench evaluator and fail explicitly for unknown
    task types.

Owning layer

This is an examples-layer compatibility fix.

Reward policy remains owned by the Task layer. The Claude Code recipe only
selects the existing task-level evaluator, following the same adapter
pattern already used for SWE-bench by #91.

Why this is needed

Current main contains all three of the following:

  1. run_train.sh defaults to swe_rebench_filtered.parquet.
  2. uni_agent.tasks.swe_rebench.preprocess emits
    tools_kwargs.task.
  3. The Claude Code recipe only consumes tools_kwargs.reward and rejects
    swe_rebench.

Therefore, a dataset generated by the canonical preprocessor cannot be
consumed by the default Claude Code training configuration.

Removing the unsupported-source check would not be sufficient: the recipe
must also extract the task metadata and dispatch to the correct existing
reward evaluator.
PixPin_2026-07-29_18-32-24

Compatibility

No public API or dataset migration is required.

Legacy rows using tools_kwargs.reward and tools_kwargs.env continue to
work. Current task-shaped rows are added as a fallback. Existing SWE-bench
evaluation remains unchanged, and unknown task types continue to fail
closed.

@Mengyuyang
Mengyuyang force-pushed the codex/fix-claude-code-swe-rebench branch from fecdf50 to cba2c14 Compare July 29, 2026 10:55
@Mengyuyang Mengyuyang closed this Jul 30, 2026
@Mengyuyang
Mengyuyang deleted the codex/fix-claude-code-swe-rebench branch July 30, 2026 01:37
@Mengyuyang
Mengyuyang restored the codex/fix-claude-code-swe-rebench branch July 30, 2026 01:40
@Mengyuyang Mengyuyang reopened this Jul 30, 2026
@Mengyuyang Mengyuyang closed this Jul 30, 2026
@Mengyuyang
Mengyuyang deleted the codex/fix-claude-code-swe-rebench branch July 30, 2026 01:47
@Mengyuyang
Mengyuyang restored the codex/fix-claude-code-swe-rebench branch July 30, 2026 01:53
@Mengyuyang Mengyuyang reopened this Jul 30, 2026
"swerebench",
"nebius/swe-rebench",
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The canonical evaluator selector is task.name for task-shaped rows and reward.name for legacy rows. Top-level HuggingFace dataset IDs belong to data_source, not to the recipe’s evaluator selector.
Please remove the speculative dataset-ID aliases and route only the supported canonical names (swe_bench and swe_rebench). Unknown names should fail explicitly.

return [str(value)]


def _get_task_config(tools_kwargs: dict | None) -> dict:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

_get_task_config and _get_reward_metadata are small single-use config-access wrappers, and the Mapping → {} coercions can hide malformed sample contracts. Please inline the simple reads and fail clearly at the task/legacy boundary.

tools_kwargs = extra_info.get("tools_kwargs", {})
reward_config = tools_kwargs.get("reward", {})
task_config = tools_kwargs.get("task", {})
task_config = task_config if isinstance(task_config, Mapping) else {}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again, please avoid coercing a present but malformed task value to {} here. The compatibility bridge should distinguish “field absent” (valid for legacy rows) from “field present with the wrong type” (invalid input that should fail clearly).

@zackcxb

zackcxb commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

The task-shaped fallback currently maps task.sandbox to env_config, but canonical SWE-rebench rows do not contain post_setup_cmd. As a result, the legacy runner will skip the future-git-history cleanup that SWEREBenchTask.run() performs before launching the agent.
Please either add an explicit, narrowly scoped cleanup path for task.name == "swe_rebench", or narrow the PR claim to data/evaluator compatibility and document that full SWE-rebench lifecycle parity is deferred. The current env_config.get("post_setup_cmd", "") only preserves cleanup for legacy rows; it does not cover task-shaped rows.

@Mengyuyang
Mengyuyang force-pushed the codex/fix-claude-code-swe-rebench branch 2 times, most recently from 165eda3 to 7d688e7 Compare August 5, 2026 09:22
@Mengyuyang
Mengyuyang force-pushed the codex/fix-claude-code-swe-rebench branch from 7d688e7 to e599e12 Compare August 5, 2026 09:27
@@ -268,6 +312,10 @@ async def claude_code_runner(
)

try:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[阻塞] Legacy SWE-ReBench parquet 不会执行 history cleanup
当前 runner 在 legacy 分支中将 task_name 设置为 None,因此旧 parquet 中的 tools_kwargs.reward.name == "swe_rebench" 不会触发已有的 _SWE_REBENCH_GIT_CLEAN_HISTORY。
build_reward_context() 已经统一处理了:
task.name → evaluator
reward.name → evaluator
请将 build_reward_context() 的调用提前到 sandbox 创建前,并复用返回的 metadata["evaluator"]、metadata 和 eval_timeout:
metadata, eval_timeout = build_reward_context(tools_kwargs)
evaluator = metadata["evaluator"]

...

if evaluator == "swe_rebench":
await sandbox.exec_shell(
_SWE_REBENCH_GIT_CLEAN_HISTORY,
workdir="/testbed",
)
后续 reward evaluation 直接复用同一组 metadata / eval_timeout。这样 task-shaped 和 legacy parquet 会遵循完全相同的 evaluator 路由。
同时请删除 post_setup_cmd 的读取和执行逻辑;reBench cleanup 是固定的 task/evaluator 行为,不再由数据字段注入。此次不要求新增测试,但请在 PR Validation 中说明 task-shaped 和 legacy 两条路径均已验证。

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.

2 participants