Skip to content

[fix] Standardize rollout trajectory records and document producer coverage - #2293

Merged
Glorf merged 4 commits into
mainfrom
agent/standardize-rollout-trajectories
Aug 5, 2026
Merged

[fix] Standardize rollout trajectory records and document producer coverage#2293
Glorf merged 4 commits into
mainfrom
agent/standardize-rollout-trajectories

Conversation

@Glorf

@Glorf Glorf commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a versioned ng_trajectory projection for normalized model calls, token statistics, semantic turns, tool observations, and invocation-scoped model-visible history
  • preserve provider-reported cached, reasoning, and total token usage across capture, conversion, and multi-turn agent loops
  • preserve Responses lifecycle status as response_status without reinterpreting dialect-specific finish_reason
  • add an opt-in reference trajectory producer for Simple Agent and document current V/O/X coverage for C1-C7 across all 34 agents

This PR establishes the shared schema and one reference producer. The capability matrix reports current support; it does not claim that every producer satisfies C1-C7.

Correctness and compatibility

  • collector-derived task and rollout identities are canonical; producer mismatches are recorded and turn identities are normalized without dropping the producer trajectory
  • producer invocations remain authoritative on duplicate IDs, observation-only invocations are appended, and model and tool records are merged only by exact identifiers
  • projection failures retain an explicit gap and captured request and response payloads; successful projections remove the duplicate capture payloads
  • Simple Agent records the actual per-turn model input, cumulative tool-step count, and an explicit gap when resolution is unavailable
  • no existing fields are removed; response lifecycle status, provider token details and totals, and cached-token aggregation are intentional correctness changes; ng_trajectory is additive
  • Simple Agent retains self-dispatch when observability is disabled or responses() is overridden
  • trajectory collection remains gated by observability and independent of the token-ID capture correlation introduced by feat(token-id-capture): capture training tokens from external harnesses #2124
  • captured request and response payloads are retained in persisted ng_trajectory; LabBench's multimodal_history_redacted gap omits those copies
  • W&B rollout tables omit ng_trajectory and model-call request and response payloads during collection and reverification
  • payload projection has no separate size cap or trajectory-specific opt-out; model-call capture remains opt-in

NVBug alignment

  • NVBug 6535274 is addressed with its preferred lossless option: completed Responses calls preserve response_status="completed"; finish_reason remains unset when the dialect does not provide one. The inference_provider path now uses the shared Chat-to-Responses converter, so the fix applies to the backend named in the report.
  • This is the schema and reference-producer phase of NVBug 6555643 / [epic] standardised trajectories format #1867. The capability matrix marks unsupported and path-dependent producers as X or O; it is not a claim of full producer coverage.

Follow-up pull requests

PRs #2115 and #2117-#2120 are stacked; later PRs include earlier stack changes. Open PRs describe planned evidence and do not affect the current capability matrix. #2153 provides Claude Code tool timing and status; this PR joins tool results to those observations. No available PR from #2115 through #2122 adds canonical C3 turns.

PR Producer or path Evidence added Remaining gap
#2115 OpenClaw, PinchBench Correlated model calls, conversations, parallel tool timing, and sandbox observations No C3 turns
#2116 Claude Code Superseded by #2153 See #2153 and this PR
#2117 Hermes Parallel tool timing and agent observations No C3 turns
#2118 Pi Correlated model calls, conversations, and parallel tool timing No C3 turns
#2119 OpenCode Rollout-level model calls, retained conversations, and parallel tool timing No exact per-invocation model-call ownership; no C3 turns
#2120 SWE OpenCode, OpenHands OpenCode model-call correlation plus retained conversations and sandbox observations for both paths OpenHands calls, tool timing, and C3 turns remain unavailable
#2121 No PR exists
#2122 Stirrup, GDPVal GDPVal judge-call correlation; Stirrup and Tau2 model-call correlation is already present No agent turns or tool observations

