Repository navigation
Conversation
Contributor
svcnvidia-nemo-ci
left a comment
Contributor
There was a problem hiding this comment.
SHIP
LGTM — no concerns found. I reviewed all 28 changed files and traced ownership expiry, cleanup retries, verification, and checkpoint interactions. This was a static review; I didn't execute tests.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
… its state Session routing judged how long a worker owns a resources session only from the requests it served: a session that is not open kept its owner for session_close_retry_window_seconds after the last request. Several servers keep a sandbox after a failed seed, verify or close whose stop also failed, so that a later close can retry the stop. If that close arrived after the window, it reached another worker, which fenced the ID and answered 200, and the sandbox on the first worker lived until shutdown or the provider TTL. scale_swe, terminal_bench_2_1, swebench_pro, swe_atlas_qa, rna_design, browsecomp_advanced_harness and the servers built on swebench's SandboxSessionResourcesServer (swebench, swe_gym, r2e_gym, deepswe, deepswe_external1) can already run with several workers. SimpleResourcesServer gains a synchronous keeps_session_state hook, passed to routing through owned_session_routing. When a session's window passes, the ownership sweep asks it whether the server still keeps state for the session and, if so, keeps ownership for another window. A release by a request starts a new window; a release outside one, such as shutdown or a server's own expiry, is noticed at the next check. A hook that raises releases ownership, as before the hook existed, so a buggy override cannot keep every session owned; the warning names the session and logs the traceback once. The base hook reports live state and what a failed initialization's release left. Servers that keep sandboxes, tool workers or workspaces in their own maps override it to report those maps: scale_swe, terminal_bench_2_1, swebench_pro, swe_atlas_qa, rna_design, browsecomp_advanced_harness, SandboxSessionResourcesServer, and officeqa, vibench and agentic_if, which run with several workers once their refusals are lifted. scale_swe leaves out its session records, which a cancelled close can leave behind with nothing to release. The same callable serves as holds_state for check_resources_session_contract. session_release_pending keeps its meaning: a verification's cleanup is pending. The resources server guide and the close retry window description now describe the longer ownership. Signed-off-by: Ananth Subramaniam <[email protected]>
ananthsub
force-pushed
the
ananthsub/routing-held-session-state
branch
from
November 13, 2026 20:31
d8bcd2a to
b84f326
Compare
yaoyu-33
requested review from
gchlebus
and removed request for
cynthiagao-nv
November 16, 2026 00:16
ananthsub
marked this pull request as draft
November 17, 2026 16:01
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This branch had an error being 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.
What changed and why
Session routing decided how long a worker owns a resources session only from the requests that worker served. A session that is not open kept its owner for
session_close_retry_window_seconds(300 s by default) after its last request.Several servers keep a sandbox, tool worker or workspace after a failed seed, verify or close whose own teardown also failed, so that a later close can retry the teardown. If that close arrived after the window, it reached another worker, which fenced the session ID and answered 200. The resource on the first worker then lived until shutdown or the provider TTL.
This PR lets the server tell routing that it still holds something a close must reach:
SimpleResourcesServergains a synchronouskeeps_session_state(session_id)hook, passed to routing throughowned_session_routing().__init_subclass__rejects an async override.has_session_state) and sessions whose failed initialization left something to release.SandboxSessionResourcesServer, which covers swebench, swe_gym, r2e_gym, deepswe and deepswe_external1session_release_pendingkeeps its meaning: a verification's cleanup is pending./verifyownership and the checkpoint tracker read it unchanged.holds_stateforcheck_resources_session_contract. The conformance tests of officeqa, vibench, swebench_pro and deepswe now pass it.session_close_retry_window_secondsdescription now describe the longer ownership.flowchart TD A[Window since the last request passes] --> B{keeps_session_state} B -- True --> C[Keep ownership for another window] C --> A B -- False --> D[Release ownership] B -- raises --> E[Log a warning and release ownership]Issue
No issue. This was found in the team review of #5988, which records it as a known edge of running these servers with several workers.
Compatibility
keeps_session_stateto stay safe with several workers. Otherwise a late close after a failed teardown can still reach another worker. The docs and thesession_close_retry_window_secondsdescription now say so.app.pyfiles.Validation
Commands, run from this branch's worktree with a venv built by
uv sync --extra devplus the browsecomp_advanced_harness server dependencies:tests/unit_tests/.pytest resources_servers/<server>/tests, one directory at a time, for swebench_pro, rna_design, swe_atlas_qa, browsecomp_advanced_harness, agentic_if, officeqa, vibench, terminal_bench_2_1, scale_swe and deepswe, plusresources_servers/swebench/tests/test_sandbox_sessions.py.pre-commit run --fileson the changed files.Rollout evidence
N/A. The change affects only how long a worker keeps ownership of a session after a failed teardown. It does not change agent turns, tools or verification. A unit test runs two real workers and checks that a late close reaches the worker that kept the state.