Skip to content

fix(linux): harden CLI and network bridge lifetimes - #4

Merged
EliasCodeFI merged 5 commits into
mainfrom
fix/linux-cli-process-lifetime
Oct 21, 2026
Merged

EliasCodeFI merged 5 commits into
mainfrom
fix/linux-cli-process-lifetime

Conversation

@EliasCodeFI

@EliasCodeFI EliasCodeFI commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

On Linux, killing only the CLI can leave the sandbox workload alive: bubblewrap's immediate parent is an intermediate shell that remains waiting. The host socat bridges and the mux backend's filesystem socket can also outlive abrupt CLI termination. Separately, a healthy bridge which binds after the fixed readiness attempts is killed during startup.

This change replaces the Linux CLI's intermediate shell with the rendered sandbox invocation, adds an expected-parent supervisor for host socat, and uses abstract Unix sockets for the Linux mux backend. The supervisor waits for its child, forwards termination after the CLI dies, escalates if graceful shutdown is ignored, and removes the managed socket after child exit. Bridge readiness waits to a monotonic startup deadline and rejects an already-exited child promptly.

The launcher is capability-probed. An absent or older helper retains direct-socat startup, so complete bridge/socket cleanup after SIGKILL is not claimed for that fallback. The host launcher mode does not apply sandbox restrictions.

The regression cases wait for actual workload or proxy readiness before signaling only the CLI, then inspect workload/process identity and socket cleanup. The socat stand-in deliberately leaves its sockets behind, matching the residual file observed with socat1.8. Native checks cover parent validation, child exit/signal status, ignored graceful shutdown, and preservation of a regular file at the cleanup path. Additional cases delay each bridge and test stalled startup. Local CLI cases explicitly use network.allowAllUnixSockets=true; they exercise the matching host launcher without validating nested seccomp setup.

Independent read-only review accepted this revision. Local native/project build, typecheck, affected lint/formatting and checks pass, including a socat1.8 build and a final cleanup test observed failing against the earlier baseline after workload/proxy readiness. Default nested-helper and platform validation is running on this exact source in the fork.

Fork validation at 2d3ac54: combined branch PR #4, Tests, Release/package checks. The standalone startup-deadline prerequisite was also validated in fork PR #2.

This is a draft fork validation PR. No package publication is requested. The branch includes the accepted startup-deadline prerequisite from fork PR #2; the final upstream submission combines these product changes.

EliasCodeFI and others added 4 commits October 21, 2026 11:51
initializeLinuxNetworkBridge checked for both socat sockets five times,
with sleeps of 0, 100, 200 and 300 ms between checks, so a healthy
socat that takes 0.9 s to bind failed every start. Wait until a
five-second deadline instead, polling at most every 100 ms within the
remaining budget, and keep the timeout's process cleanup.

The new tests start real socat behind a delayed wrapper. They fail
against main and pass with this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: drop some CA roots from the runners' trust store

Each release job starts by dropping a fixed list of root certificates
from the runner's trust store, has Node, npm and git read the cleaned
store, and then checks the result. The test jobs drop the same list
from the system store on Linux and Windows.

* ci: check the CA file against the list of Node, and each Windows store

The check on Windows compares the CA file with the certificates of the
Node that wrote it, counts each store, and removes its own certificate
by path.

* ci: let the check's Node end by itself on Windows

The helper sets an exit code and returns, and a host that is not
reached is reported with the code Node gave.
@EliasCodeFI EliasCodeFI changed the title fix(linux): bind CLI workloads and bridges to parent lifetime fix(linux): harden CLI and network bridge lifetimes Oct 21, 2026
@EliasCodeFI
EliasCodeFI marked this pull request as ready for review October 21, 2026 19:05
@EliasCodeFI
EliasCodeFI merged commit 4e2d3da into main Oct 21, 2026
16 checks passed
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