Repository navigation
fix: doctor skips host services for isolated state - #115922
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 11:05 AM ET / 15:05 UTC. ClawSweeper reviewWhat this changesThe branch makes Doctor and daemon service management skip copied or otherwise non-default OpenClaw state/config identities, while allowing a known copied auth-store account with an omitted SecretRef provider to start as configured-unavailable instead of aborting Gateway startup. Merge readinessKeep this PR open for normal maintainer handling. The focused patch appears correct: it puts the copied-install boundary ahead of Doctor service inspection and shared daemon mutation, and the copied-auth exception stays limited to persisted known-owner assignments. The contributor’s updated PR body and follow-up comment provide redacted after-fix CLI results plus real Gateway-readiness coverage, so the prior proof blocker is cleared; the remaining compatibility and auth-provider behavior is explicitly accepted in the supplied maintainer work order. Priority: P1 Review scores
Verification
How this fits togetherDoctor health flows inspect, repair, install, and restart the local Gateway’s OS-managed service; this patch prevents an isolated copy from modifying that host-level service. During Gateway startup, secrets runtime resolves persisted auth profiles, so the patch also determines when a missing provider degrades one stored account rather than preventing readiness for the entire Gateway. flowchart LR
A[Copied state or config] --> B[Install identity check]
B -->|Default identity| C[Doctor and daemon service flows]
B -->|Isolated identity| D[Show skip diagnostic]
D --> E[Leave host service untouched]
F[Persisted copied auth profile] --> G[Secret provider resolution]
G -->|Known stored owner unavailable| H[Gateway ready with unavailable account]
G -->|Other invalid or unknown input| I[Fail closed before dispatch]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +127, Tests +293. Total +420 across 27 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single install-identity policy only after refreshing the branch against current main and confirming the exact merge-result checks; preserve fail-closed handling for config-owned, invalid, mismatched, and unknown-owner SecretRef failures. Do we have a high-confidence way to reproduce the issue? Yes for source reproduction: copied state/config overrides reach the Doctor and daemon service seams, while the proposed tests and reported real CLI run exercise the isolated identity and unchanged-host-service result. I did not independently execute the destructive service scenario in this read-only review. Is this the best way to solve the issue? Yes. One canonical install-identity predicate shared by Doctor early exits and daemon mutation guards is the narrowest durable service-ownership fix, and the auth exception is constrained to persisted known-owner assignments rather than broadening missing-provider fallback behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5fa8c4a4e5c7. LabelsLabel changes:
Label 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 (4 earlier review cycles)
|
|
ClawSweeper rank-up move disposition for
|
|
Merged via squash.
|
* fix(doctor): isolate host service management * fix(doctor): clarify service isolation recovery * test(doctor): isolate service identity fixtures * test(daemon): keep lifecycle fixtures lint-clean * test(daemon): isolate install identity fixtures
What Problem This Solves
Fixes a critical isolation issue where running
openclaw doctor --fixagainst a copied install with non-default state/config paths could inspect, stop, rewrite, and re-bootstrap the operator's real host Gateway service. The rewritten service could then point at temporary wrapper and credential-bearing environment files, interrupting the live listener and coupling the host service to copied state.The same stress run also found that a copied auth-profile row referencing an omitted SecretRef provider prevented isolated Gateway startup even though the owning account was identifiable.
Why This Change Was Made
Host launchd/systemd/Scheduled Task management now belongs only to the OS account's default OpenClaw install identity. A single path predicate compares the active state and config against the canonical account home; doctor skips all service inspection/repair for non-default identities with an explicit diagnostic, while shared service mutation guards prevent install and start-repair paths from bypassing the boundary. There is no force override.
For copied auth rows, the missing provider now has its own typed resolution code. Only persisted auth-store assignments with a known account owner may start configured-unavailable; config-owned missing providers, source mismatches, invalid refs, and unknown owners remain fail-closed.
This change is AI-assisted and was reviewed with the repository autoreview workflow until no accepted/actionable findings remained.
User Impact
Operators can run doctor against copied or otherwise isolated state without risking changes to the host's managed Gateway service. Default-install doctor and service commands retain their existing management behavior.
Gateways with stale copied auth rows now reach readiness with the exact account marked configured-unavailable and a typed redacted diagnostic, instead of failing the entire startup. Requests targeting that account still fail before provider dispatch.
Evidence
/readyzGateway startup.node scripts/check-changed.mjs -- <23 touched files>passed on Blacksmith Testboxtbx_01kyq0xf8zc1x5trn8jxfvyq9bin 8m14s, including core/core-test typechecks, changed lint, formatting, import cycles, database-first guards, and boundary checks: https://github.com/openclaw/openclaw/actions/runs/30456065301/tmpstate/config identity and a non-default Gateway port. Redacted result:doctor_exit=0,skip_message_seen=true,plist_unchanged=true,listener_unchanged=true. The minimal fixture was moved to Trash after the run.c5ef839bb79a46e46e27dbd10ce4f9e0466e16ff: https://github.com/openclaw/openclaw/actions/runs/30462097997HOME/OPENCLAW_HOMEidentity bypass and incomplete recovery guidance; the final review reported no accepted/actionable findings.git diff --checkpassed.