Skip to content

feat(agents): let Claude Code and Codex take Harbor tasks that declare skills_dir - #6293

Open
adil-a wants to merge 23 commits into
mainfrom
adasif/gym-1268-task-skills-cli-harnesses
Open

adil-a wants to merge 23 commits into
mainfrom
adasif/gym-1268-task-skills-cli-harnesses

Conversation

@adil-a

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

Copy link
Copy Markdown
Contributor

What does this PR do?

Claude Code and Codex now run Harbor tasks that declare [environment] skills_dir, and the model finds the skills
through the CLI's own skill mechanism. Before, the harbor Environment Server refused these tasks for any harness
without supports_task_tool_context (only mini-SWE and the oracle). Deleting skills_dir, as SkillEvaluator does
today, passes the gate but leaves the skills hidden from the CLI.

Refs #5639 (Harbor tasks that declare skills_dir are refused for Claude Code, Codex and OpenCode; Linear GYM-1268).
It stays open for OpenCode: its default profile denies skills on purpose, and overriding that is a maintainer decision.

  • New optional supports_task_skills capability on the seed response and capabilities route. With it, the Harbor
    server counts skills_dir as reached; MCP servers are judged as before.
  • stage_task_skills (nemo_gym/agents/utils/task_skills.py) copies the folder named in /tmp/.nemo-gym/task.json
    with one quoted exec. It refuses the seed for a failed copy, a task.json that is not a JSON object, a ~ or $
    path, or a missing folder; an exec with no exit code is retryable.
  • Claude Code copies to <CLAUDE_CONFIG_DIR>/skills and drops --bare for that session; Codex copies to
    <CODEX_HOME>/skills. Only a task sandbox the Environment Server lent is staged.
  • Multi-step tasks: the server rewrites task.json after each step's setup.sh, so later fresh sessions still find
    the skills.
  • Docs: the agent skills, integrate-existing-agents, Harbor and task folder pages, and the affected READMEs.

It conflicts with the always-grant-MCP PR (#6292) in the refusal block of
environment_servers/harbor/app.py and in the Harbor docs; whichever merges second needs a small rebase. That PR also
drops the refusal's task_mcp_grants hint.

Validation

At head 6406bf6a6 (main merged at 51630ce4f in a1770981d, with one conflict, the _build_command call in
claude_code_agent/app.py, where main's instruction_on_stdin prompt argument and this PR's skills_active both
stay; 0a7de79f5 gives the task-skills fake sandbox main's sandbox_id; then main merged at 15adc2254 in
6406bf6a6 with no conflicts), with gym env test (serial) and root tests at -n 2:

  • environment_servers/harbor: 732 passed
  • claude_code_agent: 304 passed
  • codex_agent: 635 passed, 9 skipped, 1 failed: test_sandbox_runner.py::test_task_descendants_survive_until_owner_teardown[natural], a process-timing test this PR does not touch, while the host was under heavy load from other work; test_sandbox_runner.py then passed 16 of 16 twice on this head and twice on main 15adc22542
  • root tests/unit_tests/agents: 853 passed, 5 failed; all 5 also fail on main 15adc22542 in a dev venv built from the same lock: 3 outcome-policy upload-evidence tests need cloudpickle and 2 sandbox_python archive-owner tests depend on the host's gid mapping

Earlier, at head 579a1bc34 (origin/main cd899cad5 merged in):

  • pre-commit run --all-files: passed, no files changed, before the last commit (two lines in one docs page).
  • Harbor server venv, cd environment_servers/harbor && pytest tests -n 8: 732 passed.
  • Root dev venv, pytest tests/unit_tests/agents tests/unit_tests/test_public_api_facades.py responses_api_agents/claude_code_agent/tests responses_api_agents/codex_agent/tests -n 8: 2450 passed, 6 skipped,
    6 failed, none in changed code (missing cloudpickle or opensandbox in that venv, and a host-specific uid/gid
    assertion).
  • pytest responses_api_agents/harbor_oracle_agent/tests responses_api_agents/opencode_agent/tests -n 8: 1016 passed,
    24 skipped; both assert their exact seed reply, which is unchanged.
  • New tests fail without the change (multi-step one checked at this head, the rest in an earlier round on
    origin/main's sources).
  • stage_task_skills tests use a real shell for dotfiles, shell characters in paths (nothing injected), an empty
    folder, a bad task.json or path, and a missing folder. Failed-copy and no-exit-code cases are scripted.

Rollouts

A hosted GPT model behind an OpenAI-compatible Responses API endpoint, through Gym's openai_model server (Claude
Code via Gym's converter). OpenSandbox, Claude Code 2.1.292, Codex 0.144.4. The task's demo skill says "The magic
word is pineapple."; test.sh checks the final answer. Single-step cases ran at 56fb4c586 (before the multi-step
fix, which does not affect them), two-step cases at 579a1bc34.

Case Reward Observed
Claude Code, skills 1.0 One call, Skill {"skill": "demo"}; answered pineapple
Claude Code, no skills 0.0 Searched with Bash; answered Abracadabra
Codex, skills 1.0 Read <CODEX_HOME>/skills/demo/SKILL.md; answered pineapple
Codex, no skills 0.0 Said the skill is not available
Two steps, each harness; step two's setup.sh moves /tmp/.nemo-gym away 1.0 per step Step two sees a rewritten task.json and uses the skill
gym eval run <dir>/skillsreal --agent claude_code_agent --sandbox opensandbox \
  --model-type openai_model --model <model> --model-url <model-url> \
  '++harbor_skillsreal_agent.responses_api_agents.claude_code_agent.model_server={type: responses_api_models, name: policy_model}' \
  ++harbor_skillsreal_agent.responses_api_agents.claude_code_agent.model=<model> \
  ++harbor_skillsreal_agent.responses_api_agents.claude_code_agent.claude_code_version=2.1.292 \
  ++harbor_skillsreal_agent.responses_api_agents.claude_code_agent.anthropic_api_key=EMPTY

Codex: --agent codex_agent, with ...codex_agent.codex_version=0.144.4 as its only override.

Without a model: on origin/main, Claude Code is refused with "does not support (skills_dir)". With skills plus an
MCP server, Claude Code is refused for the MCP server only, and Codex under task_mcp_grants=required passes the seed
(a stub MCP server saw initialize and tools/list). An empty skills folder seeds, and Claude Code runs without
--bare.

Compatibility and benchmark impact

  • Existing scores are unaffected. With-skill scores on these harnesses are not comparable to runs that deleted
    skills_dir.
  • Wire: the field is sent only when True, so other harnesses' replies are unchanged. An older Environment Server
    forbids unknown seed keys and would reject every Claude Code and Codex seed reply, so they ship together. An older
    Claude Code or Codex on a newer server is refused skills tasks as before.
  • Claude Code drops --bare for a task that declares skills and keeps it for one that does not, so for
    SkillsBench-style comparisons set bare: false on both arms (documented).
  • For these harnesses, a missing skills folder or a ~/$ path now fails the seed. Multi-step tasks with skills or
    MCP servers run one more exec per step. No new configuration knobs.

The rollouts above ran before the merge with main at 51630ce4f. After it, a combined branch of this PR with the
other SkillEvaluator-related PRs on that main ran SkillEvaluator's calculator, task-list and magic-mcp tasks: Claude
Code's Skill tool loaded the staged skill 7 times across the with-skill rows (baseline rows got "Unknown skill"),
and Codex's skill listing named the staged SKILL.md in 8 of 8 with-skill rows and 0 of 8 baseline rows.

Not tested: Codex with skills plus a real MCP server on this PR alone, a non-root [agent].user, the full unit
suite after the merge, and the mini-SWE and Terminus suites.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally (failures above are outside this change).
  • Documentation added or updated.
  • Pre-commit checks pass locally (pre-commit run --all-files), before the last, docs-only commit.
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s).