Validation

  • 354 capture, conversion, trajectory, collector, reverification, Fern-link, and inference-provider tests passed, plus 5 subtests
  • 10 Simple Agent producer and dispatch tests passed
  • in-process endpoint-to-record test passed: prefixed Responses request → inference_provider → capture middleware → CaptureStoreModelCallRecord
  • producer-to-collector-to-JSON trajectory round trip passed with both available and unavailable resolution status
  • 110 vLLM model and Responses conversion tests passed
  • 67 Claude Code observation tests and 4 LabBench redaction tests passed
  • the trajectory patch merges cleanly with feat(token-id-capture): capture training tokens from external harnesses #2124; combined-stack token-capture and trajectory tests passed
  • Ruff check, Ruff format check, and git diff --check passed

Part of #1867.

@copy-pr-bot

copy-pr-bot Bot commented Aug 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.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@Glorf Glorf changed the title Standardize rollout trajectories and document capability coverage [fix] Better standardized rollout trajectories and document capability coverage Aug 3, 2026
@Glorf Glorf changed the title [fix] Better standardized rollout trajectories and document capability coverage [fix] Standardize rollout trajectory records and document producer coverage Aug 4, 2026
@Glorf
Glorf force-pushed the agent/standardize-rollout-trajectories branch from dfc35ab to 6973f4e Compare August 4, 2026 12:00
@Glorf
Glorf marked this pull request as ready for review August 4, 2026 12:23
@Glorf
Glorf force-pushed the agent/standardize-rollout-trajectories branch 4 times, most recently from 5037dbb to ca868a5 Compare August 4, 2026 14:58
@Glorf Glorf closed this Aug 4, 2026
@Glorf
Glorf deleted the agent/standardize-rollout-trajectories branch August 4, 2026 19:37
@Glorf Glorf reopened this Aug 5, 2026
@Glorf
Glorf force-pushed the agent/standardize-rollout-trajectories branch 4 times, most recently from ff5548a to cf17057 Compare August 5, 2026 10:00
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Aug 5, 2026
Comment thread nemo_gym/openai_utils.py Outdated
Comment thread nemo_gym/rollout_collection.py Outdated
Comment thread nemo_gym/rollout_collection.py
Glorf added 4 commits August 5, 2026 17:34
Signed-off-by: Michal Bien <mbien@nvidia.com>
Signed-off-by: Michal Bien <mbien@nvidia.com>
Signed-off-by: Michal Bien <mbien@nvidia.com>
Signed-off-by: Michal Bien <mbien@nvidia.com>
@Glorf
Glorf force-pushed the agent/standardize-rollout-trajectories branch from ed1c8f2 to 880ceb8 Compare August 5, 2026 15:37

@mlazuka mlazuka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm :)

