Repository navigation
Conversation
A resources server that keys state by repeat (for example deliverables persisted per repeat) has no reliable way to learn the repeat at seed time: task_data carries no `_ng_*` keys and EpisodeId holds only the rollout ID and attempt, so servers parse the repeat out of the rollout ID, which breaks for explicit `_ng_rollout_id` values. Carry the collector's `_ng_rollout_index` as an optional `rollout_index` on BaseEpisodeRequest and ResourcesSeedSessionRequest, filled by the collector and the legacy single-agent-turn adapter and forwarded by the single-agent-turn and UserSim environment servers. EpisodeId is unchanged, so capture keys and checkpoint identity keep round-tripping. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
yaoyu-33
marked this pull request as ready for review
October 15, 2026 20:17
…known one off the wire - Describe rollout_index as the row's `_ng_rollout_index`, numbered per task across fan-out agents and never parsed from the rollout ID, and say that an Environment Server's /verify does not carry it. - Make both fields strict ints, like the other `_ng_rollout_index` readers. - Omit a None rollout_index from the seed body, so a Resources Server built before the field still accepts seeds that carry no index. - Document the field in the Environment Server sessions bullet. - Test the UserSim seed forwarding and the omitted null. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
7 tasks
Contributor
Author
|
A few questions that came up about this change:
|
…out-index Signed-off-by: yaoyu-33 <[email protected]> # Conflicts: # tests/unit_tests/test_rollout_collection.py
…out-index Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
This was referenced Oct 22, 2026
Signed-off-by: yaoyu-33 <[email protected]>
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.
What does this PR do?
Gives a resources server's
/seed_sessionthe rollout (repeat) index, so state keyed by repeat no longer has to be parsed out of the rollout ID.A resources server that keeps state per repeat of a task, for example deliverables persisted under
task_<id>/repeat_<n>/so later stages can judge them without rerunning the policy, needs to know at seed time which repeat it is serving. Today it can't learn that reliably:task_datais stripped of every_ng_*key (task_materialization.py:47), so_ng_rollout_indexis gone.EpisodeIdholds onlyrollout_idandattempt. It has to round-trip through capture keys (EpisodeId.from_capture_key), and those don't encode the repeat, so the repeat can't be added there."<task_index>-<rollout_index>"out ofrollout_id. That works for collector-generated IDs, but with an explicit_ng_rollout_idit either fails (a UUID) or picks the wrong repeat (batch-7→ repeat 7). Meanwhile verify reads_ng_rollout_index, so the seed and the reader of the same state disagree.This came up while reviewing GDPVal's decoupling in #4178 (thread). There, putting the repeat on
EpisodeIdwas tried and reverted for the capture-key reason above.Change
The collector's
_ng_rollout_indexnow travels next to the identity instead of inside it:BaseEpisodeRequest.rollout_index: int | None(ge=0, defaultNone).ResourcesSeedSessionRequest.rollout_index: int | None(ge=0, defaultNone)._episode_request_body) and thesingle_agent_turn_legacyadapter fill it from the row.single_agent_turnandnemo_user_simforward it to/seed_session.EpisodeId, capture keys and checkpoint identity are unchanged.flowchart LR row["dataset row<br/>_ng_rollout_id: batch-7<br/>_ng_rollout_index: 2"] subgraph before["Before"] direction TB b_ep["episode request<br/>episode_id: {rollout_id: batch-7}<br/>task_input: no _ng_* keys"] b_seed["/seed_session<br/>episode_id + task_data"] b_rs["resources server<br/>parses repeat from 'batch-7' → 7 ✗"] b_ver["/verify<br/>reads _ng_rollout_index → 2"] b_ep --> b_seed --> b_rs b_rs -. "writes repeat_7, reads repeat_2" .- b_ver end subgraph after["After"] direction TB a_ep["episode request<br/>episode_id: {rollout_id: batch-7}<br/><b>rollout_index: 2</b>"] a_seed["/seed_session<br/>episode_id + task_data<br/><b>rollout_index: 2</b>"] a_rs["resources server<br/>uses rollout_index → 2 ✓"] a_ep --> a_seed --> a_rs end row --> b_ep row --> a_epsequenceDiagram participant C as Rollout collection participant E as Environment server<br/>(single_agent_turn / legacy / nemo_user_sim) participant R as Resources server C->>E: episode request {episode_id, task, rollout_index} Note over C,E: legacy flat rows: the adapter reads _ng_rollout_index itself E->>R: POST /seed_session {resources_session_id, episode_id, task_id, task_data, rollout_index} R-->>E: seed response (state keyed by task_id + rollout_index)What the number means: it is exactly the row's
_ng_rollout_index. The collector numbers each task's rollouts across every agent a row fans out to, so with two agents andnum_repeats=4the second agent's rollouts are 4–7. The numbers are stable for a materialized input. It is never parsed fromepisode_id.rollout_id. The field keeps the existing name, asgenrm_compare,atif_reverificationand others already use barerollout_indexfor this key.An Environment Server's
/verifybody still carries neither_ng_*keys nor this field, so a server that keys state by rollout number stores it with the session at seed time. The "Environment Server sessions" bullet inresources-server-apis.mdxnow says so.No resources server reads the field yet, so behavior is unchanged. Tracking: #4178. GDPVal there can switch its seed from the rollout-ID parse to
body.rollout_index. Its in-session verify already uses the repeat stored at seed time, and its sessionless reuse reads_ng_rollout_index, so both then come from the same collector field. Ideally this lands just before or together with that switch.Validation
All runs on macOS, Python 3.13, in a fresh
uvvenv for this branch (--extra dev --extra ray --extra sandbox):pytest tests/unit_tests/{test_episode_types,test_rollout_collection,test_base_resources_server,test_task_materialization,test_session_contract_repo,test_checkpoint_resources,test_server_utils}.py: 799 passed.single_agent_turn47,single_agent_turn_legacy20,legacy_agent5 andnemo_user_sim28 passed.nemo_user_simran in a venv with the pinnednemo-usersim.ResourcesSeedSessionRequestor a union with it:example_single_tool_call5,nullable_tool_args4,swebench_pro96,terminal_bench_2_1/tests/test_sessions.py58 andnemo_user_sim36 passed.pre-commit run --files <changed files>: passed.single_agent_turnandnemo_user_simforwarding lines;ge=0bound;Rollouts
N/A. This is wire plumbing for an optional field that no environment reads yet. Verifier inputs, rewards and existing seed behavior are unchanged.
Compatibility
extra="forbid", so a receiver on an older nemo_gym rejects the key when it is present.rollout_indexonly when the row has_ng_rollout_index, and collector rows always do. A newer collector therefore needs an Environment Server at this version.Noneindex, so seeds without one still reach an older Resources Server unchanged.Trueand"2"are rejected), matching how other_ng_rollout_indexreaders validate it. Collector rows always carry ints.ResourcesSeedSessionRequest(swebench_pro,terminal_bench_2_1,interactive_browser) still resolve the same member with the field absent,nullor set. This was checked withTypeAdapter.🤖 Generated with Claude Code