Repository navigation
[rl] Terminal-Bench: terminal_bench_env_config takes the package that exports the taskset - #5876
Conversation
c12151c to
708a921
Compare
|
@claude review |
|
Claude finished @felipemello1's task in 2m 1s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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
- 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.
- 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
EnvConfigtype, the hard-codedHarborEnvConfig(...)in the helper would also have to be replaced on the returned config. IsHarborEnv(or a subclass that acceptsHarborEnvConfig) 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.replaceon the returned config, swapping both taskset configs and resettingverifiers_env_server.environment.tasksettoVerifiersTasksetConfig()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.mddiscourages. So if the use case is accepted, the argument is the right shape (+1 parameter, 3 substitutions). _local_taskset_modulerequirestaskset.id == alias(type(taskset).__module__). The helper registers the alias from the sametaskset_config_cls.__module__, so the two always agree.torchtitan_recipesis 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).
| 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__ |
There was a problem hiding this comment.
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.
708a921 to
96a1e89
Compare
a52089b to
58fa440
Compare
96a1e89 to
c4797b7
Compare
|
Claude finished @felipemello1's task in 2m 15s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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 MyTasksetMust fix
- 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_recipesbe 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
TerminalTasksetsubclass and an Env, and loads them throughresolve_env_config/load_environment, which is the worker's path. - Resolved: the question about a hardcoded env config.
resolve_env_configre-validatesworker.environmentas the config class of the Env that the taskset package exports, sovf.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.
| assert env.config.agent.harness.id == "torchtitan_verifiers_terminal_bench" | ||
| assert isinstance( | ||
| load_harness(env.config.agent.harness), TerminalBenchTerminusHarness | ||
| ) |
There was a problem hiding this comment.
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.
| assert env.config.agent.harness.id == "torchtitan_verifiers_terminal_bench" | |
| assert isinstance( | |
| load_harness(env.config.agent.harness), TerminalBenchTerminusHarness | |
| ) |
There was a problem hiding this comment.
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.
58fa440 to
e070bcd
Compare
c4797b7 to
16a1803
Compare
|
Claude finished @felipemello1's task in 56s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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
- 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_recipesbe a supported surface for out-of-repo launchers? If yes,taskset_idis 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-276are 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 thatVerifiersTaskDataset.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.
e070bcd to
22c93e2
Compare
16a1803 to
91c269f
Compare
cfc55e1 to
b927628
Compare
|
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 finished @felipemello1's task in 44s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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 MyTasksetMust fix
- 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_recipesbe a supported surface for launchers outside the repo? If yes,taskset_idis 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 setsruntime. 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.
f21370b to
238c621
Compare
b927628 to
c2624c8
Compare
238c621 to
ea0ee59
Compare
c2624c8 to
d08019e
Compare
|
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 |
|
Claude finished @felipemello1's task in 43s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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 MyTasksetMust fix
- 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_recipesbe a supported surface for launchers outside the repo? If yes,taskset_idis 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_envare 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 setsruntime. That needs no change here.
- The helper and the dataset validation call the same
Not verified: an Env whose own config class has extra required fields. Verifiers isn't installed in this checkout.
|
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 finished @felipemello1's task in 33s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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 MyTasksetMust fix
- 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_recipesbe a supported surface for launchers outside the repo? If yes,taskset_idis 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_envare 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 setsruntime.
- The helper and the dataset validation both call
Not verified: an Env whose own config class has extra required fields. Verifiers isn't installed in this checkout.
|
Reply from claude: @claude please review |
|
Claude finished @felipemello1's task in 1m 44s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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 unchangedMust fix
- 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.
- 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_configtakes env configs, so the launcher can build its ownvf.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 differentpackage_id, the summary line "Terminus-2 in a local Docker container" may not hold, because the harness is whateverpackage_idexports. Also, the configs built here are alwaysTerminalTasksetConfig/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 thepackage_iddoc would state that contract.
Questions
- For maintainers (still open): should helpers in
torchtitan_recipesbe a supported surface for out-of-repo launchers? If yes,package_idis 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_idargument on the rollouter helper (rename plustaskset_config_type) is gone. The base now has a publicterminal_bench_env_configand aterminal_bench_rollouter_config(train_env, validation_env, ...)that takes env configs, and this PR only addspackage_idto the env helper. - The earlier test
test_taskset_id_picks_the_taskset_config_and_envis 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).
|
Reply from claude: answers to the points in the review that have no inline thread.
The user is a launcher outside the repo that ships its own Taskset package. It can't be named here.
Done. The
That is the maintainers' call. If yes, this argument is the smallest shape. If no, this PR closes, and a launcher calls |
|
Claude finished @felipemello1's task in 1m 12s —— View job Verdict: Needs discussion -- review |
There was a problem hiding this comment.
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
- 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.
- 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_copyswap above is about 5 lines in the launcher. The helper's docstring already recommends that pattern forruntime(verifiers_terminal_bench.py:83-84), so it doesn't break.claude/rules/config.mdany more than the existing guidance does.
Questions
- For maintainers (still open): should helpers in
torchtitan_recipesbe 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_configis called by the 3 recipes andtests/rl/unit_tests/cpu/test_verifiers_terminal_bench.py:50-51, all with the default. - Resolved: the contract for a foreign package. The
taskset_iddoc now says the package exports this example's taskset and harness (re-exports, as in the TLDR). That makesTerminalTasksetConfig/TerminalBenchTerminusHarnessConfigthe right config classes, and keeps "Terminus-2" in the summary line true. A package with its ownTasksetsubclass 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.
… exports the taskset
|
Claude finished @felipemello1's task in 1m 16s —— View job Verdict: Approve -- please address the item below before merging -- review |
There was a problem hiding this comment.
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
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_copyon both ids) is about 5 lines, and this argument is the smallest shape that removes it. - 98a8f6a changes only the
taskset_iddocstring. The constant is used only in this file.terminal_bench_env_configis called by the 3 recipes (lines 176-177, 318-319, 437-438) and bytests/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.
| 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. |
There was a problem hiding this comment.
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.
| 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. |
Summary (human-written)
exposes import path arg so this works with mast/coreweave
Agent details
TLDR:
terminal_bench_env_configtakes ataskset_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.Depends on the PRs below it: they make each example an installed package and add
terminal_bench_env_config.Problem
terminal_bench_env_configalways uses this example's package,torchtitan-verifiers-terminal-bench.Solution
taskset_idargument, used as the taskset id and the harness id.TERMINAL_BENCH_TASKSET_ID, so recipes in the repo don't change. The constant is renamed fromTERMINAL_BENCH_PACKAGE_ID, so the argument and its default share one name.You may ask: why
taskset_id, notpackage_idorenv_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 anEnvConfig.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 defaulttaskset_id.my-cluster-terminal-bench. Verifiers loadsTerminalTasksetandTerminalBenchTerminusHarnessfrom it, andSingleAgentEnvsince it exports no env.pytest tests/rl/unit_tests/cpu: 695 passed, 7 skipped.