Repository navigation
feat(harbor): multi-turn tasks, Harbor [[steps]] as turns (M34) - #4819
Conversation
|
/ok to test c651c07 |
c651c07 to
dc10869
Compare
|
/ok to test dc10869 |
|
/ok to test 900df85 |
900df85 to
21895b8
Compare
|
/ok to test 21895b8 |
|
/ok to test 9dceeb6 |
|
/ok to test cd095e5 |
|
/ok to test d3e037a |
ffrujeri
left a comment
There was a problem hiding this comment.
Thanks for the thorough port. All ten earlier threads look addressed at the current head with real covering tests, and the per-turn session, user and grading-file lifecycle reads cleanly; the focused suites pass locally. My main open question is the mean roll-up dropping a measured no-result turn: it matches Harbor but differs from Gym's single-turn scoring and could inflate rewards in training. The same question comes up again in #4951 for a later step whose preparation fails, so it might be worth deciding the scoring rule once here. With that decided and the forced_tasks follow-up linked, this looks close to ready to leave draft.
nemo_gym/tasks/harbor/prepare_builds.py (around line 202): Could a second prepare with builds.force over a complete record still leave forced_tasks unset? It looks like this early return skips build_images, so record_forced_tasks never runs here, which is the gap the PR body flags. Would it make sense to record the forced tasks on this path too, or link the follow-up issue before this leaves draft?
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — eight correctness, compatibility, and lifecycle issues remain.
Reviewed the changed files and their directly affected runtime, preparation, sandbox-access, and rollout-collection paths. The earlier admission-slot, literal-dollar, force-build selection, step-timeout scaling, task-data validation, MCP capability, and grading-file cleanup concerns have corresponding fixes in the current source. The complete-record force-build gap remains.
The reported mean behavior excluding no-result turns matches the explicitly documented Harbor scoring policy; it is not included as an additional implementation defect.
Source inspection only: no tests or live rollouts were executed. All three delegated inspections terminated; the deployment/framework advisory was unavailable for consolidation, so that assignment was rechecked directly. Suggested patches and proposed tests below require verification before adoption.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
/ok to test 1438d29 |
|
/ok to test 4f15198 |
|
/ok to test 5599a57 |
|
/ok to test 9c59312 |
|
/ok to test 7310fc2 |
Harbor multi-step tasks now load and run on the harbor environment server instead of being rejected. Each [[steps]] entry is one Gym turn in the same sandbox, as Harbor runs them without resume_trajectory: a fresh agent session per turn, the step's own instruction and agent budget, then the shared verifier with the task's tests/ and steps/<name>/tests/ on top. A turn that is masked, writes no valid reward file, or misses its min_reward ends the episode, and multi_step_reward_strategy (mean or final) rolls the turns up. Multi-step rows never carry the top-level instruction.md, which SWE-Interact uses for the hidden spec its simulated user holds. task_mcp_grants (off by default) grants the task's streamable-http [[environment.mcp_servers]] entries to the agent as MCP tool accesses, so a harness can reach a Compose sidecar such as SWE-Interact's ask_user server. Per-step workdir/, setup.sh, healthchecks, artifacts and separate verification are refused by name for now. Port note (round 13 layout, PR #4728 commit 59545d8): VerifierSettings and _turn_verifier_settings live in environment_servers/harbor/verifier.py beside _run_shared_verifier (HarborVerificationMixin); VerifierSettings carries the task's [[verifier.collect]] hooks, which the mixin runs for every turn; a step's user overrides the verifier user; the single-turn path still uploads the task's tests/ unconditionally (only step and multi-step folders may be absent). The conftest episode() helper builds a HarborEpisodeRequest. Port note (round 14, rebased onto the round-14 M24): the base now forwards the harness's own trajectory from the session close as ng_trajectory on the result (M7 round-14 fix), so _agent_turn returns it with the response and observations, HarborTurnResult carries it per turn as `trajectory` (left out when None, as ng_trajectory is) and a multi-turn episode forwards the last turn's, beside the last turn's observations; test_multi_turn covers it. The base's rewritten README rows (artifacts and hooks, image ENTRYPOINT), its verifier_image_config docstring and its _refuse_verifier_group seed check are kept as they are. Port note (round 20, rebased onto M33 1dd755f): the base's run() now bounds the episode with the task deadline (enforce_task_timeouts), seeds the harness with agent_timeout_sec, tolerates a timed-out session close and hands the verifier an ATIF export of the turn, so _agent_turn carries all four per turn (the step's own agent budget as agent_timeout_sec) and run() wraps both the single-turn path and _run_turns in one deadline, _post_seed_budget_s summing every turn's setup allowance, agent budget, hooks and verifier time for a multi-step task; a _TurnProgress holder gives the deadline failure the running turn's stage, response and observations. _verified_outcome exports each turn's transcript from that turn's own request (_export_trajectory takes it as a third argument) before _run_shared_verifier, which keeps its trajectory argument. VerifierSettings carries network_mode, which _score reports as verifier_network, and HarborTurnResult carries verifier_network. A multi-step task is refused at seed when separate_verifier_for_artifacts would force it into separate mode. materialize_task keeps the base's dataset_digest keyword on multi-turn rows. test_multi_turn covers the per-turn budget and transcript, the summed deadline and the seed refusal. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Felipe Vieira Frujeri <[email protected]> Co-authored-by: Felipe Vieira Frujeri <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
A Harbor task's Compose file may leave a variable to the deployment, as
SWE-Interact's simulated user does with ${LITELLM_BASE_URL}, ${LITELLM_API_KEY}
and ${SIM_USER_MODEL}. Prepare used to fail on any unresolved name. It now
leaves a name used only in a service's environment to the deployment, since an
environment value cannot change which images run; elsewhere it still fails.
The harbor server's compose_variables fill those names at seed from a literal
value, a process environment variable, or a Gym model server. A model_server
value is that server's sandbox-reachable URL with the episode's rollout prefix,
so a sidecar's model calls are recorded with the rollout and never become
training tokens. A name still unset at seed fails the episode terminally before
provisioning. A document holding these values goes to a private folder removed
after the group starts, never under artifacts_dir.
Port note (round 13 layout, PR #4728 commit 95804b3): the stack's loader
already follows docker compose for every unset name at prepare (an empty
string with one warning, M19), which covers the environment-only deferral, so
_blank_deployment_values is not carried; with operator_variables the loader
substitutes strictly, keeping the seed-time refusal. _compose_variable_values
and the episode-keyed _compose_document live in sandboxes.py
(HarborSandboxMixin); the per-digest cached document stays for servers without
compose_variables, and the private per-episode folder is used when they are
set. The seed pre-check reads the document through load_compose_document, so
it does not touch the provider block.
Port note (round 20, rebased onto M33 1dd755f): _create_compose on this base
routes sidecars per provider block, plans volumes and starts the group through
_start_with_pull_retries (M13/M22/M28), so the private per-episode document is
removed in a finally around that call, after the last pull attempt has read it;
_compose_document keeps the base's field check and volume planning around the
operator_variables load. The test's recording Compose stub takes the adapter's
extra keywords. Everything else applied unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Co-authored-by: Felipe Vieira Frujeri <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
SWE-Interact's tasks cannot prepare without two things Harbor does at run time. Every task's simulated user is a Compose sidecar with a build: section. Prepare now builds each sidecar context once, from that context's own Dockerfile, keyed by Harbor's content hash like main's build, and records it; the recorded image then stands in for the build: section everywhere the Compose file is read. A sidecar build takes only a context inside environment/, and its section passes the same host-safety checks as main's. With docker, the compose build of main then names main alone. The tasks' declared docker_image lacks the helper their Dockerfiles copy in, which is why their run configs pass Harbor's --force-build. builds.force builds the Dockerfile of a task that declares an image, and the loader then prefers the recorded build of the task's own Dockerfile, as Harbor does. Validating the main compose build also leaves environment values that only the deployment can fill blank, since they cannot change what is built. Port note (round 13 layout, PR #4728 commit df0a130): on this stack M24 (Compose service builds) already builds every service with a build: section, records it by service name under the context's digest and substitutes it at load (sidecar_build_services, ImageBuilder.build_many, with_built_images), and the M19 loader already leaves every unset Compose name blank at prepare, so the sidecar-build and blank_unresolved_environment parts are not carried. What is carried is builds.force: BuildOptions.force and BUILD_SETTINGS (build_options.py), plan_builds/build_images/_build_dockerfiles force (build_plan.py, image_build.py, prepare_builds.py) and the loader's preference (task.py). To keep the stack's rule that a recorded main is never substituted for a task pinned to a prebuilt image, the record names the tasks whose declared image a forced prepare built over (forced_tasks, written on build and on reuse) and the loader prefers the build for those tasks only. Port note (round 14, rebased onto the round-14 M24): the base's _build_dockerfiles now plans a second time without the tasks refused_before_build names (20 Oct review fix); that replan passes builds.force too, or a forced main would drop out of the plan whenever another task of the dataset is refused (test_harbor_compose_prepare covers it). Everything else applied unchanged. Port note (round 20, rebased onto M33 1dd755f): the loader on this base reads built-images.json from the dataset root (nested task folders, M27), so the forced_tasks record is read from the same root and _build_required keeps its root argument. The base's pre-build screen now reads keys only (a value such as featurebench's `count: all` is refused after the build), so the forced-replan test refuses its other task through a main.build.args key instead. Everything else applied unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Felipe Vieira Frujeri <[email protected]> Co-authored-by: Felipe Vieira Frujeri <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
A config overlay and README for running the published SWE-Interact dataset through the harbor environment server with Codex: force-built images and sidecars, the user-server MCP grant on every turn, the simulated user's model bound to a Gym model server, and an episode budget that fits the Atlas tasks. The overlay validates against the server's config model; native Codex sessions still need to accept MCP tool grants before a run can start. Port note (round 13 layout, PR #4728 commit 5c33771): unchanged apart from one README sentence, since on this stack the user-server sidecar is built as a second service of each task's context (M24 Compose service builds), not as a context of its own. Port note (round 14, rebased onto the round-14 M24): the recipe lives under environments/harbor/swe_interact/ (the stack moved benchmarks/harbor/ to environments/harbor/ beside terminal_bench_4), and the --config paths in the README and the overlay's header follow; the files are otherwise unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Felipe Vieira Frujeri <[email protected]> Co-authored-by: Felipe Vieira Frujeri <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…step_reward_mode (M34 follow-ups) Two follow-ups to M34 (Harbor [[steps]] tasks as turns), to be squashed into it. A step's `[steps.verifier].user = "name:group"` was dispatched as written by `_turn_verifier_settings` on every provider, while the task-level `[verifier].user` pair was refused at seed on providers that switch user by name only. Every step's pair is now refused in `_refuse_verifier_group` the same way: a terminal seed failure with no sandbox, session or exec, instead of a verification failure after the earlier turns were paid for; on Docker the pair passes and grades that turn alone. The refusal names the step that carries the pair (`<task_id> step 'build': user ...`), as the loader names the step in its per-step refusals; the task-level message is unchanged. The agent-side sibling, `[steps.agent].user`, was read by the model and applied by nothing: every turn runs as the task's user, where Harbor 0.22.0 switches to the step's own user per step (`multi_step.py` `_step_agent_user`). The loader now refuses a step that sets one, by step name, like the other per-step features it does not run yet, so the task fails at load (and at seed, through the server's snapshot) instead of running as the wrong user. The memory team's MemoryArenaBundledShopping tasks carry the pre-1.3 keys `version = "1.0"` and `multi_step_reward_mode = "aggregate"`. Harbor 0.22.0 maps `version` to `schema_version` and has no `multi_step_reward_mode` field: the key is dropped as unknown and the task rolls up with the default `mean`. The mirror accepts the key as a known legacy spelling and drops it the same way: "aggregate" is dropped and the task rolls up with the default `mean` (an explicit `multi_step_reward_strategy` beside it is the one read), any other value is dropped with a warning naming it, and the loader no longer reports the key as unknown. The shape of one task of that dataset is a unit-test fixture (its task.toml, Dockerfile and Compose file with a placeholder sidecar image, and per step a one-line instruction with stub solve.sh and test.sh in place of the dataset's own scripts) and loads as six turns with per-step budgets, a streamable-http MCP sidecar from a Compose file and per-step instruction, solution and tests, with no top-level instruction, tests or solution. Signed-off-by: Adil Asif <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…decar sizing, long-task budget (M34 follow-ups) Six follow-ups on the M34 multi-turn work (#4819), found running the memory team's MemoryArenaBundledShopping task end to end on OpenSandbox (round-24 G7_M34 and G4_M30). 1. Per-step solution for the oracle: the server places each turn's steps/<name>/solution/ at /solution (falling back to the task's top-level solution/), gym dataset validate counts a multi-step task validatable when every step has a solution, and the oracle is unchanged. Removes the need for G7's dispatcher. 2. Registry credentials at prepare: record_image_configs reads the sandbox block's images.auth (credentials_for_image_prefixes, registry_credentials_from_overrides) so a private Compose sidecar records without an anonymous HTTP 403; no new config key. 3. Sidecar sizing and diagnostics: the seed warns once per task which sidecars run at the provider's default size, and an unhealthy-service failure carries a bounded tail of the service's command log. 4. Episode timeout for a long multi-step task: a new BaseEnvironmentServer.episode_timeout_seconds hook; the Harbor server raises the deadline and sandbox lifetime to the task's own budget when the steps exceed default_episode_timeout_seconds, and refuses at seed naming the setting when enforcement is off. 5. Step-level agent user: [steps.agent].user is applied per turn (sandbox default user, workdir owner, harness user switch and switch back), a name:group pair refused at seed by step on name-only providers. 6. Docs: new fern page data/multi-step-tasks.mdx and the harbor README updated. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…agent A multi-step episode verifies every turn in the agent's own sandbox, and the shared verifier only emptied /tests and /logs/verifier right before it ran. Between two turns the next agent's fresh session therefore worked beside the previous turn's uploaded tests (hidden ones included: SWE-Interact uploads its root tests/test.patch from the first step on), its reward, and the previous agent's transcript at /logs/agent/trajectory.json. Before every turn after the first, the server now empties /tests and /logs/verifier and removes /logs/agent/trajectory.json as root, with the same command the shared verifier already used, as Harbor's _reset_shared_step_verifier_dirs does between steps. The first turn keeps whatever the image put in /tests. Files the agent wrote under /logs/agent stay. A sandbox that cannot do it fails the episode retryably before the next agent session opens. Reported by Yuhe Zhang in review of #4728 (P1). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The harbor server refuses a task that declares [[environment.mcp_servers]] or skills_dir to a harness that does not declare supports_task_tool_context, so the run cannot score a silent zero without its tools. The check only knew the task.json channel: with task_mcp_grants it still refused every harness that does not read task.json, even one that took every server as a grant. Hermes and Pi, which accept required MCP grants in the agent's sandbox, could therefore not run SWE-Interact or the Harbor Cookbook's simulated-user recipe. A declared MCP server now counts as reached when it was granted as required: by the tool-access contract, a harness that cannot establish a required server fails its seed. Optional grants may be skipped, SSE and other non-streamable-http servers cannot be granted, and skills_dir has no grant, so those still need supports_task_tool_context. The refusal now names what would not reach the harness and points at task_mcp_grants: required. Codex, Claude Code, OpenCode, Kilo Code and OpenClaw still reject required grants in sandbox mode; with this change such a task fails loudly at their seed instead of being refused up front. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The Harbor environment server graded every agent response, including failed ones whose harness had reported the cause in response.metadata.ng_agent_outcome. A Codex response that failed with a stream error reported as `unknown` was handed to test.sh on the half-finished sandbox and recorded as a real 0. single_agent_turn already routes these responses through agent_outcome_policy; Harbor ignored it. - Move OutcomeAction, AgentOutcomePolicyConfig and agent_outcome_policy from environment_servers/single_agent_turn/app.py into nemo_gym/agent_outcome.py, next to AgentOutcome, so both environment servers share one implementation. No behavior change for single_agent_turn. - Add agent_outcome_policy to HarborEnvironmentServerConfig and apply it after the agent session closes and before verification. retry and fail become a stage: agent episode failure (non-terminal and terminal respectively) that keeps the partial response, the agent's observations and its trajectory; verify runs test.sh as before. - Point the agent tests (Codex, OpenCode, Pi, Hermes) at the new import location. - Docs: the harness guide now says the policy applies to harbor too; the Harbor README and the module docstring describe the rule. Ported from #4950 onto the multi-turn server: the policy sits in the shared turn helper, so it applies to every turn of a [[steps]] task as well as to a single-step task. A retry or fail cause on a later step ends the episode at that turn, ungraded, with the partial response and observations attached; a new multi-turn test covers it. (cherry picked from commit d8a25d9) Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
/ok to test bf97cbb |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40407409248 |
What does this PR do?
M34 of the Harbor stack: Harbor
[[steps]]tasks run on theharborenvironment server as turns, and thedeployment can fill a task's Compose variables and force-build declared images, which SWE-Interact needs.
The four commits are Felipe's PR #4728 (
feat(harbor): multi-turn tasks), ported onto the stack above M33(
adasif/harbor-m33-dataset-identity), author kept, each commit carrying its port notes. In order:feat(harbor): run [[steps]] tasks as turns and grant task MCP servers— each[[steps]]entry is one Gymturn in the same sandbox (a fresh agent session per turn, the step's instruction and agent budget, then the
shared verifier with
tests/andsteps/<name>/tests/on top); a masked turn, a missing reward or a missedmin_rewardends the episode andmulti_step_reward_strategyrolls the turns up; multi-step rows never carrythe top-level
instruction.md;task_mcp_grants(off by default) grants the task's streamable-http[[environment.mcp_servers]]to the agent. Per-stepworkdir/,setup.sh, healthchecks, artifacts andseparate verification are refused by name.
feat(harbor): let the deployment fill a task's Compose variables—compose_variableson the server fill${NAME}s a task's Compose file leaves to the deployment, from a literal, a process variable or a Gym modelserver (its sandbox-reachable URL under the episode's rollout prefix); a name still unset fails the episode
before provisioning; the per-episode document lives in a private folder outside
artifacts_dir.feat(harbor): build Compose sidecars and force-build declared images—builds.forcebuilds the Dockerfileof a task that declares
docker_image(Harbor's--force-build); the record names the forced tasks and theloader prefers the build for those only.
docs(harbor): add a SWE-Interact run recipe on the Harbor task shape— overlay and README underenvironments/harbor/swe_interact/.Port notes (carried from the earlier rounds, kept in the commit messages)
HarborTurnResult.trajectorycarries the harness's own trajectory per turn; a multi-turn episode forwards thelast turn's as
ng_trajectory, beside the last turn's observations.build:section and the M19 loader leaves everyunset Compose name blank at prepare, so the sidecar-build and
blank_unresolved_environmentparts of docs(harbor): add a SWE-Interact run recipe on the Harbor task shape #4728 arenot carried;
builds.forceis, throughBuildOptions.force,plan_builds/build_images/_build_dockerfilesand the loader.
_build_dockerfiles' replan without the refused tasks honoursbuilds.forcetoo.record_forced_tasks/forced_tasksreconciliation: a recordedmainis substituted for a declared-image taskonly when that task was built under
force, keeping the stack's rule that a task pinned to a prebuilt imagenever gets another task's record.
environments/harbor/swe_interact/(the stack's layout besideterminal_bench_4).Port notes (round 20, this rebase onto M33)
run()now bounds the episode with the task deadline (enforce_task_timeouts), seeds the harnesswith
agent_timeout_sec, tolerates a timed-out session close and hands the verifier an ATIF export of the turn._agent_turncarries all four per turn (the step's own agent budget asagent_timeout_sec);run()wraps thesingle-turn path and
_run_turnsin one deadline;_post_seed_budget_ssums every turn's setup allowance,agent budget, hooks and verifier time for a multi-step task; a
_TurnProgressholder gives the deadline failurethe running turn's stage, response and observations.
_verified_outcomeexports each turn's transcript from that turn's own request (_export_trajectorytakes itas a third argument) before
_run_shared_verifier, which keeps itstrajectoryargument;VerifierSettingscarries
network_mode(reported asverifier_network, per turn too).separate_verifier_for_artifactswould force it into a mode itsturns do not run (the loader admits multi-step tasks in shared mode only).
materialize_taskkeeps M33'sdataset_digestkeyword on multi-turn rows._create_composeon this base routes sidecars per provider block, plans volumes and starts through_start_with_pull_retries, so the private per-episode document is removed in afinallyafter the last pullattempt has read it;
_compose_documentkeeps the field check and volume planning around theoperator_variablesload.built-images.jsonfrom the dataset root (nested task folders, M27), soforced_tasksis readfrom the same root; the base's pre-build screen reads keys only, so the forced-replan test refuses its other task
through a
main.build.argskey.Reviewer notes for @ffrujeri
environment_servers/harbor/app.py:run(),_agent_turn,_run_turns,_verified_outcome,_deadline_failure,_post_seed_budget_sand the seed refusal are where the port diverges from docs(harbor): add a SWE-Interact run recipe on the Harbor task shape #4728; theturn protocol itself is yours. Please check the multi-turn deadline budget (sum over turns) matches what you
expect for the Atlas tasks against
default_episode_timeout_seconds: 32400in the overlay.environment_servers/harbor/verifier.py:VerifierSettings.network_modeand the_export_trajectorythirdargument are additions of the port.
nemo_gym/tasks/harbor/task.py: theforced_tasksread moved to the dataset root with the rest of the recordreads.
MCP tool grants before a run can start (as in docs(harbor): add a SWE-Interact run recipe on the Harbor task shape #4728).
Follow-up (flagged gap, not fixed here)
When every planned context already has a usable record,
_build_dockerfilesreturns beforebuild_images, sorecord_forced_tasksnever runs on that path: a secondpreparewithbuilds.forceover a complete record doesnot add the forced task names, and the loader keeps the declared image for a task first prepared without
force. Tracked as a follow-up on this PR.Validation
Run from the branch at the current tip, with the stack's
m2envvenv (RAY_TMPDIR=/tmp):environment_servers/harbor/testsin its own session,-k "not partial_eval and not buildah and not validate_ and not real_image":380 passed, 2 deselectedresponses_api_agents/harbor_oracle_agent/tests:22 passedtest_harbor_tasks.py test_harbor_image_build.py test_harbor_image_configs.py test_compose_config.py test_harbor_build_plan.py test_harbor_build_records.py test_harbor_build_tools.py test_harbor_compose_prepare.py test_harbor_validation.py test_cli_main.py test_rollout_outcomes.py test_episode_types.py test_harbor_manifest.py test_rollout_collection.py test_global_config.py):1 failed, 1646 passedin one session; the one failure,test_global_config.py::TestGlobalConfig::test_get_global_config_dict_global_env_var, is a pre-existingsession-order leak from
test_harbor_tasks.py(the same 15-file session on the unmodified M33 base gives1 failed, 1633 passedwith the same test;test_global_config.pyalone:232 passed). Docker Hub 429s intest_harbor_validationare node noise and did not fail here.ruff check .: All checks passed;ruff format --check .: all files already formattedpre-commit run --files <the 25 changed files>: all hooks passedenvironment_servers.harbor.{app,verifier,sandboxes},nemo_gym.tasks.harbor.*andnemo_gym.sandbox.*: oktests/unit_testsimportsenvironment_servers.harbor.app(coverage gate unchanged).and fake agent client of the server suite (
test_multi_turn.py: per-turn sessions, budgets, transcripts,deadline, roll-up, MCP grants). A SWE-Interact run with Codex is blocked on native Codex sessions accepting MCP
tool grants.
Compatibility and benchmark impact
HarborTaskInputreplacesSingleAgentTurnTaskInputon Harbor rows(same JSON for single-turn rows),
HarborEpisodeResultgainsturns,turn_reward_strategy,turns_without_verifier_result,stopped_after_turn(allNonefor single-turn episodes).task_mcp_grants(defaultoff),compose_variables(default empty). New build optionbuilds.force(defaultfalse). Newbuilt-images.jsonfieldforced_tasks.workdir/,setup.sh, healthchecks,artifacts and separate verification are still refused by name. No existing benchmark result changes.
Follow-ups (sixth commit)
Summary
Six follow-ups on the M34 multi-turn work (#4819), all found while trying to run the memory team's
MemoryArenaBundledShoppingtask end to end on OpenSandbox (round-24 G7_M34 and G4_M30 reports). Together they letgym dataset validaterun that task through the oracle with no dispatcher and no prerecord script, the way Harborruns a
[[steps]]task.What changes
[[steps]]task keeps its reference solutions insteps/<name>/solution/solve.sh. The environment server now places the current turn's step solution at/solutionbefore each turn (emptying the previous turn's), falling back to the task's top-levelsolution/for a step without its own, exactly as Harbor 0.22.0's
MultiStepTrial/OracleAgentresolve it.gym dataset validatecounts a multi-step task as validatable when every step has a solution (its own or the task's), andlists it unvalidated otherwise.
HarborTask.has_solution/turn_solution_dir(loader),_place_turn_solution(server) and
has_solution(CLI filter) carry it; the oracle is unchanged.record_compose_images/record_base_imagesread the sandbox block'simages.auth(image prefix →{username, password}, keyed by registry host) and record private images withit, so a private Compose sidecar no longer stops prepare with an anonymous
HTTP 403. Newregistry.credentials_for_image_prefixesandcli.registry_credentials_from_overrides; no new config key. Testedthrough
prepare_targetagainst a fake registry whose token endpoint refuses the private repository withoutBasic auth, with the credentials (recorded, Basic auth sent to that host only) and without (the registry's 401
stops prepare, naming the image and the task).
default size (no
deploy.resources), naming where a size goes; a sidecar whose process dies at start fails thegroup with a bounded tail of its command log, not only
unhealthy: exit status 1. The tail is a second execafter the verdict and the sandbox may be gone by then (an OOM-killed pod), so a failure to read it goes into the
message and never replaces the verdict that names the service (unhealthy and exited paths alike). Documented how
to size a sidecar (
deploy.resources.limitsin the task's Compose file). Defaults are unchanged.once the sandbox is ready (every step's harness setup, agent, hooks and verifier time), the nominal episode (one
ready timeout, and the overlay build, before that) and the worst case (a ready timeout and its grace per image
pull attempt), because the episode deadline opens before the seed. With
enforce_task_timeouts, a multi-steptask whose worst case is above
default_episode_timeout_secondsgets the episode deadline and sandbox lifetimeraised to it (an episode cut off at the default would be retried, never scored), logged once per episode at
WARNING with all three figures. Without enforcement the default is the deadline: a task whose nominal episode
does not fit it is refused at seed naming the setting and both figures; one that fits only without a retried
seed runs, with a WARNING that a retried seed may time the episode out. New
BaseEnvironmentServer.episode_timeout_secondshook.[steps.agent].useris applied per turn (the sandbox default user, the workingdirectory owner and the harness's user switch for that turn, a numeric uid resolved to its name, and switch
back for a later step), as Harbor runs each step. The seed's default user is put back around each turn's
verifier (hooks and
test.sh), as Harbor'swith_default_useraround the agent phase ends before its sharedverifier, so
test.shnever runs as a step's agent user; a switch back to the image's default gives theworking directory back to the owner the seed left. A
name:grouppair is refused at seed on a provider thatswitches by name only, naming the step, as the task's own user is.
data/multi-step-tasks.mdx(what runs per turn, verification per step, reward roll-up,early stop, per-step solutions and users, legacy keys, sidecar sizing, what is refused); harbor README updated.
Test plan
environment_servers/harbor/tests/test_multi_turn.py(per-turnsolution placement and reset, per-step user switch/switch-back, the verifier's user under a switch on a root
and a non-root image, the workdir owner restored, step-user group refusal, long-task bound, a seed slower than
the ready timeout, the no-enforcement refusal at the boundary and the run-with-WARNING case above it),
test_app.py(sidecar sizing warning),tests/unit_tests/test_harbor_tasks.py(per-stephas_solution/turn_solution_dir, step-agent-user loads,registry credentials from the sandbox block),
test_harbor_validation.py(validate keeps a per-step-solutiontask),
test_harbor_image_configs.py(credentials_for_image_prefixes, andprepare_targetend to end againsta token-refusing fake registry with and without credentials),
test_docker_compose.py(unhealthy-service logtail, and the verdict surviving a sandbox that ended before the tail could be read),
test_environment_server.py(per-request deadline hook).
environment_servers/harbor/tests -k "not partial_eval and not buildah and not validate_ and not real_image":428 passed, 2 deselected.
responses_api_agents/harbor_oracle_agent/tests: 22 passed. The touched core unitfiles in one session: 602 passed.
ruff check/formatclean;pre-commiton the changed files passed.49e7d1e77):gym dataset validateofMemoryArenaBundledShopping/0000-baking-item-0through the oracle on OpenSandbox, with no dispatcher and no prerecord script (live config, run script, logs
and rollouts in the group folder,
live_runA_v3/): six turns verified, eachverifier_return_code 0, reward 1.0,oracle solved, 4:44 wall, with the item-4 budget WARNING in the environment log naming all three figures(23 580 s after the seed, 31 680 s with one sandbox start, 33 705 s with every pull retry; the deadline follows
the last, above 21 600). A second run of the same copy without the sidecar's
deploy.resources(live_runB_v3/)shows the item-3 WARNING naming the service and, 82 s later, the default-size sidecar ended
OOMKilledby theprovider, reported as a retryable seed failure with that cause. Round 1's runs of the previous head are kept under
live_runA/andlive_runB/.Turn cleanup and MCP grants (commits 7 and 8)
Two fixes from Felipe's gap analysis of the Harbor runtime, ported from his drafts #4903 and #4904 onto this branch with the review changes folded in:
fix(harbor): clear the previous turn's grading files before the next agent(8c39a50). Before every turn after the first, the server empties/testsand/logs/verifierand removes its/logs/agent/trajectory.jsonas root, with the command the shared verifier already runs, so the next agent does not open beside the previous turn's tests, reward or transcript; a failed reset fails the episode (agent stage, retryable) before the next session opens. Harbor 0.22.0 clears these only before each step's verifier and Harbor main clears them in step preparation, which this follows; Harbor also empties the whole/logs/agent, here the agent's own files stay. Documented in the README and the Fern multi-step page.fix(harbor): let required MCP grants satisfy a task's MCP servers(16d1686). The seed check that refuses an MCP task to a harness withoutsupports_task_tool_contextnow counts a server granted as required as reached, and refuses only what a grant cannot cover (optional grants, non streamable-http entries,skills_dir), naming it. The grant lookup runs inside the seed's try, so a declaration the grant schema rejects is a staged terminal failure; the grants and the check read one list (the overlay-merged list once M30 lands); thetask_mcp_grants: requiredhint is offered only when it would help.Checklist
environment_servers/harbor/README.md,environments/harbor/swe_interact/).Agent outcome policy before verification (commit 9)
fix(harbor): apply agent outcome policy before verification(9dceeb6), ported from Felipe's fix(harbor): apply agent outcome policy before verification #4950. The server graded every agent response, including failed ones whose harness had reported the cause inresponse.metadata.ng_agent_outcome; a Codex stream error reported asunknownwas handed totest.shon the half-finished sandbox and recorded as a real 0.OutcomeAction,AgentOutcomePolicyConfigandagent_outcome_policymove fromsingle_agent_turnintonemo_gym/agent_outcome.py(shared, no behaviour change there), the Harbor server config gainsagent_outcome_policy(same schema and defaults), and the policy runs after the agent session closes and before verification:retryandfailbecome astage: agentepisode failure (non-terminal and terminal) carrying the partial response, observations and trajectory;verifyrunstest.shas before. On this branch the hook sits in the shared turn helper, so it applies to every turn of a[[steps]]task too: a retry or fail cause on a later step ends the episode at that turn, ungraded (new multi-turn test). Felipe's TB4 evidence on fix(harbor): apply agent outcome policy before verification #4950: six Codex tasks moved from 18 fake zeros to retried ungraded failures, four controls unchanged.🤖 Generated with Claude Code