🤖 Generated with Claude Code

adil-a and others added 9 commits November 17, 2026 00:24
…e skills_dir

The harbor Environment Server refused a task that declares skills_dir unless the
harness set supports_task_tool_context in its seed response, which only mini-SWE
and the oracle do. Claude Code and Codex hide the image's skills from the CLI
(CLAUDE_CONFIG_DIR, CODEX_HOME and --bare), so a skills task could not run on
them as written.

Add supports_task_skills to the agent seed response. A harness that sets it has
copied the task's skills_dir into the folder its CLI discovers skills in during
its seed. The server treats skills_dir as reached for such a harness, and judges
MCP servers separately, by grants or supports_task_tool_context.

Claude Code and Codex read skills_dir from /tmp/.nemo-gym/task.json inside the
sandbox and copy the folder to <CLAUDE_CONFIG_DIR>/skills and <CODEX_HOME>/skills
with stage_task_skills. Claude Code runs a session with task skills without
--bare, as it does for run-level skills. A missing or unusable skills folder
refuses the seed. Run-level skills.path is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
A task that declares skills_dir is now taken by a harness that declares
supports_task_tool_context or supports_task_skills. Update the pages that
described the gate: the agent skills page, the Harbor environment server README
and configuration table, the task folder format and patterns pages, the Claude
Code and Codex READMEs, and the two SkillsBench READMEs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…ills_dir wording

The SkillsBench README still said the skills reach the model under /skills and that
loading does not depend on the harness. Say where each harness finds them, that the
with-skill and no-skill conditions differ by more than the skills on Claude Code (it
drops --bare only for a task that declares skills_dir), and that admission is not a
validated pairing.

A relative skills_dir does not fail the seed: the Environment Server makes it absolute
before it writes task.json. Only a path a shell resolves (~ or $) is refused, so say
that in the skills page, both harness READMEs and the helper's docstring, and note
that a declared but empty folder is copied too. Point the harness-selection page at
Claude Code and Codex for a task whose only tool declaration is skills_dir.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…lder with no skills

An agent-owned Codex sandbox must not read task.json: with the guard dropped, every
existing Codex test still passed, while Claude Code already had this test. Add it, and
pin that a declared skills_dir holding no skills (the baseline arm of a skills
comparison) is still copied and counts as declared.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…w Codex differs

"Loading does not depend on the harness" read as a claim about every harness, next to
the paragraph that now has two ways a harness takes skills. Scope it to harnesses that
read task.json, and say Codex needs no bare-style setting for a paired comparison.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
Claude Code and Codex are admitted to a skills_dir task because they copy the
folder that /tmp/.nemo-gym/task.json names at their seed. The server wrote the
file once, at episode seed, while a fresh session seeds every step: the previous
step's agent or verifier, or the step's setup.sh, could remove it, and the next
step's harness would copy nothing and run without its skills while the gate,
which reads the harness's declaration, still admitted it. Each step's
preparation now ends by writing the file again, which also keeps mini-SWE's
task MCP servers in reach on later steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…covers

test_the_copy_quotes_both_paths only pinned the literal cp command, so a
harmless rewrite of the command would fail it. The local-sandbox test with a
space, ';' and '$(...)' in both paths already checks the copy and that nothing
was injected.

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

copy-pr-bot Bot commented Nov 17, 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 feature New capabilities, enhancements, or enablement work area:agent Agent harnesses and Responses API agent behavior labels Nov 17, 2026
@adil-a

adil-a commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 579a1bc

@adil-a

adil-a commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

@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

No runtime correctness defects found. One non-blocking NOTE asks the multi-step regression test to enforce setup → context rewrite → session seed.

I inspected all 25 changed files and traced the affected admission, staging and activation paths. This was a static review; I did not run tests or reproduce the author-reported rollouts.

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

writes = [i for i, call in enumerate(sandbox.execs) if "/tmp/.nemo-gym/task.json" in call["command"]]
assert all('"skills_dir": "/app/.skills"' in sandbox.execs[i]["command"] for i in writes)
# Step two's harness starts from a task.json written after step one's turn, not only from the episode seed's.
assert len(activations) == 2 and any(activations[0] <= i < activations[1] for i in writes)

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.

