Skip to content

fix: Prevent fd double-close and handle EINTR in PTY I/O#105

Open
2witstudios wants to merge 1 commit intomainfrom
pu/fix-fd-bugs
Open

fix: Prevent fd double-close and handle EINTR in PTY I/O#105
2witstudios wants to merge 1 commit intomainfrom
pu/fix-fd-bugs

Conversation

@2witstudios
Copy link
Owner

Summary

  • ManifestWatcher.swift: deinit was closing the file descriptor twice — once via the DispatchSource cancel handler and again explicitly with close(fileDescriptor). Fixed by only closing via one path depending on whether a source exists.
  • pty_manager.rs: Both the PTY read loop and write loop treated EINTR (signal interruption) as a fatal error/EOF instead of retrying. A stray signal could terminate the output reader or fail a write.

Test plan

  • All 93 pu-engine tests pass (unit + integration)
  • Verify ManifestWatcher still detects file changes after atomic writes
  • Verify PTY output streaming isn't interrupted by signals during long-running agents

🤖 Generated with Claude Code

ManifestWatcher.deinit closed the file descriptor twice — once via the
DispatchSource cancel handler and again explicitly. Now only one path
closes it depending on whether a source exists.

PTY read and write loops treated EINTR (signal interruption) as fatal
when they should retry, which could prematurely terminate the output
reader or fail a write on any signal delivery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2026

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 25 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b0c932af-dc95-439a-bd73-5e0d5b705fb1

📥 Commits

Reviewing files that changed from the base of the PR and between 55aa882 and 4b4be33.

📒 Files selected for processing (2)
  • apps/purepoint-macos/purepoint-macos/Services/ManifestWatcher.swift
  • crates/pu-engine/src/pty_manager.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pu/fix-fd-bugs

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.

❤️ Share

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

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