Skip to content

fix(update): restore survivor auto-auth restart proof - #159498

Merged
steipete merged 2 commits into
mainfrom
steipete/update-service-membership-empty-cgroup
Sep 27, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/update-service-membership-empty-cgroup

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes the published upgrade-survivor auto-auth lane refusing its candidate-driven recovery update with service-membership-unverified after #158314. Both manager shims reported a live Gateway PID with an empty ControlGroup.

User Impact

No production behavior change. Production LOC delta is 0. The native membership guard still refuses running services with missing or unreadable containment evidence and still ignores inherited service markers as proof of membership.

Update behavior is unchanged for shipped 2026.9.x drivers. In particular, v2026.9.6 does not contain service-process-membership.ts; it drives the first hop before the candidate is installed. The failing recovery hop is driven by the installed candidate, which contains the newer guard. This harness-only fix supplies real native facts to that hop; it does not patch an already-running shipped updater or change its post-swap contracts.

Why This Change Was Made

Systemd legitimately returns an empty ControlGroup for a drained inactive or failed unit. Its shared user/system manager property getter returns the cached cgroup path, with null meaning no cgroup. Inactive/failed transitions prune it, while lingering processes or unreadable emptiness retain it. A running Gateway is placed in a cgroup before spawning. Active/exited oneshot units can also have no cgroup; active alone is not sufficient evidence.

OpenClaw already bypasses this guard for a nonrunning service without a PID. On macOS the guard uses live process groups and launchctl print pid/<pid> resource coalitions, not a unit cgroup; stopped jobs have no PID, and unavailable live membership stays unknown. Therefore this repair belongs to the fixture.

Auto-auth containers now create a private cgroup subtree, drop setup capabilities, and move the ExecStart shell into it before launching the Gateway. Both manager adapters report the same native cgroup while it owns work and report an empty value once settled. Cgroup population also prevents surviving descendants from being mistaken for a stopped service. The restart/replacement assertions remain intact. This requires cgroup v2 and Docker's private cgroup namespace. SYS_ADMIN is used only for initial remount and removed before the scenario; the host hierarchy is never bind-mounted. A credential-free, network-disabled container first ensures Docker has loaded docker-default. The bootstrap requests that profile on exec, drops all capability sets, and verifies the payload is under docker-default (enforce) on AppArmor hosts. Docker's capability-dependent seccomp configuration is not claimed to be identical to a stock container.

Evidence

  • Regression: new adapter tests fail on the original fixture's missing cgroup output and pass with the fix. pnpm test test/scripts/upgrade-survivor-systemd-cgroup.test.ts --maxWorkers=1: 3 passed, final command wall 10.86 s, test execution under 50 ms; Linux CI: 0.012 s test time. No added processes, timers, or sleeps.
  • Existing owner suite: pnpm test test/scripts/upgrade-survivor-systemd.test.ts --maxWorkers=1: 14/15 passed, 152.73 s wall. Same-order replay: 14/15 passed, 156.31 s wall, failing a different loaded-runtime read. Initial failure was binds installation paths ... custom=false (expected stopped, got unknown); replay failure was stopped-state inspection after the terminal/restart lifecycle test. Isolated initial case passed (96.41 s wall). Host load/deadline sensitivity is suspected but not proven; no timeouts, assertions, or baselines were weakened, and a passing replay is not claimed as a fix.
  • pnpm update:compat:check: passed for all pinned 2026.9.1–2026.9.6 lazy-import inventories.
  • Changed-check dry run and all runnable checks: passed, including root-test typecheck, lint, formatting, Docker boundary guard, and unused-export scans. git diff --check: passed.
  • Independent Codex autoreview: scoped-clean at P0/P1, including the confinement follow-up.
  • Initial CI run 36301916281 failed in upgrade-survivor-plugin-registry.test.ts because its direct auto-auth case still asserted no --user option; downstream jobs were canceled. The correction verifies root setup, a private cgroup namespace, and the setup-before-timeout command, while retaining manual-mode assertions for no added user/capability/security options. Full file: 42 passed, 110.29 s wall on macOS; follow-up focused shell cases after the confinement change: 3 passed, 8.04 s wall. This existing process-heavy shell-contract suite runs both Bash variants on macOS; the existing shell-process fixture is reused, with no new test cases or timers. Linux CI corrected file: 38 passed, 13.215 s test time (job 74 s including setup).
  • Testbox native mechanism probe: passed on tbx_01m3gt8p7xqethj5bw799f5jbw; unprivileged child with setup capabilities dropped observed 0::/openclaw-gateway.service, then populated 0 after exit. Lease stopped.
