Skip to content

🤖 perf: session tape read side follow-ups for T3 (from #5568) #5587

Description

@ThomasK33

Tracking the limitations of the session tape read side (T2, #5568), for the perf tape program. Tapes hold full chat content; every fixture and repro here must be synthetic.

Owner: T3 (perf E2E tape replay). Trigger: when T3 starts.

T2 ships only the offline read side: the loader, the offline replay driver, bun scripts/perf/tapeInfo.ts and the synthetic tape builder. Delivering a tape to the app renderer, with network isolation, is T3's main scope and is not tracked here.

Current limitations of the offline read side

  1. Bounded-reader size check. readSessionTapeFile reads the whole file before validating it. Stat the path first, and refuse non-regular files and files above the recorder's tape cap (32 MiB) before reading.

  2. Validation time. Loading is synchronous. A 24.1 MiB synthetic tape with 60,007 events took 0.6 to 0.9 s (Bun 1.3.12). That is a measurement for one fixture shape, not a worst-case bound. Recheck it once T3 plays tapes inside the app, where a long synchronous load blocks the main process.

  3. Offsets above the timer limit. A recorded t above about 24.9 days (2^31-1 ms) is clamped by setTimeout, so later events would burst. Wait in bounded chunks against the absolute deadline, or reject such offsets in the loader.

  4. Space-padded workspace ids. The recorder hashes the raw workspaceId for the header's workspaceIdHash. A tape recorded through a space-padded id therefore carries a hash that a trimmed-id check will not match. Trim the id in the recorder (sessionTapeRecorder.ts) before hashing, like WorkspaceService does.

  5. Malformed UTF-8. readSessionTapeFile decodes with replacement characters, so a corrupted byte is not reported. Read bytes and decode with a fatal TextDecoder before loading (Codex, 🤖 perf: session tape loader, offline replay driver and tapeInfo CLI (T2) #5568 round 6).

  6. Pathologically deep JSON. An event nested deeply enough for JSON.stringify to overflow the stack throws RangeError out of loadSessionTape instead of rejecting the tape. Convert non-TapeRejection errors during canonicalization and decoding into a rejection (Codex, 🤖 perf: session tape loader, offline replay driver and tapeInfo CLI (T2) #5568 round 6).

Features for T3's app integration

  1. Resumable replay. Only a fresh full replay is planned. Re-entering a replayed workspace (a since resubscription) needs an explicit design, or a documented refusal.
  2. Fast pacing through the app. The driver supports pacing: "fast". Decide whether T3's harness exposes it (for example make perf-tape TAPE=<file> PACING=fast).

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $43.69

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions