Skip to content

fix(cli): exit ocx init cleanly on piped stdin EOF - #774

Closed
Wibias wants to merge 2 commits into
lidge-jun:devfrom
Wibias:fix/754-init-eof
Closed

Wibias wants to merge 2 commits into
lidge-jun:devfrom
Wibias:fix/754-init-eof

Conversation

@Wibias

@Wibias Wibias commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Handle piped stdin EOF during ocx init without hanging or noisy errors.
  • Add init EOF regression test.

Fixes #754

Test plan

  • �un run test (init-eof tests)
  • Manual: piped stdin EOF during init

Security

  • none

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Wibias, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2ab132c6-c374-4629-8f41-7d2d6c0b9ba7

📥 Commits

Reviewing files that changed from the base of the PR and between be177ea and f772d5a.

📒 Files selected for processing (2)
  • src/cli/init.ts
  • tests/init-eof.test.ts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6342e0fd2e

ℹ️ 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".

Comment thread src/cli/init.ts Outdated
@github-actions github-actions Bot added the bug Something isn't working label Jul 30, 2026
@Wibias

Wibias commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

[shipping-github] Merge-ready

  • \mergeStateStatus: CLEAN after windows-latest passed on 4th CI attempt
  • ubuntu/macos/windows + npm-global matrix green; enforce-target + react-doctor green
  • Prior windows failures were unrelated \�xecuteArchivedCleanup\ 5s timeouts on slow runners (flake)

Init prompts cannot consume a complete answer pipe safely; tell users to rerun in an interactive terminal instead.
@Wibias

Wibias commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Verdict: approve-comment

  • Usefulness: Fixes ocx init busy-loops at ~100% CPU after piped stdin reaches EOF #754 — ocx init exits cleanly on piped stdin EOF instead of busy-looping.
  • Bugs: none blocking; regression covers closed stdin.
  • Security: local CLI only.
  • Owner/maintainer reviews: none.
  • Bots: addressed.
  • Base / CI: dev; windows red appears unrelated to tests/init-eof.test.ts.
  • Gate: none material.

@lidge-jun

Copy link
Copy Markdown
Owner

Landed on codex/260731-pr-merge-round, squashed with your authorship preserved. That branch is a staging line: it merges into dev and ships once the performance work in flight there lands.

bfa1a599c — landed unchanged.

The diagnosis was exact: readline.question() never invokes its callback when stdin closes, so the promise stayed pending, the interface stayed open, and the loop spun with nothing left to read. Rejecting on EOF and mapping that to a non-zero exit is the right shape.

Your regression test is what makes it hold. It closes stdin, requires exit 1 within 8 seconds, and asserts no config file was written — so a regression to the hanging behavior fails on the timeout instead of passing quietly. Verified green on the branch.

#754 closed alongside.

@lidge-jun lidge-jun closed this Jul 31, 2026
@Wibias
Wibias deleted the fix/754-init-eof branch July 31, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants