Skip to content

feat: add dynamic Environment Server compliance rules A4 and A5 - #5920

Merged
marta-sd merged 3 commits into
martas/fep-1925-static-agent-testsfrom
martas/fep-1927-dynamic-tests-for-agent-servers
Nov 13, 2026
Merged

marta-sd merged 3 commits into
martas/fep-1925-static-agent-testsfrom
martas/fep-1927-dynamic-tests-for-agent-servers

Conversation

@marta-sd

@marta-sd marta-sd commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds dynamic rules to the Environment Server compliance check: rules judged by running the agent, not only by reading its class. Stacked on #5441.

For an agent that implements sessions, the probe builds the agent from its default config (configs/<component>.yaml) in the agent's own venv, lends it a sandbox, seeds a session with that sandbox, closes the session and checks whether the sandbox still runs. The lent sandbox is the local provider made connectable in process, so the probe needs no model, container or network. The global config gets a policy_model entry as in harness conformance, and the seed carries agent_timeout_sec as the environment server sends it.

  • A4 (requires A2): the agent should accept a sandbox lent in the session seed, or refuse it with a 422 whose detail says does not support sandbox access. A failed seed is reported at the agent's _seed_agent_session_state, or at its class.
  • A5 (requires A4): the agent should leave a borrowed sandbox running when its session closes, since its owner stops it. A stopped sandbox is reported at the agent's _close_agent_session_state, or at its class. A5 does not apply when the agent refused the sandbox or the close failed.

claude_code_agent leaves claude_code_version unset in its default config, so the probe uses 2.1.261, the version that benchmark configs pin. Its seed installs that runtime. The probe does not set flags that only an operator may set: for pool_agent, whose seed needs accept_pool_eula, A4 and A5 do not apply. When the sandbox's state after the close cannot be read, A5 does not apply.

The README and the harness guide describe A4 and A5.

Validation

  • tests/unit_tests/tooling/test_environment_server_compliance.py and tests/unit_tests/test_public_api_facades.py
  • pre-commit run on the changed files
  • This PR's CI run (43390693427) checked all 73 agents: 6 compliant, 67 with findings, 0 unavailable. 31 implement sessions and reach A4. A4 reported langchain_deepagents_agent, and A5 found nothing. A4 and A5 did not apply to pool_agent (operator opt-in) and to pi_sandboxed_agent and vision2code_agent, which have no configs/<component>.yaml.

Rollouts

N/A: CI-only change.

Compatibility and benchmark impact

None. The check is a separate workflow job and does not gate other jobs.

🤖 Generated with Claude Code

@marta-sd marta-sd added ci CI, automation, test queue, or workflow infrastructure work area:ci CI workflows, test routing, and repository automation labels Nov 10, 2026
@copy-pr-bot

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

@marta-sd
marta-sd added this pull request to stack #5369 November 10, 2026 07:13
@marta-sd marta-sd self-assigned this Nov 10, 2026
@marta-sd

Copy link
Copy Markdown
Contributor Author

/ok to test 260369a

@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: Pool's missing EULA opt-in becomes an A4 violation without exercising its sandbox support.

I inspected all three changed files and the directly affected session, sandbox, and compliance-reporting paths. Tests weren't executed in this read-only review. The delegated lifecycle report wasn't available, so I completed that inspection directly.

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

@marta-sd
marta-sd force-pushed the martas/fep-1927-dynamic-tests-for-agent-servers branch from 260369a to e1282f5 Compare November 10, 2026 08:25
@marta-sd

Copy link
Copy Markdown
Contributor Author

/ok to test 94ca277

@marta-sd

Copy link
Copy Markdown
Contributor Author

/ok to test e1282f5

@ko3n1g

ko3n1g commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

/review-approve

@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 — The prior Pool opt-in finding is resolved; no eligible findings remain.

The opt-in guard now makes A4 skip when Pool lacks explicit EULA acceptance, without accepting it implicitly. A5 also skips, while static findings remain. Explicit acceptance still permits both dynamic checks. The regression tests assert these outcomes and retain the distinction between disconnecting, stopping, recognized sandbox refusal, and generic seed failure.

I completed the follow-up inspection of the fix, its rule/report propagation, and its regression tests. The previously reviewed tree wasn't supplied, so I couldn't compare the exact inter-review delta. Tests weren't executed in this read-only review.

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

@ko3n1g

ko3n1g commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

/review-approve 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: an inconclusive health-command timeout becomes a false A5 finding.

The prior Pool EULA issue is resolved: the opt-in guard skips the dynamic checks without implicitly accepting the license, while explicit acceptance remains eligible.

I completed the broad review of all three changed files, consolidated all three delegated inspections, and traced the affected configuration, session, sandbox, and reporting contracts. Tests weren't executed in this read-only review.

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

if reply.status_code != 200:
return SessionObservation("accepted", "failed", None)
try:
killed = (await owner.exec("true", timeout_s=30)).return_code != 0

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 — Distinguish an inconclusive health command from a stopped sandbox.

If the final true command times out after a successful seed and close, LocalProvider.exec returns return_code=125, error_type="timeout". This comparison records sandbox_killed=True, producing an A5 violation even when the agent left the sandbox running. The execution-result contract explicitly distinguishes runtime sentinels from process exit codes. The affected behavior is compliance classification; this isn't evidence of a production sandbox failure.

Could you preserve the successful A4 observation and mark A5 inconclusive instead? Replace this comparison with:

result = await owner.exec("true", timeout_s=30)
killed = None if result.error_type is not None else result.return_code != 0

Then insert this before the truthiness check in stopped_lent_sandbox:

if session.sandbox_killed is None:
    raise Unavailable("the lent sandbox's survival could not be determined")

Update SessionObservation's documentation to permit unknown survival after an accepted close. Keep the explicit-stop exception path: calling stop() must still produce A5, while disconnect() must not. The invariant is that an inconclusive execution cannot establish an ownership violation.

Proposed acceptance checks: using the lending-agent fixture, make only the final true execution return SandboxExecResult(None, "local command timed out", 125, "timeout"). Expect SessionObservation("accepted", "accepted", None), A4 held, and A5 skipped with the inconclusive reason. Retain the disconnect/stop assertions, which expect False and True respectively, and the distinct recognized-refusal, generic-seed-failure, and failed-close outcomes. The suggested code and tests haven't been executed; verify them before adoption.

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 087ef63

@marta-sd
marta-sd force-pushed the martas/fep-1927-dynamic-tests-for-agent-servers branch from 06fd38d to 3a411d4 Compare November 13, 2026 08:06
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 13, 2026 08:07
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

@marta-sd
marta-sd force-pushed the martas/fep-1927-dynamic-tests-for-agent-servers branch from 3a411d4 to 02d13a5 Compare November 13, 2026 08:26
@marta-sd

Copy link
Copy Markdown
Contributor Author

/ok to test 02d13a5

@giuliolovisotto

Copy link
Copy Markdown
Contributor

/review-approve

@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 eligible findings remain in this follow-up.

The prior timeout fix remains present: the health check records unknown sandbox survival for runtime errors, and A5 skips with an inconclusive reason while A4 remains held. The regression test asserts the exact previously reported timeout result. Neighboring assertions retain the distinction between disconnecting and stopping, recognized refusal and seed failure, and failed close.

The Pool opt-in guard still avoids implicit license acceptance while keeping explicitly accepted configurations eligible. I also checked the A4/A5 documentation against the current rule and reporting paths.

I completed the scoped follow-up. All three delegated inspections reached completion; one report wasn't available, so I checked its configuration topic directly. The previously reviewed tree wasn't supplied, so I couldn't compare the exact inter-review delta or establish additional regressions from that comparison. Tests weren't executed in this read-only review.

Note: ⚠️ giuliolovisotto is not in any eligible team (automation, gym_maintainers) — you don't have permission to trigger formal reviews. Posting review as comment only.

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

@marta-sd
marta-sd enabled stacked auto-merge November 13, 2026 10:55
@marta-sd
marta-sd added this pull request to the merge queue Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Nov 13, 2026
@marta-sd
marta-sd added this pull request to the merge queue Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Nov 13, 2026
marta-sd and others added 3 commits November 13, 2026 12:24
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Marta Stepniewska-Dziubinska <[email protected]>
@marta-sd
marta-sd force-pushed the martas/fep-1927-dynamic-tests-for-agent-servers branch from 02d13a5 to c7cd0e9 Compare November 13, 2026 12:24
@marta-sd

Copy link
Copy Markdown
Contributor Author

/ok to test c7cd0e9

@marta-sd
marta-sd enabled stacked auto-merge November 13, 2026 12:35
@marta-sd
marta-sd added this pull request to the merge queue Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit 510ded5 Nov 13, 2026
140 of 142 checks passed
@marta-sd
marta-sd deleted the martas/fep-1927-dynamic-tests-for-agent-servers branch November 13, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI workflows, test routing, and repository automation ci CI, automation, test queue, or workflow infrastructure work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants