Skip to content

[rl] Terminal-Bench: terminal_bench_env_config takes the package that exports the taskset - #5876

Merged
felipemello1 merged 1 commit into
felipemello1/verifiers-v2/4-phase-timesfrom
felipemello1/tb-oss/2-rollouter-config
Nov 20, 2026
Merged

felipemello1 merged 1 commit into
felipemello1/verifiers-v2/4-phase-timesfrom
felipemello1/tb-oss/2-rollouter-config

Conversation

@felipemello1

@felipemello1 felipemello1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary (human-written)

exposes import path arg so this works with mast/coreweave

Agent details

TLDR: terminal_bench_env_config takes a taskset_id, so a launcher outside the repo can run the Terminal-Bench recipe with its own package, e.g. one that adds an env for remote sandboxes. The default is this example's package, so in-repo recipes don't change.

# my_cluster_terminal_bench/__init__.py, installed as "my-cluster-terminal-bench"
from torchtitan.rl.examples.verifiers.terminal_bench.harness import TerminalBenchTerminusHarness
from torchtitan.rl.examples.verifiers.terminal_bench.taskset import TerminalTaskset
from my_cluster_terminal_bench.env import RemoteSandboxEnv

__all__ = ["RemoteSandboxEnv", "TerminalBenchTerminusHarness", "TerminalTaskset"]

# the launcher
env = terminal_bench_env_config("local/tmax@v1", max_turns=120, taskset_id="my-cluster-terminal-bench")

Depends on the PRs below it: they make each example an installed package and add terminal_bench_env_config.

Problem

  1. Verifiers loads a taskset by id: the name of an installed package. By default, it also takes the harness and the env from that package, if it exports them.
  2. terminal_bench_env_config always uses this example's package, torchtitan-verifiers-terminal-bench.
  3. So a launcher that needs its own env (a remote sandbox instead of local Docker) must rebuild the taskset and harness configs with its own id.

Solution

  1. A taskset_id argument, used as the taskset id and the harness id.
  2. Its default is TERMINAL_BENCH_TASKSET_ID, so recipes in the repo don't change. The constant is renamed from TERMINAL_BENCH_PACKAGE_ID, so the argument and its default share one name.

You may ask: why taskset_id, not package_id or env_id? Verifiers resolves the harness and the env from the taskset's package, and torchtitan's Verifiers README calls these "Taskset ids". Verifiers already has an EnvConfig.env_id, with another meaning.

Test plan

  • pytest tests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py: 12 passed. They build the envs with the default taskset_id.
  • A package like the TLDR's, without the env: both ids are my-cluster-terminal-bench. Verifiers loads TerminalTaskset and TerminalBenchTerminusHarness from it, and SingleAgentEnv since it exports no env.
  • pytest tests/rl/unit_tests/cpu: 695 passed, 7 skipped.

@pytorch-bot pytorch-bot Bot added the ciflow/rl label Nov 6, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 6, 2026
@felipemello1
felipemello1 added this pull request to stack #5878 November 6, 2026 01:30
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from c12151c to 708a921 Compare November 6, 2026 02:07
@felipemello1

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 2m 1s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- the code change is small and correct, but the only consumer of the new public API and its taskset_config_cls argument is an unnamed out-of-repo launcher. Whether recipe helpers in torchtitan_recipes are an extension surface for external launchers is a maintainer call.

What this PR does. It renames _terminal_bench_rollouter_config to terminal_bench_rollouter_config and adds taskset_config_cls (default TerminalTasksetConfig). That class is used for both the train and validation taskset configs, and its module is registered as the local taskset alias. VerifiersRollouter.Config.__post_init__ then sets verifiers_env_server.local_taskset_module to that module (rollouter.py:131-153). The three in-repo recipes pass no new argument, so their configs are unchanged.

Example.

# caller_pkg/terminal_bench.py: class MyCfg(TerminalTasksetConfig), plus a Taskset bound to MyCfg and an Env
cfg = terminal_bench_rollouter_config("local/tmax@v1", "terminal-bench/terminal-bench-2-1",
                                      ..., taskset_config_cls=MyCfg)
cfg.verifiers_env_server.local_taskset_module
#   before: not possible without copying the ~75-line helper
#           (swapping the taskset on the returned config trips "must not configure a different taskset")
#   after:  "caller_pkg.terminal_bench"

Must fix

  1. PR description -- "Summary (human-written)" is empty. A maintainer has to approve an API whose only user is outside the repo, so the author should state the motivation in their own words.
  2. PR description -- name the consumer. "A self-hosted sandbox service" is a hypothetical. Per the core principles, a new extension point with no in-repo consumer needs a concrete, named user (which launcher, which runtime, which per-rollout data its Env needs). Without one, the default answer is to keep the helper private.