Baseline Scenario Restart mode Result Lease
2026.9.6 base, live=0 default/manual LANE_EXIT=0; final Gateway startup/status and preservation probes passed tbx_01m3gvknbbdqy25325dt734bm4 (stopped)
2026.9.6 base, live=0 auto-auth after AppArmor follow-up LANE_EXIT=0 on 5ef7f2782b1e; recovery restart replaced supervisor, final probes passed tbx_01m3gyjbqezycyjkbt4p32c9v8 (stopped)

Review disposition

The persistent AppArmor reduction finding is accepted and fixed in 5ef7f2782b1e; the exact-head auto-auth lane passed. Its retained tail does not include the profile-label line, so separate live AppArmor enforcement proof is not claimed. The claimed same-user cgroup-containment violation is rejected: this fixture models a systemd user manager. [email protected] delegates the user's subtree, and cg_set_access assigns that user the writable migration files. Kernel migration rules therefore allow deliberate movement inside that delegated subtree on real hosts too. The production guard proves current membership and protects updater survival across ordinary reparenting/detachment; it does not impose an adversarial same-UID isolation boundary. OpenClaw's operator trust model uses separate OS users/hosts for adversarial isolation. Moving a Gateway outside its reported cgroup continues to fail native validation.

Coordinator decision — accepted trusted-fixture boundary

The coordinator ACCEPTS the documented trusted-fixture boundary; no separate syscall-filter work is required. The auto-auth fixture runs only in the upgrade-survivor Docker lane (CI docker-seed job, Testbox, manual dispatch). Fork PRs run that job on ephemeral GitHub-hosted runners without repository secrets, where the same PR code already executes directly on the runner in other steps, so a broader in-container syscall filter grants no capability an attacker lacks; member PRs are trusted code. After setup the payload drops all capabilities (empty bounding, inheritable, and ambient sets), sets no_new_privs, and restores the docker-default AppArmor profile, so the SYS_ADMIN-selected seccomp allowances are not usable for privileged operations. The fixture proves native membership and updater survival, not hostile-code isolation within one account.

Release note: none (internal test harness). Both required lanes passed: manual on 972300e9eab3 (unchanged path), and auto-auth again on final head 5ef7f2782b1e. Provider portal synchronization timed out after successful receipts and confirmed lease stops. CI run 36304868208 and the required openclaw/ci-gate passed. The tooling dependency mismatch was resolved by its owner. Native review and preparation are being refreshed to record the coordinator's acceptance; no code changes are authorized or needed.

@clawsweeper

clawsweeper Bot commented Sep 27, 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 scripts Repository scripts docker Docker and sandbox tooling size: S labels Sep 27, 2026
@steipete
steipete marked this pull request as ready for review September 27, 2026 07:03
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 5:16 AM ET / 09:16 UTC (Revision 6).

ClawSweeper review

What this changes

The branch places the Docker upgrade test’s simulated Gateway service in a private Linux cgroup and reports its membership during automatic authenticated restart, with regression coverage.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. Current main still supplies an empty cgroup for a live simulated Gateway, so the merged native-membership guard prevents the published upgrade lane from proving automatic restart. The branch has direct final-head upgrade evidence, and the coordinator accepted the documented Docker-fixture security tradeoff.

