Skip to content

feat(monitor): upload native v1 episodes to Platform - #3217

Merged
mikasenghaas merged 3 commits into
feat/episode-first-classfrom
feat/native-v1-prime-monitor
Aug 8, 2026
Merged

feat(monitor): upload native v1 episodes to Platform#3217
mikasenghaas merged 3 commits into
feat/episode-first-classfrom
feat/native-v1-prime-monitor

Conversation

@mrmoxon

@mrmoxon mrmoxon commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Stacked on #3206.

PrimeMonitor currently receives first-class v1 Episodes from the orchestrator, but flattens them back into one legacy Platform row per trace. This change makes training sample uploads use the same native Episode envelope introduced for verifiers eval uploads in PrimeIntellect-ai/verifiers#2278.

Upload contract

  • Call verifiers' public build_samples() helper so eval and training uploads share one projection contract.
  • Emit one Parquet row per normal Episode.
  • Store the complete Episode record in info.native_wrapper; this is the authoritative payload for native Platform consumers.
  • Keep info.native_trace_index so legacy readers know which trace supplied the flat summary fields.
  • Select the first trainable trace for that summary, falling back to the first trace when none is trainable.
  • Preserve every trace in the native wrapper, including fixed-agent traces and traces with no message branches.
  • Retain numeric RFT sample_id values required by the existing training-ingestion schema; the stable native Episode id remains in native_wrapper.id.
  • Continue layering PrimeRL's training-only fields onto the projection: run id, step, environment name, integer problem id, scalar advantage, and per-branch advantage.
  • Keep verifiers' 25 MiB compatibility behavior: oversized Episodes fall back to projected per-trace rows.
  • Pass first-class effective.episodes to every sample monitor, while keeping PrimeMonitor serialization best-effort: invalid batches warn and skip upload without aborting training.

No Platform backend schema change is required: the existing native rollout adapter already treats info.native_wrapper as authoritative and uses native_trace_index for the legacy summary.

Dependency stack

#3206 pins verifiers at PrimeIntellect-ai/verifiers#2252 (306a95fc), which predates the merged native upload helper. This PR temporarily advances that submodule to b43c355a, a narrow two-file integration commit based directly on 306a95fc that layers in the merged #2278 contract.

Once #2252 is rebased/merged with current verifiers main, the temporary integration pin can be replaced with the resulting upstream commit without changing the PrimeMonitor implementation.

Test plan

  • uv run ... pytest -q tests/unit/utils/test_prime_monitor.py — includes serialization-failure regression coverage
  • uv run --isolated --no-project --with ruff ruff check src/prime_rl/orchestrator/orchestrator.py src/prime_rl/utils/monitor/prime.py tests/unit/utils/test_prime_monitor.py
  • uv run --isolated --no-project --with ruff ruff format --check src/prime_rl/utils/monitor/prime.py tests/unit/utils/test_prime_monitor.py
  • verifiers integration smoke: native Episode id, trace index, trace payload, and training run metadata survive build_samples()
  • verifiers integration ruff check and ruff format --check on the two changed files

Note

Medium Risk
Changes training telemetry shape and upload path relied on by Platform dashboards; failures are softened at upload time but bad episodes could be dropped from samples without stopping training.

Overview
Training sample uploads to Prime Intellect now follow the same native Episode contract as verifiers eval uploads, instead of flattening each trace into its own Platform row.

PrimeMonitor calls verifiers' build_samples() so each normal episode becomes one Parquet row with the full episode in info.native_wrapper (authoritative for native consumers) and info.native_trace_index pointing at the trace used for legacy flat fields (first trainable trace when present). Prime-RL still adds run id, step, problem id, env name, and scalar/per-branch advantage on top of that projection.

The orchestrator passes effective.episodes into log_samples. Building parquet is wrapped in try/except so a serialization failure logs a warning and skips upload rather than crashing the step.

Unit tests were updated for episode-level rows, multi-trace episodes, and the serialization failure path.

Reviewed by Cursor Bugbot for commit b36afc2. Bugbot is set up for automated code reviews on this repo. Configure here.

@mrmoxon
mrmoxon marked this pull request as ready for review August 7, 2026 23:29
Comment thread src/prime_rl/utils/monitor/prime.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cbbcac4. Configure here.

Comment thread src/prime_rl/utils/monitor/prime.py Outdated
@mikasenghaas
mikasenghaas merged commit 9a31766 into feat/episode-first-class Aug 8, 2026
14 of 15 checks passed
@mikasenghaas
mikasenghaas deleted the feat/native-v1-prime-monitor branch August 8, 2026 18:04
mrmoxon added a commit that referenced this pull request Aug 10, 2026
@mrmoxon
mrmoxon restored the feat/native-v1-prime-monitor branch August 10, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants