Skip to content

🛡️ Sentinel: [CRITICAL] Fix Process pipe deadlocks - #146

Open
NSEvent wants to merge 3 commits into
mainfrom
sentinel/fix-process-deadlocks-2809143174757296115
Open

🛡️ Sentinel: [CRITICAL] Fix Process pipe deadlocks#146
NSEvent wants to merge 3 commits into
mainfrom
sentinel/fix-process-deadlocks-2809143174757296115

Conversation

@NSEvent

@NSEvent NSEvent commented Aug 19, 2026

Copy link
Copy Markdown
Owner

🛡️ Sentinel: [CRITICAL] Fix Process pipe deadlocks

Severity: CRITICAL
Vulnerability: Foundation.Process pipe handling caused deadlocks.
Impact: Denial of Service. The application would hang indefinitely if child process output exceeded the ~64KB OS pipe buffer because waitUntilExit() was called before draining the pipe.
Fix: Refactored synchronous Process executions to read from pipes (readDataToEndOfFile()) before calling waitUntilExit(). Also assigned unused streams to FileHandle.nullDevice instead of instantiating unread Pipe()s. Fixed across AutomationExecutor.swift, UniversalControlMouseRelay.swift, and OBSWebSocketLiveIntegrationTests.swift.
Verification: Statically validated Swift syntax since tests cannot run in sandbox.


PR created automatically by Jules for task 2809143174757296115 started by @NSEvent

Summary by CodeRabbit

  • Bug Fixes
    • Prevented potential process hangs when handling command output.
    • Improved reliability when reading process results and identifying process IDs.
    • Suppressed unused command error output to avoid blocking during background checks.
    • Preserved existing executable-path validation and process status behavior.

Severity: CRITICAL
Vulnerability: `Foundation.Process` pipe handling caused deadlocks.
Impact: Denial of Service. The application would hang indefinitely if child process output exceeded the ~64KB OS pipe buffer because `waitUntilExit()` was called before draining the pipe.
Fix: Refactored synchronous `Process` executions to read from pipes (`readDataToEndOfFile()`) *before* calling `waitUntilExit()`. Also assigned unused streams to `FileHandle.nullDevice` instead of instantiating unread `Pipe()`s.
Verification: Statically validated Swift syntax.

Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 19 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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 within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 65284b10-f395-4777-b312-5f87dbcacab6

📥 Commits

Reviewing files that changed from the base of the PR and between 9e7a5e6 and 7f39573.

📒 Files selected for processing (2)
  • XboxControllerMapper/XboxControllerMapperTests/OBSWebSocketLiveIntegrationTests.swift
  • patch_obs_tests4.py

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7072ebdf-d71e-4a7b-9509-79b8cc37d0b2

📥 Commits

Reviewing files that changed from the base of the PR and between 491237a and 9e7a5e6.

📒 Files selected for processing (4)
  • .Jules/sentinel.md
  • TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift
  • XboxControllerMapper/XboxControllerMapper/Services/Input/UniversalControlMouseRelay.swift
  • XboxControllerMapper/XboxControllerMapperTests/OBSWebSocketLiveIntegrationTests.swift

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changes prevent process pipe deadlocks by reading output before waiting for termination and redirecting unused standard error streams to FileHandle.nullDevice. The sentinel documents these rules.

Changes

Process pipe safety

Layer / File(s) Summary
Pre-wait process output reads
TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift
runProcess and childPIDs read process output before calling waitUntilExit().
Unused stream handling
XboxControllerMapper/XboxControllerMapper/Services/Input/UniversalControlMouseRelay.swift, XboxControllerMapper/XboxControllerMapperTests/OBSWebSocketLiveIntegrationTests.swift, .Jules/sentinel.md
Tailscale and which mediamtx discard unused standard error through FileHandle.nullDevice. The sentinel documents pre-wait or concurrent pipe reads and null-device usage.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9e7a5

The change drains process output before waiting and redirects unused streams, addressing the reported deadlock path. No actionable merge-blocking risk remains beyond normal follow-up testing.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing critical process pipe deadlocks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel/fix-process-deadlocks-2809143174757296115

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.

google-labs-jules Bot and others added 2 commits August 19, 2026 09:42
Severity: CRITICAL
Vulnerability: `Foundation.Process` pipe handling caused deadlocks.
Impact: Denial of Service. The application would hang indefinitely if child process output exceeded the ~64KB OS pipe buffer because `waitUntilExit()` was called before draining the pipe.
Fix: Refactored synchronous `Process` executions to read from pipes (`readDataToEndOfFile()`) *before* calling `waitUntilExit()`. Also assigned unused streams to `FileHandle.nullDevice` instead of instantiating unread `Pipe()`s. Fixed uncatchable exception on `try? process.run()` failure.
Verification: Statically validated Swift syntax.

Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
Severity: CRITICAL
Vulnerability: `Foundation.Process` pipe handling caused deadlocks and uncatchable exceptions on failed launches.
Impact: Denial of Service. The application would hang indefinitely if child process output exceeded the ~64KB OS pipe buffer because `waitUntilExit()` was called before draining the pipe. Additionally, test suites would crash due to uncatchable exceptions if `run()` failed and was swallowed by `try?`.
Fix: Refactored synchronous `Process` executions to read from pipes (`readDataToEndOfFile()`) *before* calling `waitUntilExit()`. Assigned unused streams to `FileHandle.nullDevice` instead of instantiating unread `Pipe()`s. Wrapped `run()` calls in proper `do/catch` blocks in tests to prevent crashes on unlaunched processes. Fixed across `AutomationExecutor.swift`, `UniversalControlMouseRelay.swift`, and `OBSWebSocketLiveIntegrationTests.swift`.
Verification: Statically validated Swift syntax since tests cannot run in sandbox.

Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
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