Priority: P2
Reviewed head: 5ef7f2782b1e4bf10b270d1d55a657b164a59c2d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture repair has direct final-head upgrade evidence, compatible fixture metadata, and an explicitly accepted confinement tradeoff.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The changed Docker fixture creates native service membership; the PR body records a final-head Testbox upgrade from published v2026.9.6 to the candidate with successful automatic restart, supervisor replacement, and final Gateway probes. CI is supplemental because its Docker seed job was skipped. The fixture-only runtime JSON adds an optional field, is freshly written for the lane, and remains readable in its older shape.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The changed Docker fixture creates native service membership; the PR body records a final-head Testbox upgrade from published v2026.9.6 to the candidate with successful automatic restart, supervisor replacement, and final Gateway probes. CI is supplemental because its Docker seed job was skipped. The fixture-only runtime JSON adds an optional field, is freshly written for the lane, and remains readable in its older shape.
Evidence reviewed 10 items Current main still lacks the fixture fact: The simulated manager returns an empty ControlGroup when queried, including while its Gateway PID is live; none of the six PR paths changed between the merge base and fetched main.
Production guard requires native membership: On Linux, an absent or empty systemd ControlGroup yields unknown membership; the update preflight turns unknown membership into service-membership-unverified.
Introduced fixture behavior: The branch reads cgroup population, reports the service cgroup while work remains, and places the ExecStart shell in that cgroup before starting Gateway descendants.
Findings None None.
Security None None.

How this fits together

The upgrade-survivor Docker lane starts a published OpenClaw install, updates it to a candidate, and checks that the Gateway and its state survive. A simulated systemd user manager supplies service facts to the candidate updater’s native membership check.

flowchart LR
 A[Published OpenClaw install] --> B[Docker upgrade lane]
 B --> C[Private service cgroup]
 C --> D[Simulated systemd manager]
 D --> E{Native membership check}
 E --> F[Candidate restart]
 F --> G[Gateway and state probes]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +96, Other +49. Total +145 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 98 2 +96
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 61 12 +49
Total 6 159 14 +145

Review metrics

Metric Value Why it matters
New regression cost 3 cases; 0.012 s Linux test time The new manager-adapter cases cover live, draining, and stopped cgroup states within the per-PR test budget.

Stored data model

Persistent data-model change detected: migration/backfill/repair: scripts/e2e/lib/upgrade-survivor/cgroup-entrypoint.sh, migration/backfill/repair: scripts/e2e/lib/upgrade-survivor/systemd-fixture.mjs, migration/backfill/repair: scripts/e2e/lib/upgrade-survivor/update-restart-auth.sh, migration/backfill/repair: scripts/e2e/upgrade-survivor-docker.sh, serialized state: scripts/e2e/lib/upgrade-survivor/systemd-fixture.mjs, serialized state: scripts/e2e/lib/upgrade-survivor/update-restart-auth.sh, and 2 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep the production membership guard and land the fixture-owned containment repair so published-driver-to-candidate upgrades continue to verify restart safety.

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

Yes. Current-main source supplies an empty cgroup for the live fixture while the candidate’s Linux guard requires one, giving a specific published-2026.9.6-to-candidate auto-auth reproduction path. I did not execute it in this read-only checkout.

Is this the best way to solve the issue?

Yes. Supplying native facts at the simulated systemd owner is narrower than weakening the production guard, and the branch preserves the existing restart assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 023af0d31935.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed Docker fixture creates native service membership; the PR body records a final-head Testbox upgrade from published v2026.9.6 to the candidate with successful automatic restart, supervisor replacement, and final Gateway probes. CI is supplemental because its Docker seed job was skipped. The fixture-only runtime JSON adds an optional field, is freshly written for the lane, and remains readable in its older shape.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed Docker fixture creates native service membership; the PR body records a final-head Testbox upgrade from published v2026.9.6 to the candidate with successful automatic restart, supervisor replacement, and final Gateway probes. CI is supplemental because its Docker seed job was skipped. The fixture-only runtime JSON adds an optional field, is freshly written for the lane, and remains readable in its older shape.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs an internal published-upgrade proof lane without changing production update behavior.
  • merge-risk: 🚨 security-boundary: Docker setup briefly uses SYS_ADMIN and an unconfined AppArmor phase; the coordinator accepted that trusted-fixture tradeoff for this exact head.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed Docker fixture creates native service membership; the PR body records a final-head Testbox upgrade from published v2026.9.6 to the candidate with successful automatic restart, supervisor replacement, and final Gateway probes. CI is supplemental because its Docker seed job was skipped. The fixture-only runtime JSON adds an optional field, is freshly written for the lane, and remains readable in its older shape.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Docker fixture creates native service membership; the PR body records a final-head Testbox upgrade from published v2026.9.6 to the candidate with successful automatic restart, supervisor replacement, and final Gateway probes. CI is supplemental because its Docker seed job was skipped. The fixture-only runtime JSON adds an optional field, is freshly written for the lane, and remains readable in its older shape.

