Skip to content

Revert "feat(v1)!: move run info from trace to episode" - #2264

Merged
mikasenghaas merged 1 commit into
mainfrom
revert/run-info-on-episode
Aug 6, 2026
Merged

Revert "feat(v1)!: move run info from trace to episode"#2264
mikasenghaas merged 1 commit into
mainfrom
revert/run-info-on-episode

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Moving the run onto the episode forced consumers that keep per-trace records (prime-rl's orchestrator) to reconstruct episode shells around traces just to place them, and the episode-level home only pays off with the rest of the episode-first pipeline (#2252 / prime-rl#3206), which we're not taking. Reverting keeps the trace self-describing and makes the prime-rl pin bump trivial.

Verification

uv run pytest tests/v1/test_trace.py tests/v1/test_graph.py
ruff check verifiers/v1/trace.py verifiers/v1/episode.py verifiers/v1/cli/eval/runner.py

Both pass. Only in-tree users of the episode-level fields were Episode.record_run itself and the three eval-runner call sites restored here.

🤖 Generated with Claude Code

Note

Move run info from episode level to trace level in v1 eval runner

  • Removes run and info fields and the record_run method from Episode; run metadata is no longer stored at the episode level.
  • Adds a run: RunInfo | None field and record_run method to Trace so each trace carries its own run metadata.
  • Updates eval.runner to call trace.record_run(...) on each trace within an episode instead of stamping the episode directly.
  • In the group execution path, traces are now persisted individually via append_trace and Episode.of(trace) is called without an env argument, leaving env id empty on returned Episode records.
  • Behavioral Change: Episode.record_run is removed; callers must now stamp run info on individual traces.

Macroscope summarized eaab120.


Note

Medium Risk
Changes persisted artifact shape and public v1 APIs (Episode/Trace); callers that adopted episode-level run must migrate back to per-trace stamping.

Overview
Reverts the episode-first run stamping from #2244 so eval and downstream consumers (e.g. prime-rl) can keep per-trace records without wrapping traces in episodes just to attach run identity.

Trace again has run: RunInfo | None and record_run, which sets run id/type and merges optional metadata into trace.info. Episode drops run, info, and record_run—episodes are no longer the place for consumer-stamped run metadata.

The v1 eval runner stamps EvalRunInfo on every trace in an episode (on_complete, run_unit, and the legacy run_group path). Group rollouts persist each trace with append_trace (with env=config.env_id) and return Episode.of(trace) shells for in-memory results; single-rollout paths still use append_episode after per-trace stamping.

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

This reverts commit f14b41c.

Run identity returns to Trace.run / Trace.record_run. The episode-level
home turned out to push consumers that keep per-trace records into
episode reconstruction for no gain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
records.append(record)
trace.record_run(EvalRunInfo(id=config.uuid))
await append_trace(out, trace, write_lock, env=config.env_id)
records.append(Episode.of(trace))

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.

🟡 Medium eval/runner.py:263

In run_group_unit, each trace is persisted with append_trace(..., env=config.env_id), but the in-memory episode returned to callers is built via Episode.of(trace) without passing env. As a result, every group-scored legacy result returned by run_eval_server has an empty episode.env.id, even though the same episode on disk carries the configured environment ID. The previous code constructed Episode.of(trace, env=config.env_id), so this change silently drops the env metadata from in-memory results. Pass env=config.env_id to Episode.of to preserve the in-memory episode's environment identity.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @verifiers/v1/cli/eval/runner.py around line 263:

In `run_group_unit`, each trace is persisted with `append_trace(..., env=config.env_id)`, but the in-memory episode returned to callers is built via `Episode.of(trace)` without passing `env`. As a result, every group-scored legacy result returned by `run_eval_server` has an empty `episode.env.id`, even though the same episode on disk carries the configured environment ID. The previous code constructed `Episode.of(trace, env=config.env_id)`, so this change silently drops the env metadata from in-memory results. Pass `env=config.env_id` to `Episode.of` to preserve the in-memory episode's environment identity.

@mikasenghaas
mikasenghaas marked this pull request as ready for review August 6, 2026 03:53
@mikasenghaas
mikasenghaas merged commit eb2c3fe into main Aug 6, 2026
11 of 12 checks passed
@mikasenghaas
mikasenghaas deleted the revert/run-info-on-episode branch August 6, 2026 03:53

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

records.append(record)
trace.record_run(EvalRunInfo(id=config.uuid))
await append_trace(out, trace, write_lock, env=config.env_id)
records.append(Episode.of(trace))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returned episodes diverge from persisted records

Medium Severity

append_trace persists one episode shell, while Episode.of(trace) creates a different returned shell with a fresh id and empty env. Group-run callers therefore receive episode identities that differ from traces.jsonl and lack environment provenance.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit eaab120. Configure here.

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.

1 participant