Repository navigation
fix(gateway): recognize system-scope systemd ownership in status and maintenance checks - #149055
Conversation
|
🦞👀 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. |
bc7b9f0 to
233f0c9
Compare
|
Codex review: blocked before merge. Reviewed September 15, 2026, 9:36 PM ET / September 16, 2026, 01:36 UTC (Revision 13). ClawSweeper reviewWhat this changesThe PR makes Gateway status and Doctor inspect the installed systemd scope, preserve system-owned definitions, and offer inspection commands instead of unverified removal advice. Merge readiness⛔ Blocked before merge - 3 items remain This remains a useful fix absent from inspected main. The previous duplicate-warning finding is resolved, and no additional blocking code defect was established. Priority: P2 Review scores
Verification
How this fits togetherGateway service inspection reads Linux service definitions and manager state for status, Doctor, and update maintenance. Its results determine diagnostic output and whether maintenance can safely proceed. flowchart TD
A[Installed service definitions] --> B[Scope discovery]
B --> C[User or system manager]
C --> D[Verified command and runtime]
D --> E[Status and inspection guidance]
D --> F[Doctor and update admission]
F --> G[Maintenance or ownership refusal]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +146, Tests +594, Docs +8. Total +748 across 29 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep scope-aware inspection under the existing service owner, with demonstrated upgrade recovery and system-owned definitions left intact. Do we have a high-confidence way to reproduce the issue? Yes: current-main service readers still omit system-scope propagation, and the PR records a matching real Linux baseline failure. This read-only review did not execute target code. Is this the best way to solve the issue? Yes: extending the existing scope detector and service readers avoids a competing implementation; complete update compatibility remains the outstanding validation gate. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cdba90dd5cdc. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
d9d0b59 to
68ee3f0
Compare
0e6221f to
40dea55
Compare
2bc6865 to
325cd67
Compare
|
@clawsweeper re-review Addressed the P2 at head 00a4b5e35906f362d6faefd7b94df5baea743de3: removed the duplicate printer-owned supervisor diagnosis. The gatherer remains the sole owner; managed-service status emits its warning once and explicit URL/port targets emit none. All three cases failed before the deletion for the expected warning counts and pass after it. The full status printer/gatherer suites passed (176 tests, one platform-specific skip), as did changed-file checks. Details are in the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
ad81e89 to
cef0058
Compare
Carry the installed scope through effective command and loaded-runtime inspection, verify the service account separately from the manager, and preserve system-owned definitions during offline Doctor repair. Report the observed scope and competing supervisors, and replace unverified Linux cleanup commands with inspection guidance. Reported by @cookywook (#149009). System-scope installs on 2026.9.2 through 2026.9.4 could receive misleading service diagnostics and fail offline Doctor maintenance.
cef0058 to
cbaac7e
Compare
|
Merged via squash.
|
…maintenance checks (openclaw#149055) Inspect installed Gateway systemd units at their actual user or system scope. Carry the selected manager through command and runtime inspection, report its scope accurately, and avoid listing the owned unit as an extra service or suggesting its removal. After the system service owner stops the Gateway, Doctor can verify offline maintenance from the service's User= account. System-owned definitions stay sealed, competing supervisors remain explicit, and unverifiable ownership still blocks maintenance. Automatic system-unit update handoff retains its existing manual-update requirement. Fixes openclaw#149009. Reported by @cookywook (openclaw#149009). The status gatherer remains the sole owner of competing-supervisor warnings: managed-service status prints its warning once, while unrelated explicit URL/port targets print none. Validation: the warning regression failed before the deletion in all three cases and passed after it. The full status printer/gatherer suites passed (176 tests, one platform-specific skip), changed-file checks passed, and independent branch review at P1 is scoped-clean. The PR records regression failure before the fix, passing focused and changed-file checks, and live Linux system/user service proof. Exact-head CI and the completed ClawSweeper review are linked in the PR body; the broader published-updater validation gap is recorded there.
Fixes #149009
What Problem This Solves
Fixes system-scope Gateway installations being labeled as user services, offered destructive cleanup advice, and rejected during offline Doctor maintenance because effective command and loaded-runtime inspection queried the user manager.
Reported by @cookywook (#149009).
User Impact
Installed system units are inspected at their actual scope. Status names the observed manager, excludes the observed unit from extra-service warnings, and shows the existing competing-supervisor diagnosis when both scopes are installed. Linux discovery offers inspection commands instead of unconditional disable/remove commands.
After the system service owner stops the Gateway, Doctor can verify its offline state from the service's non-root account. System-owned definitions remain sealed; this does not grant service-control privileges or create a user unit.
Release-note context: system-scope installations on 2026.9.2–2026.9.4 could receive false user/extra-service diagnostics and blocked offline
doctor --fixchecks. Valid Control UI config writes do not directly use this gate; repairing invalid configuration through Doctor can unblock their prerequisite.Why This Change Was Made
The shared service reader now carries the existing scope discovery result through command, runtime, and definition-capability inspection. System-manager reads verify the native manager UID separately from the Gateway's
User=account and preserve the existing non-activating admission rules. A missing unit at the queried scope is no longer described as a stopped service.Scope discovery remains limited to the existing installed-unit and marker paths. Runtime/generated-only and fileless transient units are not newly supported. Automatic managed-update handoff for system units retains its existing manual-update requirement.
Evidence
systemd user, thendoctor --fixexited 1 with the reported ownership/shutdown refusal after the unit was stopped. Testbox run.systemd system,scope: system, RPC success, and zero extra services. The user-unit sibling installation/start also passed withsystemd user,scope: user, and RPC success.node scripts/check-changed.mjspassed, including production/test typechecking, lint, schema and ownership guards, and zero runtime import cycles. The final reader refactor also passed 325 focused tests.refs/heads/main; workflow linting never ran. This PR changes no workflow or guard scripts. Cancelled dependency/security guard jobs were rerun once and passed.d363685cab9fd6c6202998216cf945c46a195904, which contains the upstream fix for the attribution test fixture at273b6c5e114.git range-diffcontains only identical commit mappings, with no patch differences and no other branch changes. Rebased head before the warning follow-up:325cd67dab198d44a12b6f8e0ae5f660b9e25176. CI for that rebased head passed with 147 successful checks and 42 skipped checks.ClawSweeper review
Applied the P2 finding: the status renderer no longer independently derives a competing-supervisor warning from service metadata. The gatherer owns the target-aware verdict; managed-service status prints its warning once, while unrelated explicit
--urland--porttargets print none.Regression proof:
node scripts/run-vitest.mjs src/cli/daemon-cli/status.print.test.ts -t 'renders the gathered supervisor warning once'failed before the deletion in all three cases (managed expected 1 warning, received 2; URL and port expected 0, received 1). With the same assertions and the 11-line production deletion,node scripts/run-vitest.mjs src/cli/daemon-cli/status.print.test.ts src/cli/daemon-cli/status.gather.test.tspassed: 176 tests passed, one platform-specific skip. The gather-to-print coverage now checks both stdout and stderr.node scripts/check-changed.mjs -- src/cli/daemon-cli/status.print.ts src/cli/daemon-cli/status.print.test.ts src/cli/daemon-cli/status.gather.test.tspassed, including production/test typechecking, lint, and ownership guards. Independent branch review at P1 is scoped-clean (confidence 0.85) for follow-up head00a4b5e35906f362d6faefd7b94df5baea743de3. The earlier CI run failed on an unrelated duplicate-case lint error in the base/merge context; ClawSweeper revision 9, reviewed at 2026-09-15 20:12 UTC on this exact head, confirms the P2 and its rank-up request are resolved and reports no remaining correctness or security findings. No other production behavior changed. The archived-log access concern reflects the review environment; the recorded real Linux observations cover system/user status, offline Doctor, unchanged system definitions, and no competing user unit. The generic data-model flag is not applicable: no schema, stored format, retention, or recovery format changes. A full published-driver-to-candidate update was not run; automatic system-unit update handoff retains its existing manual-update requirement.Latest landing refresh
Rebased onto main
d3930e1641997f9f5c5c9f53cda7cfd0bbe5c595, which contains the trusted-sibling alias-wrapper fix. Current head:cbaac7e6aa880bc361dea817373ab467e8027360. All four patches are unchanged:git range-diffreports four identical mappings. The P1 scoped-clean review and ClawSweeper revision 9 cover these unchanged patches. Fresh exact-head CI passed. The standard exact-head watcher reported GREEN with zero pending checks and five superseded contexts; no rerun was needed on this head.