Evidence

What I checked:

  • Current main still lacks the fixture fact: The simulated manager returns an empty ControlGroup when queried, including while its Gateway PID is live; none of the six PR paths changed between the merge base and fetched main. (scripts/e2e/lib/upgrade-survivor/systemd-fixture.mjs:353, 023af0d31935)
  • Production guard requires native membership: On Linux, an absent or empty systemd ControlGroup yields unknown membership; the update preflight turns unknown membership into service-membership-unverified. (src/daemon/service-process-membership.ts:128, 5ef7f2782b1e)
  • Introduced fixture behavior: The branch reads cgroup population, reports the service cgroup while work remains, and places the ExecStart shell in that cgroup before starting Gateway descendants. (scripts/e2e/lib/upgrade-survivor/systemd-fixture.mjs:224, 5ef7f2782b1e)
  • Systemd cgroup contract: The v256 property getter reports an empty string when a unit has no cgroup; inactive or failed transitions prune the unit cgroup. The cited SHA is the verified v256 tag target. (src/core/dbus-unit.c:1212, 5c79cdec10a5)
  • Fixture metadata compatibility: The shim writes fresh test-local runtime metadata. Its new controlGroup field is optional in the reader, so an older metadata shape retains the prior behavior without rewriting user state. (scripts/e2e/lib/upgrade-survivor/update-restart-auth.sh:29, 5ef7f2782b1e)
  • Direct upgrade proof: The captured PR body reports a final-head Testbox run from published 2026.9.6 to the candidate in auto-auth mode: LANE_EXIT=0, supervisor replacement, and passing final Gateway probes. It also reports the manual baseline lane passing. The raw retained tail does not establish whether AppArmor was enabled on that host.

Likely related people:

  • Peter Steinberger: Raw commit 6209f31 adds src/daemon/service-process-membership.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6209f31ce9bb; files: src/daemon/service-process-membership.ts)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-27T07:11:59.455Z sha 972300e :: needs real behavior proof before merge. :: [P2] Keep parent-cgroup migration under manager authority | [P2] Keep live provider keys out of the unconfined container
  • reviewed 2026-09-27T08:11:27.889Z sha 5ef7f27 :: needs real behavior proof before merge. :: [P2] Preserve the payload's default seccomp restrictions
  • reviewed 2026-09-27T08:41:38.478Z sha 5ef7f27 :: needs real behavior proof before merge. :: [P2] Restore the candidate payload’s normal seccomp restrictions
  • reviewed 2026-09-27T08:56:18.469Z sha 5ef7f27 :: needs real behavior proof before merge. :: [P2] Restore the payload's normal seccomp restrictions
  • reviewed 2026-09-27T09:08:47.533Z sha 5ef7f27 :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. label Sep 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Coordinator decision for this prepared head (5ef7f2782b1e4bf10b270d1d55a657b164a59c2d):

The coordinator ACCEPTS the documented trusted-fixture boundary; no separate syscall-filter work is required. The auto-auth fixture runs only in the upgrade-survivor Docker lane (CI docker-seed job, Testbox, manual dispatch). Fork PRs run that job on ephemeral GitHub-hosted runners without repository secrets, where the same PR code already executes directly on the runner in other steps, so a broader in-container syscall filter grants no capability an attacker lacks; member PRs are trusted code. After setup the payload drops all capabilities (empty bounding, inheritable, and ambient sets), sets no_new_privs, and restores the docker-default AppArmor profile, so the SYS_ADMIN-selected seccomp allowances are not usable for privileged operations. The fixture proves native membership and updater survival, not hostile-code isolation within one account.

The decision is recorded in the PR body and validated READY review artifact. Native preparation succeeded, both required upgrade lanes passed, and the head's CI passed. No code changes were made for this acceptance.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Sep 27, 2026
@steipete
steipete merged commit 31ecca4 into main Sep 27, 2026
150 checks passed
@steipete
steipete deleted the steipete/update-service-membership-empty-cgroup branch September 27, 2026 09:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
* fix(update): give survivor restart fixtures native cgroup membership

* fix(update): restore survivor payload confinement after setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant