Skip to content

[fix] preserve session recordings and report write failures (STAR-106) - #37

Merged
vt128 merged 4 commits into
masterfrom
codex/recording-lifecycle
Sep 20, 2026
Merged

vt128 merged 4 commits into
masterfrom
codex/recording-lifecycle

Conversation

@vt128

@vt128 vt128 commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

--record omitted readline prompts/input echoes despite promising a complete session, leaked two pipe readers per completed recording, and treated a full recording destination as success. A runtime write failure could also stop draining a pipe and stall a sufficiently chatty script.

Tee readline's existing platform-specific terminal writers without taking ownership of them, close all owned pipe ends on normal and failed setup paths, and retain recording errors while continuing to drain script output. Return a non-zero exit code on recording failure while preserving an existing non-zero script exit code. Stop is idempotent. The readline version is unchanged; its existing dependency is now a direct import.

Fixes STAR-106. Behavior changes: transcripts now include terminal prompts/input echoes and may contain ANSI sequences; recording setup/write/close failures are observable. The real terminal rehearsal now runs for the installed Unix release archives, including plain REPL, post-script inspection, evaluation-error recovery, Ctrl-C and EOF. Portable session append/error tests run on all six targets.

Validation:

  • Before: a real PTY omitted prompts; 20 recordings increased open descriptors from 7 to 47; /dev/full returned exit 0 and executed the script. Regression tests failed before the fix.
  • After: full build/race twice/vet/format; Go 1.26.8 Docker build/race; actual runtime Dockerfile build/run and disk-full failure; real macOS PTY REPL and inspection passed.
  • Unit tests cover header errors/short writes, both pipe allocation failures, stdout/stderr forwarding failures, write/short-write/close failures, repeated stop, all classified exit codes, resource ownership and continued draining beyond pipe capacity.
  • Existing tests remain in the functional test files; release CI repeats native archive installation and rollback tests.

Additional validation: ten alternating 4 MiB recording workloads (4096 print calls) showed 22.68 ms before and 22.77 ms after at the median on macOS arm64, including process startup (about +0.4%, a local sample rather than a throughput guarantee). Native CI also exposed non-portable descriptor-test assumptions, which are now checked using the documented close contract. The terminal driver waits for readline raw mode before control keys and drains terminal output through child exit.

@codecov

codecov Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (760b2d2) to head (6db0fe1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
+ Coverage   86.34%   87.99%   +1.64%     
==========================================
  Files          23       23              
  Lines        1128     1166      +38     
==========================================
+ Hits          974     1026      +52     
+ Misses        117      108       -9     
+ Partials       37       32       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vt128
vt128 merged commit d32d3f6 into master Sep 20, 2026
18 checks passed
@vt128
vt128 deleted the codex/recording-lifecycle branch September 20, 2026 00:31
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