Skip to content

feat(ci): check snapshots out in process groups of their own - #160

Open
PiquelChips wants to merge 1 commit into
feat/ci-checksfrom
feat/ci-checkouts
Open

PiquelChips wants to merge 1 commit into
feat/ci-checksfrom
feat/ci-checkouts

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

Every check must run in a fresh checkout of the revision, so no check sees what another changed. It must also leave nothing running once it ends or its run is killed.

State keeps what origin-ci needs per repository under $XDG_STATE_HOME/origin-ci/<key>/:

  • Snapshots and checkouts. Snapshot holds the trees and blobs the remote sent, and State::checkout writes them into a directory of its own, removed when dropped.
  • Process groups. Checkout::spawn starts each command in a process group of its own, which inherits a locked <n>.held file. Checkout::stop kills what is left of the group, but only while one of its processes still holds that lock. A crashed run's checkout is swept, and its group killed, by the next run.
  • One worker. State::lock_worker makes sure a single worker answers a repository's events.

The sweep only kills a process group it can prove still holds its run's lock. On macOS no such proof is possible (Processes::SEES_HELD_FILES), so it leaks the group rather than risk killing the wrong one.

Known limitation: being in a group of its own, a check doesn't get the terminal's Ctrl-C. Interrupting origin ci run leaves it to the next sweep.

Note

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

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 34 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

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: f186dff2-7351-4492-882d-e1f80620b1ce
Commits

Reviewing files that changed from the base of the PR and between f933e51 and 0fa32ce.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 3

  • apps/origin-ci/Cargo.toml
  • apps/origin-ci/src/lib.rs
  • apps/origin-ci/src/state.rs
  • 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 #165 November 22, 2026 14:59
@PiquelChips
PiquelChips force-pushed the feat/ci-checkouts branch 2 times, most recently from 93d10d4 to da512ca Compare November 22, 2026 18:54
Every check must run in a fresh checkout of the revision, so no check sees
what another changed, and leave nothing running once it ends or its run
is killed.

`State` keeps what `origin-ci` needs for each repository, under
`$XDG_STATE_HOME/origin-ci/<key>/`. `Snapshot` holds the trees and blobs
a remote sent, and `State::checkout` writes them into a directory of its
own, removed when dropped. `State::lock_worker` lets a single worker
answer a repository's events.

`Checkout::spawn` starts each command in a process group of its own,
which inherits a locked `<n>.held` file, and `Checkout::stop` kills what
is left of the group only while one of its processes still holds that
lock: never another group that took its number since. A crashed run's
checkout is swept, and its group stopped, by the next run. Where the
platform can't tell which files a group holds, as on macOS, the group is
leaked rather than risk killing someone else's.
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