fix(staged): improve action output with PTY support and carriage return handling#557
fix(staged): improve action output with PTY support and carriage return handling#557
Conversation
…dd tests Extract processChunksToLines into a testable utility module and fix a bug where \r\n split across chunk boundaries was incorrectly treated as a bare \r (clearing the line) followed by a \n (pushing an empty line). Add vitest and comprehensive tests covering progress bar overwriting, CRLF handling, and cross-chunk boundary edge cases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ll recipes The test recipe only ran Rust tests, so the new vitest frontend tests were never executed by the justfile or the pre-push git hook. Add a test-frontend recipe and wire it into ci and check-all. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rectly Child processes detect they're writing to a pipe (not a TTY) and fall back to \n-separated output instead of \r-based overwriting for progress bars. Fix this by opening a PTY pair and redirecting the child's stdout/stderr to the PTY slave, so isatty() returns true. The PTY master is read in the parent for output streaming. Key changes: - Add pty module with open() and configure() helpers using libc::openpty - Disable echo on PTY so piped stdin commands don't appear in output - Set 200x50 terminal size to prevent progress bar line wrapping - Redirect stdout/stderr to PTY slave via dup2 in pre_exec - Read output from PTY master (single merged stream) instead of pipes - Remote execution still uses pipes (PTY only affects local execution) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91b9626149
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (pendingCR) { | ||
| pendingCR = false; | ||
| if (ch === '\n') { | ||
| // \r\n split across chunks — treat as a single newline | ||
| lines.push({ text: currentText, stream: currentStream }); |
There was a problem hiding this comment.
Gate split-CRLF handling by stream
The pendingCR branch currently treats any next \n as the completion of a prior \r, even when that \n comes from a different stream chunk. In mixed stdout/stderr output (still possible when chunks are interleaved from separate streams), a stdout chunk ending in \r followed by a stderr chunk starting with \n will be misinterpreted as CRLF and incorrectly preserve/finalize the stdout line instead of applying carriage-return overwrite semantics. The CRLF-bridging logic should only trigger when the continuation chunk is from the same stream as the pending \r.
Useful? React with 👍 / 👎.
Summary
Test plan
processOutput.test.tswith unit tests for carriage return handling🤖 Generated with Claude Code