Skip to content

feat(monitor): upload native v1 episodes without orchestration refactor - #3232

Open
mrmoxon wants to merge 1 commit into
mainfrom
feat/restore-native-v1-prime-monitor
Open

feat(monitor): upload native v1 episodes without orchestration refactor#3232
mrmoxon wants to merge 1 commit into
mainfrom
feat/restore-native-v1-prime-monitor

Conversation

@mrmoxon

@mrmoxon mrmoxon commented Aug 10, 2026

Copy link
Copy Markdown

Goal

Preserve complete native v1 Episodes in Prime-RL sample uploads without making Episode the orchestration unit.

What changes

  • retain the original v1 Episode envelope as excluded, in-memory metadata when Env.run converts its traces to existing Rollout objects
  • deduplicate that shared envelope in PrimeMonitor and serialize it through verifiers' existing build_samples() compatibility path
  • preserve fixed-agent, failed, and other sibling traces in info.native_wrapper, while the existing trainable trace remains the flat summary for older Platform consumers
  • keep legacy/group rollout paths working through a one-trace Episode fallback
  • treat serialization failures as best-effort monitor failures rather than crashing training

What does not change

  • Rollout remains the unit used by dispatch, scoring, training, metrics, and storage
  • no Episode-first orchestration foundation is included
  • no dependency on the earlier stacked Episode PRs
  • the existing Platform upload endpoint and Parquet schema remain unchanged

Validation

  • focused PrimeMonitor tests: 6 passed
  • Ruff check and format check passed
  • git diff --check passed

Note

Medium Risk
Changes telemetry serialization and Platform payload shape (info, episode grouping) but keeps training on rollouts; failures are best-effort and should not block training.

Overview
Prime Monitor now uploads native v1 Episodes to Platform instead of flattening each rollout with trace_to_sample, so multi-trace episodes (judge/solver/critic, failed siblings, etc.) stay intact on the wire while training still runs on rollouts.

Each v1 Env.run attaches an in-memory native_episode on every Rollout (full WireEpisode with orchestrator Rollout traces). Rollout gains an excluded native_episode field for monitors only.

log_samples rebuilds episodes via _rollouts_to_episodes (dedupe shared envelopes; legacy paths synthesize one-trace episodes), then build_samples projects rows and layers run/step/advantage/env_name as before. info comes from verifiers (e.g. native_wrapper, native_trace_index). Parquet build failures warn and skip upload instead of crashing training.

Unit tests cover multi-trace retention, legacy fallback, and serialization failure handling.

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

@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 8c4c303. Configure here.

Comment thread src/prime_rl/orchestrator/orchestrator.py Outdated
@mrmoxon
mrmoxon changed the base branch from feat/episode-first-class to main August 10, 2026 21:01
@mrmoxon
mrmoxon force-pushed the feat/restore-native-v1-prime-monitor branch from 8c4c303 to 208ba21 Compare August 10, 2026 21:13
@mrmoxon mrmoxon changed the title feat(monitor): upload native v1 episodes to Platform feat(monitor): upload native v1 episodes without orchestration refactor Aug 10, 2026
episode_id: str = Field(default="", exclude=True)
# The original v1 envelope, retained only in memory so monitors can upload the
# complete multi-trace Episode without making Episode the orchestrator's unit.
native_episode: vf.WireEpisode | None = Field(default=None, exclude=True, repr=False)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wait each rollout stores its back-stores its episode? this seems like a lot of redundancy and could lead to perf issues

imo this is a braoder smell of the episode-type not being fully native on prl orch yet. this is a known limitation @hallerite and me want to tackle this week. wondering if we should delay this pr until then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

e..g do we even dedup the episodes if one episode makes multiple rollouts?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if we want to get in today, then we should try to pass a flat list of episodes directly to the prime monitor

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should. the PR will be much cleaner after the refactor

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will leave it for now then

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.

3 participants