Skip to content

feat: offline trace replay scorer + redacted trace archive (#107) - #108

Merged
ajianaz merged 1 commit into
developfrom
feat/trace-replay-scorer
Sep 22, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/trace-replay-scorer

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

What (description of the change)

Adopts the Dream-RSI replay-evaluation pattern (arXiv:2609.14858) inside the existing eval harness. Three pieces:

  • Trace archive — evals/tier2/run.py --archive keeps a REDACTED copy of each mission's session JSONL under evals/traces/<model>/<mission>/ (+ meta.json). Secret-shaped tokens (sk-, rk-, ghp_, github_pat_, xoxb-/xoxp-, AIza…) are dropped — only the token family stub is kept — and host session paths are replaced with <HOSTPATH>. Prose is untouched; the archived file stays valid JSONL. Also: results.json gains a model field (closes the documented operator-trust gap in diff.py), and TOLE_EVAL_BINARY overrides the binary path.
  • Replay core — tole_core::replay parses archived session JSONL (single AND batched-array lines, torn-tail safe — same contract durable_metrics already follows), pairs intent→settlement, and walks the trace under a candidate prompt with ZERO tool executions: recorded outcomes settle every call (exact (tool, input) match first, oldest-same-tool fallback); calling a tool the recorded run never called ends the walk as an explicit path divergence.
  • Scorer bin — tole-replay (operator-built from evals/replay/, NOT part of the shipped tole binary): scores candidates over the trace corpus. A COMPLETED walk scores 0.7 × path_agreement + 0.3 × final_match; an errored/diverged walk scores 0 — replay is exact only inside the recorded world. The incumbent default prompt is always evaluated in the same run (extracted from the CLI source, never a drifting copy) and a revision is only reported SHIP: revised when strictly better on the corpus (monotone selection, Dream-RSI §3). --model / --mission filters, --json output, one transient retry on provider errors (feat: usage ledger wiring, 429 retry classification, no per-step transcript clone #66 pattern).

evals/README.md gains the Tier 2.5 — offline trace replay section: replay is an advisory pre-check for prompt/policy revisions; live Tier-2 missions remain the release gate. 7 new unit tests cover parsing (incl. batched array lines), wire-equivalence of the synthetic intent/result pairs, scoring, and divergence surfacing.

Why (the problem you're solving)

Closes #107. A prompt/policy revision could previously only be validated by ANOTHER live run (cost + noise), and the decision+outcome data each mission had already paid for — what Dream-RSI calls a replay simulator — was deleted after a single scoring pass. Offline replay turns recorded traces into a reusable feedback corpus: cheap, execution-free evaluation for prompt/tool-discipline changes before they ever touch the deployed default.

Testing (how you verified this works)

  • cargo test -p tole-core --lib replay → 7/7 pass; full workspace suites green; --no-default-features (mobile) profile green; clippy 0 warnings on touched bins; run.py py_compile clean.
  • Live E2E (glm/glm-5.1 via Bifrost): run.py --all --archive → 3/3 missions PASS; 3 traces archived; redaction verified both on the real traces (0 secrets, 0 host paths, JSONL parses) and via a synthetic test asserting sk-/ghp_ tokens dropped, family stubs kept, prose intact.
  • Live replay: incumbent scores 1.000/1.000 on read_and_report and echo_chain (replay ≈ live agreement); a deliberately degraded no-tools candidate (evals/replay/prompts/answer-only.txt) is REJECTED — SHIP: incumbent (0.783 vs 0.842 avg; crash_resume incumbent 0.525 vs 0.350). A transient provider 502 recovered via the one-retry path. --json smoke: valid JSON, ship: incumbent, traces: 1 on scoped run.

Adopt the Dream-RSI replay-evaluation pattern (arXiv:2609.14858) inside
the existing eval harness. Tier 2 runs can now archive a redacted copy
of each mission trace (evals/traces/<model>/<mission>/, secret-shaped
tokens dropped, host paths scrubbed) via run.py --archive, and a new
operator-built scorer bin (tole-replay) walks those traces under a
candidate prompt at zero tool executions — recorded outcomes settle
every tool call. The incumbent default prompt is always evaluated in
the same run (extracted from the CLI source, never a drifting copy) and
a revision only ships when strictly better on the corpus (monotone
selection). Divergent/errored walks score zero: replay is exact only
inside the recorded world. results.json gains the model field and the
runner accepts TOLE_EVAL_BINARY. Live-validated end-to-end on glm-5.1:
3/3 missions archived, replay scored, a degraded no-tools candidate
rejected (0.783 vs 0.842 incumbent avg).
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit cd43d51 into develop Sep 22, 2026
16 checks passed
@ajianaz
ajianaz deleted the feat/trace-replay-scorer branch September 22, 2026 08:34
ajianaz added a commit that referenced this pull request Sep 22, 2026
Every [[bin]] target builds unconditionally, so the eval scorer
shipped in plain builds and cargo install tole-cli — contradicting
the documented operator-only contract (cora full-scan #12, my error
from #108). required-features = ["replay"] with a non-default
replay = [] feature: default builds/installations never produce it,
eval sessions opt in via --features replay. Build commands in
evals/README.md + run.py docstring updated. Verified: default build
produces no tole-replay, --features replay builds it, package list
excludes replay.rs.

Co-authored-by: ajianaz <[email protected]>
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.

evals: archive mission traces + offline trace-diff scorer (Dream-RSI replay pattern)

1 participant