Skip to content

feat(inspect): add checkpoint-safe transcript viewer#4

Merged
siriusctrl merged 4 commits into
mainfrom
agent/inspect-transcript
Jul 22, 2026
Merged

feat(inspect): add checkpoint-safe transcript viewer#4
siriusctrl merged 4 commits into
mainfrom
agent/inspect-transcript

Conversation

@siriusctrl

Copy link
Copy Markdown
Owner

Summary

  • add a checkpoint-safe TranscriptTimeline adapter between Fiasco storage and fmtview's public embedding API
  • make fiasco inspect <run-id> open a tail-first TTY transcript viewer, with --follow for live committed checkpoints
  • keep redirected output pipeline-safe as exact committed NDJSON, support explicit --output ndjson, and preserve the existing metadata/final view behind --summary
  • document the ownership boundary and decision in ADR 0037

Architecture boundary

Fiasco owns run lookup, checkpoint validation, growth/reset detection, and raw committed record bytes. It implements fmtview's RecordTimeline interface but contains no ratatui/crossterm viewport or rendering code.

fmtview owns terminal lifecycle, lazy viewport/indexing, search, wrap, raw/structured display, and tool call/result navigation. It receives no Fiasco run or storage types.

This PR uses the released crates.io dependency fmtview = "0.6.1"; there is no path or git dependency.

Correctness and performance

  • all readers share the incremental checkpoint decoder, so resume, recovery, NDJSON output, and the viewer agree on the committed boundary
  • incomplete/torn checkpoints are never published
  • original JSON bytes and tool argument strings are preserved
  • reverse loading starts at the latest committed checkpoint and pages older checkpoints atomically
  • follow mode keeps a persistent suffix decoder, avoids rescanning unchanged incomplete tails, and emits epoch resets on committed-prefix replacement/truncation
  • a separately run million-record acceptance test verifies bounded tail-open reads; reverse budget coverage ensures a large older checkpoint is not decoded before a small tail batch

Validation

  • cargo fmt --check
  • cargo check --all-targets
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all-targets: 294 passed, 0 failed, 1 ignored
  • million-record tail-open acceptance test: passed separately
  • git diff --check

Local PTY/video evidence (kept under ignored target/, not committed) exercised a real 120x34 terminal session and the conversation emulator. It verified alternate-screen and mouse lifecycle, tail-first opening, search, wrap, tool call/result round trips, exact raw tool arguments, structured return, and clean quit without terminal residue. The conversation capture contains 268 frames, 23 keyframes, and 21 scripted actions.

Embed fmtview 0.6.1 behind a RecordTimeline adapter so TTY inspection opens at the committed tail, pages older checkpoints lazily, and follows growing runs without exposing torn checkpoints.

Keep redirected output exact and pipeline-safe as committed NDJSON, preserve the summary view, and document the storage/viewer boundary and verification contract.
Preflight the next checkpoint before a non-empty forward batch crosses its record or byte budget. This keeps large committed groups atomic without decoding or formatting them until a caller has room, while still validating malformed checkpoint starts.

Treat refresh reads as a coherent transaction over one file observation. Retry confirmed truncate/replace races, discard partial suffix decoder state, and publish offsets and prefix samples only after the observed file remains stable.

Cover oversized forward groups, malformed preflight data, buffered-reader position restoration, and deterministic concurrent tail replacement. Document the checkpoint-budget and refresh snapshot semantics.
Upgrade the published crates.io fmtview dependency to 0.6.2. Upstream PR #15 fixed sticky-layout convergence where the one-draw preserved position overrode the exact active-follow tail after a JSON breadcrumb changed the first frame height, immediately producing follow:detached.

Keep fiasco behind the public fmtview facade; fmtview-core remains registry-transitive only, with no path or Git dependency.
fix(inspect): bound batches across writer races
@siriusctrl
siriusctrl marked this pull request as ready for review July 22, 2026 13:41
@siriusctrl
siriusctrl merged commit ec9a526 into main Jul 22, 2026
2 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