NOTE, suggestion: check the rewrite before session seed, not only before activation.

The test currently passes if the rewrite happens after /v1/agent_sessions but before /v1/responses. The fake client's hook records activation, but Claude Code and Codex read the context during seed. There is also no step-two setup.sh, so moving the rewrite before setup would still pass. The production ordering is correct; this is a regression-coverage gap.

Could you add step-two setup and sample the exec position at session seed? A small change in this test would protect the required ordering without introducing a filesystem-aware fake:

# Before multi_turn_server(...), so the fixture is included in the task digest:
step_workdir = tmp_path / "datasets/ds/hello/steps/two/workdir"
step_workdir.mkdir(parents=True)
(step_workdir / "setup.sh").write_text("#!/bin/bash\nrm -rf /tmp/.nemo-gym\n")

# Replace activations and the turn_hooks registration:
seed_positions: list[int] = []
post = type(server.server_client).post

async def record_seed(client, server_name, url_path, **kwargs):
    if url_path == "/v1/agent_sessions":
        seed_positions.append(len(sandbox.execs))
    return await post(client, server_name, url_path, **kwargs)

monkeypatch.setattr(type(server.server_client), "post", record_seed)

# Replace the final ordering assertion:
setup_index = next(
    i for i, call in enumerate(sandbox.execs)
    if call["command"] == "bash /app/setup.sh"
)
assert len(seed_positions) == 2
assert any(setup_index < i < seed_positions[1] for i in writes)

Keep the existing assertions that both turns score 1.0 and that the rewritten JSON names /app/.skills. Proposed acceptance: the current implementation passes, while moving the rewrite before step-two setup or after its session seed fails. FakeSandbox records rather than executes the setup, so this checks ordering, not filesystem restoration. I have not executed this suggested change.

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.

Done in 09c0ff5: step two now has a setup.sh that removes /tmp/.nemo-gym, and the test records where each agent seed falls among the sandbox execs and asserts a task.json write between step two's setup and its seed. Checked that it fails when the per-step rewrite is removed.

… setup and the session seed

Gives step two a setup.sh that removes /tmp/.nemo-gym and records where each
agent seed falls among the sandbox execs, so moving the rewrite before the
step's setup or after its seed fails the test (review suggestion).

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

adil-a commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 09c0ff5

@adil-a

adil-a commented Nov 18, 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.

SHIP

LGTM, no concerns found.

I reviewed all 25 changed files and traced Harbor admission, skills staging and CLI activation through their affected contracts and failure paths.

The earlier test-coverage NOTE is resolved. The multi-step regression test now requires a context write after step two's setup and before its session seed. It checks ordering, not filesystem restoration.

This was a static review. I did not run tests or independently reproduce the reported model rollouts.

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

adil-a and others added 3 commits November 22, 2026 22:51
One conflict, the _build_command call in claude_code_agent/app.py: main
added instruction_on_stdin (the prompt argument is None when the
instruction goes on stdin) and this branch turns skills on for staged
task skills. Both kept.

Signed-off-by: Adil Asif <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dbox_id

Main now reads sandbox.sandbox_id when a session seeds its own sandbox,
which the fake sandbox of the task-skills seed tests lacks.

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

adil-a commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Merged main at 51630ce4f2 into this branch (merge commit a1770981d2, with the conflict below), added one test
commit (0a7de79f59), then merged main at 15adc22542 (merge commit 6406bf6a62, new head; no conflicts).

Conflict in a1770981d2: one, the _build_command call in claude_code_agent/app.py. main added instruction_on_stdin (the
prompt argument is None when the instruction goes on stdin) and this PR turns skills on for staged task skills
(skills_active=bool(skills_path) or state.task_skills is not None). Both kept.

Test fix (0a7de79f59): main now reads sandbox.sandbox_id when a session seeds its own sandbox, which the fake
sandbox of the task-skills seed tests (_task_sandbox in tests/test_sandbox.py) lacked; it now has one.
Without this commit, 4 tests in tests/test_sandbox.py fail on the merged tree (AttributeError on sandbox_id).

Not changed by the merge: on main the harbor Environment Server still has task_mcp_grants, so this PR's refusal
hint and docs that name it stay. If the always-grant-task-MCP PR (#6292) merges first, this PR's merge of main needs
the resolution the combined end-to-end branch recorded: drop the task_mcp_grants hint from the agent-stage refusal,
keep the supports_task_skills or supports_task_tool_context wording, and drop the task_mcp_grants row edit in
agent-interactions/harbor.mdx. In that combined branch (all nine SkillEvaluator-related PRs on main 51630ce4f2), Claude
Code's Skill tool loaded the staged skill 7 times across the with-skill rows (baseline rows got "Unknown skill"),
and Codex's skill listing named the staged SKILL.md in 8 of 8 with-skill rows and 0 of 8 baseline rows.

Tests on the new head (gym env test serial; root tests -n 2; no env.yaml in the tree):

  • environment_servers/harbor: 732 passed
  • claude_code_agent: 304 passed
  • codex_agent: 635 passed, 9 skipped, 1 failed: test_sandbox_runner.py::test_task_descendants_survive_until_owner_teardown[natural], a process-timing test this PR does not touch, while the host was under heavy load from other work; test_sandbox_runner.py then passed 16 of 16 twice on this head and twice on main 15adc22542
  • root tests/unit_tests/agents: 853 passed, 5 failed; all 5 also fail on main 15adc22542 in a dev venv built from the same lock: 3 outcome-policy upload-evidence tests need cloudpickle and 2 sandbox_python archive-owner tests depend on the host's gid mapping

@adil-a

adil-a commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 6406bf6

@adil-a

adil-a commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

@adil-a

adil-a commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Merged main at 66a0698b3c into this branch (merge commit b952949386, now the head).

Conflict: one, the _PUBLIC_API map of nemo_gym/agents/__init__.py: this PR's stage_task_skills next to
main's stop_and_confirm_cleanup (added with OpenCode's resume in place). Both kept. main's other changes to the
files this PR touches (the Codex adapter, the Harbor server and their tests and docs) merged on their own; the task
skills are still staged in a borrowed sandbox only (if not owns_sandbox:), after the runtime install.

