Skip to content

Upload native v1 Episodes to Platform - #2278

Merged
mrmoxon merged 3 commits into
mainfrom
feature/native-v1-platform-upload
Aug 7, 2026
Merged

Upload native v1 Episodes to Platform#2278
mrmoxon merged 3 commits into
mainfrom
feature/native-v1-platform-upload

Conversation

@mrmoxon

@mrmoxon mrmoxon commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • upload one Platform sample per v1 Episode when the payload fits
  • preserve the complete Episode in info.native_wrapper
  • retain a flat trace summary for existing Platform consumers
  • fall back to the existing per-trace projection only when native duplication would exceed the 25 MiB API limit
  • synchronize the existing nemo-gym extra in uv.lock so locked hooks run

Why

The current uploader flattens every native v1 Trace before sending it. Platform can reconstruct part of that structure, but native node identity, branches, trace ordering, and Episode state should be transported intact.

This activates the native path without changing the create → samples → finalize API lifecycle. Oversized Episodes remain uploadable through the existing projected representation.

Architecture

ADR: Native v1 Episode upload compatibility bridge

Validation

  • normal multi-trace Episode serializes as one native sample
  • duplicated 13 MiB Episode automatically uses projected fallback
  • 69 v1 tests passed; 73 credential-gated tests skipped
  • full pre-commit and pre-push hooks passed

Note

Upload one Platform sample per Episode with full Episode payload as native source of truth

  • Replaces the previous per-trace upload model with one Platform sample per Episode in platform.py. A summary trace (preferring the first trainable trace) is used for legacy-compatible flat fields, while the full Episode record is stored in sample.info['native_wrapper'].
  • Adds Episode.to_record() in episode.py to serialize an Episode to a JSON-ready dict, excluding None values and raw trace tensor fields defined by EXCLUDE_FIELDS.
  • Adds a json_bytes utility to compute payload size using compact JSON encoding, used for batching logic.
  • If a single Episode-backed sample exceeds the payload size limit, upload falls back to per-trace samples for that Episode.
  • Behavioral Change: the number and structure of samples posted to Platform changes — previously one sample per trace, now one per Episode (with a per-trace fallback for oversized payloads).

Macroscope summarized 0aa7a48.


Note

Medium Risk
Changes the shape and cardinality of Platform sample uploads (episode-level IDs and nested native data) while relying on a size-based fallback; failures during sample build are now swallowed by the best-effort upload path.

Overview
Platform eval uploads now send one sample per v1 Episode instead of flattening every trace into its own row. Each sample keeps legacy flat fields from the first trainable trace (or the first trace), sets sample_id to the episode id, and adds info.native_wrapper (full episode via Episode.to_record()) plus native_trace_index so older UI can still anchor on a summary trace.

Episode.to_record() serializes the episode to JSON while stripping per-trace tensor fields (EXCLUDE_FIELDS), matching trace disk/msgpack behavior. build_samples measures payload size with a shared json_bytes helper; if a native episode sample would exceed the 25 MiB API cap, it logs and falls back to the previous per-trace projection. push_traces now builds samples inside the upload try/except, and several platform helpers are renamed from private to module-level (credentials, run_metrics, build_samples).

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

@mrmoxon
mrmoxon marked this pull request as ready for review August 6, 2026 20:41
Comment thread verifiers/v1/utils/platform.py
@mrmoxon
mrmoxon force-pushed the feature/native-v1-platform-upload branch from 96eff01 to 9b94ff7 Compare August 6, 2026 20:47
Comment thread verifiers/v1/utils/platform.py
Comment thread verifiers/v1/utils/platform.py
@macroscopeapp

macroscopeapp Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR changes the upload granularity from one sample per Trace to one sample per Episode, embedding the full native Episode in the Platform API payload. This is a significant behavioral change affecting the external API contract and downstream consumers.

You can customize Macroscope's approvability policy. Learn more.

@mrmoxon
mrmoxon force-pushed the feature/native-v1-platform-upload branch from 9b94ff7 to 1e076ff Compare August 6, 2026 22:10

@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 1e076ff. Configure here.

Comment thread verifiers/v1/utils/platform.py
Comment thread tests/v1/test_platform.py Outdated
Comment thread verifiers/v1/utils/platform.py Outdated
Comment thread verifiers/v1/utils/platform.py
Comment thread verifiers/v1/utils/platform.py Outdated
Comment thread verifiers/v1/utils/platform.py Outdated
@mrmoxon
mrmoxon force-pushed the feature/native-v1-platform-upload branch from 75716f7 to 0aa7a48 Compare August 7, 2026 20:58
@mrmoxon
mrmoxon requested a review from mikasenghaas August 7, 2026 21:07
@mrmoxon
mrmoxon merged commit e34e0d9 into main Aug 7, 2026
13 checks passed
@mrmoxon
mrmoxon deleted the feature/native-v1-platform-upload branch August 7, 2026 22:56
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