Should consider

  • tests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py:246-266 -- the new test only checks that the argument is forwarded, and its stand-in plugin wouldn't load in a real worker (see inline comment).

Questions

  • If the external Env needs its own EnvConfig type, the hard-coded HarborEnvConfig(...) in the helper would also have to be replaced on the returned config. Is HarborEnv (or a subclass that accepts HarborEnvConfig) enough for the named use case? If not, this argument doesn't fully remove the need to copy the helper.
Details
  • Smallest alternative without the argument: the launcher calls dataclasses.replace on the returned config, swapping both taskset configs and resetting verifiers_env_server.environment.taskset to VerifiersTasksetConfig() so that __post_init__ re-derives it. That is ~10 fiddly lines out of repo, and it patches a finished config, which .claude/rules/config.md discourages. So if the use case is accepted, the argument is the right shape (+1 parameter, 3 substitutions).
  • _local_taskset_module requires taskset.id == alias(type(taskset).__module__). The helper registers the alias from the same taskset_config_cls.__module__, so the two always agree.
  • torchtitan_recipes is a packaged top-level package (pyproject.toml:40-42), so out-of-repo imports of the helper work.
  • The rename and the README edits are mechanical, and every in-repo callsite is updated.

Not verified: Verifiers' environment_class fallback to SingleAgentEnv when the plugin exports no Env (Verifiers isn't installed in this checkout).

Comment on lines +246 to +266
def test_taskset_config_cls_module_is_the_env_server_plugin(
tmp_path, monkeypatch
) -> None:
"""The env server's plugin module is the module of the taskset class passed in."""
(tmp_path / "caller_pkg").mkdir()
(tmp_path / "caller_pkg" / "__init__.py").write_text("")
(tmp_path / "caller_pkg" / "terminal_bench.py").write_text(
"from torchtitan.rl.examples.verifiers.terminal_bench.taskset import (\n"
" TerminalTasksetConfig,\n"
")\n\n\n"
"class RemoteSandboxTasksetConfig(TerminalTasksetConfig):\n"
" pass\n"
)
monkeypatch.syspath_prepend(str(tmp_path))
caller = importlib.import_module("caller_pkg.terminal_bench")
rollouter = _rollouter_config(
TRAIN_DATASET,
EVAL_DATASET,
taskset_config_cls=caller.RemoteSandboxTasksetConfig,
)
assert rollouter.verifiers_env_server.local_taskset_module == caller.__name__

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.

This test catches one regression: the helper ignoring its own argument. The derivation it relies on (_local_taskset_module -> local_taskset_module) is already exercised by test_env_server_workers_skip_the_trainer_imports, which also checks that a worker can actually resolve the plugin. That makes this close to the "re-read a config you just set" case in .claude/rules/tests.md.

The stand-in plugin also breaks the contract the new docstring states: caller_pkg/terminal_bench.py exports no Taskset bound to RemoteSandboxTasksetConfig and no Env, so a real env-server worker could not load it. The test passes on a config that would fail at runtime.

Smallest fix: delete the test. If you want coverage, extend test_env_server_workers_skip_the_trainer_imports so it also runs with a subclass whose module re-exports TerminalTaskset-style bindings and HarborEnv. Then the worker-side resolution is what gets checked, not the string.

@felipemello1
felipemello1 removed this pull request from stack #5878 November 8, 2026 19:07
@felipemello1
felipemello1 changed the base branch from felipemello1/tb-oss/1-taskset-workdir to main November 8, 2026 19:07
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from 708a921 to 96a1e89 Compare November 8, 2026 19:09
@felipemello1
felipemello1 changed the base branch from main to felipemello1/rollout-placement/3-process-metrics November 8, 2026 19:09
@felipemello1
felipemello1 added this pull request to stack #5950 November 8, 2026 19:09
@felipemello1 felipemello1 changed the title [rl] Terminal-Bench: public terminal_bench_rollouter_config with a taskset class argument [rl] Terminal-Bench: public terminal_bench_rollouter_config with a taskset_id argument Nov 8, 2026
@felipemello1
felipemello1 force-pushed the felipemello1/rollout-placement/3-process-metrics branch from a52089b to 58fa440 Compare November 9, 2026 07:22
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from 96a1e89 to c4797b7 Compare November 9, 2026 07:22
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. This push is a code-style pass over every file (docstrings, comments, names, tests), rebased on main 98bbfe1. No behavior change.

@claude

claude Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 2m 15s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- the code is small and correct, and the new test now covers what a worker actually loads. A maintainer still has to accept a public recipe helper and argument whose only user is an out-of-repo launcher, and the human-written summary is still empty.

What this PR does. It renames _terminal_bench_rollouter_config to terminal_bench_rollouter_config and adds taskset_id (default torchtitan_verifiers_terminal_bench). Both taskset configs are built as taskset_config_type(taskset_id)(id=taskset_id, ...), which also passes the class check in VerifiersTaskDataset.Config.__post_init__ (data.py:53-61). VerifiersRollouter.Config.__post_init__ copies the training taskset into worker.environment (rollouter.py:550-569). The worker's resolve_env_config then picks the Env that the taskset package exports (rollouter.py:203-207). The three in-repo recipes pass no new argument, so their configs don't change.

Example.

# my_sandbox_tb/__init__.py exports MyTaskset(TerminalTaskset) and MyEnv(vf.SingleAgentEnv)
cfg = terminal_bench_rollouter_config("local/tmax@v1", "terminal-bench/terminal-bench-2-1",
                                      max_context_length=..., max_turns=...,
                                      taskset_id="my_sandbox_tb")
load_environment(resolve_env_config(cfg.worker.environment))
#   before: not possible without copying the ~85-line helper
#           (swapping the taskset on the returned config raises "must not configure a different taskset")
#   after:  MyEnv, with env.taskset a MyTaskset

Must fix

  1. PR description: "Summary (human-written)" is still empty. This was raised last round. The PR exists only for a launcher outside the repo, so the author has to state that motivation in their own words for a maintainer to sign off.

Should consider

  • tests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py:273-276 -- the harness asserts re-check a hardcoded value that line 241 already covers (see inline comment).

Questions

  • For maintainers: should helpers in torchtitan_recipes be a supported surface for out-of-repo launchers? If yes, this argument is the right shape. Patching the taskset on the finished config would take ~10 lines out of repo and goes against .claude/rules/config.md. If no, the helper stays private and the launcher copies it.
Since the last review
  • Resolved: "name the consumer". Problem item 2 now describes the launcher concretely: a remote VM sandbox, its own package with a Taskset, an Env subclass and a Terminus harness subclass. It is still unnamed, which the maintainers have to accept.
  • Resolved: the earlier test's stand-in plugin couldn't load in a real worker. The new test exports a real TerminalTaskset subclass and an Env, and loads them through resolve_env_config / load_environment, which is the worker's path.
  • Resolved: the question about a hardcoded env config. resolve_env_config re-validates worker.environment as the config class of the Env that the taskset package exports, so vf.SingleAgentEnvConfig(...) in the helper doesn't pin the Env type.
  • No other new problems in the style pass. The rename covers every in-repo callsite (3 recipes, the test, the README). The default keeps the in-repo recipes byte-identical.

