Repository navigation
Conversation
Signed-off-by: Robert Washbourne <[email protected]>
rawsh
marked this pull request as ready for review
October 2, 2026 12:56
Contributor
Ashish-Soni08
pushed a commit
to Ashish-Soni08/Gym
that referenced
this pull request
Oct 10, 2026
…nt holds no cookie jar (NVIDIA-NeMo#4449) ## What changed Under `single_agent_turn`, the environment server seeds the resources server and keeps the session cookie from that seed. It sends that cookie to `/verify` and `/close_session`, and a stateful resources server finds the episode's state by it. `SimpleAgent` closed every agent session with `resources_cookies={}` when the session had no direct HTTP tool grant. That is the default, because `resources_tool_transports` on `single_agent_turn` is empty. `single_agent_turn` replaced its cookie jar with any value that was not `None`, so `/verify` and `/close_session` went out with no session cookie. A resources server that keys per-rollout state by the session cookie (sandboxes, tool environments, session dictionaries) then could not find the episode during verify, and close could not release it. - `SimpleAgent` now reports `resources_cookies=None` when the session never held the resources cookie jar, and only tracks the jar when the session has a direct HTTP grant. - `single_agent_turn` keeps the jar from the resources seed when the agent returns `None` or an empty jar. `nemo_user_sim` already behaves this way. - The `resources_cookies` field on `AgentCloseSessionResponse` now documents that `None` or an empty jar leaves the environment server's jar unchanged. Related: NVIDIA-NeMo#3928 fixes cookie loss when a tool response on the legacy `/run` path carries no `Set-Cookie`. This change covers the agent session path when the session has no tool grant, so the two do not overlap. No issue: this is a standalone bug with a direct regression test. ## Validation - `pytest environment_servers/single_agent_turn/tests/test_app.py responses_api_agents/simple_agent/tests/test_app.py` passed. - The new `single_agent_turn` test closes the agent with an empty jar and with no jar, and checks that `/verify` and `/close_session` carry the seed's cookie. - The new `SimpleAgent` test seeds a session without a grant, runs one activation, and checks that close reports no cookie jar. - Both regression cases fail on the code before this change. - `pytest -n 16 tests/unit_tests` shows the same failures with and without this change, in `test_opensandbox_compose.py`, `test_reward_profile.py`, `test_dataset_orchestrator.py`, `test_sandbox_stop_retry.py` and `test_exporters.py`. None of those touch agent sessions. - `pre-commit run` on the changed files passed. ## Rollout evidence N/A: the change only decides which resources cookie the environment server forwards to `/verify` and `/close_session`. Model inputs and outputs are unchanged, and the cookie routing is covered by the tests above. ## Compatibility Agents that return a non-empty `resources_cookies` jar behave as before. An agent that returned `{}` to clear the jar now leaves the seed's jar in place; no agent in the repository relies on that. Signed-off-by: Ananth Subramaniam <[email protected]>
This was referenced Oct 22, 2026
yaoyu-33
marked this pull request as draft
November 18, 2026 02:18
Contributor
|
We’re doing some cleanup of the open PR list. This PR has had no activity for over a month, so I’ve moved it back to draft. If this change is still needed, please resolve any merge conflicts and mark the PR ready for review again when it’s ready to merge. Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A tool response without
Set-Cookiecurrently discards the seeded resource session, causing the later verifier request to fail with HTTP 409. Merge cookie deltas at the model response, tool response, seed, and agent response boundaries. Responses that rotate a cookie update its value while other session cookies remain available.Three real HTTP regressions cover tool HTTP 500, successful tools without cookie headers, and cookie rotation. They use
SimpleAgent,ServerClient, and a disabled implicit client cookie jar. Existing unit fixtures use realSimpleCookieobjects so they exercise the transport contract. This standalone bug has a direct regression reproduction, so a separate issue is unnecessary. The self-dispatch and optional trajectory behavior described in #2293 remains covered by the existing component tests.Validation against the final signed-off commit:
uv sync --frozen --extra dev: 23 SimpleAgent tests passed, 0 skipped. The unmodified upstream base fails two new HTTP cases with verifier 409; its rotation control passes.gym env test +entrypoint=responses_api_agents/simple_agent +should_validate_data=true: 23 passed, 0 skipped, in the normal isolated component environment.pre-commit run --all-files: all applicable hooks passed; the Markdown filename hook had no matching files.get_weather(city=Paris). Cookie-free tool 200 and 500 both reached same-session verification and returned run 200. The actual model reported cold weather and tool unavailability respectively; total usage was 829 and 797 tokens. The controlled resource fixture is diagnostic smoke, with raw agent/tool/verifier results inspected; it does not qualify a production training shape.Existing configurations need no migration. Previously invalid session-loss episodes can now reach verification, which can change benchmark completion and reward statistics. Hosted CI and maintainer review remain pending; downstream pins and production rollout are separate.