Skip to content

🛡️ Sentinel: [CRITICAL] Fix Process pipe deadlock in AutomationExecutor - #144

Open
NSEvent wants to merge 3 commits into
mainfrom
sentinel/fix-process-deadlock-automation-executor-10245832723257948522
Open

🛡️ Sentinel: [CRITICAL] Fix Process pipe deadlock in AutomationExecutor#144
NSEvent wants to merge 3 commits into
mainfrom
sentinel/fix-process-deadlock-automation-executor-10245832723257948522

Conversation

@NSEvent

@NSEvent NSEvent commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Severity: CRITICAL
Vulnerability: The AutomationExecutor executed child processes and waited for them to exit (process.waitUntilExit()) before attempting to read standard output or error pipes.
Impact: If a child process writes more data than the OS pipe buffer can hold (~64KB), the child will block on write. If the parent is blocked on waitUntilExit(), a permanent deadlock occurs, leading to a Denial of Service.
Fix: Modified runProcess and childPIDs to consume pipe output using readDataToEndOfFile() before calling waitUntilExit(), ensuring the buffer is drained and the child can complete safely.
Verification: Static syntax validation was executed on modified files and related test files (AutomationExecutorTests.swift, AutomationExecutorPolicyTests.swift).


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

Summary by CodeRabbit

  • Bug Fixes
    • Improved process output handling to ensure results are captured reliably before processes finish.
    • Preserved existing error handling and result parsing behavior.

**Severity:** CRITICAL
**Vulnerability:** The `AutomationExecutor` executed child processes and waited for them to exit (`process.waitUntilExit()`) before attempting to read standard output or error pipes.
**Impact:** If a child process writes more data than the OS pipe buffer can hold (~64KB), the child will block on write. If the parent is blocked on `waitUntilExit()`, a permanent deadlock occurs, leading to a Denial of Service.
**Fix:** Modified `runProcess` and `childPIDs` to consume pipe output using `readDataToEndOfFile()` *before* calling `waitUntilExit()`, ensuring the buffer is drained and the child can complete safely.
**Verification:** Static syntax validation was executed on modified files and related test files (`AutomationExecutorTests.swift`, `AutomationExecutorPolicyTests.swift`).

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 18, 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: 24 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

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 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 11613e8f-2e7b-414c-955b-f923ae25de77

📥 Commits

Reviewing files that changed from the base of the PR and between bb8821c and 90af2c5.

📒 Files selected for processing (1)
  • XboxControllerMapper/XboxControllerMapperTests/OBSWebSocketLiveIntegrationTests.swift

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: 22862876-9d0f-4bb3-8dc5-70a073c9e2e9

📥 Commits

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

📒 Files selected for processing (1)
  • TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift

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


📝 Walkthrough

Walkthrough

AutomationExecutor now reads process output before waiting for termination in runProcess and childPIDs. Existing error handling and result parsing remain unchanged.

Changes

Process output ordering

Layer / File(s) Summary
Read output before termination waits
TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift
runProcess and childPIDs read pipe output before calling the process termination wait.

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

Merge Risk: ⚪ Minimal · up to bb882

The PR makes a localized process-output ordering change, and no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

🚥 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 identifies the critical pipe deadlock fix in AutomationExecutor, which matches the primary change.
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-deadlock-automation-executor-10245832723257948522

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 18, 2026 09:13
…or and Tests

**Severity:** CRITICAL
**Vulnerability:** The application executed child processes and waited for them to exit (`process.waitUntilExit()`) before attempting to read standard output or error pipes.
**Impact:** If a child process writes more data than the OS pipe buffer can hold (~64KB), the child will block on write. If the parent is blocked on `waitUntilExit()`, a permanent deadlock occurs, leading to a Denial of Service.
**Fix:** Modified `runProcess`, `childPIDs` (in `AutomationExecutor`), and `mediamtx` resolution (in `OBSWebSocketLiveIntegrationTests`) to consume pipe output using `readDataToEndOfFile()` *before* calling `waitUntilExit()`, ensuring the buffer is drained and the child can complete safely.

Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
…or and Tests

**Severity:** CRITICAL
**Vulnerability:** The application executed child processes and waited for them to exit (`process.waitUntilExit()`) before attempting to read standard output or error pipes. In tests, it also created pipes that were never read.
**Impact:** If a child process writes more data than the OS pipe buffer can hold (~64KB), the child will block on write. If the parent is blocked on `waitUntilExit()`, a permanent deadlock occurs, leading to a Denial of Service.
**Fix:** Modified `runProcess`, `childPIDs` (in `AutomationExecutor`), and `mediamtx` resolution (in `OBSWebSocketLiveIntegrationTests`) to consume pipe output using `readDataToEndOfFile()` *before* calling `waitUntilExit()`, ensuring the buffer is drained and the child can complete safely. Additionally, replaced unread `Pipe()` instances with `FileHandle.nullDevice` to eliminate any risk of buffer overflow for discarded output streams.

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