Skip to content

fix(agent): declare in-sandbox model calls and accept Kilo task timeouts - #5863

Merged
yaoyu-33 merged 5 commits into
mainfrom
fix/harness-calls-model-from-sandbox-kilo-timeout
Nov 10, 2026
Merged

yaoyu-33 merged 5 commits into
mainfrom
fix/harness-calls-model-from-sandbox-kilo-timeout

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

Two small consistency fixes across the agent-harness adapters. Neither changes a shared contract.

1. Declare calls_model_from_sandbox on four harnesses. Claude Code, Kilo, Stirrup and NOOA run their harness inside the task sandbox and call the Gym model server from there, but their agent classes did not declare it. A Harbor run (gym eval run <target> --agent <name>) reads this literal from the entrypoint source without importing it (entrypoint_class_flag, used by runs_in_sandbox in nemo_gym/data/tasks/harbor/prepare.py). It then sets use_absolute_ip and absolute_ip_server_types: [responses_api_models] for the run. Without the declaration, these four harnesses needed a hand-set use_absolute_ip. Each app.py now declares calls_model_from_sandbox: ClassVar[bool] = True, as Codex, Pi, OpenCode, Hermes and the others already do.

  • NOOA: sandboxed mode calls the model from the task sandbox. Embedded mode calls it from the agent host, which reaches the advertised node address too, so one class-level declaration is safe for both modes. Embedded NOOA cannot pair with Harbor anyway: Harbor grants only MCP tools, and NOOA accepts only direct HTTP grants.
  • Stirrup: with the local provider, the runner runs on the host, and the node address is reachable from there as well.
  • Hand-set use_absolute_ip kept: the configs that set it themselves do not go through the Harbor path, so they keep it: claude_code_agent/configs/profiles/benchmark.yaml (HLE profile) and benchmarks/swebench/pro/nooa.yaml (SWE-bench Pro through its Resources server).

2. Kilo accepts a task row's metadata.agent_timeout_sec. Kilo's sandbox activation refused every request field except input, instructions and model. Every Harbor task row carries metadata.agent_timeout_sec, so every Harbor row got a 422. Kilo now:

  • accepts metadata whose only key is agent_timeout_sec;
  • runs for resolve_agent_timeout(metadata, ceiling=timeout), that is min(config timeout, task value), as Codex, Pi, OpenCode and Claude Code do;
  • records the applied budget in the response metadata, as Codex, Pi and OpenCode do.

Any other metadata key is still refused with 422. The host-side (non-session) Kilo path is unchanged.

3. Stirrup honors a task row's metadata.agent_timeout_sec. With the declaration above, Harbor runs now pair with Stirrup, and every Harbor row carries a task budget. Stirrup already accepted request metadata but ignored it, so it always ran for sandbox_runner_timeout_seconds (12600 s by default). The runner now gets resolve_agent_timeout(metadata, ceiling=sandbox_runner_timeout_seconds), and the response metadata records the applied agent_timeout_sec, like Kilo above.

Issue: none. These are small consistency fixes that need no design decision.

Compatibility

  • Harbor runs with these four harnesses now get use_absolute_ip: true plus absolute_ip_server_types: [responses_api_models] by default. Only the model server advertises the node address. An explicit config or command-line value still wins.
  • Kilo and Stirrup responses from sandbox sessions gain one metadata key, agent_timeout_sec.
  • Stirrup runs whose request carries metadata.agent_timeout_sec below the configured limit now stop at the task's budget. Runs without it are unchanged.
  • Benchmark results: no change for configs that worked before. Kilo on Harbor rows did not run at all before this change.

Validation

  • pre-commit run --files <touched files>: passed.
  • Core and Kilo/Claude Code tests (primary venv, worktree on PYTHONPATH and NEMO_GYM_EXTRA_ROOTS): 873 passed, 28 skipped. Suites: responses_api_agents/kilocode_agent/tests, responses_api_agents/claude_code_agent/tests, tests/unit_tests/data/tasks/harbor/test_harbor_tasks.py, tests/unit_tests/server_runtime/test_ray_opt_out.py and tests/unit_tests/agents/test_base_responses_api_agent.py.
  • Stirrup and NOOA tests (their stirrup / nooa packages added): 918 passed, 10 skipped, 20 failed. The 20 failures are in stirrup_agent/tests/test_sandbox_runner.py and test_sessions.py. They run the local process supervisor, which reads /proc/uptime, so they fail on macOS. The same 20 fail with origin/main's stirrup_agent/app.py, so this change does not cause them. CI runs them on Linux.
  • A/B against origin/main's adapter code: the 10 new or changed assertions fail on main and pass here. Those are the four flag cases, the accept/min-budget cases and the response-metadata case. The "other metadata key is still refused" cases pass on both, as intended.
  • New tests:
    • test_shipped_sandboxed_harnesses_declare_model_calls_from_sandbox now lists all 15 shipped harnesses that declare the flag, including the four new ones plus browsecomp_agent and pool_agent, which were declared but not listed.
    • Kilo: test_task_timeout_metadata_reaches_activation, test_task_timeout_shortens_but_never_extends_the_configured_budget (none / 600 / 5000 / invalid against a 900 s ceiling), and two more rejected-metadata cases in test_unsupported_request_semantics_are_rejected.
    • Stirrup: test_task_timeout_shortens_but_never_extends_the_configured_budget (same four cases against a 900 s sandbox_runner_timeout_seconds), and the response-metadata assertion in test_the_response_is_built_from_the_runner_report now includes the applied budget.
  • Stirrup timeout change (f455010310): stirrup_agent/tests/test_app.py 47 passed. A/B against the previous app.py: the 5 new or changed assertions fail there. The full Stirrup suite is 162 passed, 20 failed; those are the same 20 macOS-only supervisor failures described above.

Rollout evidence

The Stirrup timeout change has no real-model smoke yet: it changes only the deadline passed to the existing runner, which the wall-time tests exercise on Linux CI.

A real-model Kilo smoke on the bundled Harbor example tasks (environment_servers/harbor/data/tasks, the folder behind data/example.jsonl):

  • Setup: Kilo 7.4.15 ran in borrowed Docker task sandboxes on a Linux workstation. The model was hosted nvidia/nemotron-3.5-super-vl-120b-a12b behind vllm_model, with thinking off. The servers listened on the docker0 bridge address.
  • Command: gym eval run environment_servers/harbor/data/tasks --agent kilocode/kilocode_sandboxed --sandbox docker --model-type vllm_model ...
this branch (4e70268c2f) origin/main (349f23eb11), task first-line
Generated run config use_absolute_ip: true, absolute_ip_server_types: [responses_api_models] neither key
Rollouts 5/5 completed, 0 failed, run health "healthy" 0/1 completed: 422 {"detail":"Unsupported Kilo sandbox request fields: metadata"}
Response metadata harness_execution: sandbox, the container hostname, kilo_version: 7.4.15, agent_timeout_sec: "60.0" (min of config 900 and the row's 60) n/a
Reward 1/5 n/a
Sandbox containers left after shutdown 0 0
  • Reward: 1/5. On first-line, Kilo ran head -n 1 /app/input.txt > /app/output.txt through its bash tool, and the verifier passed it. On the other four tasks, the model answered with the right command as text and did not run it. These example prompts end with "Return a single shell command to do so" because they were written for a single-command harness. That is the model's choice, not a harness failure: every rollout made real model calls (about 9.8k input tokens each) from inside its task container.
  • Reachability: in this smoke the servers were reachable because the overlay set default_host to the docker0 bridge address, which applies to every server. The new declaration is what puts use_absolute_ip in the generated run config; this smoke does not check reachability through the default node address on its own.

🤖 Generated with Claude Code

Claude Code, Kilo, Stirrup and NOOA run their harness inside the task
sandbox and call the Gym model server from there, but their agent classes
did not declare `calls_model_from_sandbox`. A Harbor run
(`gym eval run <target> --agent <name>`) reads that literal from the
entrypoint source to decide whether the model server must advertise a
sandbox-reachable address, so these harnesses needed a hand-set
`use_absolute_ip`. Declare it on each class. NOOA's embedded mode calls
the model from the host, which also reaches the advertised node address.

Kilo's sandbox activation refused every request field except `input`,
`instructions` and `model`, so every Harbor task row, which carries
`metadata.agent_timeout_sec`, got a 422. Accept metadata whose only key is
`agent_timeout_sec`, run Kilo for min(config `timeout`, that value) as
Codex and Pi do, and report the applied budget in the response metadata.
Any other metadata key is still refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 added the area:agent Agent harnesses and Responses API agent behavior label Nov 9, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 9, 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.

@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 4e70268

@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 9, 2026 18:05
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test de311ed

ananthsub
ananthsub previously approved these changes Nov 9, 2026
@ananthsub

Copy link
Copy Markdown
Contributor

Optional, non-blocking: the sandboxed-mode paragraph in the NOOA README still tells users to configure use_absolute_ip / default_host themselves. That is still right outside Harbor, but Harbor runs now set it automatically. A short clause saying so would avoid confusion.

Harbor task rows carry metadata.agent_timeout_sec, and Stirrup now declares
calls_model_from_sandbox, so Harbor runs pair with it. The runner now runs for
min(sandbox_runner_timeout_seconds, agent_timeout_sec), as Codex, Pi, OpenCode,
Claude Code and Kilo do, and the response metadata records the applied budget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f455010

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 9, 2026 18:18
ananthsub
ananthsub previously approved these changes Nov 9, 2026
@yaoyu-33
yaoyu-33 enabled auto-merge November 9, 2026 18:22
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 03bba1d

@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5c70874

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 10, 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/42744451434

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 10, 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/42922032345

Merged via the queue into main with commit 0dc9f54 Nov 10, 2026
69 checks passed
@yaoyu-33
yaoyu-33 deleted the fix/harness-calls-model-from-sandbox-kilo-timeout branch November 10, 2026 23:30

This branch was previously deployed

1 inactive deployment
public — 5c70874d Deployed Nov 9, 2026 by copy-pr-bot[bot] via release / finalize / notify #11206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants