Skip to content

Feat/deterministic replay#127

Merged
dgarson merged 14 commits intodgarson/forkfrom
feat/deterministic-replay
Feb 24, 2026
Merged

Feat/deterministic replay#127
dgarson merged 14 commits intodgarson/forkfrom
feat/deterministic-replay

Conversation

@dgarson
Copy link
Owner

@dgarson dgarson commented Feb 24, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

…elpers

Add session-level replay manifest types distinct from the replay bundle
format in src/replay/types.ts (Nate's work in PR #92).

- ReplaySessionManifest: session metadata for replay-capable sessions
- ReplaySessionEvent: session-level events in the replay lifecycle
- ReplaySessionEventLog: collection of session events
- Serialization helpers: parse/serialize functions
- Factory functions: createReplaySessionId, createReplaySessionManifest, createReplaySessionEvent
- exportSessionManifest stub: placeholder for future storage integration

Add 43 focused tests covering:
- Schema validation for all types
- Serialization round-trips
- Factory function behavior
- Edge cases and error handling
…elpers (#98)

Add session-level replay manifest types distinct from the replay bundle
format in src/replay/types.ts (Nate's work in PR #92).

- ReplaySessionManifest: session metadata for replay-capable sessions
- ReplaySessionEvent: session-level events in the replay lifecycle
- ReplaySessionEventLog: collection of session events
- Serialization helpers: parse/serialize functions
- Factory functions: createReplaySessionId, createReplaySessionManifest, createReplaySessionEvent
- exportSessionManifest stub: placeholder for future storage integration

Add 43 focused tests covering:
- Schema validation for all types
- Serialization round-trips
- Factory function behavior
- Edge cases and error handling
…elpers

Add session-level replay manifest types distinct from the replay bundle
format in src/replay/types.ts (Nate's work in PR #92).

- ReplaySessionManifest: session metadata for replay-capable sessions
- ReplaySessionEvent: session-level events in the replay lifecycle
- ReplaySessionEventLog: collection of session events
- Serialization helpers: parse/serialize functions
- Factory functions: createReplaySessionId, createReplaySessionManifest, createReplaySessionEvent
- exportSessionManifest stub: placeholder for future storage integration

Add 43 focused tests covering:
- Schema validation for all types
- Serialization round-trips
- Factory function behavior
- Edge cases and error handling
…elpers (#98)

Add session-level replay manifest types distinct from the replay bundle
format in src/replay/types.ts (Nate's work in PR #92).

- ReplaySessionManifest: session metadata for replay-capable sessions
- ReplaySessionEvent: session-level events in the replay lifecycle
- ReplaySessionEventLog: collection of session events
- Serialization helpers: parse/serialize functions
- Factory functions: createReplaySessionId, createReplaySessionManifest, createReplaySessionEvent
- exportSessionManifest stub: placeholder for future storage integration

Add 43 focused tests covering:
- Schema validation for all types
- Serialization round-trips
- Factory function behavior
- Edge cases and error handling
@dgarson dgarson closed this Feb 24, 2026
@dgarson dgarson reopened this Feb 24, 2026
@dgarson
Copy link
Owner Author

dgarson commented Feb 24, 2026

@codex review plz

@chatgpt-codex-connector
Copy link

To use Codex here, create a Codex account and connect to github.

Copy link
Owner Author

@dgarson dgarson left a comment

Choose a reason for hiding this comment

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

⚠️ Overall assessment: Mostly solid foundation, but a few correctness/robustness issues to address before scaling usage

Summary

This PR adds deterministic replay primitives end-to-end: replay event/manifest schemas, recorder/runner/clock utilities, session-level replay manifest types, JSON/JSONL parsing, hashing/fingerprinting, and test coverage for core happy paths.

What looks good

  • Clear modular boundaries (types, recorder, runner, clock, session manifest layer).
  • Good schema validation and helpful parse error wrapping.
  • Deterministic fingerprint strategy via stable key ordering is a strong choice.
  • Test footprint is meaningful for serialization, sequence constraints, and session-manifest helpers.

Concerns

  1. getEvents() exposes mutable internal recorder state (src/replay/recorder.ts)

    • Returning the internal array directly allows external mutation and can invalidate invariants/fingerprints unexpectedly.
    • Suggest returning this.#events.slice() (or frozen copy).
  2. Inactive recorder emit path can produce repeated seq values (src/replay/recorder.ts)

    • When enabled=false, emit() returns events with seq: this.#nextSeq but never increments.
    • If consumers rely on sequence monotonicity even in inactive mode, this is surprising.
    • Suggest either incrementing seq consistently or explicitly documenting that inactive emits are synthetic/non-sequenced.
  3. Deterministic clock start parsing lacks guardrails (src/replay/clock.ts)

    • Date.parse(options.start) can yield NaN; first call then throws on toISOString().
    • Suggest explicit validation with clear error message for invalid start input.

Suggestions for follow-up

  • Add immutability test for recorder events.
  • Add tests for inactive recorder semantics (seq behavior).
  • Add one failure-mode test for invalid deterministic clock start string.
  • Consider introducing replay bundle export/import integration tests once storage wiring lands.

Overall: good architectural scaffold; recommend tightening these edges before broad adoption.

@dgarson dgarson merged commit 79787e8 into dgarson/fork Feb 24, 2026
1 of 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