Skip to content

fix(ci): bound the waits for what an escaped process holds - #184

Open
PiquelChips wants to merge 1 commit into
fix/never-push-a-result-without-thefrom
fix/bound-the-waits-for-what-an
Open

PiquelChips wants to merge 1 commit into
fix/never-push-a-result-without-thefrom
fix/bound-the-waits-for-what-an

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

A process that a check's command left running could hang origin-ci if it escaped being stopped. It escapes by leaving its process group, or on macOS, where leftovers are never killed. Two waits had no bound:

  • collect joined the thread reading the command's output. It waited until every holder closed the pipe, so an escaped process holding stdout blocked the run.
  • Checkout::spawn took the checkout's .held lock with a blocking open. An escaped process from the toolchain command that kept the lock blocked the check's own command.

Either one stalled the worker, which then answered no other check requests.

Both waits now end after Checkout::GRACE (5 seconds). That is enough time for the processes stop SIGKILLed to die and release what they held, so the brief wait after stop still works. After that:

  • spawn fails with StateError::Held.
  • collect fails with RunError::OutputHeld. It leaves the reader thread to the escaped process and issues no result from output that may be cut short.

Each fix has a unit test that hangs without it. The end-to-end test that leaves sleep 60 & running used to expect the run to wait for it on macOS. It now expects the check to fail quickly there.

Closes #166: this is the last of the PRs fixing its follow-ups.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 97738e0a-7520-45ed-a167-46e7879d48d5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@PiquelChips
PiquelChips added this pull request to stack #185 November 22, 2026 20:21
@PiquelChips
PiquelChips removed this pull request from stack #185 November 22, 2026 20:22
A process a command started that escaped being stopped, by leaving its
group, or on macOS where no leftover is killed, could hang the runner:
`collect` joined the output reader with no bound while it kept the pipe
open, and `Checkout::spawn` blocked on the checkout's `.held` lock while
it kept that, stalling the worker for every other request.

Both now wait only `Checkout::GRACE`, long enough for the processes
`stop` killed to die and release what they held, then fail: `spawn` with
`StateError::Held`, and `collect` with `RunError::OutputHeld`, leaving
the reader thread to the escaped process rather than issue a result from
output it may have cut short.
@PiquelChips
PiquelChips force-pushed the fix/never-push-a-result-without-the branch from 82ac938 to b3ed9d2 Compare November 22, 2026 20:22
@PiquelChips
PiquelChips force-pushed the fix/bound-the-waits-for-what-an branch from 3da5d2e to 835f3f6 Compare November 22, 2026 20:22
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.

Follow-ups from CodeRabbit's reviews of the stack

1 participant