Skip to content

feat(m8.4): record / replay — deterministic offline re-runs - #37

Merged
shamspias merged 1 commit into
mainfrom
build/m8.4-record-replay
Jul 18, 2026
Merged

feat(m8.4): record / replay — deterministic offline re-runs#37
shamspias merged 1 commit into
mainfrom
build/m8.4-record-replay

Conversation

@shamspias

Copy link
Copy Markdown
Owner

Capture a run's model responses to a file and re-run it later offline — no API key, no cost, no network. The determinism boundary (CLAUDE.md §3) made persistent.

  • reins/record.py: RecordingModel(inner, path) wraps any Model and appends each response to a JSON-lines file as the run proceeds (so even a crashed run leaves a usable partial recording); ReplayModel(path) feeds those responses back in order — a Model with no key, no network, and no stochasticity — raising a hinted error if the harness asks for more turns than were recorded. Serialization reuses the existing codec (to_dict/from_dict round-trip), so any ModelResponse re-inflates exactly.
  • Exported top-level (RecordingModel, ReplayModel) for discoverability.

Handy for debugging a real run, or turning one live run into a fast, deterministic regression fixture.

Verified: make check green — ruff, mypy --strict, 380 passed / 3 skipped, all 14 conformance cases; record.py is 100% covered (total 95.62%, gate 90%).

Capture a run's model responses to a file and re-run it later offline — no API key,
no cost, no network. The determinism boundary (CLAUDE.md §3) made persistent.

- reins/record.py: RecordingModel(inner, path) wraps any Model and appends each
  response to a JSON-lines file as the run proceeds (so even a crashed run leaves a
  usable partial recording); ReplayModel(path) feeds those responses back in order —
  a Model with no key, no network, and no stochasticity — raising a hinted error if
  the harness asks for more turns than were recorded. Serialization reuses the
  existing codec (to_dict/from_dict round-trip), so any ModelResponse re-inflates
  exactly.
- Exported top-level (RecordingModel, ReplayModel) for discoverability.

Handy for debugging a real run, or turning one live run into a fast, deterministic
regression fixture.

Verified: make check green — ruff, mypy --strict, 380 passed / 3 skipped, all 14
conformance cases; record.py is 100% covered (total 95.62%, gate 90%).
@shamspias
shamspias merged commit 69d5ae7 into main Jul 18, 2026
3 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