Repository navigation
fix(checkpoint): close agent-run resources sessions by their seeded ID - #6421
Conversation
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
RISK: Required real-model smoke evidence is still missing
The PR description explicitly leaves the representative live-model smoke rollout pending. This changes cleanup behavior in both Simple Agent and Tool Simulation Agent, so the real-model smoke requirement in AGENTS.md applies. Controlled model replies do not satisfy that requirement. This is a validation gap, not a demonstrated code defect.
Could you run a representative checkpoint-enabled /run smoke for each changed agent using a real model and replayable resources server through session routing, then record the configuration, revision, reward and cleanup outcome? Include a restored replacement attempt. Expected outcomes: fresh and restored runs return the verifier result, /close_session receives the decoded ID matching the resources cookie, and the close succeeds without the caught warning or a session left tracked by the checkpoint participant. No code change is requested unless the smoke exposes a failure.
Keep the neighboring contracts intact: the Simple Agent restore test must still return trajectory rollout ID 0-0-a1 and close the same resources ID under attempts 0 and 1; the successive Tool Simulation Agent restore test must still return reward 1.0 with one successful close. The routed-close regression must still reject run:r with HTTP 409 before accepting the reported ID. Servers and snapshots without the added metadata must keep the documented fallback.
I inspected all nine changed files and traced the affected session routing and continuation paths. I found no code defect in that inspection. I did not execute tests or independently verify the reported test results.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| async def _close_legacy_resources_session( | ||
| self, body: SimpleAgentRunRequest, cookies: Any, *, resources_session_id: str | None = None | ||
| ) -> None: |
There was a problem hiding this comment.
Both agents now repeat the same four pieces:
- reading the ID from the seed reply
- adding it to every boundary
- the close with its
run:fallback _LEGACY_SESSION_PREFIX
The copy in tool_simulation_agent is at L197-L232 and L302-L317. The next agent that adopts LegacyRun has to copy all four, or it brings this bug back.
A LegacyRun method in _checkpoint/agent.py could record the seed reply, add the ID to each boundary, and build the close request. Every agent's own /run would then use one mechanism. A follow-up PR is fine; this does not block.
There was a problem hiding this comment.
Agreed. I will move this into a shared LegacyRun method in a follow-up PR, so this one stays focused on the fix.
|
/ok to test b980611 |
Signed-off-by: Anish Mahishi <[email protected]>
- Rename the seed-reply header to x-ng-checkpoint-resources-session-id, matching its x-ng-checkpoint-* siblings, and keep its constant private; seed_resources_session_id stays the public reader. - Say that every successful seed reports the ID, and that the run: fallback close is refused by session routing and cannot release the session. - Test on a server with the base close and session-state hooks, routed as a worker, that the reported ID releases the session state and that the worker's ownership then expires. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
b980611 to
ae635c8
Compare
|
/ok to test ae635c8 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44656991491 |
Summary
x-ng-resources-session-id(percent-encoded for HTTP headers)./runcontinuations and use it for/close_session, including after restore.An agent-run seed does not assign a resources session ID. Cleanup previously sent the agent's
run:<capture_key>key alongside a cookie naming the actual resources session, so session routing correctly rejected the close with HTTP 409. The warning was caught and the reward returned, but the resources participant could retain the session after replayable verification.This fixes that mismatch without weakening cookie/body validation, changing close timing, dropping cookies, or changing attempt fencing. Related lifecycle/routing contracts: #3888 and #3909. No separate issue: the bug and its reproduction are contained in this PR.
Compatibility
Validation
pre-commit run --all-filespassed, including package layering; checks on the final staged files also passed.mainreproduced the wrong close ID and missing restored ID: 2 expected failures, 3 compatibility cases passed.Rollout evidence / readiness
Draft pending a representative live-model smoke rollout. The local tests use controlled model replies, a real verifier, and the real resources/session-routing middleware; no new GPU job was launched. Reward/convergence changes are not claimed.
Documentation: protocol metadata and fallback behavior are documented inline; there is no new user configuration.