Skip to content

Run log and replay: live --arms --log writes grl_snam.run_log/v1, grl-snam ariadne replay plays it (Phase 4a) - #176

Merged
transfix merged 1 commit into
mainfrom
feat/run-log-replay
Nov 14, 2026
Merged

transfix merged 1 commit into
mainfrom
feat/run-log-replay

Conversation

@transfix

Copy link
Copy Markdown
Contributor

This is Phase 4a of the plan: record and play back a live comparison of policies. It builds on #175 (live --arms).

grl-snam ariadne live austin-freedrive --plant kinematic --arms trained,untrained,constant \
    --retarget-at 20 --log run.npz
grl-snam ariadne replay run.npz

The run log: grl_snam.learning.runlog, grl_snam.run_log/v1

RunLog writes and reads one .npz. It needs no host, so it is in the coverage gate.

Per tick and arm, as (T, A) arrays, it holds:

  • the cars template's log fields, with each arm as a car: x y heading speed steer vx vy goal_x goal_y goal_dist reached coef_*. Anything that reads the template's logs can read this one.
  • ms and the vehicle's length, width and wheelbase.
  • tel_<field>: every drive telemetry field.
  • book_<name>: the energy books.
  • stats_<col>: the Stats row.
  • plant_<key>: the plant ledger's items, NaN where an item doesn't apply.

It also keeps the legs (leg_tick, leg_goal). The meta JSON holds:

  • each arm's spec, the .cvcnav it ran with its sha256, its source's sha256 and its policy key;
  • the seed, start, goal, legs, dt, frame and plant;
  • the run.* and world.* keys that rebuild the world, and the settings;
  • the provenance: the GRL-SNAM version and checkout commit, libcvc's version (read from the loaded libcvc.so.X.Y.Z), and each --history H.jsonl with its sha256.

RunLog.at(k, j) gives arm j's values at tick k, with the books summed up to that tick.

The plan named RunLog(CarsLog). This version writes CarsLog's layout instead of subclassing it, so grl_snam.learning stays free of pycvc_gl.

live --arms --log writes it

ArmsRun now also records the plant ledger and the vehicle size each tick, and keeps running book sums. The run log replaces #175's interim grl_snam.live_arms/v1. live without --arms still writes the cars template's log, unchanged.

grl-snam ariadne replay run.npz

  • The world: it rebuilds the recorded world (the city, a generated world or the flat square) and draws each arm's ghost and track at the play head.
  • The windows: it writes the Stats and Ledger windows (stats_panels.ari) as they were at that tick.
  • The transport: docs/replay.ari uses libcvc's components/sim_transport.ari (optional import, with a fallback unit): Paused, Speed, Step (one tick while paused) and Restart. Beside it are a Position slider that scrubs, Loop and the camera.
  • The charts carry cursor: play.t, and a click on one seeks via pick: play.seek / arms_seek. In a live run the cursor is unset and a click does nothing.
  • The flags are --at, --paused, --loop and --camera. Headless, it builds no world; the panels follow the play head.
  • The Retarget controls in stats_panels.ari now show only in a live run (arms.live).
  • player.ari is unchanged.

One path for live and replay. _arms.panel_tables, _arms.chart_series and live.update_ghosts take arrays. Both ports call them, so a replay shows what the live run showed at the same tick, cell for cell.

Tests

  • tests/learning/test_learning_runlog.py (host-free):
    • a save/load round trip;
    • the cars fields;
    • index, leg and at (summed books, n/a plant items);
    • refusals;
    • provenance without libcvc.
  • tests/test_ariadne_live_arms.py:
    • replay at the run's end and at a tick mid-run gives the live run's six tables, cell for cell;
    • Step moves the play head one tick while paused, a chart seek jumps, and Restart goes back to the start;
    • replay refuses a file that isn't a run log;
    • charts carry the cursor (chart build only);
    • an offscreen live run and replay (GRL_SNAM_ARIADNE_GL=1);
    • the earlier arms tests, updated for the refactor.

Locally:

  • With the catalog 3.7.13 closure, the Ariadne and learning tests give 144 passed, 6 skipped. The skips are for chart, GL and Austin.
  • With the chart build and GL=1: 44 passed (3 skipped: no Jolt plant, no Austin scene bundle, GL); the GL tests also pass on 3.7.13.
  • runlog.py has 88% coverage from the host-free tests alone.
  • black 26.5.1 and ruff 0.16 are clean.

Screenshot: a replay of a 40 s Austin run (kinematic, three arms, retarget at 20 s), paused at 26 s with the orbit camera. The chart cursor is at 26 s and the "leg 2" marker at 20 s. It is phase4a-replay-austin-26s.png in the session's shared notes.

…-snam ariadne replay plays it

Phase 4a. A live comparison of policies can now be recorded and played back.

- grl_snam.learning.runlog (no host): RunLog writes and reads grl_snam.run_log/v1. Per tick and
  arm: the cars template's log fields (each arm a car), the size, every drive telemetry field,
  the books, the Stats row and the plant ledger's items; the legs; meta with each arm's policy
  and hashes, the seed, start, goal, the keys that rebuild the world, the settings, and the
  provenance (GRL-SNAM version and commit, libcvc's version, --history files with sha256).
- live --arms --log writes it; ArmsRun records the plant ledger and the vehicle size per tick.
- grl-snam ariadne replay run.npz (docs/replay.ari: libcvc's sim_transport and
  stats_panels.ari): rebuilds the recorded world, draws each ghost and track at the play head,
  and writes the Stats and Ledger windows there. Step, Restart, a Position slider, Loop,
  --at/--paused/--camera; the charts carry a cursor at play.t and a click seeks.
- Live and replay share one path: _arms.panel_tables, _arms.chart_series and live's
  update_ghosts take arrays, so a replay shows what the live run showed at that tick, cell for
  cell (tested at the end and mid-run).
@transfix
transfix force-pushed the feat/run-log-replay branch from a681ec8 to e8193ae Compare November 14, 2026 08:44
@transfix
transfix merged commit 7ac0b29 into main Nov 14, 2026
5 checks passed
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