@Glorf
Glorf merged commit bc521f7 into main Aug 5, 2026
17 checks passed
OlegSudakov pushed a commit to OlegSudakov/Gym that referenced this pull request Aug 7, 2026
…verage (NVIDIA-NeMo#2293)

## Summary

- add a versioned `ng_trajectory` projection for normalized model calls,
token statistics, semantic turns, tool observations, and
invocation-scoped model-visible history
- preserve provider-reported cached, reasoning, and total token usage
across capture, conversion, and multi-turn agent loops
- preserve Responses lifecycle status as `response_status` without
reinterpreting dialect-specific `finish_reason`
- add an opt-in reference trajectory producer for Simple Agent and
document current V/O/X coverage for C1-C7 across all 34 agents

This PR establishes the shared schema and one reference producer. The
capability matrix reports current support; it does not claim that every
producer satisfies C1-C7.

## Correctness and compatibility

- collector-derived task and rollout identities are canonical; producer
mismatches are recorded and turn identities are normalized without
dropping the producer trajectory
- producer invocations remain authoritative on duplicate IDs,
observation-only invocations are appended, and model and tool records
are merged only by exact identifiers
- projection failures retain an explicit gap and captured request and
response payloads; successful projections remove the duplicate capture
payloads
- Simple Agent records the actual per-turn model input, cumulative
tool-step count, and an explicit gap when resolution is unavailable
- no existing fields are removed; response lifecycle status, provider
token details and totals, and cached-token aggregation are intentional
correctness changes; `ng_trajectory` is additive
- Simple Agent retains self-dispatch when observability is disabled or
`responses()` is overridden
- trajectory collection remains gated by observability and independent
of the token-ID capture correlation introduced by NVIDIA-NeMo#2124
- captured request and response payloads are retained in persisted
`ng_trajectory`; LabBench's `multimodal_history_redacted` gap omits
those copies
- W&B rollout tables omit `ng_trajectory` and model-call request and
response payloads during collection and reverification
- payload projection has no separate size cap or trajectory-specific
opt-out; model-call capture remains opt-in

## NVBug alignment

- NVBug 6535274 is addressed with its preferred lossless option:
completed Responses calls preserve `response_status="completed"`;
`finish_reason` remains unset when the dialect does not provide one. The
`inference_provider` path now uses the shared Chat-to-Responses
converter, so the fix applies to the backend named in the report.
- This is the schema and reference-producer phase of NVBug 6555643 /
NVIDIA-NeMo#1867. The capability matrix marks unsupported and path-dependent
producers as `X` or `O`; it is not a claim of full producer coverage.

## Follow-up pull requests

PRs NVIDIA-NeMo#2115 and NVIDIA-NeMo#2117-NVIDIA-NeMo#2120 are stacked; later PRs include earlier stack
changes. Open PRs describe planned evidence and do not affect the
current capability matrix. NVIDIA-NeMo#2153 provides Claude Code tool timing and
status; this PR joins tool results to those observations. No available
PR from NVIDIA-NeMo#2115 through NVIDIA-NeMo#2122 adds canonical C3 turns.

| PR | Producer or path | Evidence added | Remaining gap |
|---|---|---|---|
| NVIDIA-NeMo#2115 | OpenClaw, PinchBench | Correlated model calls, conversations,
parallel tool timing, and sandbox observations | No C3 turns |
| NVIDIA-NeMo#2116 | Claude Code | Superseded by NVIDIA-NeMo#2153 | See NVIDIA-NeMo#2153 and this PR |
| NVIDIA-NeMo#2117 | Hermes | Parallel tool timing and agent observations | No C3
turns |
| NVIDIA-NeMo#2118 | Pi | Correlated model calls, conversations, and parallel tool
timing | No C3 turns |
| NVIDIA-NeMo#2119 | OpenCode | Rollout-level model calls, retained conversations,
and parallel tool timing | No exact per-invocation model-call ownership;
no C3 turns |
| NVIDIA-NeMo#2120 | SWE OpenCode, OpenHands | OpenCode model-call correlation plus
retained conversations and sandbox observations for both paths |
OpenHands calls, tool timing, and C3 turns remain unavailable |
| #2121 | — | No PR exists | — |
| NVIDIA-NeMo#2122 | Stirrup, GDPVal | GDPVal judge-call correlation; Stirrup and
Tau2 model-call correlation is already present | No agent turns or tool
observations |

## Validation

- 354 capture, conversion, trajectory, collector, reverification,
Fern-link, and inference-provider tests passed, plus 5 subtests
- 10 Simple Agent producer and dispatch tests passed
- in-process endpoint-to-record test passed: prefixed Responses request
→ `inference_provider` → capture middleware → `CaptureStore` →
`ModelCallRecord`
- producer-to-collector-to-JSON trajectory round trip passed with both
available and unavailable resolution status
- 110 vLLM model and Responses conversion tests passed
- 67 Claude Code observation tests and 4 LabBench redaction tests passed
- the trajectory patch merges cleanly with NVIDIA-NeMo#2124; combined-stack
token-capture and trajectory tests passed
- Ruff check, Ruff format check, and `git diff --check` passed

Part of NVIDIA-NeMo#1867.

---------

Signed-off-by: Michal Bien <mbien@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants