Fix OSError [Errno 22] when running process without a TTY#3
Conversation
The `process` command's clip-picker uses questionary/prompt_toolkit, which calls `loop.add_reader()` on stdin and raises `OSError: [Errno 22] Invalid argument` when stdin is not a real terminal (piped input, CI, scripted/automated runs, or when driven by another process). Guard the three interactive entry points with `sys.stdin.isatty()`: - `_review_clips()` renders all suggested clips instead of prompting - `_should_enter_post_render_loop()` returns False - per-clip `_skip_review` is forced True Interactive behavior in a real terminal is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 27 minutes and 35 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds non-TTY stdin detection across three interactive entry points in the CLI: the clip review picker, the post-render loop, and the export review coordination. When stdin is piped (not a TTY), interactive prompts and UI pickers are bypassed to prevent crashes. ChangesNon-TTY stdin non-interactive CLI mode
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nmbrthirteen
left a comment
There was a problem hiding this comment.
Hey Hey, You are the first contributor. Thanks a lot for this! Approved :))
|
Pls check test error before merging |
The TTY guard added in this PR makes _should_enter_post_render_loop return False in non-interactive environments (incl. CI), so the config/interrupt tests must force a TTY. Adds a test for the non-TTY guard itself.
* Fix OSError [Errno 22] when running `process` without a TTY The `process` command's clip-picker uses questionary/prompt_toolkit, which calls `loop.add_reader()` on stdin and raises `OSError: [Errno 22] Invalid argument` when stdin is not a real terminal (piped input, CI, scripted/automated runs, or when driven by another process). Guard the three interactive entry points with `sys.stdin.isatty()`: - `_review_clips()` renders all suggested clips instead of prompting - `_should_enter_post_render_loop()` returns False - per-clip `_skip_review` is forced True Interactive behavior in a real terminal is unchanged. * test: stabilize post-render-loop tests under the new TTY guard The TTY guard added in this PR makes _should_enter_post_render_loop return False in non-interactive environments (incl. CI), so the config/interrupt tests must force a TTY. Adds a test for the non-TTY guard itself. --------- Co-authored-by: Ricardo Prieto <ricardoprieto@ricardos-mbp.lan> Co-authored-by: Nika Siradze <nikushasiradzee@gmail.com>
Problem
Running
podcli process <video>in a non-interactive context (piped stdin, CI, a wrapper script, or another process driving the CLI) crashes with:The clip-review step uses questionary/prompt_toolkit, which calls
loop.add_reader()on stdin. That fails when stdin isn't a real terminal, so the whole render aborts even though transcription and clip detection already succeeded.Fix
Guard the three interactive entry points with
sys.stdin.isatty():_review_clips()— renders all suggested clips (the same as the default "Render N selected clips" action) instead of launching the picker._should_enter_post_render_loop()— returnsFalseso the post-render menu never opens._skip_review— forcedTrue.Interactive behavior in a real terminal is completely unchanged; this only affects the no-TTY path, which previously could only crash.
Testing
./podcli process clip.mp4 --top 1 --crop face --caption-style hormozi --quality max --no-speakers < /dev/nullOSError: [Errno 22]during clip review.🤖 Generated with Claude Code
Summary by CodeRabbit