feat(m8.4): record / replay — deterministic offline re-runs - #37
Merged
Conversation
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%).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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%).