Skip to content

fix(harbor): let required MCP grants satisfy a task's MCP servers - #4904

Closed
ffrujeri wants to merge 1 commit into
adasif/harbor-m34-multi-turnfrom
ffrujeri/harbor-mcp-grant-refusal
Closed

ffrujeri wants to merge 1 commit into
adasif/harbor-m34-multi-turnfrom
ffrujeri/harbor-mcp-grant-refusal

Conversation

@ffrujeri

Copy link
Copy Markdown
Contributor

What

The harbor environment server refuses a task that declares [[environment.mcp_servers]] or skills_dir to a harness that does not declare supports_task_tool_context, so a run cannot score a silent zero without its tools. That check only knew the /tmp/.nemo-gym/task.json channel. With task_mcp_grants set, it still refused every harness that does not read task.json, even one that took every MCP server as a grant.

This change counts an MCP server as reached when it was granted as required. By the tool-access contract (MCPToolAccess), "failure to establish a required server fails session seeding", so a harness that accepted the seed has the server. Three cases stay refused:

  • Optional grants: the harness may skip them.
  • SSE or other non-streamable-http servers: they can't be granted.
  • skills_dir: it has no grant.

The refusal now names what would not reach the harness, and points at task_mcp_grants: required.

Why

Hermes and Pi accept required MCP grants in the agent's sandbox, but neither declares supports_task_tool_context, so neither could run an MCP task. That includes SWE-Interact's simulated user and the Harbor Cookbook's simulated-user recipe. After this change they can, with 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. Making them accept the grants is separate harness work (Codex first, for SWE-Interact).

Part of the gap analysis of the Harbor stack against Harbor's trial runner (gap 2). No issue filed; this follows the review of #4728.

Changes

  • environment_servers/harbor/app.py: _unreached_task_tools decides which declared tools only task.json reaches; the seed check in _agent_turn uses it. The task_mcp_grants comment is updated.
  • environment_servers/harbor/README.md: documents the rule.
  • environment_servers/harbor/tests/test_app.py:
    • A task whose only MCP server is granted as required runs and is verified on a harness without supports_task_tool_context.
    • The four cases a grant does not cover are still refused, each naming only what is unreached: grants off, optional grants, an SSE server, skills_dir.

Validation

  • pytest environment_servers/harbor/tests tests/unit_tests -k "harbor or tb4": 1297 passed, 5 skipped, 4 failed.
    • The 4 failures fail identically on a clean adasif/harbor-m34-multi-turn. They come from this host's umask (test_harbor_build_inputs.py ×3, test_harbor_build_plan.py ×1 expect modes 0644/0755 and get 0640/0750).
    • tests/unit_tests/test_indic_in22.py was ignored: it fails to import benchmarks.indic.in22 on the base too.
  • Mutation check: with the grant lookup removed, 3 of the 5 new cases fail.
  • pre-commit run on the changed files: passed. DCO sign-off on the commit.

Rollout evidence

N/A for now. The harnesses this change unlocks (Hermes, Pi) need model credentials that were not available where this was written, and the oracle declares supports_task_tool_context, so it doesn't exercise the new path. Suggested smoke once credentials are available: one SWE-Interact task, or the Cookbook simulated-user recipe, with hermes_agent and task_mcp_grants: required, inspecting that ask_user calls reach the sidecar.

Compatibility

Behavior changes only for task_mcp_grants: required with a harness that does not declare supports_task_tool_context. Such a task was refused before; now it runs, or fails at the harness's own seed if the harness rejects the grant. Defaults (task_mcp_grants: off) are unchanged.

🤖 Generated with Claude Code

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]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 22, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working labels Oct 22, 2026
@adil-a

adil-a commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Thanks Felipe, this is in the stack now too. I ported this commit onto #4819 as its eighth commit, 49baabd, with your authorship kept and the two review items fixed: the grant lookup runs inside the seed's try again, so a declaration the grant schema rejects is a staged terminal agent failure rather than an unhandled error (new test for that case), and the grants and the refusal read one server list, which the M30 rebase switched to the overlay-merged self._task_mcp_servers(task) with a new test that an overlay-only sse entry is still refused under required grants. The hint to use task_mcp_grants: required is offered only when every unreached entry is a grantable streamable-http server and grants are not already required, and the README says seed or first turn for Hermes and Pi and that Harbor's default transport is sse. Closing this draft since #4819 carries it.

@adil-a adil-a closed this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants