Skip to content

fix(process): Doctor and spawn-broker cleanup fail when the host denies process-group signals - #198132

Merged
roboclaw-bot merged 3 commits into
openclaw:mainfrom
EmilienM:fix-spawn-broker-group-cleanup-eperm
Nov 13, 2026
Merged

roboclaw-bot merged 3 commits into
openclaw:mainfrom
EmilienM:fix-spawn-broker-group-cleanup-eperm

Conversation

@EmilienM

@EmilienM EmilienM commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #198130

What Problem This Solves

Fixes: openclaw doctor --fix and spawn-broker shutdown fail when OpenClaw runs on a Linux host that denies process-group signals, such as inside an OpenShell sandbox.

User Impact

User impact: OpenClaw inside an OpenShell sandbox (or under any seccomp rule that denies kill(2) with a negative PID) can finish Doctor maintenance and shut its spawn broker down again. OpenClaw Enterprise holds Agent startup until Doctor reports settled maintenance, so this unblocks Agents that could not start after an upgrade (openclaw/openclaw-enterprise#5706). Hosts where group signals work are unchanged. No config, state or schema changes, and no update steps.

Why This Change Was Made

OpenShell's child seccomp filter returns EPERM for every process-group signal, including the signal 0 probe. Two probes treated that EPERM as "still alive" forever: isChildProcessTreeAlive() (command scopes, Doctor process custody, update handoffs) and the spawn-broker groupGone(). Every wait ran to its deadline and failed.

isProcessGroupGone() now makes that decision for both. The kernel probe still runs first. Only when the host itself denies the call (the same call against a group id above PID_MAX_LIMIT, which the kernel always answers with ESRCH, is refused too) does the /proc census decide, and it fails closed: a live member, a census error, or a /proc from another PID namespace keeps the group alive. A kernel EPERM from a member owned by another user keeps the old answer. When a broker group signal is denied, cleanup signals each member by PID after rechecking its pgid and start time, reusing the drain's existing per-member step.

Accepted edge cases, named rather than coded around:

  • Under the deny, each poll does a synchronous /proc scan. That is cheap in a sandbox (the OpenShell workload we checked has 6 processes) but scales with retained detached groups; sharing one census per tick is a possible follow-up.
  • A member that forks and exits in the middle of one scan can be missed, the same race the existing drain census accepts.
  • hidepid or a restricted /proc under the deny can still hide a member.

Follow-ups, not in this PR: agent-core killProcessTree group signals (used by exec-spawn stop, exec-termination, command custody, provider-local services, and a detached child lost with the broker before its group identity is recorded) still only signal the group, so under the deny those paths can now confirm extinction but cannot kill survivors.

Overlap: #189415 changes the same terminateBrokerProcessGroup confirmation for zombie-only groups and leaves permission handling alone. Its brokerGroupHasLiveMembers calls groupGone(), which this PR replaces with isProcessGroupGone(), so whichever lands second needs a one-line rename.

Evidence

Review follow-up on 2026-11-13

Rebased onto main at 6eb8095ae971f51bfa547644d4d249c21ebb8335. Both original production commits remain patch-identical after the rebase. Follow-up commit 1435ab73daa5adf addresses ClawSweeper's remaining P2 finding: the Node-only broker scenario now uses resolveTestNodeExecPath() for both execFile and resolveRuntimeWorkerArgv. All existing shutdown and child-extinction assertions are retained.

Focused proof on secretless AWS Linux, Node 24.22.1, with the rebased candidate's exact source tree verified before execution:

  • Pinned Bun fork: pnpm test src/process/spawn-broker/group-custody.test.ts --maxWorkers=1 — 3/3 pass, including the real kernel seccomp scenario. Wall time 54.45 s, including 43.15 s of cold worker compilation; test bodies total 1.09 s.
  • Node: the same suite plus cleanup-group.test.ts, service-child-group-ownership.test.ts, and exec-spawn.test.ts — 70/70 pass across 4 files, 13.86 s wall time.
  • Final formatting, targeted oxlint, and node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.services.json --incremental — pass. The final formatting-only adjustment leaves the tested behavior unchanged; the final checked source tree matches the pushed commit.
  • Independent local autoreview (Codex, P0–P2) of the launcher-repair delta from rebased head 985779b9ea9aea9, before mechanical formatting — no actionable findings. The existing full-PR ClawSweeper review covers 041b1b2509b; its sole remaining finding is addressed above. New-head broad CI is separate from these focused results.

Current-head CI and inherited failure

CI run 43438047021, attempt 1 tested head 1435ab73daa5adf104f489b4c2f88a915eb8083a in merge checkout b14d600d19758cb6aed4ceb911ffa4401c973a88 against main 64fd44bdaae8434611e841f4fb50d2443c9461f6. All 10 executed Node test shards and the executed lint, type, and security checks passed. CI remains failed, not green: checks-ui-e2e (1/3) timed out after 120000 ms in Read-only Home real Gateway > opens existing Home for a reader without granting writes and hides denied targets (ui/src/e2e/home-readonly.real-gateway.e2e.test.ts:45), making the downstream openclaw/ci-gate fail.

The same test, timeout, and suite stack already fail in scheduled main run 43425732822, attempt 1 at 777c036d592808418f95da97cf6b4ee6af614bbc. The test, its shared suite support, and src/gateway/server.ts are byte-identical between that baseline, the CI main parent, and the tested PR merge; this PR changes no UI or Gateway source. This qualifies as an inherited unrelated CI failure for the authorized landing exception. Its underlying UI cause is not repaired or claimed to be a proven flake. No CI rerun or branch refresh was made solely to seek green.

Contributor runtime and upgrade proof at 041b1b2509b

Red on the original merge base 664a791058e, green on 041b1b2509b, all under a real BPF filter that returns EPERM for kill() with a negative PID (the OpenShell rule; wrapper in the linked issue):

Check Base This PR
node openclaw.mjs doctor --fix --non-interactive, isolated HOME exit 1: "Command cleanup could not confirm that owned work stopped" exit 0: "Doctor complete."
SpawnBrokerHost close with an attached / detached child fails after 7.4 s: "Spawn broker group cleanup could not be confirmed … kill EPERM" closes in ~420 ms
Command scope settlement CommandProcessCleanupError after 10 s settles in 30 ms
settleCommandProcessGroups custody cleanup: "uncertain" after 10.3 s cleanup: "normal"

Upgrade from the latest stable: the published [email protected] npm release (registry integrity verified) was upgraded to the packed build at 041b1b2509b, with an isolated HOME, and Doctor ran under the same filter. On 2026.11.3, doctor --fix --non-interactive exits 1 with "Command cleanup could not confirm that owned work stopped" (exit 0 without the filter). After the upgrade, it exits 0 with "Doctor complete.", applies main's pending state and agent database migrations, and keeps the profile's four settings and all workspace files byte-identical. A rerun is clean. Steps, snapshot diff and redacted output: upgrade proof comment.

Committed regressions, each red on the pre-fix source:

  • group-custody.test.ts runs a real broker in its own Node process under the repo's kernel seccomp fixture (installKillGroupSeccompFilter) and checks that close settles and a detached descendant dies.
  • exec-spawn.test.ts covers scope settlement under a denied probe, that a kernel EPERM keeps the group alive without a census, and that the census never runs when the kernel probe works.
  • service-child-group-ownership.test.ts and cleanup-group.test.ts cover the census contract and per-member signalling (late joiners get SIGKILL, one unsignalable member does not stop the others, errors retry until the deadline, a foreign /proc signals nothing).

Contributor local checks at 041b1b2509b on Linux with Node 24 (OPENCLAW_VITEST_RUNTIME=node; the pinned Bun fork could not be staged on that host): 61 test files across src/process/spawn-broker, the supervisor service-child suites and every isChildProcessTreeAlive consumer pass. tsgo:core, tsgo:test:src, oxlint and oxfmt on the changed files, check:test-mock-exports, both import-cycle guards and check:docs pass. pnpm check passes every guard and typecheck lane. Its lint lane fails only on untouched files (mostly ui/), because of the plain-oxlint fallback without the Bun fork, and fails the same way on the base. proxy-retention.test.ts ("releases completed command proxies after the host closes") is flaky on main without this change (2 of 3 runs fail).

Size against the rebased merge base: production +229/-78 in three existing owners (child-process-tree.ts, service-child-group-ownership.ts, spawn-broker/cleanup.ts), tests +389 net, docs +4. The drain's own per-member signalling moved into the shared step rather than being duplicated.

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: L labels Nov 13, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Use a process census and individual process signals to settle Doctor and broker cleanup when Linux denies process-group signals.

Example: Run openclaw doctor --fix --non-interactive under a Linux seccomp filter denying negative-PID kill calls.

  • Before: Doctor exits 1 with “Command cleanup could not confirm that owned work stopped.”
  • After: Doctor completes maintenance and exits 0 with “Doctor complete.”

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The runtime and upgrade evidence clears the previous proof hold, but an introduced regression fixture currently fails the required CI gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied Linux Node 24 terminal results exercise Doctor and real broker cleanup under a kernel negative-PID filter; the new comment pins the packed reviewed head and demonstrates successful Doctor execution after upgrading published stable.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Doctor and spawn-broker shutdown report unsettled processes after owned work exits on Linux hosts denying process-group signals.
Reason: The report and stable-release reproduction establish a concrete owned failure, and the repair preserves working-host behavior without new settings.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR fixes a demonstrated Linux cleanup failure and now supplies the requested upgrade proof, but its new regression fixture fails CI by launching a Node-only broker scenario under Bun.

Priority: P1
Reviewed head: 041b1b2509b4682bd8484d8a3ada573245e509fc

Before merge

  • Launch the broker regression with an explicit Node executable (P2) - When Vitest runs under the pinned Bun runtime, process.execPath launches this fixture and its broker under Bun. The fixture requires Node's transferable command pipes, which supportsSpawnBrokerCommandTransport explicitly excludes on Bun; detached.stdout is consequently null and once(detached.stdout!, "data") crashes. Exact-head CI job checks-node-changed-compact-large-22 records this failure, preventing the regression from reaching its cleanup assertions. Resolve Node with resolveTestNodeExecPath(), pass that executable to both execFile and resolveRuntimeWorkerArgv(fixture, node), and retain the existing child-extinction assertions.

Findings

  • [P2] Launch the broker regression with an explicit Node executable — src/process/spawn-broker/group-custody.test.ts:78-80
Agent review details

How this fits together

Command scopes and spawn brokers retain subprocess custody until cleanup confirms extinction; the changed owners translate signal failures and process-table observations into termination and settlement outcomes.

flowchart TD
  A[Doctor and command scopes] --> B[Process group observation]
  C[Spawn broker shutdown] --> B
  B --> D[Kernel group probe]
  D --> E[Linux process census]
  C --> F[Revalidated member signals]
  E --> G[Cleanup settlement]
  F --> G
Loading

Technical review

Best possible solution:

Keep the shared observation and broker cleanup repair, and launch its Node-only regression fixture with the existing explicit Node resolver.

Do we have a high-confidence way to reproduce the issue?

Contributor-supplied terminal evidence reproduces the failure on published 2026.11.3 and the merge base under a real seccomp filter; source inspection confirms the mechanism, and no target code was executed during this review.

Is this the best way to solve the issue?

The production change repairs the owning observation boundary and reuses broker member signaling without adding configuration or persistence; the regression launcher needs a focused runtime-selection correction.

Full review comments:

  • [P2] Launch the broker regression with an explicit Node executable — src/process/spawn-broker/group-custody.test.ts:78-80
    When Vitest runs under the pinned Bun runtime, process.execPath launches this fixture and its broker under Bun. The fixture requires Node's transferable command pipes, which supportsSpawnBrokerCommandTransport explicitly excludes on Bun; detached.stdout is consequently null and once(detached.stdout!, "data") crashes. Exact-head CI job checks-node-changed-compact-large-22 records this failure, preventing the regression from reaching its cleanup assertions. Resolve Node with resolveTestNodeExecPath(), pass that executable to both execFile and resolveRuntimeWorkerArgv(fixture, node), and retain the existing child-extinction assertions.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b9f1e62e00d8.

Provenance checked

  • Process-group liveness changes intended behavior with a stated reason (70dc991: Permission errors must retain custody rather than falsely certify cleanup.)
  • Broker member signaling keeps the original intent (98813c2: Broker shutdown joins native cleanup and signals descendants only after validating group membership and process identity.)
  • Lost-child settlement changes intended behavior with a stated reason (083e253: Attached cleanup must await the captured tree rather than only the root; detached cleanup needs group-extinction observation.)
  • Service-child group census keeps the original intent (2d345fa: Observe owned-group retirement on Linux without requiring /bin/ps while preserving uncertainty on incomplete observations.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • OPENCLAW_VITEST_RUNTIME=bun pnpm test src/process/spawn-broker/group-custody.test.ts
  • OPENCLAW_VITEST_RUNTIME=node pnpm test src/process/spawn-broker/group-custody.test.ts
  • node scripts/check-changed.mjs -- src/process/spawn-broker/group-custody.test.ts
  • git diff --check

What I checked:

PR surface

Source +151, Tests +387, Docs +4. Total +542 across 13 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 229 78 +151
Tests 9 398 11 +387
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 631 89 +542

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P1: The demonstrated failure prevents Doctor maintenance and clean broker shutdown on affected Linux sandboxes, blocking reported agent startup after upgrades.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-13T06:24:18.887Z sha 041b1b2 :: needs real behavior proof before merge. :: none

Reviewed November 13, 2026, 8:29 AM ET / 13:29 UTC (Revision 2).

@EmilienM
EmilienM marked this pull request as ready for review November 13, 2026 12:55
@EmilienM

Copy link
Copy Markdown
Contributor Author

This is the latest-stable upgrade run you asked for. We upgraded the published [email protected] npm release to this PR's packed build. Every Doctor run below used the same OpenShell-style negative-PID kill filter (negpid_seccomp.py, from the linked issue).

Setup: Linux x86_64, Node 24.22.1, an isolated HOME and npm prefix, no Gateway, no credentials. We verified the stable tarball against the registry sha512 integrity. The PR build comes from node scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelog at 041b1b2509b; the tarball check passed.

Step Build Filter Result
setup --baseline, then 4 config sets and 2 workspace edits 2026.11.3 (847611d) no profile created
doctor --fix --non-interactive 2026.11.3 (847611d) no exit 0, Doctor complete.
doctor --fix --non-interactive 2026.11.3 (847611d) yes exit 1, Command cleanup could not confirm that owned work stopped
npm install -g --prefix <prefix> openclaw-2026.11.3.tgz (PR build) now 2026.11.3 (041b1b2) no upgraded
doctor --fix --non-interactive 041b1b2 yes exit 0, Doctor complete., migrations applied
doctor --fix --non-interactive again 041b1b2 yes exit 0, no pending repairs

The PR build carries main's version string, so openclaw --version shows the build commit change: 2026.11.3 (847611d) before, 2026.11.3 (041b1b2) after.

Profile snapshot before the upgrade, then after the first filtered Doctor run on the PR build:

config.gateway.port = 18999                              unchanged
config.agents.defaults.timeoutSeconds = 900              unchanged
config.logging.level = debug                             unchanged
config.agents.entries.main.identity.name = Proof Agent   unchanged
workspace AGENTS.md, BOOTSTRAP.md, IDENTITY.md, SOUL.md,
  USER.md (edited), memory/2026-11-13.md (added)         same sha256
state DB user_version   22 -> 40   (main's migrations since 2026.11.3)
state DB tables        101 -> 98   (same migrations)
agent DB user_version   27 -> 42   (pre-migration backups written by Doctor)

This PR adds no schema or config changes. The version bumps come from migrations main gained since the stable tag, and they ran to completion under the filter.

Redacted output

Stable 2026.11.3 under the filter (complete output):

┌  OpenClaw doctor
Command cleanup could not confirm that owned work stopped

PR build under the filter (Doctor phase lines; $WORK is the scratch directory):

Doctor: maintenance begin
Doctor: database migrations
- Upgraded agent database schema in $WORK/home/.openclaw/agents/main/agent/openclaw-agent.sqlite: v27 -> v42.
Doctor: maintenance ready
Doctor: maintenance finish
Doctor: maintenance release
└  Doctor complete.

We also ran a control without the filter on the PR build. It printed the same agent-db debug lines (integrity gate ... outcome=pending, clean-close receipt), so those lines don't come from the filter. A real deployment shows the same failure: an OpenShell-sandboxed OpenClaw Enterprise Agent logged Doctor root process extinction could not be proven on 2026.10.8 (openclaw/openclaw-enterprise#5706).

@EmilienM

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@sallyom sallyom self-assigned this Nov 13, 2026
EmilienM and others added 3 commits November 13, 2026 13:47
…roup probes are denied

Some Linux sandboxes deny kill(2) with a negative PID. OpenShell's child
seccomp filter returns EPERM for any process-group signal, including the
signal 0 probe. isChildProcessTreeAlive() treated that EPERM as "alive"
forever, so command scopes, Doctor process custody and update handoffs
never confirmed that a finished group was gone, and Doctor failed with
"Command cleanup could not confirm that owned work stopped".

isProcessGroupGone() now makes that decision for isChildProcessTreeAlive()
and spawn-broker cleanup. The kernel probe still runs first and ESRCH
still means gone. An EPERM only counts as a host denial when the same
call against a group id above PID_MAX_LIMIT, which the kernel always
answers with ESRCH, is refused too; a kernel EPERM from a member owned by
another user keeps the group alive as before. On a denial, the /proc
census decides: the group is gone when no member with that pgid is
alive. A census failure, or a /proc that is not this PID namespace's,
keeps the group alive. Hosts where group probes work take the same path
as before.

Signed-off-by: Emilien Macchi <[email protected]>
… denied

Under a host that denies kill(2) with a negative PID, spawn-broker cleanup
could neither probe nor signal its process groups. SpawnBrokerHost.close()
failed with "Spawn broker group cleanup could not be confirmed ... kill
EPERM", and the worker's retained detached groups rethrew EPERM and left
the broker hanging. Doctor inspection cleanup then reported unfinished
spawn-broker resources.

Every broker group probe now goes through isProcessGroupGone(). When a
group signal is denied, terminateBrokerProcessGroup() and the retained
detached cleanup signal each census member by PID instead, after
rechecking its pgid and start time, and repeat the current signal on
every poll so members that join later are covered. One member that
cannot be signaled no longer stops the others, and both paths record
errors and retry until their deadline. The drain's existing per-member
step is shared for this rather than copied. A detached lost child
settles on the same group decision; without a recorded group identity
it can be confirmed but still not signaled, as the docs now say.

The host-side regression runs a real broker under the kernel seccomp
fixture that denies group signals. When group signals work, cleanup
takes the same path as before.

Signed-off-by: Emilien Macchi <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the fix-spawn-broker-group-cleanup-eperm branch from 041b1b2 to 1435ab7 Compare November 13, 2026 13:56
@roboclaw-bot
roboclaw-bot merged commit 708c378 into openclaw:main Nov 13, 2026
132 of 136 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Congrats on your first OpenClaw PR, @EmilienM! The Doctor can finish its rounds again. 🦞 Thanks for the thoughtful fix and thorough upgrade proof!

— @sallyom & Roboclaw

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 14, 2026
…es process-group signals (openclaw#198132)

* fix(process): confirm process-group extinction from the census when group probes are denied

Some Linux sandboxes deny kill(2) with a negative PID. OpenShell's child
seccomp filter returns EPERM for any process-group signal, including the
signal 0 probe. isChildProcessTreeAlive() treated that EPERM as "alive"
forever, so command scopes, Doctor process custody and update handoffs
never confirmed that a finished group was gone, and Doctor failed with
"Command cleanup could not confirm that owned work stopped".

isProcessGroupGone() now makes that decision for isChildProcessTreeAlive()
and spawn-broker cleanup. The kernel probe still runs first and ESRCH
still means gone. An EPERM only counts as a host denial when the same
call against a group id above PID_MAX_LIMIT, which the kernel always
answers with ESRCH, is refused too; a kernel EPERM from a member owned by
another user keeps the group alive as before. On a denial, the /proc
census decides: the group is gone when no member with that pgid is
alive. A census failure, or a /proc that is not this PID namespace's,
keeps the group alive. Hosts where group probes work take the same path
as before.

Signed-off-by: Emilien Macchi <[email protected]>

* fix(process): clean spawn-broker groups when negative-PID signals are denied

Under a host that denies kill(2) with a negative PID, spawn-broker cleanup
could neither probe nor signal its process groups. SpawnBrokerHost.close()
failed with "Spawn broker group cleanup could not be confirmed ... kill
EPERM", and the worker's retained detached groups rethrew EPERM and left
the broker hanging. Doctor inspection cleanup then reported unfinished
spawn-broker resources.

Every broker group probe now goes through isProcessGroupGone(). When a
group signal is denied, terminateBrokerProcessGroup() and the retained
detached cleanup signal each census member by PID instead, after
rechecking its pgid and start time, and repeat the current signal on
every poll so members that join later are covered. One member that
cannot be signaled no longer stops the others, and both paths record
errors and retry until their deadline. The drain's existing per-member
step is shared for this rather than copied. A detached lost child
settles on the same group decision; without a recorded group identity
it can be confirmed but still not signaled, as the docs now say.

The host-side regression runs a real broker under the kernel seccomp
fixture that denies group signals. When group signals work, cleanup
takes the same path as before.

Signed-off-by: Emilien Macchi <[email protected]>

* test(process): run denied-group broker fixture with Node

Co-authored-by: sallyom <[email protected]>

---------

Signed-off-by: Emilien Macchi <[email protected]>
Co-authored-by: sallyom <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 17, 2026
Backport #198132. Classify host-denied negative-PID probes separately
from genuine kernel EPERM and use a bounded namespace-checked census
for command and broker group extinction. Reuse identity-revalidated
member signaling for broker cleanup, including late members and KILL
escalation. Keep service-relay anchor proof kernel-only.

The real seccomp broker baseline left a descendant alive and failed
shutdown; all 180 targeted cases now pass across 12 files.

(cherry picked from commit 708c378)

Signed-off-by: Emilien Macchi <[email protected]>
Co-authored-by: sallyom <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Doctor and spawn-broker cleanup fail when the host denies process-group signals (OpenShell sandbox)

3 participants