Repository navigation
fix: complete root updates of a system service that runs as another account - #207230
Open
fuller-stack-dev wants to merge 44 commits into
Open
fuller-stack-dev wants to merge 44 commits into
fuller-stack-dev wants to merge 44 commits into
Conversation
…count When root updates a package whose selected systemd system unit runs it as another account, candidate admission now runs as that account against the unit's state, and the post-activation Doctor child stops the unit, runs the account's own update migrate, starts the unit, verifies it serves the new build, and records the run with update finish. A failure restores the state as the account and starts the unit again once the previous package is back. The openclaw#206343 refusal stays as the fallback when the account cannot be used.
Address review: root's runuser now runs with a trusted environment and the unit's environment reaches the account's process through an owner-only handoff file, so loader variables never reach a root process. Restores require a confirmed stop, and the run record and backup retirement wait until the installed updater has settled the package, restoring the state as the account if that updater put the previous package back.
…lapping selectors Address review: an unscheduled settle step keeps the backup instead of retiring it early, a caller whose state or config overlaps the service's (by canonical path) stays on the refusal, and the serving entry is found after runtime options in the unit's command.
…updater Address review: the transient settle step reads the account's bounded status word before restarting or retiring anything, keeps the backup when the installed updater outlives its deadline, and the activation fixture runs the release entry the way a unit does.
When the settle step cannot be scheduled, restore the account's state instead of reporting success, since a later package restore by the installed updater would otherwise pair the previous package with migrated state.
…cgroups Address review: migrate, restore and finish print Doctor output before an indented JSON result, so the final object is parsed; a stop counts only when the unit is inactive and its cgroup is empty, in both the Doctor child and the settle step. Hand files over under root's sticky /tmp, which the account can traverse, and show a bounded line of the account's error when its admission fails.
… admission Installed updaters stage the candidate in a 0700 directory. For the account's own admission, root adds only the traverse bit to its own ancestors that lack it and restores each mode afterwards. The settle step now parses the final JSON result like the Doctor child, checks the current and captured cgroup, and an unconfirmed first stop no longer starts the new package. Tests run the scheduled settle script against stand-ins.
…count's class Address review: root no longer adds traverse bits to arbitrary private ancestors. Only the installed updater's .openclaw.update-stage-* directory gets the traverse bit of the permission class the account falls in, and a staged release under any other directory the account cannot enter refuses.
…pped restart Root's own service inspection cannot read a unit that runs as another account. When that unit already serves this release because its account's steps ran earlier in the update, the warning now says so instead of claiming the restart was skipped and pointing at update repair.
… HOME Address review: the account keeps its update backup under the unit's HOME, so admission now checks that HOME is a directory the account owns and can write, instead of failing the migration after the service was stopped.
Address review: the settle step treats a package whose build differs from the candidate's as the restored previous package, so a same-version replacement restores the account's state instead of retiring the backup.
…when settling Address review: the settle step follows the installation path the unit uses, so a release-slot rollback that moves the link back is seen as the previous package.
The Docker cell showed the skipped-restart warning still comes from another finalization path, so the hook did not change what operators see. Keep the lint fix it carried.
Address review: the transient settle step is scheduled after the unit is confirmed stopped and before the account's migration, so if this process ends early, for example at the installed updater's deadline, the state is still reconciled once that updater exits. A migration that never backed anything up left the state unchanged, so the previous package may start. Root-run test fixtures give the stand-in account its HOME.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
obviyus
added a commit
that referenced
this pull request
Nov 28, 2026
- Run only the recorded runtime's version probe as User= with a sanitized environment; refuse before replacement with its cause and next step. - Reuse the byte-identical systemd-service-account-command helper from #207230 without its bridge orchestration. - Use blocking systemctl restart before checking activity, rather than observing a queued RestartUnit job. - Focused source proof: 19 tests pass; scoped formatting and lint pass. Root never runs service state maintenance. Co-authored-by: Jason (Json) <[email protected]>
obviyus
added a commit
that referenced
this pull request
Nov 28, 2026
## What Problem This Solves A root-owned global OpenClaw package can serve a systemd system unit running as another account (`User=`). Updating it as root must not run state work against `/root` or write the service account's state as root. Today the cross-account candidate refuses and prints a manual procedure. ## User Impact For a positively identified matching system unit, `sudo openclaw update --yes` replaces only the package as root and restarts the existing unit. Its own boot, running as `User=`, owns migrations and plugin convergence. Root does not run Doctor, finalize, snapshots, config/RPC/run writes, or update-report persistence. The CLI requires systemd to report the unit active and prints `systemctl status <unit>` and `journalctl -u <unit>` without claiming readiness. The existing HTTP readiness helper needs the service's TLS configuration; root must not open that state, so this path uses the systemd-active fallback instead of assuming HTTP. A failed restart or inactive unit fails the CLI. `--no-restart` explicitly reports that the package still needs activation. The saved update channel is not changed by this package-only path. ## Why This Change Was Made This follows the maintainer-directed package/state ownership split: root owns package replacement; the service owns state at boot. The branch occurs before update state setup and reuses #206343's installation/unit identification, the existing staged package installer, and the blocking systemctl owner. A state-free `runuser ... <recorded runtime> --version` probe runs as `User=` before replacement, with a sanitized launch environment; failure or an incompatible version refuses with its cause and next step. No service-controlled runtime is executed as root. The manual-procedure shell formatter and its obsolete tests are removed; shipped-candidate and non-root cross-account state checks remain refused, with a working documented manual recovery route for older installed updaters. Scope boundary: the remaining frozen bridge state readers are not migrated or orchestrated here; they stay for their shipped contracts until the first-hop floor permits bridge deletion. launchd, Windows, and single-account update paths are unchanged. Thanks to @fuller-stack-dev for #206343's system-account identification and #207230's 33-line `src/daemon/systemd-service-account-command.ts` helper. The original helper functions and synchronous argv API remain unchanged at the same path. The only addition is a 23-line NSS login-name resolver: systemd accepts numeric `User=1001`, but `runuser -u` requires its login name. None of #207230's bridge orchestration is inherited, and its branch remains untouched. The helper contribution is credited with the verified GitHub noreply co-author trailer. Author pr-simplify completed: one reused identification and package operation, no new persisted records, statuses, phases, leases, notices, retries, flags, or triggers. Against `dfd17d025fe0`: production net **+227 lines**, test net **+189**, docs net **+23**. The positive production net is the complete package/runtime-check/restart operation replacing a refusal, plus the command helper and numeric-account resolution. No state-maintenance or bridge orchestration is added. ## Evidence - Red on the unchanged main source (`dfd17d025fe0`): the new real `updateCommand` boundary regression reached the forbidden root state-setup tripwire instead of replacing the package/restarting the unit. - Final head `18627bcd4b65641eb80a69a774b3e0d01a97ae6c`: source regressions passed with the repository wrappers under both the pinned Bun fork (11 tests) and Node (21 tests including candidate admission), 94.11 s combined wall time. The earlier full focused selection, including unchanged `src/update/cli.test.ts`, passed 64 tests on `c8bd81b367df0fd02389453b6cc54eea7d755207`. - Scoped Oxfmt and type-aware Oxlint checks pass on the three repaired files (19.71 s); earlier scoped formatting and lint cover the unchanged files. - Unit proof covers default root state and explicit service-state selectors, account-isolated version-probe argv/environment, numeric UID-to-login resolution and mismatched NSS rejection, incompatible recorded Node and exact probe failures before replacement, blocking restart completion, restart failure/inactive units, and `--no-restart`. Package installation, NSS lookup, the version-probe subprocess, and native service operations are mocked at their existing I/O boundaries; this is not live systemd proof. - No existing system-unit-with-`User=` proof harness was found. `ci-published-driver-update.yml` / `scripts/e2e/lib/upgrade-survivor/native-systemd.mjs` uses `systemctl --user`, not system units. No hosted container run is claimed. Proof is unit tests plus PR CI. - Full builds/type checks are left to hosted CI per the host constraint. First-head CI: https://github.com/openclaw/openclaw/actions/runs/46119231572 — architecture failed on the untouched `ui/src/pages/skill-workshop/action-presentation.ts` ↔ `skill-workshop-page.tsx` Madge cycle; runtime import-cycle and Kysely checks passed. - Prior-head CI (`6804c4623254ca899dcab5d01f794f2f58ae3057`): https://github.com/openclaw/openclaw/actions/runs/46120628365 caught a fixture bug: its Bun shard made `process.execPath` describe a Bun service, so the intended Node-engine refusal did not apply. The fixture now records `/usr/bin/node` independently of the runner, preserving every refusal assertion. The two unnecessary deferred type arguments were also removed. Final-head CI is pending; no local full build or third review is claimed. - Local ClawSweeper completed two rounds. Its TLS/legacy-recovery findings and then its service-runtime/queued-restart findings were repaired. The latter now uses the maintainer-approved state-free account probe and blocking systemctl restart. No third review is claimed; the package-only/no-root-state contract and unit+CI proof scope are the maintainer-selected direction. Related: #204775, #206343. No release branch changes. Co-authored-by: Jason (Json) <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Collaborator
|
Thanks for this, and for #206343. Your #207304 is the direction we're taking for this layout, so I'd suggest closing this PR:
If you see a case on this layout that #207304 still gets wrong, a failing repro against current |
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 29, 2026
…law#207304) ## What Problem This Solves A root-owned global OpenClaw package can serve a systemd system unit running as another account (`User=`). Updating it as root must not run state work against `/root` or write the service account's state as root. Today the cross-account candidate refuses and prints a manual procedure. ## User Impact For a positively identified matching system unit, `sudo openclaw update --yes` replaces only the package as root and restarts the existing unit. Its own boot, running as `User=`, owns migrations and plugin convergence. Root does not run Doctor, finalize, snapshots, config/RPC/run writes, or update-report persistence. The CLI requires systemd to report the unit active and prints `systemctl status <unit>` and `journalctl -u <unit>` without claiming readiness. The existing HTTP readiness helper needs the service's TLS configuration; root must not open that state, so this path uses the systemd-active fallback instead of assuming HTTP. A failed restart or inactive unit fails the CLI. `--no-restart` explicitly reports that the package still needs activation. The saved update channel is not changed by this package-only path. ## Why This Change Was Made This follows the maintainer-directed package/state ownership split: root owns package replacement; the service owns state at boot. The branch occurs before update state setup and reuses openclaw#206343's installation/unit identification, the existing staged package installer, and the blocking systemctl owner. A state-free `runuser ... <recorded runtime> --version` probe runs as `User=` before replacement, with a sanitized launch environment; failure or an incompatible version refuses with its cause and next step. No service-controlled runtime is executed as root. The manual-procedure shell formatter and its obsolete tests are removed; shipped-candidate and non-root cross-account state checks remain refused, with a working documented manual recovery route for older installed updaters. Scope boundary: the remaining frozen bridge state readers are not migrated or orchestrated here; they stay for their shipped contracts until the first-hop floor permits bridge deletion. launchd, Windows, and single-account update paths are unchanged. Thanks to @fuller-stack-dev for openclaw#206343's system-account identification and openclaw#207230's 33-line `src/daemon/systemd-service-account-command.ts` helper. The original helper functions and synchronous argv API remain unchanged at the same path. The only addition is a 23-line NSS login-name resolver: systemd accepts numeric `User=1001`, but `runuser -u` requires its login name. None of openclaw#207230's bridge orchestration is inherited, and its branch remains untouched. The helper contribution is credited with the verified GitHub noreply co-author trailer. Author pr-simplify completed: one reused identification and package operation, no new persisted records, statuses, phases, leases, notices, retries, flags, or triggers. Against `5d0834dfe163`: production net **+227 lines**, test net **+189**, docs net **+23**. The positive production net is the complete package/runtime-check/restart operation replacing a refusal, plus the command helper and numeric-account resolution. No state-maintenance or bridge orchestration is added. ## Evidence - Red on the unchanged main source (`5d0834dfe163`): the new real `updateCommand` boundary regression reached the forbidden root state-setup tripwire instead of replacing the package/restarting the unit. - Final head `18627bcd4b65641eb80a69a774b3e0d01a97ae6c`: source regressions passed with the repository wrappers under both the pinned Bun fork (11 tests) and Node (21 tests including candidate admission), 94.11 s combined wall time. The earlier full focused selection, including unchanged `src/update/cli.test.ts`, passed 64 tests on `c8bd81b367df0fd02389453b6cc54eea7d755207`. - Scoped Oxfmt and type-aware Oxlint checks pass on the three repaired files (19.71 s); earlier scoped formatting and lint cover the unchanged files. - Unit proof covers default root state and explicit service-state selectors, account-isolated version-probe argv/environment, numeric UID-to-login resolution and mismatched NSS rejection, incompatible recorded Node and exact probe failures before replacement, blocking restart completion, restart failure/inactive units, and `--no-restart`. Package installation, NSS lookup, the version-probe subprocess, and native service operations are mocked at their existing I/O boundaries; this is not live systemd proof. - No existing system-unit-with-`User=` proof harness was found. `ci-published-driver-update.yml` / `scripts/e2e/lib/upgrade-survivor/native-systemd.mjs` uses `systemctl --user`, not system units. No hosted container run is claimed. Proof is unit tests plus PR CI. - Full builds/type checks are left to hosted CI per the host constraint. First-head CI: https://github.com/openclaw/openclaw/actions/runs/46119231572 — architecture failed on the untouched `ui/src/pages/skill-workshop/action-presentation.ts` ↔ `skill-workshop-page.tsx` Madge cycle; runtime import-cycle and Kysely checks passed. - Prior-head CI (`6804c4623254ca899dcab5d01f794f2f58ae3057`): https://github.com/openclaw/openclaw/actions/runs/46120628365 caught a fixture bug: its Bun shard made `process.execPath` describe a Bun service, so the intended Node-engine refusal did not apply. The fixture now records `/usr/bin/node` independently of the runner, preserving every refusal assertion. The two unnecessary deferred type arguments were also removed. Final-head CI is pending; no local full build or third review is claimed. - Local ClawSweeper completed two rounds. Its TLS/legacy-recovery findings and then its service-runtime/queued-restart findings were repaired. The latter now uses the maintainer-approved state-free account probe and blocking systemctl restart. No third review is claimed; the package-only/no-root-state contract and unit+CI proof scope are the maintainer-selected direction. Related: openclaw#204775, openclaw#206343. No release branch changes. Co-authored-by: Jason (Json) <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Collaborator
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #204775
Follows: #206343
What Problem This Solves
A common Linux layout is a root-owned global npm package with a systemd system unit that runs the Gateway as a service account (
User=openclaw, state in that account's home or the unit'sOPENCLAW_STATE_DIR). Since #206343,sudo openclaw updateon such an install stops before the package is replaced and prints a manual procedure. That protects the service's data, but the update never completes on its own.User Impact
A plain
sudo openclaw updatenow completes on this layout. Root replaces the package; every step that touches the service's state runs as the unit's account, with the unit's effective environment and--profile:update migrate). Root starts the unit and waits until systemd runs the new release and the service account's ownopenclaw gateway healthreaches it.openclaw-update-settle-<id>.service) writes the update record into the service's state as the service account (update finish), so the account'sopenclaw update statusshows it, and retires the backup. If the installed updater put the previous package back after a later failure, that unit instead stops the service, restores its state as the service account and starts it again.If the new release does not come ready, the state is restored as the service account (only after the unit is confirmed stopped), the step fails so the installed updater restores the previous package, and the unit starts again once that package is back. The new package is never started on restored state; if the stop or the restore cannot be confirmed, the unit stays stopped and the backup is kept, and the failure says where.
The #206343 refusal stays, with its procedure, when the steps cannot run as the account: numeric, empty or root
User=; an account that does not resolve; aHOMEit cannot write; no root-ownedrunuser; an unreadable effective environment (for example anEnvironmentFile=root cannot read) or sandboxing that hides the state; an invalid answer from the account's admission; and a caller whose state or config overlaps the service's, such assudo env OPENCLAW_STATE_DIR=<service state> openclaw update(the installed updater would write that state as root before any candidate step runs). Each refusal names its reason. Single-account installs, units that run as the updating account, other installations and unrelated units are unchanged.Why This Change Was Made
The installed updater cannot change, so the work sits in the two places a published updater calls into the new release:
update admitbefore the swap and the update Doctor child (update-migrated-finalize --doctor) after it. Both reuse existing owners: unit discovery and the root-read effective environment (readSystemdServiceExecStartAsRoot), the immutable path'srunuserswitch (now one helper for both), the systemd identity and lifecycle owners for stop/start, and the externally supervisedupdate migrate/restore/finishcommands that already own the backup, Doctor migration, restore and run record. No new protocol, config option, flag, stored field or schema.Trust boundary (for the service-owner and security review)
Root owns the package and the unit; the unit's account owns its state. Privilege only goes down:
User=(must be a named, resolvable, non-root account), its effective environment read as root through the existingreadSystemdServiceExecStartAsRootreader (inlineEnvironment=andEnvironmentFile=), the--profilein itsExecStart, and whether sandboxing (RootDirectory=,BindPaths=,PrivateTmp=,ProtectHome=and similar) hides the state. Nothing the service account wrote chooses the account, unit, environment or paths.runuser(/usr/sbin/runuseror/sbin/runuser, regular file, owner root, not group/other-writable) with a fixedPATHand nothing else; the unit's environment reaches the account's process through an owner-only file and applies only after the switch, so loader variables such asLD_PRELOADfrom the unit never affect a root process, and no environment value appears in any argv. The account runs this release's own entry point (node <root>/dist/index.js update admit|migrate|restore|finish|gateway health). Both immutable-updaterunusercall sites now build their argv through the same helper (unchanged argv)./tmp(checked: real directory, owner root, sticky bit), mode0711, holding files created withO_EXCL, thenfchownto the account andfchmod 0400: only the account can read them and nobody but root can replace them. Root never reads them back. They are removed when the step ends, or by the settle unit.parseUpdateAdmissionVerdictthe installed updater uses, exit code and candidate version cross-checked, the combined verdict revalidated; migrate/restore/finish up to 256 KiB, reading only a^[a-z-]{1,32}$status word). No path from the account's output is used for anything. Readiness is decided by root from/proc/<MainPID>/cmdlineand its ownpackage.json, plus the exit status of the account'sgateway health.systemctl/D-Bus start and stop of the selected unit (through the existingcaptureSystemdServiceIdentitywithrootServiceAccountand the systemd lifecycle owner),systemd-runfor the settle unit, and the package manager the installed updater already runs. The settle unit's script is a constant in this release; its single argument is JSON of root-derived values.0700.openclaw.update-stage-*directory. For the account's admission only, root adds the traverse bit of the account's permission class (owner, primary group, others) to that one directory and restores its mode afterwards; any other ancestor the account cannot traverse makes admission refuse.User=, unresolvable account, aHOMEthe account does not own and cannot write, no root-ownedrunuser, unreadable effective environment, sandboxed state, a caller whose state or config overlaps the service's (canonical paths, sosudo env OPENCLAW_STATE_DIR=<service state>and aliases), or any invalid answer from the account's admission. Each refusal happens in candidate admission, before the package is replaced.Threat cases tested (unit tests at the boundary, account process replaced by a stand-in that answers as an account could): malformed verdict, admit verdict with refusal exit, verdict for another candidate, verdict that claims the account check itself, output past its bound, failed run; migrate success exit without a status word, a status word with shell metacharacters, output past its bound; restore failure; unconfirmed stop; processes surviving in the cgroup; the scheduled settle script executed against stand-ins (kept update recorded from indented output, rollback restores then restarts, restore without a status or with a populated cgroup leaves the unit stopped, same-version different-build treated as rollback); settle scheduling failure restores; unit secrets kept out of root's
runuserenvironment and out of the settle unit's argv; handed-over files0400owned by the account. Each admission case was shown red by disabling its check.Update behavior
update admitand its Doctor child. Proven below with 2026.11.10./root/.openclawwith plainsudo) and finishes with its own messages. The service's run record is therefore written separately by the settle step, as the service account. The updater's closing lines still include text about root's own state ("gateway.mode is unset", "Gateway service inspection is unavailable; automatic service restart was skipped ... runopenclaw update repair") although the service was restarted and verified; this text comes from the installed updater's finalization against root's state and is not changed here.main-driven hop: goes through the release path insrc/update/, which this PR does not touch (it belongs to the update-path owner). Observed in the cell: the nextsudo openclaw updaterun by the new release refuses at its own schema preflight against root's state and changes nothing. The change that path needs is in the issue thread, not here.Evidence
Linux Docker, systemd as PID 1, root-owned global npm install of the published 2026.11.10 driver, system unit
openclaw-gateway.servicewithUser=openclaw,HOME=/var/lib/openclaw,OPENCLAW_STATE_DIR=/var/lib/openclaw/.openclaw, state seeded by the 2026.11.10 Gateway (state schema 40, agent schema 42) plus a retired delivery-queue file that exists only in the service state, a local registry serving the candidate aslatest, and a 1-second/readyzprobe for the whole cell. Every step runs inside the container as a script; the host only starts the container and the scripts. Candidates are packs under unpublished versions.sudo openclaw update --yestwiceorigin/main8b36e346b45as 2026.11.13service-account-mismatchbefore the swap; package 2026.11.10, schemas 40/42, MainPID unchanged, 0 restarts; 0 entries under the service home not owned byopenclaw; no not-ready probe during either attemptsudo openclaw update --yesbce55cc1b18as 2026.11.26openclawbefore, after and at the end; longest not-ready run 18 s (20 of 1,395 probes); the service account'sopenclaw update statusshows the runsucceeded, after2026.11.26Which account ran each state step (process owner from a 250 ms process sampler in the green cell):
update admitlaunched by the installed updaterupdate admitagainst the service's state (throughrunuser)openclawupdate migrate --backup-root /var/lib/openclaw/.openclaw-update/system-service-<id>/nativeopenclawgateway health --jsonreadiness checkopenclawupdate finish(settle unit, after the updater exited)openclawAdmission validated the service's own state: its warning names
/var/lib/openclaw/.openclaw/delivery-queue/seeded.json, a file that exists only there. The backup lived under the service home owned byopenclawand was removed byupdate finish(82 entries after the update, 65 at the end).Recordings (terminal, 4x speed):
Further cells (same harness; "head11" is
bce55cc1b18as 2026.11.26, "final" is444eabf6394as 2026.11.29, "base" isorigin/main8b36e346b45as 2026.11.13):openclawbefore, after and at the end; longest not-ready run 17 s; admit, migrate,gateway health --json --port 18789andupdate finishran asopenclaw; the account'sopenclaw update statusshowssucceeded, after2026.11.29. Recording: https://github.com/user-attachments/assets/e39bb502-1615-49c5-b37c-8bd1633babdfExecStartPrefails on the candidate)openclaw.sqlite.sealappeared in the service state in this path only; it is written by a clean SQLite close of a root process, and the root processes in this path include the installed updater's own rollback steps. The writer was not proven.company-gateway.service)openclaw; every state step asopenclawExecStart … --profile prod gateway --port 18789--port. Fixed in a later commit (health now passes the unit's--port); the final rerun of this cell did not run (see below).runuseropenclawUser=997sudo env OPENCLAW_STATE_DIR=<service state> openclaw updatechownto give them back.openclaw updateitselfservice-account-mismatch). The second unit's state is not handled by either.runtime-artifact-publication("Cannot replace …"), unrelated to this change. Final rerun did not run.The final reruns of the failure,
--profile, root-unit and explicit-state cells were stopped before they started when #207304 landed.Raw output: red, attempt 1 (base)
Raw output: green, tail
Which commit the proof covers. Red:
8b36e346b45. Green:bce55cc1b18and the final444eabf6394. Commits after444eabf6394change only uncertain-cleanup handling of account health runs (they no longer count as ready) and a merge ofmain; those are covered by unit tests, not cells.Tests
src/cli/update-cli/update-command-admit.service-account.test.ts(whole file audited): the fix: refuse root updates of a system service that runs as another account #206343 refusal cases now assert the fallback reason; new cases run admission through arunuserstand-in that answers as an account could: admits with the account's verdict (argv, a trustedrunuserenvironment without unit secrets, the unit environment in an owner-only0400file, handoff removed, root's own state untouched), passes on the account's refusal, and refuses for malformed output, an admit verdict with a refusal exit status, another candidate's verdict, a verdict claiming the account check, output past its bound, and a failed run; falls back for non-root, numericUser=, unresolvable account, unwritableHOME, unreadable environment, overlapping config, a state directory inside the service's, and sandboxed state. The overlap cases were shown red with the check disabled. No cases removed.src/cli/update-cli/update-command-service-account-activation.test.ts(new): the activation through the production entry with systemd stand-ins and a real process for/procidentity: success (Linux), restore and never start the candidate after a failed or malformed migration, unconfirmed stop, surviving cgroup processes, unit not serving the candidate, account health failure (Linux), settle scheduling failure (Linux); and the scheduled settle script executed in a VM context with stand-ins (kept, rolled back, restore without status, populated cgroup, same-version different build, start-mode rollback). The JSON-framing and newline cases were shown red.update-command-admit.test.ts,update-migrated-finalize.worker.test.ts,update-command-service-maintenance*.test.ts,systemd-service-files.scope.test.ts,systemd-scope.identity.test.ts,systemd-service-identity.test.ts,update-immutable-activation.test.tsandupdate-immutable-build.test.ts(Linux-only cases skip on macOS),test/scripts/update-restart-module-outcome.test.ts.node scripts/check-changed.mjs: format, lint, typecheck and guards pass; the dead-export scan fails only on an export already unused onmain(AgentHarnessSideQuestionRequest). Session identity ratchet: OK.gpt-6.1-sol, thinking high),--max-priority P2, branch mode againstorigin/main, owners and callers as source context: 27 passes on successive heads. Each finding was fixed in its own commit (among them: verifying the activation before retiring the backup, restoring at once on a crash loop, verifying the cgroup hierarchy before treating a missing group as empty, the unit's--portand retitled Gateways, admission answering before the installed updater's deadline, settling only after the Doctor child and its account work end, an unescaped NUL in the settle script, and fencing everything on uncertain process cleanup). The pass on3d79ecace73(this branch before the lastmainmerge) isscoped-clean. Two findings were declined with reasons: the settle step uses the restored previous package'supdate restore(receipt and backup schemas are byte-identical in published 2026.11.10), and a failedupdate finishleaves the verified candidate serving with the backup kept.main, covered byconfig/test-lines-allocations/207230-service-account-update-steps.txt(909). The cases are the hostile-account answers, fallback blockers, the settle script run against stand-ins, the shared cgroup owner on unified, hybrid and legacy hierarchies, and serving-release identity.main(an iOS protocol-coverage allowlist entry and an unformatted UI file, both failing onmainitself).Not proven
KillMode=processsurvivors andEnvironmentFile=units were not run in a cell; the custom-unit,--profileand numeric-User=variants are listed below as they complete.