Tests on the head (gym env test, serial; root tests -n 2; no env.yaml in the tree):

  • environment_servers/harbor: 752 passed
  • claude_code_agent: 304 passed
  • codex_agent: 679 passed, 9 skipped
  • root tests/unit_tests/agents: 933 passed, 26 skipped, 5 failed; the same 5 fail on main 66a0698b3c in the same
    venv: 3 outcome-policy upload-evidence tests need cloudpickle and 2 sandbox_python archive-owner tests depend on
    the host's gid mapping

@adil-a

adil-a commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b952949

@adil-a

adil-a commented Nov 27, 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

One BLOCKER: the capabilities endpoint breaks compatibility with an older Environment Server even for harnesses that do not support task skills. Same-version deployments are unaffected.

I reviewed all 25 changed files and traced Harbor admission, multi-step context restoration, shared staging, both CLI integrations and cleanup. I compared against review 6033264612, which reported no findings. Its claimed setup → context rewrite → session seed coverage is still present. The compatibility finding below was already present at that review’s commit but was not reported; this is a full RESET review.

Execution: I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, the default-branch CI image, with Python 3.13.14. Purpose-built probes under /workspace/review-probes/ exercised:

  • skills_behavior_probe.py: real shell copies, independent session snapshots, symlink contents, quoting, dotfiles, empty folders and invalid inputs passed.
  • shared-skills-1/wire_probe.py: reproduced the compatibility failure below. failure_probe.py confirmed read/copy error classification.
  • cli-integration-1/probe.py: seed/activation wiring and borrowed-sandbox cleanup passed with fake transport and execution.
  • harbor-lifecycle-1/probe.py: eight admission cases passed; context restoration worked through two turns. Substituting only base’s _prepare_turn reproduced the missing-context failure this PR fixes.

These probes imported the admitted head. They did not execute real CLIs, provider identity switching or models. I read the author’s smoke-rollout evidence but did not independently reproduce it. Existing repository suites were left to CI.

CI: Checks attached to b9529493 show lint, four core shards, eight server shards, combined coverage, sandbox tests, session routing and Nemo_CICD_Test passed. Changed-server tests were skipped. Job logs show the suites executed synthetic merge 1dbc5847ca44b55897060fc6529b850651fd01ff, not the admitted head alone. The overall workflow failed on non-blocking diagnostics: Claude Code and Terminus conformance report failures also reported on base, mini-SWE timed out and was unavailable on both, and compliance flags the adapters’ pre-existing run() methods. This is not an all-checks-green claim.

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

model_config = ConfigDict(extra="forbid")

supports_task_tool_context: bool = False
supports_task_skills: bool = False

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: Omit the false capability from the wire response.

Could this response omit supports_task_skills when false, as AgentSeedSessionResponse already does? Adding the field here makes GET /v1/agent_sessions/capabilities emit "supports_task_skills": false for every unchanged harness. The base Environment Server parses that response with the strict base model. Upgrading an agent server independently therefore breaks ordinary turn_sessions: continue tasks on a continuing harness such as OpenCode, even when the task declares no skills.

The route/model probe shared-skills-1/wire_probe.py reproduced extra_forbidden on supports_task_skills; removing only that false key made the base model accept the same continuation response. This extends the documented Claude Code/Codex compatibility boundary to unrelated harnesses.

Please apply false-field omission to this model without weakening unknown-field validation or changing continuation metadata. Acceptance checks: a false-support GET response retains its previous wire keys and parses with the base model, including non-null continuation; a true-support response still emits the key and round-trips through the head model; seed serialization stays unchanged.

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.

Fixed in bd23ef419c. The capabilities reply now omits supports_task_skills unless it is true, so a harness that stages no task skills answers as before, and an Environment Server that predates the field still accepts the reply. Test: test_the_capabilities_reply_sends_supports_task_skills_only_when_declared, which checks the reply against a copy of the earlier model with extra="forbid".

… when declared

The capabilities reply now carried "supports_task_skills": false for every harness. An environment server whose
reply model predates the field forbids unknown keys, so upgrading only the agent server broke ordinary continuing
runs on harnesses that stage no skills. The reply drops the field when it is false, as the seed reply already does;
a harness that stages task skills still sends it.

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

Addressed the BLOCKER in bd23ef419c. AgentSessionCapabilitiesResponse now drops supports_task_skills from the wire when it is false, the same way AgentSeedSessionResponse does (a wrap model_serializer, so the schema and unknown-field validation are unchanged). A harness that stages no task skills answers GET /v1/agent_sessions/capabilities with the keys it sent before, continuation included; a harness that stages them still sends true. New test test_the_capabilities_reply_sends_supports_task_skills_only_when_declared: the no-skills reply has exactly supports_task_tool_context and continuation and parses with a model that predates the field (extra="forbid"), and the skills reply round-trips. It fails without the change. Seed serialization is unchanged. Session tests 41 passed; Claude Code, Codex and Harbor capability/skill tests pass. The stacked OpenCode/Hermes/Pi task-skills PR (#6351) merges this commit.

@adil-a

adil-a commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test bd23ef4

@adil-a

adil-a commented Nov 27, 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.

SHIP WITH CARE

One RISK: copying read-only skill directories makes non-root Claude Code and Codex sessions fail cleanup. I reproduced it in both adapters. No BLOCKER found.

I reviewed all 25 changed files, including connected admission, staging, activation and cleanup paths, with three delegated reviewers. This was a full RESET review. The new finding existed at the previous review’s commit but was not reported then.

Previous finding: Review 6093801598 is resolved. Eight HTTP/model combinations confirmed that false-support capabilities responses now parse with the actual base models, including non-null continuation. True-support responses still emit the field and round-trip through the current models. Their documented coordinated-upgrade requirement is unchanged.

Execution: I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, the default-branch CI image, with Python 3.13.14. Probes imported the admitted head and covered:

  • Real-shell copies, quoting, dotfiles, executable modes, symlink contents and independent session snapshots.
  • HTTP error classification and failed-seed cleanup.
  • Twenty-four Harbor admission combinations and two-step task-context restoration. Substituting base’s _prepare_turn reproduced the missing-context regression this PR fixes.
  • Both adapters’ seed/activation wiring and borrowed-sandbox cleanup. A non-root read-only-directory probe reproduced the finding below; I reran it independently and confirmed that making only copied directories writable permits cleanup.

Existing repository suites were left to CI. No live CLI/model or remote-provider run was performed. I read the author’s representative smoke-rollout evidence but did not independently reproduce it.

CI: Lint, four core shards, eight server shards, combined coverage, sandbox tests, session routing, Unit tests / Test, Unit tests / Server suite and Nemo_CICD_Test passed. Changed-server tests were skipped. The job log shows CI tested synthetic merge 47afb9f82d168bf8e83a972aa78d84fe5b4ae5a0, not the admitted head alone. Non-blocking conformance and compliance aggregates are red. The conformance summary reports the same Claude Code and Terminus failures on base; compliance flags the adapters’ pre-existing run() methods. This is not an all-checks-green claim.

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

Comment thread nemo_gym/agents/utils/task_skills.py Outdated
source, target = shlex.quote(skills_dir), shlex.quote(destination)
copied = await sandbox.exec(
f"[ -d {source} ] || {{ echo 'not a folder in the sandbox' >&2; exit 2; }}; "
f"mkdir -p -- {target} && cp -RL -- {source}/. {target}/",

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.

RISK: Keep copied skill directories removable by the session owner.

Could the staged copy keep its directories owner-writable? With a non-root [agent].user and a readable skill subdirectory with mode 0555, cp -RL succeeds but creates a non-writable copied directory. Both Claude Code and Codex then fail repeated session closes with Could not remove ... session files: rm -rf cannot unlink SKILL.md.

Borrowed-session cleanup removes the tree before disconnecting, so the client is not released. Harbor closes before verification, so an otherwise valid rollout can become a cleanup failure instead of reaching its verifier.

I reproduced this using the real helper, adapter seed/close methods and a non-root shell: /opt/nemo_gym_venv/bin/python /workspace/review-probes/cli-integration-2/readonly_probe.py. Both adapters failed two closes with Permission denied; making only the copied directories writable let their unchanged close paths succeed.

Please normalize directory permissions on the adapter-owned copy, including partial-copy failure paths, or harden its disposal equivalently. Preserve the original staging error, source permissions/content, executable files and borrowed-sandbox ownership. Acceptance checks: non-root seeding from a 0555 skill directory remains readable and closes successfully; a copy that fails after creating such a subtree also cleans up; both cases disconnect without stopping the environment’s sandbox.

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.

Fixed in 0f55ba11f1; details are in the PR comment on that commit. The copy runs chmod -R u+rwX on the destination after the copy, including after a copy that failed part way. The interrupted case raised in the later threads is handled in c76735324d, which repairs the destination before a copy, and in 62b22fc43a, which repairs it at close.

cp gives the copy of a task's skills_dir the modes of the task's files. A
non-root agent user can copy skills an image ships read-only, but the copy
then holds folders it cannot write, and the session's close fails to remove
them ("Could not remove ... session files"), so a borrowed session never
disconnects and the episode fails at cleanup.

After the copy, and after a copy that failed part way, the staging command
now gives the owner read and write on every entry of the copy and search on
every folder (chmod -R u+rwX). Executable files stay executable, the task's
folder is not touched, and the copy's own exit status and message are what a
refusal reports.

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

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed and fixed in 0f55ba11f1.

Cause. Without -p, cp -RL gives each copied entry its source's mode minus the umask. A non-root [agent].user
can copy a root-owned skill folder with mode 0555, so the copy under the session directory is a 0555 folder that the
agent user owns but cannot write. The close's rm -rf then cannot unlink the files in it, and
remove_session_directory() raises "Could not remove ... session files". The borrowed client is not disconnected,
and the rollout fails at cleanup. A copy that fails part way leaves the same folders behind, because cp sets a
folder's final mode after copying its contents, whether the copy succeeded or not. I checked this with GNU coreutils
9.4: a source with a 0555 skill folder and a dangling link elsewhere leaves a 0555 copy, and rm -rf fails with
"Permission denied".

Change (nemo_gym/agents/utils/task_skills.py). The copy command keeps cp's exit status, runs
chmod -R u+rwX on the destination, and then exits with cp's status:

[ -d SRC ] || { echo 'not a folder in the sandbox' >&2; exit 2; }; mkdir -p -- DEST && cp -RL -- SRC/. DEST/; copy_status=$?; chmod -R u+rwX -- DEST 2>/dev/null; exit $copy_status
  • The chmod runs after a successful copy and after one that failed part way. It is in the same exec, and both paths
    are quoted as before.
  • u+rwX gives the owner read and write on every entry and search on every folder. X adds execute only to folders
    and to files that already have an execute bit. Executable scripts stay executable, and other files do not become
    executable.
  • The chmod's own errors go to /dev/null, so a refusal still reports cp's exit status and message.
  • Only the destination changes. The task's folder keeps its modes and content. chmod -R ignores symlinks it finds
    while recursing, and the copy has none anyway, because -L copied their targets.
  • The borrowed sandbox is still not ours to stop. The close removes the session directory and disconnects, as before.

Tests. tests/unit_tests/agents/test_task_skills.py uses the real local-shell sandbox:

  • test_a_skill_shipped_read_only_is_staged_for_its_session_to_read_and_remove uses a skill with 0555 folders, a
    0444 SKILL.md and a 0555 script. It checks that:

    • the copy is readable;
    • every entry is readable and writable by its owner, and every folder can be entered;
    • the script stays executable, and SKILL.md does not become executable;
    • the source modes do not change.

    It then closes a SandboxSession that borrowed the sandbox and was seeded but never launched. The close removes the
    session directory with the same remove_session_directory() command, awaits disconnect once and never calls
    stop.

  • test_a_copy_that_fails_after_a_read_only_skill_keeps_its_error_and_its_session_still_closes uses the same skill
    plus a sibling skill with a dangling link. It checks that:

    • the seed is refused with cp's exit 1 and a message that names the link;
    • the read-only skill was copied before the failure;
    • the copy is owner-writable, and the source modes do not change;
    • the close removes the copy and disconnects without stopping the sandbox.
  • Both tests check the modes directly as well as the removal, because a test run as root removes read-only folders
    anyway. Here the suite runs as a non-root user.

  • On bd23ef419c, both tests fail on the mode check. With the mode check left out, both fail at the close with
    RuntimeError: Could not remove test session files, the error from your report. With the fix, both pass.

  • The Codex copy-command test checked that the command ends with the destination. It now checks for the destination
    followed by ;. The Claude Code test still matches as written.

Results (pytest -n 2):

  • tests/unit_tests/agents/test_task_skills.py: 24 passed.
  • claude_code_agent/tests/test_sandbox.py: 72 passed.
  • codex_agent/tests/test_sandbox_sessions.py: 368 passed.
  • pre-commit run passes on the changed files.

Not covered. Suppose a copy times out and the provider kills it before the chmod runs. That copy can still leave
read-only folders. The seed fails as a retryable infrastructure error, and the close would then fail to remove those
folders in the same way. Covering that case means hardening remove_session_directory() for every harness, for
example with a chmod -R u+rwX and a second rm -rf when the first one fails. I left that out of this PR, because it
changes the close of every harness.

The OpenCode, Hermes and Pi task-skills PR (#6351), which is stacked on this one, now has the same change through a
merge.

@adil-a

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 0f55ba1

@adil-a

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

…py before copying again

A copy that times out can be stopped after it copied read-only skills and before
its chmod. A retried seed then copies into the same destination, and cp cannot
write over those files, so the retry was refused. The copy command now makes an
existing destination owner-writable before the copy, and still repairs the copy
after it.

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

@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

One RISK remains from review 6094083643: an interrupted skills copy can still leave non-root sessions unable to close. Completed copies and ordinary copy failures now clean up correctly. No BLOCKER or separate new finding found.

I reviewed all 25 changed files and connected callers, activation paths and cleanup code with three delegated reviewers. This was a full RESET review, including comparison with bd23ef419ce98ae9a3283b432b0ac0ac3a324768.

Execution: I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, the default-branch CI image, with Python 3.13.14. Purpose-built probes covered:

  • Real-shell copies, quoting, dotfiles, executable permissions, symlink contents and independent session snapshots.
  • Both adapters’ seed, activation configuration and repeated close paths, including successful read-only copies and ordinary partial-copy failures.
  • Capability serialization and schema preservation, 24 Harbor admission combinations, two-step metadata restoration and four metadata-refresh failure cases.

Those checks passed. A separate interrupted-copy probe reproduced the remaining cleanup failure in both adapters. I independently reran the real LocalProvider reproduction and confirmed that changing only copied-directory permissions lets the unchanged close succeed. The reproduction accelerates the timeout and uses a blocking copy shim; it does not claim a live remote-provider failure.

Existing repository suites were left to CI. I read the author’s representative model-rollout evidence but did not independently run either CLI with a model.

CI: Lint check, four core shards, eight server shards, combined coverage, sandbox tests, session routing, Unit tests / Test, Unit tests / Server suite and Nemo_CICD_Test passed. Changed-server tests were skipped. The core job log shows CI tested synthetic merge 110c31846e22149afb4dfcf3f190e86451a630a7, not the admitted head alone. Non-blocking conformance and compliance aggregates are red. Base evidence shows the same Claude Code and Terminus conformance failures and unavailable OpenClaw/mini-SWE results; compliance flags pre-existing run() methods. This is not an all-checks-green claim.

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

Comment thread nemo_gym/agents/utils/task_skills.py Outdated
copied = await sandbox.exec(
f"[ -d {source} ] || {{ echo 'not a folder in the sandbox' >&2; exit 2; }}; "
f"mkdir -p -- {target} && cp -RL -- {source}/. {target}/; copy_status=$?; "
f"chmod -R u+rwX -- {target} 2>/dev/null; exit $copy_status",

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.

RISK: Keep timed-out skill copies removable too.

Could permission repair also cover an interrupted copy? The chmod runs only after cp returns in the same bounded exec. If the provider kills that exec after copying a restrictive subtree, chmod never runs. This leaves the interruption case of review 6094083643 unresolved, although successful and ordinary failed copies are fixed.

I reproduced this as uid 65532 with the real helper, LocalProvider and session close: PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=/workspace/review/source /opt/nemo_gym_venv/bin/python /workspace/review-probes/shared-skills-3/timeout_probe.py. A shim copies a 0555 subtree, then blocks; an accelerated 0.5-second timeout kills the exec. Two closes report Could not remove native-timeout session files, with zero disconnects. Both real adapter seed/close paths reproduce the failure too. Making only copied directories writable permits cleanup.

Borrowed close removes files before disconnecting, so affected Claude Code and Codex sessions retain their client and fail repeated cleanup.

Please repair permissions on the adapter-owned copy during disposal independently of the interrupted command, or avoid creating restrictive copied directories. Preserve the original timeout/copy error, source content and modes, executable files, and borrowed-sandbox ownership. Acceptance: a non-root copy interrupted after creating a read-only subtree can close repeatedly, remove its session files and disconnect without stopping the environment’s sandbox; keep the successful-copy and ordinary-copy-error cases green.

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.

Fixed in 62b22fc43a, with a symlink guard in 8d55720755; the head is now ccd9a44181. Details are in the PR comment on those commits. The repair now happens at disposal, independently of the interrupted copy.

  • remove_session_directory() still retires the session folder with mv first. If rm -rf on the retired folder fails, it runs chmod -R u+rwX on that folder (skipped when the retired path is a symlink) and removes it once more. That covers both the original path and a .closed folder that an earlier failed close left. A normal close is unchanged. If the second removal fails as well, the close still raises and keeps .closed for a retry.
  • Claude Code's and Codex's failed-seed paths close without copying again. That close now removes the read-only leftovers and then disconnects the borrowed sandbox without stopping it. The seed's original timeout or copy error is still what is raised.
  • Tests, real local shell, run as non-root:
    • test_a_session_whose_skills_copy_was_stopped_before_its_repair_still_closes: the task's read-only skills sit in the session as a stopped copy leaves them. A borrowed, seeded session closes with no copy in between. The session folder and .closed are gone, disconnect is awaited once, stop is not awaited, and the source modes do not change.
    • test_removal_makes_folders_its_owner_cannot_write_removable[seed|earlier close]: removal from the session path and from a .closed folder that an earlier close left.
    • All three fail without the change with Could not remove test session files.
  • The direct-retry case is unchanged: test_a_retry_copies_over_read_only_skills_an_interrupted_copy_left, from c76735324d.

… copies over

So the test also shows the retry wrote over what the interrupted copy left, not
only that it no longer fails.

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

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Added c76735324d and a test follow-up, 45c7a5d2ba, for a case the review bot found on the OpenCode, Hermes and Pi task-skills PR (#6351). A copy that is stopped (for example by a timeout) after cp wrote read-only skills but before the trailing chmod leaves files a later copy into the same destination cannot write over, so a retried seed was refused with a 422. The copy now runs chmod -R u+rwX on an existing destination before cp, as well as after it.

  • New test test_a_retry_copies_over_read_only_skills_an_interrupted_copy_left puts the read-only skills in the destination with their modes, one SKILL.md cut short, and stages again. The retry writes the full SKILL.md back. It fails without the pre-copy chmod (Permission denied, 422) and passes with it, as non-root.
  • The Claude Code and Codex copy-command matchers now check the mkdir and the cp separately.
  • tests/unit_tests/agents/test_task_skills.py 25 passed; Claude Code test_sandbox.py 72 passed; Codex test_sandbox_sessions.py 368 passed; pre-commit run passes on the changed files.

@adil-a

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 45c7a5d

@adil-a

adil-a commented Nov 28, 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.

SHIP WITH CARE

One prior RISK remains: interrupted skill copies can still prevent non-root sessions from closing. The new pre-copy chmod fixes direct helper retries, but neither adapter reaches that repair after failed setup. No BLOCKER or separate new finding found.

I reviewed all 25 changed files and connected callers with three delegated reviewers. This was a full RESET review, including comparison with prior review 6094780773 at 0f55ba11f1e68e630531cd82c85e4f0dcc728efe.

Execution: I used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:ba3eeeb0a60df9a7cd3bb9d2c1f36cabb0a493b5, the successful default-branch CI image because this head’s container build was skipped. Python was 3.13.14, running as uid 65532.

  • My leader-4/retry_copy.py comparison confirmed that overwriting a restrictive partial copy fails at the prior revision and succeeds at this head, preserving content, source modes and executable bits.
  • My leader-4/copy_timeout.py reproduced failed repeated cleanup at both revisions. Changing only copied-directory permissions let cleanup succeed.
  • Delegated probes covered real-shell staging, capability serialization, eight adapter activation/cleanup scenarios, 24 Harbor admission combinations, two-step metadata restoration and four metadata-refresh failure cases. Those checks passed. Both adapters’ public seed paths separately reproduced the interrupted-copy defect and rejected identical retries with 409: Agent session is closing.

The interruption probes use a blocking copy shim and an accelerated timeout, not an observed remote-provider incident. Runtime installation, CLI execution and network services were mocked. I read the author’s model-rollout evidence but did not independently run either CLI with a model. Existing repository suites were left to CI.

CI: Lint check, four core shards, eight server shards, combined coverage, sandbox tests, session routing, Unit tests / Test, Unit tests / Server suite and Nemo_CICD_Test passed. Changed-server tests and the container build were skipped. The core log shows CI tested synthetic merge 6ca96bf30e8c21b11ae86f4def6417ddc82648e0, not the admitted head alone. Non-blocking conformance and compliance aggregates are red. Base results show the same Claude Code/Terminus conformance failures and unavailable OpenClaw/mini-SWE results; compliance flags run() methods already present on base. This is not an all-checks-green claim.

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

# runs after a failed copy too. Their own errors are dropped, so a refusal reports the copy's.
copied = await sandbox.exec(
f"[ -d {source} ] || {{ echo 'not a folder in the sandbox' >&2; exit 2; }}; "
f"mkdir -p -- {target} && {{ chmod -R u+rwX -- {target} 2>/dev/null; cp -RL -- {source}/. {target}/; }}; "

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.

RISK: Repair interrupted copies during disposal, not only before another copy.

Could permission repair also cover failed-seed disposal? Both chmod operations still run inside the same bounded exec. If it is killed after copying a read-only subtree, the trailing chmod never runs. Claude Code and Codex immediately close instead of copying again. Cleanup retires the directory to .closed, then fails before disconnecting.

The new pre-copy repair is not reached through normal recovery: the failed seed is marked closing, so identical seed retries return 409: Agent session is closing. This leaves review 6094780773’s interrupted-copy finding unresolved.

I independently reproduced this on the head and prior revision with PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=/workspace/review/source /opt/nemo_gym_venv/bin/python /workspace/review-probes/leader-4/copy_timeout.py. Real LocalProvider timeout handling stops a copy shim after it creates a restrictive subtree. Two closes report Could not remove leader-timeout session files, with zero disconnects. Delegated public-seed probes reproduce it in both adapters. Making only copied directories writable permits cleanup.

Please repair the adapter-owned copy during disposal independently of the interrupted command, or avoid leaving restrictive copied directories. Preserve the original timeout/copy error, source content and modes, executable files, and borrowed-sandbox ownership. Acceptance: interrupt a non-root copy before post-copy repair, then close without another staging call; repeated close must remove original and retired session paths, disconnect once and never stop the borrowed sandbox. Keep successful-copy, ordinary-copy-error and direct-retry coverage green.

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.

Fixed in 62b22fc43a, with a symlink guard in 8d55720755; the head is now ccd9a44181. Details are in the PR comment on those commits. The repair now happens at disposal, independently of the interrupted copy.

  • remove_session_directory() still retires the session folder with mv first. If rm -rf on the retired folder fails, it runs chmod -R u+rwX on that folder (skipped when the retired path is a symlink) and removes it once more. That covers both the original path and a .closed folder that an earlier failed close left. A normal close is unchanged. If the second removal fails as well, the close still raises and keeps .closed for a retry.
  • Claude Code's and Codex's failed-seed paths close without copying again. That close now removes the read-only leftovers and then disconnects the borrowed sandbox without stopping it. The seed's original timeout or copy error is still what is raised.
  • Tests, real local shell, run as non-root:
    • test_a_session_whose_skills_copy_was_stopped_before_its_repair_still_closes: the task's read-only skills sit in the session as a stopped copy leaves them. A borrowed, seeded session closes with no copy in between. The session folder and .closed are gone, disconnect is awaited once, stop is not awaited, and the source modes do not change.
    • test_removal_makes_folders_its_owner_cannot_write_removable[seed|earlier close]: removal from the session path and from a .closed folder that an earlier close left.
    • All three fail without the change with Could not remove test session files.
  • The direct-retry case is unchanged: test_a_retry_copies_over_read_only_skills_an_interrupted_copy_left, from c76735324d.

adil-a and others added 2 commits November 27, 2026 17:45
A skills copy stopped by a timeout before it repaired its modes leaves read-only
folders in the session. A seed that fails that way closes its session without
copying again, and rm -rf, run as the non-root agent user, cannot empty those
folders: the close failed before it released the sandbox, and every retried close
failed on the retired copy the same way. When the removal fails, the close now
makes the retired folder owner-writable and removes it once more.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…s removable

GNU chmod -R follows a symlink named on its command line. A retired path that is
a symlink the close could not unlink would have had its target made writable.

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

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Added 62b22fc43a, and a symlink guard in 8d55720755, for the second case the review bot found on the OpenCode, Hermes and Pi task-skills PR (#6351). This is the limit I listed earlier on this PR. A skills copy stopped before its chmod leaves read-only folders in the session. A seed that fails that way closes its session without copying again, and rm -rf, run as a non-root agent user, could not empty those folders. The close then failed before it released the sandbox, and every retried close failed the same way on the .closed folder.

  • remove_session_directory() still retires the folder with mv first. If rm -rf fails, it now runs chmod -R u+rwX on the retired folder and removes it once more. The chmod is skipped when the retired path is a symlink, because GNU chmod -R would follow it. A normal close is unchanged. If the second removal fails as well, the close still raises and keeps .closed for a retry.
  • This changes the close of every harness that uses remove_session_directory(), but only on the path where the removal used to fail.
  • Tests (real shell, non-root): a session folder with read-only skills is removed; the same files left under .closed by an earlier failed close are removed; and a borrowed, seeded session whose copy was stopped closes, disconnects once and is not stopped. All three fail without the change with Could not remove test session files. A fourth test checks that a .closed symlink the close cannot unlink leaves its target's modes unchanged; without the guard, the target becomes writable.
  • tests/unit_tests/agents: 941 passed, plus the same 5 environment-only failures as before. Claude Code test_sandbox.py: 72 passed. Codex test_sandbox_sessions.py: 368 passed. pre-commit run passes on the changed files.

@adil-a

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 8d55720

@adil-a

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

/review reset=true

Root unlinks the link from a folder it cannot write, so the removal succeeds and
the fallback the test is about is never reached. CI runs the core tests as root.

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

adil-a commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ccd9a44

@adil-a

adil-a commented Nov 28, 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.

SHIP

LGTM. No material concerns found.

I reviewed all 27 changed files and connected callers with three delegated reviewers. This was a full RESET review, including comparison with review 6094922862 at 45c7a5d2bab752f797790587f65ca43b70d7b2a4.

The prior interrupted-copy RISK is fixed. The disposal path repairs restrictive copied directories independently of the interrupted staging command. My non-root differential probe reproduced two failed closes on the previous revision; both closes succeeded on this head, with one disconnect, no borrowed-sandbox stop and unchanged source modes. Delegated probes confirmed recovery through both adapters’ public seed paths, including identical seed retry and replay.

Execution: All probes used 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:ba3eeeb0a60df9a7cd3bb9d2c1f36cabb0a493b5, the successful default-branch CI image because this head’s container build was skipped. Python was 3.13.14, running as uid 65532.

  • leader-6/copy_timeout.py confirmed the cleanup fix against the previous revision using real LocalProvider timeout handling and a blocking copy shim.
  • Filesystem probes passed for restrictive permissions, partial copies, retry, quoted paths and symlink containment.
  • Eight adapter integration scenarios passed. Capability serialization and skills-plus-MCP configuration probes also passed.
  • Harbor probes passed 24 admission combinations and four metadata-refresh failure cases. A shell-backed two-step probe verified restored metadata before each seed; substituting base’s preparation method reproduced the missing-metadata failure.

Runtime installation, CLI execution and network services were mocked. I read the author’s model-rollout evidence but did not independently run either CLI with a model. Existing repository suites were left to CI.

CI: Lint check, four core shards, eight server shards, sandbox tests, combined coverage, session routing, Unit tests / Test, Unit tests / Server suite and Nemo_CICD_Test passed. Changed-server tests and the container build were skipped. The core log records synthetic merge d9ba293995722d930fb53e5be447d56e3af6d10d, not the admitted head alone.

The non-blocking conformance and compliance aggregates are red. Base shows the same Claude Code and Terminus conformance failures; other diagnostic failures are not fully attributed. Compliance flags run() methods already present on base. This is not an all-checks-green claim.

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

This branch has not been deployed

No deployments
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 feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants