Skip to content

fix: export an empty event log at seq -1 for asciicast and WebM - #270

Merged
ThomasK33 merged 4 commits into
mainfrom
fix/251-empty-log-export
Nov 3, 2026
Merged

ThomasK33 merged 4 commits into
mainfrom
fix/251-empty-log-export

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Why

The operator asked to work every deferred follow-up issue of agent-tty until none is left. This PR fixes #251. #235 made snapshot and screenshot report capturedAtSeq: -1 on a session that has printed nothing. record export on the same session did not match. WebM failed with exit 7 EXPORT_ERROR, and asciicast reported seq 0, the seq of an event that does not exist.

What changed

  • An empty event log is a valid state for record export, as it is for snapshot and screenshot since fix: capture an empty screen on a session that has printed nothing #235.
  • Asciicast: the header-only cast reports capturedAtSeq: -1 [asciicast.ts:generateAsciicast] [record-export.ts:resolveCapturedAtSeq].
  • WebM: the two "at least one event" guards are gone [record-export.ts] [webm.ts:generateWebmExport]. An empty log gives a blank video of the session's size with capturedAtSeq: -1 and durationMs: 0. The ghostty-web replayWithTiming accepts targetSeq -1, as replayTo already does.
  • RecordExportResultSchema.capturedAtSeq uses ReplaySeqSchema (an integer of at least -1), and recordingFilename accepts -1.
  • Docs: docs/USAGE.md and the export, protocol, storage and ghostty-web READMEs. The ghostty-web README line about lastAppliedSeq >= 0 was stale since fix: capture an empty screen on a session that has printed nothing #235 and is fixed.

Behavior for CLI and JSON users

  • record export --format asciicast on an empty log: capturedAtSeq is -1 (was 0). The default file is recording--1-asciicast.cast (was recording-0-asciicast.cast). The file content is unchanged.
  • record export --format webm on an empty log: exit 0 with a blank WebM, capturedAtSeq: -1, durationMs: 0, and metadata.outputEventCount: 0. It failed with exit 7 EXPORT_ERROR before. The default file is recording--1-webm.webm.
  • The JSON schema now allows capturedAtSeq: -1 in record export results. No error code changes. A session with at least one event behaves as before.

Verification

  • test/integration/empty-session-capture.test.ts "exports a header-only asciicast and a blank WebM at seq -1" fails on main 71d1b0c (asciicast seq 0, WebM exit 7) and passes on this branch.
  • Unit tests updated: webm (empty log exports at seq -1), asciicast (-1), artifactStorage (recordingFilename(-2) throws), golden envelopes (invalid seq is -2).
  • Gates: typecheck, lint and format:check exit 0. Unit: 138 files, 1731 tests passed. Integration (4 shards): 332 of 336 passed and e2e (3 shards): 33 of 34 passed on a host with load average 37. The 5 failures were timeouts in files that do not reach record export (run, cli, wait-render, lifecycle, resize-demo). Rerun alone, those 5 files passed 165 of 165.
  • Live run of the built CLI: 1 of 4 checks pass on main 71d1b0c and 4 of 4 on this branch. The checks: asciicast seq on an empty log, WebM to the default path, WebM with --out (SHA matches), and an asciicast of a session that printed (seq 0, unchanged). ffprobe reads the blank WebM as VP9 with 28 frames.

Closes #251


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T06:43:18.824672Z 8fc3ca3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 21b94e669b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 8fc3ca3055

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 4cc4312 Nov 3, 2026
12 checks passed
@ThomasK33
ThomasK33 deleted the fix/251-empty-log-export branch November 3, 2026 08:14
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
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.

record export: an empty event log fails for WebM and reports seq 0 for asciicast

1 participant