|
| 1 | +# Replay retained session evidence |
| 2 | + |
| 3 | +## Traceability |
| 4 | + |
| 5 | +- Spec ID: inspector-session-replay |
| 6 | +- Status: Draft |
| 7 | + |
| 8 | +## Intent |
| 9 | + |
| 10 | +Let a reviewer play through one retained coding-agent session without leaving |
| 11 | +the Inspector's existing evidence model. Session View should keep its current |
| 12 | +chronological Trace and add a Replay mode that synchronizes a current-event |
| 13 | +stage, an event/file index, a compact timeline, and playback controls. |
| 14 | + |
| 15 | +Replay is a read-only presentation of the sanitized report projection. It does |
| 16 | +not rerun tools, restore a worktree, resume a native host session, or invent |
| 17 | +timestamps for content whose time was not observed. |
| 18 | + |
| 19 | +## Acceptance Scenarios |
| 20 | + |
| 21 | +- AC-1: `Open session` exposes semantic `Trace` and `Replay` tabs. Trace remains |
| 22 | + the default, and a URL with `view=session&session-mode=replay` restores Replay |
| 23 | + for the named session. |
| 24 | +- AC-2: Each projected session owns a `SessionReplay` model, without a version |
| 25 | + suffix in its name. It deterministically projects retained prompts, |
| 26 | + intermediate responses, tool calls, final responses, and directly linked |
| 27 | + commits from the already-sanitized report model. |
| 28 | +- AC-3: Every replay event declares its timing basis. Observed prompt, tool, and |
| 29 | + commit timestamps may appear on the wall-clock rail; response boundaries may |
| 30 | + be labelled as Turn-bound; intermediate responses and other untimed content |
| 31 | + remain `sequence-only` and are never assigned an invented clock time. |
| 32 | +- AC-4: Selecting an event updates the current-event stage, the event index, the |
| 33 | + compact timeline cursor when timing exists, and the Inspector selection when |
| 34 | + the event has a Story, Session, Turn, Tool Call, File, or Commit descriptor. |
| 35 | + Existing Evidence Drawer relationships and limitations remain authoritative. |
| 36 | +- AC-5: Replay provides previous, play/pause, and next controls plus 1x, 2x, 4x, |
| 37 | + and 8x event pacing. Playback advances by retained event order, compresses |
| 38 | + long unobserved gaps instead of making multi-hour sessions wait in real time, |
| 39 | + stops at the end, and never invokes a host tool. |
| 40 | +- AC-6: Replay exposes `Events` and `Files` index tabs. Choosing a file selects |
| 41 | + that repository-relative path and moves to the first retained replay event |
| 42 | + that names it, without claiming the event authored a commit. |
| 43 | +- AC-7: The mode tabs, index tabs, event rows, file rows, playback buttons, and |
| 44 | + speed controls are keyboard operable; the current event uses non-color state |
| 45 | + cues, playback respects reduced-motion preference, and controls do not steal |
| 46 | + shortcuts from form inputs. |
| 47 | +- AC-8: The self-contained HTML retains no raw tool input/output, hidden |
| 48 | + reasoning, absolute home path, or credential. Missing content and unavailable |
| 49 | + timing stay explicit in the model and UI. |
| 50 | +- AC-9: Focused behavior tests cover `SessionReplay` ordering and timing bases, |
| 51 | + direct-commit inclusion, untimed fallbacks, mode restoration, playback |
| 52 | + controls, and final HTML privacy. A real multi-hour local session is verified |
| 53 | + in desktop and narrow browser layouts with no page or console errors. |
| 54 | + |
| 55 | +## Non-goals |
| 56 | + |
| 57 | +- Adding Replay as a top-level Inspector scope beside Delivery Tree and Date. |
| 58 | +- Executing, retrying, resuming, or mutating a tool call, Git state, worktree, |
| 59 | + feature-tree mapping, checkpoint, or native host session. |
| 60 | +- Human annotations, pinned notes, author identity, or report persistence. |
| 61 | +- Fabricating cost, token, test-result, response, or timing evidence that the |
| 62 | + source projection did not retain. |
| 63 | +- Replacing Trace, the Evidence Drawer, or the existing wall-clock activity |
| 64 | + chart with a second relationship model. |
| 65 | + |
| 66 | +## Plan and Tasks |
| 67 | + |
| 68 | +1. Extend `scripts/harness-inspector/report-model.mjs` with a bounded |
| 69 | + `SessionReplay` projection built only after Session/Commit links exist. |
| 70 | + Preserve explicit timing bases and direct-commit limitations. |
| 71 | +2. Extend `scripts/harness-inspector/ui/workbench.js` with a session-local |
| 72 | + playback owner separate from evidence selection and chart zoom. Render |
| 73 | + Trace/Replay tabs, the event stage, Events/Files index, compact rail, and |
| 74 | + playback controls from the projected model. |
| 75 | +3. Extend `scripts/harness-inspector/ui/workbench.css` with responsive Replay |
| 76 | + layout and accessible selected/focus treatments that reuse current Inspector |
| 77 | + tokens and typography. |
| 78 | +4. Extend focused Inspector tests with behavior assertions over the model and |
| 79 | + rendered interactions. Preserve unrelated working-tree changes in the same |
| 80 | + files and keep the report self-contained. |
| 81 | +5. Render a real report, exercise mode switching, event/file selection, |
| 82 | + playback, speed, URL restoration, Trace return, keyboard behavior, desktop |
| 83 | + and narrow layouts, then inspect console/page errors. |
| 84 | + |
| 85 | +## Test and Review Evidence |
| 86 | + |
| 87 | +- AC-2/AC-3/AC-8: `npx vitest run test/reporting/harness-inspector.test.mjs` |
| 88 | + asserts the parsed model shape, event ordering, timing bases, direct commits, |
| 89 | + and sanitized projection rather than matching implementation source text. |
| 90 | +- AC-1/AC-4..AC-7: browser behavior against a real self-contained report, |
| 91 | + including a copied Replay deep link and an event with no observed timestamp. |
| 92 | +- AC-9 regression: `npm test`, `npm run pack:verify`, documentation link graph, |
| 93 | + and a Review Readiness Check over the final local/staged split. |
| 94 | +- Privacy risk: Replay consumes only projected safe text and repository-relative |
| 95 | + paths; final HTML is checked for private-path and credential leakage. |
| 96 | +- Correlation risk: only explicit or observed-commit relationships enter the |
| 97 | + replay stream. Same-path and contextual commits stay in Trace/Evidence. |
| 98 | +- Scale risk: the index is event-driven and the compact rail renders timed |
| 99 | + events only; playback advances by event pace so long idle windows do not block |
| 100 | + review. |
| 101 | +- Interaction risk: Replay state is session-local and URL-addressable, while |
| 102 | + Evidence selection and activity zoom remain separate owners. |
| 103 | + |
| 104 | +## Replay Legibility Follow-up |
| 105 | + |
| 106 | +Deep-linking to a mid-session event (`replay-event=call:A179`) exposed six |
| 107 | +legibility defects, since fixed and verified in-browser against a real |
| 108 | +multi-hour local session with no console or page errors: |
| 109 | + |
| 110 | +- AC-4 follow-up: `updateReplayPresentation` now keeps the current event row in |
| 111 | + view inside the index's own scroller only, so following playback never scrolls |
| 112 | + Session View or the Workbench underneath it, and a tab return re-reveals it. |
| 113 | +- AC-7 follow-up: the current row uses a stronger non-color cue (heavier bar, |
| 114 | + bold title) in addition to background, and the mode tabs (filled) read |
| 115 | + distinctly from the index tabs (underlined). |
| 116 | +- Layout: the index column tracks layout width instead of the viewport and keeps |
| 117 | + its own readable height, so a narrow window or open Drawer narrows the column |
| 118 | + rather than stacking it where the sticky transport would cover the list. The |
| 119 | + event card no longer reserves a tall fixed height that dwarfed short evidence. |
| 120 | +- AC-8 follow-up: a bounded (clipped) projection body is flagged `bodyExcerpt` |
| 121 | + and shown as an `Excerpt` badge instead of a silently truncated command. |
| 122 | +- Orientation: the timeline rail gains a type legend, and duplicated position and |
| 123 | + timing text collapses to one `Event N / total` label plus the card's Turn line. |
| 124 | +- Overlay: the root scroller locks while Session View is open so wheel gestures |
| 125 | + cannot scroll the hidden Workbench. |
0 commit comments