Skip to content

feat(stack): read the process identity token via sysctl on darwin (RIG-3548) - #1033

Merged
trunk-io[bot] merged 1 commit into
mainfrom
compass-native/rig-3548-darwin-starttime
Sep 10, 2026
Merged

feat(stack): read the process identity token via sysctl on darwin (RIG-3548)#1033
trunk-io[bot] merged 1 commit into
mainfrom
compass-native/rig-3548-darwin-starttime

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 3 PRs:

  1. main
  2. "feat(stack): read the process identity token via sysctl on darwin (RIG-3548)" (this PR)
  3. feat(app): make the darwin podman-machine check real and provisioning-aware (RIG-3202) #1034
  4. fix(preflight): provision the darwin machine before probing podman (RIG-3563) #1057

compass-stack up records a start-time identity token for every child it
spawns, to close the pid-recycling window. The only reader was
/proc//stat, so up refused on macOS: pgidfile.go is //go:build unix,
which darwin satisfies, meaning darwin compiled the Linux reader and failed
at runtime rather than at build time.

Add a darwin reader at BOTH identity sites, split behind the existing seams
into _linux.go/_darwin.go files. The token is read at spawn by the core and
independently at teardown by the group-signal adapter, and
GroupSignaller.Alive compares the two for uint64 equality — so both darwin
readers share one packing rule (sec*1e6 + usec over the KinfoProc start
timeval, via sysctl kern.proc.pid), pinned by mirrored tests in both
packages. A drift between them would report every live child as not-alive
and silently skip it at teardown, which is why the duplication is pinned
rather than trusted.

Both readers fail closed on a dead pid, so a failed read can never yield a
0 token that would spuriously match a record carrying 0.

The darwin CI lane gains a step running the stack suite natively, because
cross-compiling type-checks these readers but never executes them, and the
sysctl has no Linux stand-in. The readers have NOT run on a real macOS
host yet; that step is what will prove them.

Promotes golang.org/x/sys to a direct dependency (already in the module
graph); go.sum unchanged.

Refs RIG-3548, RIG-1662.

Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Sep 8, 2026

Copy link
Copy Markdown

RIG-3548

RIG-1662

@trunk-io

trunk-io Bot commented Sep 8, 2026

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-native-rig-3548-darw.compass-eng-docs.pages.dev

Deployed from compass-native/rig-3548-darwin-starttime at f683bed.

…G-3548)

compass-stack up records a start-time identity token for every child it
spawns, to close the pid-recycling window. The only reader was
/proc/<pid>/stat, so up refused on macOS: pgidfile.go is //go:build unix,
which darwin satisfies, meaning darwin compiled the Linux reader and failed
at runtime rather than at build time.

Add a darwin reader at BOTH identity sites, split behind the existing seams
into _linux.go/_darwin.go files. The token is read at spawn by the core and
independently at teardown by the group-signal adapter, and
GroupSignaller.Alive compares the two for uint64 equality — so both darwin
readers share one packing rule (sec*1e6 + usec over the KinfoProc start
timeval, via sysctl kern.proc.pid), pinned by mirrored tests in both
packages. A drift between them would report every live child as not-alive
and silently skip it at teardown, which is why the duplication is pinned
rather than trusted.

Both readers fail closed on a dead pid, so a failed read can never yield a
0 token that would spuriously match a record carrying 0.

The darwin CI lane gains a step running the stack suite natively, because
cross-compiling type-checks these readers but never executes them, and the
sysctl has no Linux stand-in. The readers have NOT run on a real macOS
host yet; that step is what will prove them.

Promotes golang.org/x/sys to a direct dependency (already in the module
graph); go.sum unchanged.

Refs RIG-3548, RIG-1662.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-native/rig-3548-darwin-starttime branch from 701934f to f683bed Compare September 8, 2026 21:56
@rigel-mintaka
rigel-mintaka marked this pull request as ready for review September 8, 2026 22:04
@trunk-io
trunk-io Bot merged commit 735ec26 into main Sep 10, 2026
15 checks passed
@trunk-io
trunk-io Bot deleted the compass-native/rig-3548-darwin-starttime branch September 10, 2026 02:07
@trunk-io

trunk-io Bot commented Sep 10, 2026

Copy link
Copy Markdown

This pull request was merged into main as part of stacked PR 1034.

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.

2 participants