Skip to content

fix: make local task-folder runs work on laptops and report rejected model requests - #5798

Merged
adil-a merged 39 commits into
mainfrom
adasif/local-run-fixes
Dec 1, 2026
Merged

adil-a merged 39 commits into
mainfrom
adasif/local-run-fixes

Conversation

@adil-a

@adil-a adil-a commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the problems Chris Wing hit running the environments/hello_* examples on macOS with Docker Desktop (#5131 review), and what a laptop rerun of every hello example found after that.

Scope. Behavior changes only on task-folder runs (gym eval run <task folder>) and in the hello_* examples. Every other run (benchmarks, Harbor-backed --benchmark runs, task runs gym eval submit sends to a cluster, cluster configs) and every harness and model server outside that path behave as on main. The MCP client's rerun under its own venv applies everywhere, but it only turns a failure into a working call. Repeated regression audits against main checked this, each finding verified by a separate agent (see Testing).

Model server address on laptops

gym eval run <task folder> --agent opencode_agent --sandbox docker stopped with Cannot resolve host '<hostname>' for use_absolute_ip=true. A harness that calls the model from inside the sandbox needs an address the sandbox can reach. Gym used gethostbyname(gethostname()) and refused both a failed lookup and a loopback result, which covers most laptops: a macOS *.local name, or Debian and Ubuntu's 127.0.1.1.

A task-folder run on your machine now sets a new reserved key, absolute_ip_route_fallback. With it, Gym falls back to the address of the interface the default route leaves through, found with a UDP connect() that sends nothing, and logs a warning naming that address. The run fails only when there is no such route, for example offline. A resolvable hostname still wins, and an explicit default_host still skips resolution. The fallback applies only together with absolute_ip_server_types, so only the model server moves off loopback. Every other config fails with main's errors, including a --benchmark run, a run gym eval submit sends to a cluster, and any config that sets absolute_ip_server_types itself.

On a laptop that address is usually the Wi-Fi or VPN address, and the Model Server checks no credential, so for the run's duration another machine on that network can send it requests it forwards with your API key. The troubleshooting page now says so. A per-run token is proposed as a separate change.

Deadlines on macOS

Under uvloop on macOS the event loop's clock differs from time.monotonic(), so every sandboxed activation timed out at once. Earlier versions of this PR moved the deadlines to the loop's clock; main has since fixed the same bug the other way (#6324: deadlines are time.monotonic() times, enforced with monotonic_timeout), and the two cannot be mixed, so this PR now takes main's fix and changes no deadline code.

mini-SWE setup on macOS

hello_mcp_tool with miniswe_sandboxed_agent failed after about 17 s with mini-SWE setup timeout: TimeoutError, and the only logged error was mini-SWE process cleanup failed: .../venv/bin/python: No such file or directory.

  • The setup deadline is fixed on main (above).
  • A setup timeout is now logged with its budget.
  • Cleanup skips the venv's interpreter when setup never installed it, so its error no longer hides the real one.

Task MCP tools in miniswe_sandboxed_agent

The harness tells the model to call a task's MCP tools with <venv>/bin/python client.py call ..., but models often run python3 client.py. The system Python lacks the client's dependencies, so the call failed with ModuleNotFoundError and the model wrote the answer by hand, which hello_mcp_tool scored 1. The client now re-executes itself under its venv's Python when another interpreter starts it. Its command line is unchanged from main.

hello_mcp_tool checks that the tool was called

test.sh compared only /workspace/tool-greeting.txt. The server now appends each call to /logs/agent/hello-tools-calls.jsonl, and test.sh requires a call for NeMo Gym as well as the file. solve.sh calls the tool over MCP stdio, as an agent would. The README and the task-folder patterns page describe the check (it is not tamper-proof), and a unit test runs the real test.sh against the real server.

--max-output-tokens on task folders

OpenCode and Pi ask for up to 131,072 output tokens by default, which exceeds caps such as gpt-4.1's 32,768. --max-output-tokens sets responses_create_params.max_output_tokens, and the collector refuses that for materialized task rows, because the harness sends its own requests. For a task target it now becomes the harness's own max_output_tokens on the generated agent block, for harnesses whose config declares one (such as OpenCode, Pi, Kilo, OpenClaw, Prime, Droid and Copilot). Other harnesses refuse it, with a message, before preparation. A Harbor-backed --benchmark run now accepts the flag too; on main it refused it. Defaults are unchanged: about 15 shipped benchmark configs rely on 131,072. That default is more than some hosted models allow (gpt-4.1 32,768, GPT-5 128,000); newer ones such as GPT-5.5 and gpt-6.1-sol accept it. The hello READMEs' commands now name a model and endpoint, --model gpt-6.1-sol --model-url https://api.openai.com/v1 --model-api-key "$OPENAI_API_KEY", so they run as pasted, and say when to add --max-output-tokens for another model; the troubleshooting page lists example caps. Fitting the limit automatically in openai_model is left for a separate change.

A refusal of the run's own settings is a failure, not a 0

In Chris's run, OpenAI answered every call with 400 because the output limit was above the model's cap. openai_model passes through only 401, 403 and 429, so OpenCode got a 500. OpenCode retries a 5xx with no attempt limit, so each task ran to its agent timeout, ended incomplete, and was graded 0 with failed: 0. Pi at its default limit against gpt-4.1 also scored 0.0 with exit 0.

  • Only on task-folder runs with OpenCode or Pi. For those harnesses (CONFIGURATION_REFUSAL_HARNESSES in nemo_gym/data/tasks/harbor/prepare.py), a task-folder run sets a new reserved key, forward_configuration_refusals. Nothing else sets it: not a --benchmark run, not any other harness. A task run gym eval submit sends to a cluster renders ++forward_configuration_refusals=false ++absolute_ip_route_fallback=false on its command line (render_target_args), unless its own run: block sets either, so it behaves as on main.

  • openai_model: its default stays main's {401, 403, 429}. With the key set, it also forwards a 400 whose body names invalid run settings, with the provider's body. Any other 400 stays a 500, as on main.

  • The rule, decided by the refusal's own words: with the key set, report_outcome reports a model_request_error 400 as the new failure kind model_request_rejected when its message names one of two things:

    • an output limit above the model's cap: OpenAI and LiteLLM's "max_tokens is too large ... at most N", Anthropic's "maximum allowed number of output tokens", vLLM's "cannot be greater than max_model_len";
    • a parameter or value the model does not accept: "Unsupported parameter", "Unsupported value", "is not supported with this model", vLLM's "Unexpected ... Supported types are".

    Such a request is refused on every call, whatever the conversation holds. Any other 400, and one that names the context window (including vLLM's "input length and max_tokens exceed the context"), is handled as on any other run: openai_model answers it with HTTP 500, and a Model Server that passes 400s on, such as vllm_model, has it graded as model_request_error. The two categories follow the ones vllm_model already records (invalid_output_token_parameter, invalid_request_parameter). No harness code changes: OpenCode and Pi already call report_outcome. Not covered: OpenCode 2 (opencode_version 2 or later, opt-in) can report a provider error with a generic message such as Bad request, so its refusals stay graded as on main; reading the provider body there would change OpenCode's own error handling.

  • Policy: the default agent outcome policy fails model_request_rejected, so it is neither graded nor retried. It carries no HTTP status, so status rules do not apply to it.

  • Failure report: when the reply carries the Model Server's failure report, the rejection joins it as the selected event, caused by the 400 and keeping every original event. single_agent_turn, which fails a reply whose selected failure disagrees with its outcome, then follows the policy.

  • Run summary: on harbor, an excluded attempt whose cause is model_request_rejected names that kind, so the summary and the dropped-rollout line say model_request_rejected; any other cause stays environment_server_failed, as on main. When the refusal is an output limit, gym eval run prints a --max-output-tokens hint after the summary.

Compatibility and benchmark impact

  • Outside task-folder runs with OpenCode or Pi, grading, retries, failure kinds and the conformance check are unchanged from main; the new failure kind is never produced there.
  • New reserved top-level config keys: forward_configuration_refusals and absolute_ip_route_fallback. Only build_run for a task-folder run sets them; a submitted run turns both off on its command line, so its rendered gym eval run command has two more overrides.
  • One edge: a task job submitted by a launcher without this PR, whose later allocation checks out a Gym with it, would get both settings.
  • A Harbor-backed --benchmark run accepts --max-output-tokens (it was refused on main).
  • Within a task-folder run with OpenCode or Pi, a refusal of the run's own settings is now an ungraded failure instead of a 0. by_failure_kind: {model_request_rejected: verify} grades it as before.

Testing

The current head, e8ec2368a, merges main at 46497a69d and takes its deadline fix (#6324) in place of this PR's; it is tested by CI. The local results below are from the previous head.

On macOS (Darwin 25.6) with Docker through Colima, at 2332fd447 (this branch with main at d1f6955e4 merged in). Every failure listed also fails on main, checked by running the same suites there.

  • pre-commit run on every changed file: passed, including import-linter.

  • Core (tests/unit_tests agents, core, config, environment, cli, rollouts, orchestration, Harbor data, docs links, public API): 10,596 passed, 56 failed. 50 are orchestration tests that fail identically on main here (resume and continuation scripts under bash 3.2, Linux-only process handling); 3 fail only because of a local env.yaml; 3 are macOS-only (a closed-connection errno, symlink modes, the memory profiler test).

  • Server and harness suites:

    Suite Result
    openai_model, single_agent_turn, harness conformance all pass (178, 295, 232)
    simple_agent, copilot, droid, kilocode, prime, qwen_code all pass (192, 133, 161, 234, 138, 26)
    opencode, pi, hermes, miniswe_sandboxed all pass (1,013, 391, 399, 216)
    codex, openclaw 1 failure each (OpenSandbox SDK not installed), as on main
    goose 2 failures, as on main
    environment_servers/harbor 21 failures (20 in test_verifier_filesystem.py), as on main
  • Regression audits against main, each claim checked by a second agent:

    • Audits 1 to 4, up to 0942c613c: found the behavior changes now limited to task-folder runs; the last two rounds confirmed nothing new.
    • After merging 131 commits of main: an audit of clocks, merge semantics, regressions and docs found gym eval submit task runs picking up the laptop settings, fixed. Rounds limited to the commits since 0942c613c then repeated until one confirmed nothing new.
  • Output caps, 131,072 output tokens sent through an OpenAI-compatible gateway: gpt-4.1 (cap 32,768) and GPT-5 (128,000) refuse it; GPT-5.5, gpt-6.1-sol and gpt-6.2-sol accept it.

  • Oracle, gym dataset validate on all six hello examples after merging main: 1.0 on all 9 tasks.

  • The six hello README commands, run as written with gpt-6.1-sol (through the gateway's OpenAI route; no OpenAI key was available for api.openai.com itself): 1.0 on all 9 tasks, with OpenCode's default output limit (no --max-output-tokens) and, for hello_mcp_tool, the logged tool call test.sh requires.

  • gpt-4.1-mini (cap 32,768) on hello_world without --max-output-tokens, after merging main: OpenCode and Pi each fail as model_request_rejected, ungraded, exit 76, with the --max-output-tokens hint (on main: Pi scores 0.0 with exit 0; OpenCode retries to its timeout and scores 0).

  • Earlier rounds also scored 1.0 with OpenCode on all eight tasks of the five OpenCode hello examples at --max-output-tokens 16384 and 32768 with gpt-4.1-mini, with Pi at 32768, and with Codex on hello_world.

Follow-ups (separate PRs)

  • Fit the output limit to the provider's cap in openai_model, so no flag is needed.
  • Show token counts in masked configs (max_output_tokens: '****' in saved configs).
  • macOS: test portability, setup_dev.sh under bash 3.2, digest.py symlink mode; Linux: the Store reader hang under mawk.
  • A per-run token on the Model Server when it listens off loopback.

No external code was copied.

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Nov 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@adil-a

adil-a commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 63badbb

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP WITH CARE

I found one cleanup regression, detailed inline, and one validation gap.

RISK — Provide the required real smoke-rollout evidence

The PR explicitly says no end-to-end Docker run was performed. This changes mini-SWE setup and cleanup behavior, so the protected repository guidance requires representative real model rollouts. The new clock regression test substitutes the harness and sandbox; it doesn't establish that the reported macOS/Docker Desktop failures are fixed. This is missing validation, not a demonstrated runtime failure.

Could you record real model runs of Hello World and Hello MCP Tool on macOS with Docker Desktop, without +default_host? Include the commands, selected model-server address, rollout artifacts and relevant logs. The proposed acceptance checks are: the sandbox reaches the model, mini-SWE finishes setup within its budget, its MCP trajectory calls get_greeting, and each example's verifier returns reward 1.

Preserve both ordinary and MCP setup, plus the existing setup-timeout contract: HTTP 503, cleanup completed, no agent execution, and the same refusal on replay. A deliberately short setup budget should log that budget without a misleading missing-interpreter cleanup error. No implementation change is indicated by this evidence gap if these checks pass.

I inspected all seven changed files and their directly affected paths. I couldn't execute tests or real rollouts in this read-only review.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the bug Something isn't working label Nov 7, 2026
@adil-a

adil-a commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 76bc053

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:cli Command-line interfaces and user-facing command behavior needs-review PR is ready for code review and waiting on a reviewer labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

@adil-a

adil-a commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test eea57d5

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 7, 2026 09:01
@adil-a adil-a changed the title fix: make local Docker task-folder runs work on laptops fix: make local task-folder runs work on laptops and report rejected model requests Nov 7, 2026
@adil-a

adil-a commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 738403f

@adil-a

adil-a commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for retrying, and for the detail.

Model placeholders. Each hello README's "Run it" command now names a model and endpoint, so it runs as pasted with only OPENAI_API_KEY set:

gym eval run environments/hello_world --agent opencode_agent --sandbox docker \
  --model-type openai_model --model gpt-6.1-sol --model-url https://api.openai.com/v1 \
  --model-api-key "$OPENAI_API_KEY"

gpt-6.1-sol accepts OpenCode's default of 131,072 output tokens, so the OpenCode commands no longer pass --max-output-tokens; each README says when to add it for another model. I ran all six commands as written with gpt-6.1-sol, and all nine tasks scored 1.0 at the PR head. One caveat: I don't have an OpenAI key, so those runs went through our inference gateway's OpenAI route to the same model, not api.openai.com itself. If you can run one against OpenAI directly, that would close it.

Output caps. Agreed, "most" overstated it. Sent 131,072 through the gateway: gpt-4.1 (32,768) and GPT-5 (128,000) refuse it; GPT-5.5, gpt-6.1-sol and gpt-6.2-sol accept it. The READMEs, harbor-tasks.mdx and the troubleshooting page now say "some" and name both groups.

The flake. I haven't seen it: none of the 42 OpenCode rollouts on my Mac timed out, including two-task runs at 0942c613 with your command, and the first model call always came within about 31 s. A timeout graded as incomplete means OpenCode had already started its first step, so the stall was most likely in the first model request. Gym gives that request no client timeout ("timeout": False in the OpenCode provider config), and OpenCode retries 429s, 5xx and connection errors without limit. So a rate-limit wait on gpt-4.1 (both tasks send their first request at once) or a dropped connection through Colima's NAT can hold it until the 120 s deadline. That path, and scoring a timeout with no model calls as 0 instead of retrying it, are the same on main, so I'd handle it in a follow-up: bound that request, and retry such a timeout instead of grading it. If you still have the model server log, the lines for the multiplication rollout (any [model_retry ... status=429], or no request at all) would tell which it was.

Also since your run: I merged main, which had moved about 130 commits. Main's new OpenCode checkpoint and relaunch code took two deadlines from monotonic() again, which would have brought back the instant timeouts you first hit on macOS; both are on the event loop's clock now. And a task run that gym eval submit sends to a cluster now keeps this PR's laptop-only settings off, so it behaves as on main.

cwing-nvidia
cwing-nvidia previously approved these changes Nov 24, 2026

@cwing-nvidia cwing-nvidia 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.

Reran at ed90a0c7 with each README command as written (only the endpoint swapped for an OpenAI-compatible gateway, since the model is the same): all nine tasks scored 1.0. Code changes look good. Agree the first-request timeout can be a follow-up; could you log it as an issue if you don't already have a PR open for it? My model server log from that run is gone, sorry. Approving.

@adil-a
adil-a enabled auto-merge November 24, 2026 00:09
Main's resume-in-place change rewrote the line that bounds a launch by its deadline;
it keeps main's form and reads the event loop's clock, as `deadline` is a loop time.
Main's new receipt polling uses monotonic() on its own, so its import stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
@adil-a

adil-a commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2332fd4

@adil-a

adil-a commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 24, 2026 00:16
@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Nov 24, 2026

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

HOLD

The prior security finding still applies at 2332fd44: local task-folder runs automatically expose an unauthenticated model proxy when hostname resolution fails or returns loopback. This behavior is unchanged from the previous review at ed90a0c7. Documentation and planned authentication do not close it.

I reviewed all 62 changed files, including delegated configuration, documentation and test reviews, and traced affected callers and consumers. I found no additional high-confidence defect. Focused probes confirmed that combined context-limit errors stay gradable, while output-cap refusals select model_request_rejected and preserve the original 400 as their cause.

CI: Lint check passed. In run 45295757055 on this head, all core and server shards, combined core coverage, sandbox tests, session-routing end-to-end, Unit tests / Test and Unit tests / Server suite passed. Changed server tests was skipped. The overall workflow failed in non-blocking harness-conformance and environment-compliance checks; mini-SWE conformance timed out after five minutes. I have not attributed those failures to this diff.

Probes: In 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, Python 3.13.14, scratch probes exercised base/head address selection, unauthenticated ingress with a fake upstream, configuration precedence and submit exclusions, refusal/report consistency, shifted-clock deadlines, MCP interpreter re-execution and the hello example’s real MCP stdio/verifier path. They passed their assertions. No CI suites were rerun locally. These probes did not exercise macOS Docker networking or a paid endpoint; mini-SWE cleanup was inspected statically. The PR reports representative real-model rollouts through a gateway, not direct OpenAI API validation.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

config[USE_ABSOLUTE_IP_KEY] = True
config[ABSOLUTE_IP_SERVER_TYPES_KEY] = list(SANDBOX_REACHABLE_SERVER_TYPES)
if not benchmark_run:
config[ABSOLUTE_IP_ROUTE_FALLBACK_KEY_NAME] = True

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.

BLOCKER: Require authorization or explicit opt-in before exposing the model proxy

This automatically enables fallback for local task-folder runs using a sandboxed harness. When hostname lookup fails or returns loopback, the parser selects the default-route interface, and Uvicorn binds that address. The admitted base refuses startup in that case.

The generation routes require no credential. Requests use the configured model and the user’s API key upstream, so a reachable Wi-Fi/VPN peer can consume the endpoint and quota during the run. Model-only scoping protects the configuration endpoint, not model access. Exposure through an already-resolvable hostname predates this PR; this finding concerns laptops that previously failed closed.

I rechecked the prior finding: mocked laptop DNS made base raise ConfigError, while head selected 192.168.1.23. PYTHONPATH=. python /workspace/review-probes/model_ingress.py sent a POST without Authorization and reached the fake upstream once using configured-model. This was an in-process probe, not a live network exploit.

Could you remove the automatic assignment and retain fallback only behind an explicit ++absolute_ip_route_fallback=true exposure opt-in, updating default-generation tests and putting the warning before that command? Alternatively, authenticate generation ingress and propagate a per-run credential to sandbox clients. The acknowledgment and planned follow-up do not enforce that boundary today.

Preserve hostname precedence, explicit host overrides, model-only scoping and benchmark/submit exclusions. Acceptance: with failed or loopback DNS and an available default route, startup must fail closed by default unless ingress is authenticated. For opt-in, verify the user’s override is required; for authentication, verify an unauthorized request makes zero upstream calls while the sandbox credential succeeds.

cwing-nvidia
cwing-nvidia previously approved these changes Nov 24, 2026

@cwing-nvidia cwing-nvidia 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.

Reapproving after the merge. The conflict fix in sandbox_session.py keeps the launch deadline on the event loop's clock, and main's receipt polling stays on monotonic() throughout, so both are consistent. Sandbox session, resume, and Slurm script tests pass.

@adil-a
adil-a added this pull request to the merge queue Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45324034158

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
Main fixed the macOS clock mismatch itself (#6324): a SandboxSession or
checkpoint-slot deadline is now a time.monotonic() time, enforced with
monotonic_timeout. This branch had fixed the same bug the other way, with
deadlines on the event loop's clock, and the two cannot be mixed: a loop-clock
deadline handed to main's execute would expire at once under uvloop on macOS
again. So this branch's clock changes are dropped in favour of main's, in
sandbox_session, OpenCode, Pi, Codex, OpenClaw and mini-SWE, together with
their loop-clock tests; mini-SWE keeps its setup-timeout warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
@adil-a

adil-a commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e8ec236

@adil-a

adil-a commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

@nemo-pr-automation
nemo-pr-automation Bot requested a review from a team November 27, 2026 23:56

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

HOLD

The prior security BLOCKER still applies at e8ec2368: local task-folder runs automatically enable an unauthenticated model proxy on the default-route interface when hostname resolution fails or returns loopback. I compared the reachable previous-review commit 2332fd44; the automatic enablement is unchanged. Documentation and planned authentication do not resolve it.

I covered all 49 changed files, with three delegated reviews covering outcomes, configuration, and harness/examples/docs. I found no additional high-confidence defect.

CI: On this head, Lint check, all four core shards, all eight server shards, combined core coverage, sandbox tests, session-routing end-to-end, Unit tests / Test, Unit tests / Server suite, and Nemo_CICD_Test passed. Changed server tests was skipped. Run 46085153480 still concluded failure because the non-blocking conformance and compliance checks were red. OpenClaw and mini-SWE conformance each hit the five-minute step timeout. I have not attributed those failures to this diff.

Local probes: I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:e27be8e644b414501fe6eb9b905386a07685a2f6, the latest successful default-branch CI build I found; no head image was available. Its root dependency files and Dockerfile match this head. Source-bound probes confirmed the exposure below and passed assertions for refusal/report consistency, buffered and delayed-stream error forwarding, config precedence, submit exclusions, MCP interpreter re-execution, and cleanup. The hello solution/verifier stdio probe passed with scratch compatibility aliases for the image’s MCP2 package, so it does not validate the pinned MCP1 environment exactly. I reran no CI suites locally. These probes did not exercise macOS Docker networking or a paid endpoint; real-model rollout results are author-reported evidence.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

config[USE_ABSOLUTE_IP_KEY] = True
config[ABSOLUTE_IP_SERVER_TYPES_KEY] = list(SANDBOX_REACHABLE_SERVER_TYPES)
if not benchmark_run:
config[ABSOLUTE_IP_ROUTE_FALLBACK_KEY_NAME] = True

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.

BLOCKER: Require explicit opt-in before exposing the unauthenticated model proxy

This assignment automatically enables route fallback for sandboxed local task-folder runs. With failed or loopback hostname resolution, the parser selects the default-route interface, and Uvicorn binds the selected host. The admitted base refuses startup in that situation.

The generation routes require no incoming credential. Requests use the configured model and the configured API key upstream. A reachable Wi-Fi/VPN peer can therefore consume the user’s endpoint and quota during the run. Model-only scoping protects other servers, not model access. Exposure through an already-resolvable hostname predates this PR; this finding concerns machines that previously failed closed.

I rechecked the prior finding. route_probe.py made base raise ConfigError for failed and loopback DNS, while head selected 192.168.1.23. From the source checkout, PYTHONPATH=. python /workspace/review-probes/leader/model_ingress.py returned HTTP 200 upstream_calls 1 authorization_supplied False using configured-model. This was an in-process probe with a fake upstream, not a live network exploit.

Could you remove this automatic assignment and keep fallback behind an explicit ++absolute_ip_route_fallback=true exposure opt-in, update the generated-default tests, and put the network warning before the opt-in command? Alternatively, authenticate generation ingress and propagate a per-run credential to sandbox clients.

Preserve hostname precedence, explicit host overrides, model-only scoping, and benchmark/submit exclusions. Acceptance: failed or loopback DNS with an available route must fail closed by default unless ingress is authenticated. Verify either that fallback requires the user’s explicit override, or that an unauthorized request makes zero upstream calls while the sandbox credential succeeds.

Main added a checkpoint test beside this branch's rejected-request policy test in
single_agent_turn's failure-report tests; both are kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
@adil-a

adil-a commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test d7784aa

@adil-a

adil-a commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

HOLD

The prior security BLOCKER still applies: task-folder runs automatically expose the unauthenticated model proxy on the default-route interface when hostname resolution fails or returns loopback. I compared the reachable prior-reviewed commit e8ec2368af283975d4a16b6694cc9f7e88e8e85f; the automatic enablement is unchanged. Documentation does not resolve the exposure.

I covered all 49 changed files, including three delegated reviews of outcomes/HTTP forwarding, configuration/CLI/submission, and harnesses/examples/docs. I found no additional confirmed defect.

CI attached to this head: Lint check, all four core shards, combined core coverage, Unit tests / Test, sandbox tests, session-routing end-to-end, LongMT scoring, and seven server shards passed. Server shard 1 was still running, so I cannot report the server-suite or final CI aggregate as passed. Changed server tests was skipped. The non-blocking OpenCode and mini-SWE conformance jobs hit their five-minute step timeout; OpenCode also logged two plugin-initialization test failures. The non-blocking compliance check flagged run() definitions in mini-SWE and Pi. I have not attributed the conformance failures to this diff.

Local execution: I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:e27be8e644b414501fe6eb9b905386a07685a2f6, a successful default-branch CI build, because I found no successful head image. Its lockfile and dependency declarations match this head; the packaging and Dockerfile differences are metadata. Source-bound probes confirmed the security finding and passed checks for refusal/report consistency, HTTP forwarding, config precedence, benchmark/submission exclusions, MCP interpreter re-execution, cleanup, and hello tool-call verification. I ran no native CI suites locally. MCP probes required scratch compatibility shims for the image’s MCP 2 package, so they do not validate the pinned MCP 1 environment exactly. I did not exercise macOS Docker networking or a live model endpoint; the real-model rollout results are author-reported evidence from earlier commits.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

config[USE_ABSOLUTE_IP_KEY] = True
config[ABSOLUTE_IP_SERVER_TYPES_KEY] = list(SANDBOX_REACHABLE_SERVER_TYPES)
if not benchmark_run:
config[ABSOLUTE_IP_ROUTE_FALLBACK_KEY_NAME] = True

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.

BLOCKER: Require explicit opt-in before exposing the unauthenticated model proxy

This assignment still enables route fallback automatically for sandboxed task-folder runs. With failed or loopback hostname resolution, the parser chooses the default-route address, and Uvicorn binds that address. The admitted base refuses startup in those cases.

The generation routes require no incoming credential. They use the configured model and the configured upstream API key. A Wi-Fi/VPN peer that can reach the selected address and port can therefore consume the user’s endpoint and quota during the run. Model-only scoping protects other servers, not model access. Exposure with an already-resolvable non-loopback hostname predates this PR; this finding concerns machines that previously failed closed.

I rechecked the prior finding against base, the previous reviewed commit, and head. route_probe.py made base raise ConfigError for failed and loopback DNS, while both prior and head selected 192.168.1.23. From the source checkout, PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=. python /workspace/review-probes/leader/model_ingress.py returned HTTP 429 upstream_calls 1 authorization_supplied False upstream_model configured-model. That was an in-process request with a fake upstream, not a live network exploit; it confirms anonymous dispatch to the upstream adapter.

Could you remove this automatic assignment and require an explicit ++absolute_ip_route_fallback=true exposure opt-in, update the generated-default tests, and place the network warning before the opt-in command? Alternatively, authenticate generation ingress and propagate a per-run credential to sandbox clients.

Preserve usable-hostname precedence, explicit host overrides, model-only scoping, and benchmark/submission exclusions. Acceptance: failed or loopback DNS with an available route must fail closed by default unless ingress is authenticated. Verify either that fallback requires the user’s explicit override, or that anonymous generation makes zero upstream calls while the sandbox credential succeeds.

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.

We're deliberately not addressing this in this PR; the author has accepted the risk for now.

  • The fallback only runs on a local gym eval run <task folder> (the absolute_ip_route_fallback key build_run sets), never on a --benchmark run or a run gym eval submit sends to a cluster, and only when the hostname does not resolve or resolves to loopback, which is exactly when main refuses to start.
  • Only the Model Server moves off loopback; the head, agent and environment servers stay on it. The address it picks is logged with a warning, and the configuration reference and the task-folder troubleshooting page describe the exposure.
  • An explicit opt-in would bring back the failure this PR fixes: the hello examples would stop on most Macs until the reader adds a flag.

Authenticating the Model Server with a per-run credential is the proper fix, and is planned as a separate change.

@adil-a
adil-a added this pull request to the merge queue Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/46713460763

Merged via the queue into main with commit 34bb0d8 Dec 1, 2026
79 of 85 checks passed
@adil-a
adil-a deleted the adasif/local-run-fixes branch December 1, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Command-line interfaces and user-facing command behavior bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants