Repository navigation
Conversation
Claude Code sandbox sessions refused every required tool grant, so a Harbor task whose MCP servers are granted as required, or a Resources Server that grants its tools over MCP, could not run on Claude Code. A session now writes each streamable HTTP MCP grant (required or optional) into its --mcp-config file as an `http` server with the grant's URL and headers, next to the static mcp_config servers. The seed refuses, with a 422, required grants of another kind (direct_http), grants whose Claude Code tool names (mcp__<server>__<tool>, punctuation read as `_`) would collide with another grant or a static server, and required grants under model_only. model_and_tools now opens each grant's host. Claude Code has no required-server setting: in print mode it tries each server for up to MCP_TIMEOUT, reports each one's status in its stream-json init event, then sends its first model request. With required grants the CLI runs under require_mcp_servers.sh, which stops it when the init event reports a required server that did not connect. The agent server then checks the init event itself and fails the activation with a 502 and an agent_startup_failed gap, so the turn is never graded; an optional server that did not connect is an mcp_server_skipped gap. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…a required MCP server A timeout used to override the init-event check, so an activation whose init event showed a required MCP server failed, pending or not listed returned status incomplete with HTTP 200 and was graded. That happens when require_mcp_servers.sh does not stop the CLI (an init line it does not recognize, a required server the init event does not list, or a timeout landing before its TERM), and the model then runs out its time without the required tool. A timeout now keeps its cause only when the run ended before the init event. Once the init event shows a required server that did not connect, the activation fails with 502 and an agent_startup_failed gap whether or not the run then timed out, as OpenCode does with its recorded statuses. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…P servers The README and require_mcp_servers.sh said Claude Code waits up to MCP_TIMEOUT (30 s) for its MCP servers before the init event. That holds for 2.1.292. 2.1.108, which the benchmark profile pins, waits about 5 s in print mode and has no setting to wait longer. A required server slower than that is pending, so the activation fails. Real runs with a sidecar that answers initialize after 10 s showed both: 502 "magic (pending)" on 2.1.108, reward 1.0 on 2.1.292. The README also says that the harbor Environment Server refuses task_mcp_grants: optional for this harness. The benchmark profile's comments no longer say Claude takes no tool grants; they say that model_only refuses a required MCP grant and that model_and_tools opens each grant's host. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
/ok to test 7d571d8 |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM. No concerns found.
I reviewed all 10 changed files and traced the affected session, process-supervision and Environment Server paths. This was a static review; I did not execute tests or independently verify the reported rollouts.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Conflicts in claude_code_agent (app.py, sandbox.py, README.md) and the harness table of add-or-update-a-harness.mdx, all from main's instruction_on_stdin, Harbor system dependencies, client env and the OpenCode compaction-buffer docs landing next to this branch's MCP grants: - app.py: main's _run_system_dependencies and this branch's _colliding_mcp_server_names both kept; the session env takes main's client env and then builds the MCP grant list; _build_command gets main's prompt argument (None when the instruction goes on stdin) and this branch's --mcp-config path; the activation raises the 502 for an unconnected required server before returning main's precomputed response. - sandbox.py: stage_activation keeps main's optional prompt on stdin and this branch's events path and require_mcp_servers.sh wrapper. - README.md and the harness table: both sides' text kept. require_mcp_servers.sh runs the CLI as a background job, and bash gives a background job /dev/null as stdin without job control, which would drop main's instruction_on_stdin prompt whenever a required MCP grant is present. It now runs the CLI with <&0, and a new test checks that the wrapper passes stdin through. Signed-off-by: Adil Asif <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and the MCP-check payload Main now reads sandbox.sandbox_id when a session seeds its own sandbox, which the fake sandbox of owned_seed_mocks lacks. Main's run_runner test builds a stage_activation payload without the required_mcp_servers key that stage_activation now pops; the production caller always sends it. Signed-off-by: Adil Asif <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged Conflicts in
No textual conflict, but fixed in the merge: Test fix ( These resolutions are the ones the combined end-to-end branch used for this PR (all nine SkillEvaluator-related PRs on Tests on the new head (
|
|
/ok to test a96db92 |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM. No concerns found.
I reviewed all 11 changed files against the admitted base, read the trusted conventions, and traced grant production, session configuration, activation failures and process cleanup. The previous bot review had no findings; I also checked the changes since that revision.
CI checks attached to this head are green for Nemo_CICD_Test, Unit tests / Test, all four core shards, sandbox tests, combined coverage, changed-server tests and lint. The changed-server log reports 329 Claude Code tests passed. CI tested merge commit 76078cd9ad3a607875fa3a2f7a2e04fead5a76f6, not the detached head alone.
The non-blocking diagnostics are still red. Harness conformance reports three failing scenarios with the same count and first failure on the admitted base; I did not compare all three individually. Compliance flags the existing run() method. Neither diagnostic blocks the test aggregate.
Focused probes passed on 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, Python 3.13.14, with imports verified against the admitted checkout:
grant_contract_probe.py: Resources and Harbor grants preserve URLs, token headers and required/optional semantics; missing required status is rejected.integration/grant_overlay_probe.py: concurrent sessions keep episode endpoints and tokens isolated without mutating static configuration.probe_mcp_lifecycle.py: byte-split init output stops the CLI with exit 143; the shared supervisor kills a SIGTERM-ignoring CLI and confirms cleanup.
Initial probe import-binding errors were corrected before the passing runs. I relied on CI rather than rerunning its suites, and reviewed but did not independently reproduce the PR’s reported model rollouts.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Conflict in add-or-update-a-harness.mdx: kept this branch's Claude Code row and main's updated OpenCode row (`snapshot` added to the permitted opencode_config keys). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
Merged the latest main ( |
|
/ok to test d55f90e |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found.
I reviewed all 11 changed files and traced grant production, network restrictions, session configuration, activation failures and process cleanup. The previous bot review had no findings; the Claude Code implementation and tests are unchanged since that revision.
Validation: CI attached to this head passed Nemo_CICD_Test, Unit tests / Test, all four core shards, sandbox tests, combined coverage, changed-server tests and lint. The changed-server log reports 329 Claude Code tests passed. CI exercised generated merge commit f919d542, rather than the detached review tree alone.
Purpose-built probes ran on Ubuntu 24.04 with Bash 5.2.21, using the admitted guard and shared runner/supervisor. They confirmed split-write init handling, termination for an unavailable required server, dotted-name matching, stdin preservation, child exit-status propagation, and cleanup of a SIGTERM-ignoring child while retaining partial output. I relied on CI for repository tests and did not independently reproduce the reported model rollouts.
Existing diagnostics: The non-blocking conformance and compliance checks are red. Conformance reports three failing scenarios, with the same count and first failure on the admitted base; I did not compare every failure individually. Compliance flags the existing run() method. Neither produced a finding attributable to this diff.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…ants The two PRs are now one stack (MCP grants, then Claude Code MCP grants, then stdio and SSE MCP grants), so this branch carries the one below it and each PR's diff shows only its own changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
Linked into the MCP grants stack (https://github.com/NVIDIA-NeMo/Gym/stack/6689): always grant a task's MCP servers (#6292) → Claude Code MCP grants (#6349) → stdio and SSE MCP grants (#6350), merged in order. Merged main |
|
/ok to test c37da32 |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
One documentation defect: the Harbor instructions recommend a removed setting that prevents configuration from loading. I found no executable defect in the changed paths.
I reviewed all 11 changed files, trusted base conventions, callers, tests and existing feedback. The previous review had no findings. The Claude Code implementation is unchanged since that review, but the newly included parent branch makes its Harbor instructions invalid.
Validation: CI attached to c37da329 passed Nemo_CICD_Test, Unit tests / Test, all four core shards, sandbox tests, combined coverage, changed-server tests and lint. The changed-server log reports 329 passed. CI exercised generated merge commit 51c832c1.
Purpose-built shell probes on the platform-pinned Ubuntu 24.04.4 workstation with Bash 5.2.21 confirmed split-write init handling, rejection of an unavailable required server, dotted-name matching, stdin preservation and exit-status propagation. I relied on CI for repository suites and did not independently reproduce the reported model rollouts.
The non-blocking diagnostics are red: conformance reports three failing scenarios; compliance flags the existing run() method. I did not establish that the conformance failures were introduced by this diff.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| that failed for another reason, keeps that cause. An optional grant that did not connect is left out of the tools | ||
| and recorded as an `mcp_server_skipped` gap. The `harbor` Environment Server refuses a task with | ||
| `task_mcp_grants: optional` for a harness that does not declare `supports_task_tool_context`, as this one does | ||
| not, so run Harbor tasks with `task_mcp_grants: required`. A server lost later in the run shows up as failed tool |
There was a problem hiding this comment.
RISK — The recommended Harbor setting prevents configuration from loading. Could you replace the task_mcp_grants: optional|required instructions with the automatic required-grant behavior? The included parent branch removed this setting. _task_tool_accesses() now creates required grants automatically, and the existing regression test explicitly checks that task_mcp_grants="required" raises a validation error. Following this newly added instruction therefore stops a Harbor run before seeding.
Remove the obsolete switch and capability explanation while keeping the explanation that unavailable required servers fail activation. Acceptance: the documented Harbor setup contains no task_mcp_grants setting and agrees with the existing configuration test. Reading that contract settles the mismatch; another test run is unnecessary.
…m the Harbor note The always-grant task MCP branch below this one in the stack removed task_mcp_grants, so the README's advice to run Harbor tasks with `task_mcp_grants: required` would now fail config validation. The Harbor Environment Server grants a task's MCP servers as required on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
Addressed the RISK in |
|
/ok to test c172c3a |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM. No concerns found.
The prior documentation RISK is resolved. The Harbor instructions no longer recommend task_mcp_grants and now match the automatic required-grant behavior.
I reviewed all 11 changed files, trusted base conventions, existing feedback, grant producers and consumers, network restrictions, activation failures and cleanup paths.
CI: Changed-server tests passed, with 329 Claude Code tests passed in the log. All four core shards, sandbox tests and lint passed. Combined core coverage was still running at my last observation, so the overall test result was not yet known. CI exercised generated merge commit 9641fd3b, not the detached review tree alone.
Probes: Purpose-built Bash probes passed on the platform-pinned Ubuntu 24.04.4 workstation with Bash 5.2.21. They exercised split-write init events, unavailable required servers, dotted-name matching, stdin preservation, exit-status propagation, timeout cleanup and explicit stop before and after init. The shared supervisor confirmed cleanup and preserved partial output. I relied on CI for repository suites and did not independently reproduce the reported model rollouts.
The non-blocking diagnostics are red: conformance reports three failing scenarios, and compliance flags the existing run() method. I did not establish that the conformance failures were introduced by this diff.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
…to adasif/claude-code-mcp-grants Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
Updated with Of the files this PR changes, Tests on the head (
|
|
/ok to test 7c1da2d |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM. No source-backed defects found.
I reviewed all 11 changed files with three delegated reviewers, including grant producers and consumers, network restrictions, startup failure handling, activation replay and cleanup. The prior Harbor documentation RISK is still resolved: the README describes automatic required grants and no longer recommends task_mcp_grants.
CI: The current-head run reports success for all four core shards, combined coverage, sandbox tests and all eight server shards. The Claude Code suite log shows 329 passed. Lint also passed. Changed-server tests and session-routing end-to-end were skipped, not passed. CI tested generated merge commit 2932becd67284d9f9a192d2207bb634839cba7c8, not the detached review tree alone.
The non-blocking diagnostics are red. Conformance reports three failing scenarios, beginning with retry-call ownership; compliance flags the pre-existing run() method. I did not establish that the conformance failures were introduced by this diff.
Local probes: I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:e27be8e644b414501fe6eb9b905386a07685a2f6, a successful default-branch CI image because this head had no successful container build. Imports were checked against the admitted source. Purpose-built Python and Bash probes passed for grant isolation, collisions, allowlists, split-write init events, stdin and exit-status propagation, supervised cleanup, timeout/error precedence and public seed/activation/replay/close behavior. My leader/public_activation_probe.py passed five public-API scenarios, including repeated requests executing only once and failed required grants exporting startup evidence on close.
I relied on CI for repository suites. The probes used fake providers or a stub CLI; I inspected the author's rollout evidence but did not independently reproduce live model or MCP connectivity.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Standalone PR on main, depending on no open PR. A follow-up PR (#6350) builds stdio and SSE MCP grants on this. The
always-grant-task-MCP PR (#6292) merges cleanly with it but removes
task_mcp_grants, which this PR's README names inits Harbor sentence: whichever merges second updates or drops that sentence. The Claude Code/Codex task-skills PR
(#6293) touches the same files: whichever merges second rebases.
What does this PR do?
Claude Code sandbox sessions refused every required tool grant, so a Harbor task with granted MCP servers, or a
Resources Server serving tools over MCP, could not run on Claude Code (Codex, OpenCode, Hermes and Pi take them). A
sandbox session now takes
MCPToolAccessgrants (streamable HTTP), required and optional.httpserver (grant name, URL, headers with the session token) in the session'smcp.json, beside the staticmcp_configservers, passed with--mcp-config(works under--bare).direct_httpgrant; a grant whose tool names collide with another grant's or astatic server's (Claude Code turns
my.serverandmy_serverboth intomcp__my_server__<tool>; checked on2.1.292); a required grant under
network_access: model_only.model_and_tools, refused before, now opens eachgrant's host.
writes its
initevent with each server's status, then sends its first model request; a server still connectingis
pending. 2.1.292 waits up toMCP_TIMEOUT(30 s by default); 2.1.108, which the benchmark profile pins, waitsabout 5 s (a constant in its code). Real runs confirmed both.
require_mcp_servers.sh(bash) reads theinitevent as it is written and stops the CLI when a required serveris not
connected.initevent itself: a required server notconnected, or noinitevent,fails the activation with 502 and an
agent_startup_failedgap, so the turn is never graded, even if the runthen timed out. Only an exception, or a timeout before the
initevent, keeps its cause.mcp_server_skippedgap.mcp_statusrequest answerspendingwithout waiting.Docs: the Claude Code README (new "MCP tool grants" section,
network_access), the benchmark profile comments andthe tool-source table in
add-or-update-a-harness.mdx. The README's Harbor sentence says that theharborEnvironment Server refuses
task_mcp_grants: optionalfor this harness, which does not declaresupports_task_tool_context, so Harbor tasks run withtask_mcp_grants: required.Issue: none. This is a maintainer decision made while closing the gaps that SkillEvaluator hits on Gym.
Validation
pytest -n 8 responses_api_agents/claude_code_agent/tests(repo root, agent venv): 238 passed, 30 of them new intest_mcp_grants.py(refusals,mcp.json, statuses, timeouts, the script with a stub CLI). On main's code 28 ofthe 30 fail; the 2 that pass check that an optional grant opens no host under
model_onlyand that a timeout withthe required server connected stays a timeout.
tests/unit_tests/agents, docs links, harness profiles, Environment Server compliance, configtemplates, public-API and import checks) pass, except 5 agent tests that fail identically on main, in untouched
code (local environment).
test_process_supervisor[forking_tool]is flaky under-n 8and passed serially.pre-commit run --fileson the touched files: passed (guardwords skipped its check: private catalog unavailable).ruff check,ruff format --checkandgit diff --check: clean.Rollouts
A hosted GPT model behind an OpenAI-compatible endpoint serves Claude Code through Gym's model server, with
OpenSandbox sandboxes.
Harbor (borrowed sandbox),
task_mcp_grants: required. A Compose sidecar serves the MCP toolget_magic_wordandlogs calls; the verifier scores 1 only for the right answer plus a logged call.
mcp__magic__get_magic_wordreturnedpineapple; call loggedRequired MCP servers did not connect before Claude Code's first model request: magic (failed); the script stopped the CLI (exit 143) before its first model request (0 conversation items); nothing graded (retryable)initializeafter 10 s... magic (pending); the script stopped the CLI (exit 143), 0 model calls; nothing graded (retryable)initializeafter 10 sMCP_TIMEOUT)Agent-owned sandbox, Resources Server grant.
example_single_tool_callwithexpose_tools_over_mcp: true,granted by
single_agent_turn_legacywithresources_tool_transports: [mcp]; CLI 2.1.108 in its ownpython:3.12-slimsandbox withmodel_and_tools. 2 tasks: reward 1.0 on both;mcp__example_single_tool_call__get_weatherreturned the server'sThe weather in <city> is cold.; no agentobservation gaps; sandboxes stopped. Both servers ran on one node, so the allowlist held one host; host-per-grant is
unit-tested.
Optional grant that cannot connect. No shipped Environment Server runs this harness with one: Resources Server
grants are required, and a Harbor run of the unserved-port task with
task_mcp_grants: optional(2.1.292) wasrefused with a terminal 422 naming
supports_task_tool_context. So a driver called the session API (seed,/ng-rollout/<id>/v1/responses, close) with an optional grant to an unserved port, in an agent-ownedpython:3.12-slimsandbox withmodel_and_tools. On 2.1.108 and 2.1.292: completed with the right answer (391),no tool calls, gap
mcp_server_skippedflaky: failed, sandbox stopped.The timeout fix has no real run (the script would have to miss the
initevent, which Gym's configuration cannot setup); unit tests cover it. The first two Harbor rows ran on the first commit, the rest on the timeout fix; the last
commit changes only comments and docs. The Harbor task copies set
workdir = "/app", because Claude Code refusesthe
/workdir (a check this PR does not change).Compatibility and benchmark impact
without grants are unchanged.
model_and_toolsis accepted; colliding grant names are a new refusal.(502, retryable).
network_access: model_only, which refuses a required MCP grant; pairing it with abenchmark that serves tools over MCP needs
model_and_tools.Checklist
pre-commit run --all-files) (so CI lint/format checks pass). Run with--fileson the touched files, not--all-files.git commit -s) (so the DCO check passes).🤖 Generated with Claude Code