Skip to content

feat(workplace_assistant): serve the typed resources sessions API - #5486

Open
yaoyu-33 wants to merge 25 commits into
yuya/shared-resources-lifecyclefrom
yuya/gymint-231-workplace-assistant-sessions
Open

yaoyu-33 wants to merge 25 commits into
yuya/shared-resources-lifecyclefrom
yuya/gymint-231-workplace-assistant-sessions

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Serve typed workplace sessions and delegate common seed, verification cleanup, close and retirement to #5709. Preserve table construction/mutations and checkpoint behavior, using public identity restoration APIs instead of base-private dictionaries.

Depends on #5709 (which depends on #5708). The child diff contains only this environment and its related documentation/configuration; shared implementation is reviewed once in the dependency. No separate issue is needed for this focused migration of an existing resources server.

  • Validate full typed task data while retaining permissive cookie rows. Matching typed retries preserve mutations; conflicting identity and malformed HTTP/MCP envelopes are rejected.
  • Restore checkpoint tables and identities with atomic batch prevalidation. Keep old flat snapshots and adoption of unbound restored state; first cookie use claims the state so another episode cannot take it over.
  • Verification releases tables and active identity while retaining bounded request-scoring evidence. Offline gym eval reverify ++force=true of workplace rows, which main rescored by replay, is now masked (REVERIFY_MODE = UNSUPPORTED; the guard already refused the non-forced form as UNKNOWN). A tool call without a live session is now 404 failure_kind: session_lost (main: 400). This migration does not reconstruct workplace databases offline.

Request-scored: retains an empty marker (retain(None)) because the request already carries the answer and grading data.

Validation on a1186a92e2bcf924fc1447ec2e5cf5cd26d4364d, Python 3.13.14, with this checkout first on PYTHONPATH and NEMO_GYM_EXTRA_ROOTS pointing to it:

Real-model smoke on preceding migration revision 618012d86bb37efa3e3388fee5426833aa4d2520 (shared core 4e92d4891) used nvidia/nemotron-3.5-lightning-30b-a3b, Python 3.13.14 and the stock workplace task through real Gym HTTP applications. Typed and cookie paths each completed three model calls, scored 1.0 and released all workplace tables and identity state; lifecycle checks passed. The cookie run recovered from provider 429 responses within the existing bounded retry policy. Loaded source hashes matched that revision. Checkpoint restore/adoption and MCP validation are covered by regressions; these two rollouts do not claim model-driven checkpoint recovery or benchmark parity. Retry and cleanup paths at this head are covered by unit tests only.

These targeted checks do not replace the repository CI matrix or approval of the current head.

An Environment Server such as single_agent_turn seeds each resources
server with a typed ResourcesSeedSessionRequest and releases it with
/close_session. workplace_assistant accepted only an Agent's /run seed
and returned an untyped response, so it could not be fronted by
single_agent_turn_legacy.

- seed_session accepts the typed body next to the /run body. Typed
  sessions are keyed by resources_session_id: a repeated seed keeps
  the tables the tool calls changed, a seed bound to another episode
  or a closed session gets 409, and task_data that is not a task gets
  422.
- close_resources_session releases the tables by resources_session_id
  (no cookie needed), is idempotent, and fences late seeds with
  ResourcesSessionFence.
- verify keeps a typed session's tables for its close; a /run session
  is still released at verify. A verify for a session the server no
  longer holds returns a masked lost-session sample, and a tool call
  for one gets 404 (was 400).
- retire_session_state shares the release helper.

Refs GYMINT-231.

Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yaoyu-33 yaoyu-33 added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 3, 2026
@copy-pr-bot

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

@yaoyu-33

yaoyu-33 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 932a186

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

… path

List the typed seed first, as the path new configs use, and describe the
Agent /run seed as the path kept so the legacy_agent configs run unchanged
until they switch.

Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yaoyu-33

yaoyu-33 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 4810f54

@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 3, 2026 18:33
@yaoyu-33 yaoyu-33 added the needs-review PR is ready for code review and waiting on a reviewer label Nov 3, 2026
yaoyu-33 and others added 3 commits November 3, 2026 11:05
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
…ng it

The seed recorded the session's episode and task before get_tools built its tables. get_tools reads CSVs from disk and can fail (EMFILE under load); the seed then answered 500 but kept the binding, so the caller's retry took the repeated-seed path and returned 200 for a session with no tables, whose tool calls all got 404 and whose verify was masked.

The tables are now built first. Adds a test where get_tools fails once (fails on the previous code), makes the 422 test check that no binding is left, and moves the conformance import to nemo_gym.server_runtime.testing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 3, 2026 20:01
…ng it

Verify releases a /run session's tables, and the HTTP client sends a verify again when its connection drops, even after the server answered. The resend found no tables and came back masked, where main scored it. The score reads only the request, so verify now remembers the /run sessions it released for session_close_retry_window_seconds and scores a resend. A /run verify with no seed, and any verify of a closed typed session, is still masked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@yaoyu-33

yaoyu-33 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test fac079f

Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
yaoyu-33 and others added 2 commits November 4, 2026 12:50
The /run seed guard refused any body sharing a key with ResourcesSeedSessionRequest, so a dataset row with a scalar task_id got 422 on every seed. Treat a body as a malformed typed seed only when it names resources_session_id or carries typed episode_id and task_id objects, the rule #5480 settled on.

Also import check_resources_session_contract from nemo_gym.server_runtime, which main's public-API test requires, and state verify's no-await invariant next to its retry bookkeeping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@yaoyu-33

yaoyu-33 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 77a7ab4

@yaoyu-33

yaoyu-33 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a5e687d

Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
…antics

Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@yaoyu-33
yaoyu-33 changed the base branch from main to yuya/shared-resources-lifecycle November 5, 2026 23:29
yaoyu-33 and others added 4 commits November 5, 2026 16:27
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
…ose wording

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@yaoyu-33

yaoyu-33 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a1186a9

…ADME

The README now describes only the typed Environment Server path. The cookie
seed still works unchanged; the PR description records that compatibility.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@yaoyu-33

yaoyu-33 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5688115

This branch was previously deployed

1 inactive deployment
public — 5688115e Deployed Nov 6, 2026 by copy-pr-bot[bot] via release / finalize / notify #10690
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants