Skip to content

fix(doctor): allow offline state repair for app-owned Gateways - #170768

Merged
RomneyDa merged 3 commits into
mainfrom
fix/doctor-offline-app-owned-maintenance-20261012
Oct 13, 2026
Merged

RomneyDa merged 3 commits into
mainfrom
fix/doctor-offline-app-owned-maintenance-20261012

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Standalone Doctor refuses to repair offline config and state solely because OpenClaw.app owns the Gateway package and service.

User Impact

openclaw doctor --fix can repair the same account's state when the app-owned Gateway is verified offline. Package replacement, service installation, and activation remain with OpenClaw.app. A running app-owned Gateway retains its ownership refusal. The app's existing explicit external-owner repair flow remains available; this is standalone recovery ergonomics and does not settle an app update receipt.

Why This Change Was Made

Doctor consumes the existing package-ownership refusal through passive native inspection, validates the app marker and selected account/config/state, and uses the existing offline predicate. It grants no service mutation authority; existing custody, maintenance leases, backups, and required state checks remain authoritative.

Evidence

  • Owner, installation, and settlement suites: 68 tests passed in 131.73 seconds (wrapper 139.96 seconds). The final test-only correction reuses the unchanged installation/settlement proof; all four changed owner controls were rerun. Actual persisted credential repair preserves archived source bytes and no stage/stop/start/restart/install/uninstall operation occurs.
  • The Linux running-app control failed because its native manager identity was absent and inspection never reached the payload-owner guard. App-owned rows now supply that identity. A second CI failure showed that granting it to the separate CLI state-only fixture correctly enabled explicit service activation; that fixture now retains unavailable native ownership and explicitly exercises Linux. Both failures are fixed at the fixture, with all refusal and no-service-effect assertions preserved.
  • Fresh canonical Codex P0/P1 autoreview was scoped-clean. Current production core types (16.2 seconds), Doctor test types (10.4 seconds), targeted lint, format, and diff checks passed with a physical task-owned frozen dependency install.
  • Final pnpm test src/commands/doctor-maintenance.service-identity.test.ts --maxWorkers=1: 4 tests passed, 13.35-second suite / 16.09-second wrapper (74% transforms); the Linux refusal control takes 9 ms. Doctor test types passed again in 3.6 seconds. The preceding failed-head CI Doctor shard took 318.23 seconds and exposed the CLI fixture authority error; final-head CI cost will be recorded when available.
  • Proof uses isolated state and the native service boundary. No operator Gateway, service, or state was modified.

@RomneyDa
RomneyDa marked this pull request as ready for review October 13, 2026 07:09
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: S labels Oct 13, 2026
@RomneyDa
RomneyDa force-pushed the fix/doctor-offline-app-owned-maintenance-20261012 branch from 609844f to f01be25 Compare October 13, 2026 21:40
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 13, 2026
@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Allows standalone Doctor to repair matching offline app-owned Gateway state while leaving service installation and activation to OpenClaw.app.

Example: OpenClaw.app's Gateway is stopped and unloaded, and its account has a legacy claude-cli credential profile.

  • Before: openclaw doctor --fix refuses with “Managed by OpenClaw.app” before repairing the profile.
  • After: Doctor can migrate the credential profile under maintenance custody while preserving its archived source and leaving the app service unchanged.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-correct repair with meaningful persistence coverage; native-service and shipped-entry-point behavior remain supported by inspection rather than demonstrated execution.
Proof confidence 🦐 gold shrimp (3/6) This MEMBER-authored PR is outside the ordinary contributor proof gate; its supplied coverage exercises real credential repair through Doctor maintenance with a mocked service adapter, rather than a shipped CLI/native-service run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Standalone Doctor refuses safe offline state repair because the app owns the Gateway package.
Reason: The maintainer-authored direction removes a recovery obstacle without transferring service lifecycle authority or adding configuration.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it provides useful standalone recovery, preserves app service ownership, and has no actionable source findings.

Priority: P2
Reviewed head: 54b0eee8458c720816049eb0fc030705c3187553

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied run exercises standalone Doctor against a real app-owned native service, and a base-failing run of the new offline case is not recorded.
Agent review details

How this fits together

Doctor's maintenance admission sits between CLI repair requests and config or database writers; native service observations select the recovery path, while existing maintenance ownership controls writes.

flowchart TD
  A[Doctor repair request] --> B[Managed service inspection]
  B --> C[App marker and matching state]
  C --> D[Verified offline service]
  D --> E[Exclusive maintenance custody]
  E --> F[Existing config and state repairs]
  C --> G[App retains service lifecycle]
Loading

Technical review

Best possible solution:

Keep offline state repair with Doctor's existing maintenance owner and app service lifecycle with OpenClaw.app.

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

Current main throws the app payload ownership refusal before offline Doctor admission; the source establishes that path, and no target code was executed during this review.

Is this the best way to solve the issue?

The focused exception reuses native inspection, state selection, offline detection, and maintenance custody rather than adding another repair owner or requiring the existing external-policy environment setting.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • App-owned package and service refusal changes intended behavior with a stated reason (d7f8b2c: Keep app-owned payloads in lockstep with the app and prevent a separately installed CLI from replacing or rebinding their service.)
  • Doctor maintenance custody and cleanup keeps the original intent (ce2985b: Retain ownership until admitted command work and cleanup settle before handoff or recovery.)
  • Service identity credential regression keeps the original intent (27f2f43: Consolidate redundant tests while preserving distinct authority and lifecycle contracts.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +61, Tests +61, Docs +4. Total +126 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 68 7 +61
Tests 1 130 69 +61
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 202 76 +126

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves a bounded standalone CLI recovery path; the existing explicit external-owner repair remains available.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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-10-13T21:44:53.630Z sha f01be25 :: needs maintainer review before merge. :: none

Reviewed October 13, 2026, 6:03 PM ET / 22:03 UTC (Revision 2).

@RomneyDa
RomneyDa enabled auto-merge (squash) October 13, 2026 21:49
@RomneyDa
RomneyDa disabled auto-merge October 13, 2026 21:57
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa merged commit 44d880a into main Oct 13, 2026
132 checks passed
@RomneyDa
RomneyDa deleted the fix/doctor-offline-app-owned-maintenance-20261012 branch October 13, 2026 22:15
@RomneyDa

Copy link
Copy Markdown
Member Author

Merged via squash.

RomneyDa added a commit that referenced this pull request Oct 14, 2026
* fix: allow Doctor to repair offline app-owned state

* test(doctor): model native manager identity in app-owned repair

* test(doctor): retain state-only CLI repair fixture authority

(cherry picked from commit 44d880a)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…law#170768)

* fix: allow Doctor to repair offline app-owned state

* test(doctor): model native manager identity in app-owned repair

* test(doctor): retain state-only CLI repair fixture authority
RomneyDa added a commit that referenced this pull request Oct 14, 2026
* fix: allow Doctor to repair offline app-owned state

* test(doctor): model native manager identity in app-owned repair

* test(doctor): retain state-only CLI repair fixture authority

(cherry picked from commit 44d880a)
Backport adaptation: kept the release line's active-state-writer refusal case from #160056 as an extra row in the new service-identity matrix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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