Not verified: an Env whose own config class has extra required fields (Verifiers isn't installed in this checkout). The new test's CallerEnv has no config of its own.

Comment on lines +273 to +276
assert env.config.agent.harness.id == "torchtitan_verifiers_terminal_bench"
assert isinstance(
load_harness(env.config.agent.harness), TerminalBenchTerminusHarness
)

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.

The two harness asserts check a value the helper hardcodes (id=_TERMINAL_BENCH_PACKAGE_ID, verifiers_terminal_bench.py:138), and taskset_id never touches it. Line 241 already loads the same harness from the same helper. So these lines re-read a config instead of guarding the new argument (.claude/rules/tests.md). The two lines above them are the regression check: they fail if the helper ignores taskset_id or builds the config with the wrong class.

Smallest fix: delete them, and drop "The harness stays the example's Terminus-2" from the docstring.

Suggested change
assert env.config.agent.harness.id == "torchtitan_verifiers_terminal_bench"
assert isinstance(
load_harness(env.config.agent.harness), TerminalBenchTerminusHarness
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: Fixed in 16a1803: the two harness asserts and the docstring sentence are gone. The body test plan no longer mentions the harness.

@felipemello1
felipemello1 force-pushed the felipemello1/rollout-placement/3-process-metrics branch from 58fa440 to e070bcd Compare November 9, 2026 09:11
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from c4797b7 to 16a1803 Compare November 9, 2026 09:11
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. 16a1803 drops the two harness asserts (inline comment). The maintainer question and the Summary are for the author.

@claude

claude Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 56s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- the code has no open findings. The one blocker left is a maintainer decision: whether torchtitan_recipes helpers are a supported surface for launchers outside the repo. The Summary also still has to be written.

What changed since the last review. 16a1803 removes the two harness asserts and the docstring sentence about the harness from test_taskset_id_picks_the_taskset_config_and_env. The test now checks only what taskset_id controls: the worker loads CallerEnv, and its taskset is CallerTaskset.

Must fix

  1. PR description: "Summary (human-written)" is still empty. Per the trigger comment the author will write it. It stays listed because the only user of this API is outside the repo, so a maintainer needs the motivation in the author's own words.

Questions

  • For maintainers (still open): should helpers in torchtitan_recipes be a supported surface for out-of-repo launchers? If yes, taskset_id is the right shape. The alternative is patching the taskset on the finished config, which takes about 10 lines outside the repo and goes against .claude/rules/config.md. If no, the helper stays private and the launcher copies it.
Since the last review
  • Resolved: the harness asserts at tests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py:273-276 are deleted. The docstring no longer mentions the harness.
  • Checked again at HEAD, no new problems:
    • taskset_config_type (verifiers_terminal_bench.py:112) is the same Verifiers helper that VerifiersTaskDataset.Config.__post_init__ uses for its class check (torchtitan/rl/examples/verifiers/data.py:53), so the helper and the validation always agree.
    • With the default id, the call imports torchtitan_verifiers_terminal_bench. That package only re-exports the harness and taskset modules the recipe already imports, so it adds no new import cost to recipe construction.
    • The in-repo recipes don't pass the new argument, so their configs don't change.

Not verified: an Env whose own config class has extra required fields. Verifiers isn't installed in this checkout.

@felipemello1
felipemello1 force-pushed the felipemello1/rollout-placement/3-process-metrics branch from e070bcd to 22c93e2 Compare November 9, 2026 12:18
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from 16a1803 to 91c269f Compare November 9, 2026 12:18
@felipemello1
felipemello1 removed this pull request from stack #5950 November 9, 2026 17:31
@felipemello1
felipemello1 changed the base branch from felipemello1/rollout-placement/3-process-metrics to main November 9, 2026 17:31
@felipemello1
felipemello1 removed this pull request from stack #6034 November 12, 2026 00:33
@felipemello1
felipemello1 changed the base branch from felipemello1/rollout-placement/3-process-metrics to main November 12, 2026 00:34
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from cfc55e1 to b927628 Compare November 12, 2026 00:35
@felipemello1
felipemello1 changed the base branch from main to felipemello1/rollout-placement/3-process-metrics November 12, 2026 00:36
@felipemello1
felipemello1 added this pull request to stack #6040 November 12, 2026 00:36
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. This push puts the stack on a draft copy of the look-aside router PR, rebased onto main (row 0, DO NOT REVIEW; it closes when the original lands). The generate answer now comes from the generator, so the docs and bodies say so; each body says not to merge while row 0 is under the stack.

@claude

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 44s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- b927628 rebases the PR onto the new stack base, and this PR's own diff is the same as last round. The code has no open findings. Two things still block it: the human-written Summary is empty, and a maintainer has to decide whether torchtitan_recipes helpers are a supported surface for launchers outside the repo.

What this PR does. It renames _terminal_bench_rollouter_config to terminal_bench_rollouter_config and adds taskset_id (default torchtitan_verifiers_terminal_bench). Both taskset configs are built as taskset_config_type(taskset_id)(id=taskset_id, ...) (torchtitan_recipes/rl/verifiers_terminal_bench.py:112). The three in-repo recipes don't pass the new argument, so their configs don't change.

Example.

# my_sandbox_tb/__init__.py exports MyTaskset(TerminalTaskset) and MyEnv(vf.SingleAgentEnv)
cfg = terminal_bench_rollouter_config("local/tmax@v1", "terminal-bench/terminal-bench-2-1",
                                      max_context_length=..., max_turns=...,
                                      taskset_id="my_sandbox_tb")
load_environment(resolve_env_config(cfg.worker.environment))
#   before: not possible without copying the helper
#           (swapping the taskset on the returned config raises "must not configure a different taskset")
#   after:  MyEnv, with env.taskset a MyTaskset

Must fix

  1. PR description: the "Summary (human-written)" section is still empty. The only user of this API is outside the repo, so a maintainer needs the motivation in the author's own words before signing off.

Questions

  • For maintainers (still open): should helpers in torchtitan_recipes be a supported surface for launchers outside the repo? If yes, taskset_id is the right shape. The alternative is patching the taskset on the finished config, which takes about 10 lines outside the repo and goes against .claude/rules/config.md. If no, the helper stays private and the launcher copies it.
Since the last review
  • The new base (row 0, the look-aside router copy) doesn't touch these 3 files. I checked the diff hunk by hunk against a9bbf29: the recipe helper, the README note, and test_taskset_id_picks_the_taskset_config_and_env. They are identical.
  • Checked again at HEAD:
    • The rename covers every in-repo callsite: the 3 recipes, the test, and the README.
    • The helper still hardcodes workers_on_controller_host=True (verifiers_terminal_bench.py:158), along with Docker. A launcher that uses a remote sandbox sets that field on the returned config, the same way it sets runtime. That follows from the README note and needs no change here.

Not verified: an Env whose own config class has extra required fields. Verifiers isn't installed in this checkout.

@felipemello1
felipemello1 force-pushed the felipemello1/rollout-placement/3-process-metrics branch from f21370b to 238c621 Compare November 12, 2026 00:44
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from b927628 to c2624c8 Compare November 12, 2026 00:44
@felipemello1
felipemello1 force-pushed the felipemello1/rollout-placement/3-process-metrics branch from 238c621 to ea0ee59 Compare November 12, 2026 03:07
@felipemello1
felipemello1 force-pushed the felipemello1/tb-oss/2-rollouter-config branch from c2624c8 to d08019e Compare November 12, 2026 03:07
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. The stack is reordered: Verifiers groups in workers, then Verifiers 0.4.1, then worker placement come first (the stack table shows the new rows). It is also rebuilt with three reviewed passes: a code-style pass over every changed file, the rewritten placement docs (the VerifiersRollouter docstring and the two Verifiers READMEs; the old SVG is deleted), and the 3 newest main commits. No behavior change from the passes.

@claude

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 43s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- aa1c17b rebuilds the stack, and this PR's diff is the same as last round. The code has no open findings. Two things still block it: the human-written Summary is empty, and a maintainer has to decide whether torchtitan_recipes helpers are a supported surface for launchers outside the repo.

What this PR does. It renames _terminal_bench_rollouter_config to terminal_bench_rollouter_config and adds taskset_id (default torchtitan_verifiers_terminal_bench). Both taskset configs are built as taskset_config_type(taskset_id)(id=taskset_id, ...) (torchtitan_recipes/rl/verifiers_terminal_bench.py:112). The three in-repo recipes don't pass the new argument, so their configs don't change.

Example.

# my_sandbox_tb/__init__.py exports MyTaskset(TerminalTaskset) and MyEnv(vf.SingleAgentEnv)
cfg = terminal_bench_rollouter_config("local/tmax@v1", "terminal-bench/terminal-bench-2-1",
                                      max_context_length=..., max_turns=...,
                                      taskset_id="my_sandbox_tb")
load_environment(resolve_env_config(cfg.worker.environment))
#   before: not possible without copying the helper
#           (swapping the taskset on the returned config raises "must not configure a different taskset")
#   after:  MyEnv, with env.taskset a MyTaskset

Must fix

  1. PR description: the "Summary (human-written)" section is still empty. This API's only user is outside the repo, so a maintainer needs the motivation in the author's own words before signing off.

Questions

  • For maintainers (still open): should helpers in torchtitan_recipes be a supported surface for launchers outside the repo? If yes, taskset_id is the right shape. The alternative is patching the taskset on the finished config, which takes about 10 lines outside the repo and goes against .claude/rules/config.md. If no, the helper stays private and the launcher copies it.
Since the last review
  • The reordered stack and the three passes don't touch these 3 files at this position. I checked the diff hunk by hunk against b927628: the recipe helper, the README note, and test_taskset_id_picks_the_taskset_config_and_env are the same.
  • Checked again at HEAD:
    • The helper and the dataset validation call the same taskset_config_type (torchtitan/rl/examples/verifiers/data.py:53), so they can't disagree about the config class.
    • The rename covers every in-repo callsite: the 3 recipes, the test, and the README.
    • workers_on_controller_host=True (verifiers_terminal_bench.py:158) now has a TODO saying it is tied to the local Docker sandbox. A remote-sandbox launcher sets it on the returned config, the same way it sets runtime. That needs no change here.

Not verified: an Env whose own config class has extra required fields. Verifiers isn't installed in this checkout.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. The stack is rebased onto main (the look-aside router PR merged), and the PRs below this one are updated.

@claude

claude Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 33s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- 6385577 rebases the stack onto main, and this PR's diff is the same as last round. The code has no open findings. Two things still block it: the human-written Summary is empty, and a maintainer has to decide whether torchtitan_recipes helpers are a supported surface for launchers outside the repo.

What this PR does. It renames _terminal_bench_rollouter_config to terminal_bench_rollouter_config and adds taskset_id (default torchtitan_verifiers_terminal_bench). Both taskset configs are built as taskset_config_type(taskset_id)(id=taskset_id, ...) (torchtitan_recipes/rl/verifiers_terminal_bench.py:112). The three in-repo recipes don't pass the new argument, so their configs stay the same.

Example.

# my_sandbox_tb/__init__.py exports MyTaskset(TerminalTaskset) and MyEnv(vf.SingleAgentEnv)
cfg = terminal_bench_rollouter_config("local/tmax@v1", "terminal-bench/terminal-bench-2-1",
                                      max_context_length=..., max_turns=...,
                                      taskset_id="my_sandbox_tb")
load_environment(resolve_env_config(cfg.worker.environment))
#   before: not possible without copying the helper
#           (swapping the taskset on the returned config raises "must not configure a different taskset")
#   after:  MyEnv, with env.taskset a MyTaskset

Must fix

  1. PR description: the "Summary (human-written)" section is still empty. The only user of this API is outside the repo, so a maintainer needs the motivation in the author's own words before signing off.

Questions

  • For maintainers (still open): should helpers in torchtitan_recipes be a supported surface for launchers outside the repo? If yes, taskset_id is the right shape. The alternative is patching the taskset on the finished config, which takes about 10 lines outside the repo and goes against .claude/rules/config.md. If no, the helper stays private and the launcher copies it.
Since the last review
  • The rebase onto main (the look-aside router PR has merged) doesn't touch these 3 files at this position. I compared the diff hunk by hunk with aa1c17b: the recipe helper, the README note, and test_taskset_id_picks_the_taskset_config_and_env are identical.
  • Checked again at HEAD:
    • The helper and the dataset validation both call taskset_config_type (torchtitan/rl/examples/verifiers/data.py:53), so they can't disagree about the config class.
    • The rename covers every in-repo callsite: the 3 recipes, the test, and the README.
    • workers_on_controller_host=True (verifiers_terminal_bench.py:163) still has its TODO tying it to the local Docker sandbox. A launcher with a remote sandbox sets it on the returned config, the same way it sets runtime.

Not verified: an Env whose own config class has extra required fields. Verifiers isn't installed in this checkout.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review

@claude

claude Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 1m 44s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- the diff (+5/-5) is correct, and the in-repo recipes don't change. Two things still block it. First, the base now lets a launcher build its own env config and pass it to terminal_bench_rollouter_config, so this argument saves the launcher only about 15 lines. Second, its only user is still outside the repo and unnamed, and the human-written Summary is empty.

What this PR does. It adds package_id (default TERMINAL_BENCH_PACKAGE_ID) to terminal_bench_env_config and uses it as the id of both the TerminalTasksetConfig and the TerminalBenchTerminusHarnessConfig (torchtitan_recipes/rl/verifiers_terminal_bench.py:78-95). The three recipes don't pass it, so their configs stay the same.

Example.

env = terminal_bench_env_config("local/tmax@v1", max_turns=120, package_id="my-package")
env.taskset.id, env.agent.harness.id   # ("my-package", "my-package")
# Each worker: vf.resolve_env_config(json.loads(env.model_dump_json())) loads my-package's
# Taskset and Harness (rollouter.py:288, data.py:69)
#
# Without this PR, at this base:
env = vf.SingleAgentEnvConfig(taskset=MyTasksetConfig(id="my-package", dataset=...),
                              agent=vf.AgentConfig(harness=..., runtime=..., max_turns=120, timeout=...))
terminal_bench_rollouter_config(env, validation_env, max_context_length=...)  # works unchanged

Must fix

  1. PR description: "Summary (human-written)" is still empty. This API exists only for a launcher outside the repo, so a maintainer needs the motivation in the author's own words.
  2. PR description: name the consumer. The new argument has no in-repo caller and no test that passes a different id. "A launcher outside the repo that ships its own Taskset package" doesn't say who uses it. Per the core principles, a new option with no in-repo consumer needs a named user. If there isn't one, drop the PR: since the base change, terminal_bench_rollouter_config takes env configs, so the launcher can build its own vf.SingleAgentEnvConfig (the ~15-line body of this helper) without copying the rollouter helper.

Should consider

  • torchtitan_recipes/rl/verifiers_terminal_bench.py:81,85-86 -- with a different package_id, the summary line "Terminus-2 in a local Docker container" may not hold, because the harness is whatever package_id exports. Also, the configs built here are always TerminalTasksetConfig / TerminalBenchTerminusHarnessConfig. So the external package's Taskset and Harness must accept exactly these fields: any extra required field fails at load time, and the caller can't set one through this helper. One clause in the package_id doc would state that contract.

Questions

  • For maintainers (still open): should helpers in torchtitan_recipes be a supported surface for out-of-repo launchers? If yes, package_id is the right minimal shape (+1 parameter, 2 substitutions). If no, the launcher builds its own env config and passes it to the rollouter helper as shown above.
Since the last review
  • The stack was rebuilt, and this PR changed shape. The earlier taskset_id argument on the rollouter helper (rename plus taskset_config_type) is gone. The base now has a public terminal_bench_env_config and a terminal_bench_rollouter_config(train_env, validation_env, ...) that takes env configs, and this PR only adds package_id to the env helper.
  • The earlier test test_taskset_id_picks_the_taskset_config_and_env is gone. The description says why: a test would need a second installed Taskset package. That fits .claude/rules/tests.md, but nothing now checks that a non-default id resolves to the package's own Taskset/Env on a worker.
  • Every in-repo callsite (3 recipes, tests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py:50-51) uses the default, so the configs are byte-identical.

Not verified: that vf.resolve_env_config rebuilds a TerminalTasksetConfig with a foreign id as the external package's own config class (Verifiers isn't installed in this checkout).

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: answers to the points in the review that have no inline thread.

the review bot (review): PR description: name the consumer. The new argument has no in-repo caller and no test that passes a different id.

The user is a launcher outside the repo that ships its own Taskset package. It can't be named here.

the review bot (review): with a different package_id, the summary line "Terminus-2 in a local Docker container" may not hold, because the harness is whatever package_id exports.

Done. The package_id doc now states the contract: the package's Taskset and Harness configs must accept the fields this helper sets. The summary line now says Terminus-2 is the default package's harness. Verifiers resolves a foreign id to that package's own config class (verifiers/v1/utils/loaders.py:77).

the review bot (review): For maintainers (still open): should helpers in torchtitan_recipes be a supported surface for out-of-repo launchers?

That is the maintainers' call. If yes, this argument is the smallest shape. If no, this PR closes, and a launcher calls terminal_bench_env_config(...) and swaps both ids with model_copy.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: 5e28394: terminal_bench_env_config takes a taskset_id (default TERMINAL_BENCH_TASKSET_ID, renamed from TERMINAL_BENCH_PACKAGE_ID so both share one name). It needs the PRs below it (installed example packages, terminal_bench_env_config). @claude please review

@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 1m 12s —— View job


Verdict: Needs discussion -- review

@claude claude 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.

Verdict: Needs discussion -- the 6-line diff is correct, and the in-repo recipes don't change. Two things still block it. A maintainer has to accept a recipe-helper argument whose only user is an unnamed launcher outside the repo. And the human-written Summary is still empty.

What this PR does. It adds taskset_id (default TERMINAL_BENCH_TASKSET_ID, the renamed TERMINAL_BENCH_PACKAGE_ID) to terminal_bench_env_config and uses it as the id of both the TerminalTasksetConfig and the TerminalBenchTerminusHarnessConfig (torchtitan_recipes/rl/verifiers_terminal_bench.py:78-95). The three recipes and the test don't pass it, so their configs stay the same.

Example.

env = terminal_bench_env_config("local/tmax@v1", max_turns=120, taskset_id="my-cluster-terminal-bench")
env.taskset.id, env.agent.harness.id   # ("my-cluster-terminal-bench", "my-cluster-terminal-bench")
# A worker imports my_cluster_terminal_bench and takes the TerminalTaskset, the harness
# and RemoteSandboxEnv from its __all__.
#
# Without this PR, the same result with the pattern the helper's docstring already recommends for `runtime`:
env = terminal_bench_env_config("local/tmax@v1", max_turns=120)
env = env.model_copy(update={
    "taskset": env.taskset.model_copy(update={"id": X}),
    "agent": env.agent.model_copy(update={"harness": env.agent.harness.model_copy(update={"id": X})}),
})

Must fix

  1. PR description: "Summary (human-written)" is still empty. This argument exists only for a launcher outside the repo, so a maintainer needs the motivation in the author's own words.
  2. Consumer: the argument has no in-repo caller, and the author says the out-of-repo user can't be named. Per the core principles, an option with no in-repo consumer needs a named user. If maintainers accept an unnamed one, this is the right minimal shape. If not, close the PR: the model_copy swap above is about 5 lines in the launcher. The helper's docstring already recommends that pattern for runtime (verifiers_terminal_bench.py:83-84), so it doesn't break .claude/rules/config.md any more than the existing guidance does.

Questions

  • For maintainers (still open): should helpers in torchtitan_recipes be a supported surface for launchers outside the repo? The answer decides this PR.
Since the last review
  • Renamed package_id -> taskset_id, and the constant to match. Every callsite is updated: the constant is used only in this file. terminal_bench_env_config is called by the 3 recipes and tests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py:50-51, all with the default.
  • Resolved: the contract for a foreign package. The taskset_id doc now says the package exports this example's taskset and harness (re-exports, as in the TLDR). That makes TerminalTasksetConfig / TerminalBenchTerminusHarnessConfig the right config classes, and keeps "Terminus-2" in the summary line true. A package with its own Taskset subclass falls outside this helper, which the doc now implies.
  • The "and its own env if it has one" clause matches the "Taskset ids" section of torchtitan/rl/examples/verifiers/README.md:261-262: with the env unset, Verifiers takes the one in the taskset's package.

Not verified: that Verifiers resolves a foreign taskset_id to the re-exported TerminalTaskset and the package's own env on a worker. Verifiers isn't installed in this checkout, and no test passes a non-default id.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: 98a8f6a: the taskset_id docstring now says when to pass it: a launcher that keeps this example's taskset but needs its own env and harness, e.g. to run each rollout in a remote sandbox instead of local Docker. @claude please review

@claude

claude Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 1m 16s —— View job


Verdict: Approve -- please address the item below before merging -- review

@claude claude 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.

Verdict: Approve -- please address the item below before merging. The Summary now names the users: MAST and CoreWeave launchers that need their own sandbox env. The change is one argument, and the in-repo recipes and the test produce the same configs as before.

What this PR does. It adds taskset_id to terminal_bench_env_config. The default is TERMINAL_BENCH_TASKSET_ID, which is TERMINAL_BENCH_PACKAGE_ID renamed. The argument becomes the id of both the TerminalTasksetConfig and the TerminalBenchTerminusHarnessConfig (torchtitan_recipes/rl/verifiers_terminal_bench.py:95,97). Verifiers then imports that package and takes the taskset, the harness and, if the package exports one, the env from its __all__ (torchtitan/rl/examples/verifiers/README.md:249-257).

Example.

env = terminal_bench_env_config("local/tmax@v1", max_turns=120, taskset_id="my-cluster-terminal-bench")
env.taskset.id, env.agent.harness.id   # ("my-cluster-terminal-bench", "my-cluster-terminal-bench")
# A worker runs `import my_cluster_terminal_bench` and loads its exported taskset, harness and env
# (e.g. RemoteSandboxEnv) instead of the example's TerminalTaskset + SingleAgentEnv.
# Before: the launcher had to model_copy both ids into the returned config.

Must fix

  1. torchtitan_recipes/rl/verifiers_terminal_bench.py:89-92 -- the doc says the package can bring its own harness, but it doesn't say that the harness config must accept the fields this helper sets, or that the runtime is still Docker. See the inline comment.
Since the last review
  • Resolved: the "Summary (human-written)" section is filled in, and it names the consumer (launchers for MAST and CoreWeave). That also answers the earlier "name the consumer" must-fix.
  • Resolved: the maintainer question about a supported surface for out-of-repo launchers. The author has given a concrete use case. The alternative (model_copy on both ids) is about 5 lines, and this argument is the smallest shape that removes it.
  • 98a8f6a changes only the taskset_id docstring. The constant is used only in this file. terminal_bench_env_config is called by the 3 recipes (lines 176-177, 318-319, 437-438) and by tests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py:50-51, all with the default.
  • The PR body's TLDR re-exports this example's TerminalBenchTerminusHarness. The new docstring example uses a custom harness. Both are valid under the contract in the inline comment.

Not verified: Verifiers resolving a non-default taskset_id to the package's own classes on a worker. Verifiers isn't installed in this checkout, and no test passes a non-default id.

Comment on lines +89 to +92
taskset_id: Name of the installed package that exports the taskset, the harness and,
optionally, the env. Pass your own to swap them, e.g. this example's taskset with an
env and harness that run each rollout in a remote sandbox instead of local Docker.
See "Taskset ids" in the Verifiers README.

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.

The doc now says the package can bring its own harness. But this helper still builds the harness as TerminalBenchTerminusHarnessConfig(..., version="0.22.0") and sets runtime=vf.DockerConfig(). A custom harness only loads if its config accepts exactly these fields. Per your earlier reply, Verifiers re-validates the config as the package's own config class (verifiers/v1/utils/loaders.py:77), so an extra required field fails on the worker. Also, a remote sandbox still gets Docker unless the caller swaps runtime. The previous push said the first part; this rewrite dropped it.

Smallest fix: add one sentence stating both points.

Suggested change
taskset_id: Name of the installed package that exports the taskset, the harness and,
optionally, the env. Pass your own to swap them, e.g. this example's taskset with an
env and harness that run each rollout in a remote sandbox instead of local Docker.
See "Taskset ids" in the Verifiers README.
taskset_id: Name of the installed package that exports the taskset, the harness and,
optionally, the env. Pass your own to swap them, e.g. this example's taskset with an
env and harness that run each rollout in a remote sandbox instead of local Docker.
Its taskset and harness configs must accept the fields set here; set the runtime as
above. See "Taskset ids" in the Verifiers README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants