Skip to content

fix: interactive doctor repairs race a managed gateway - #166948

Merged
RomneyDa merged 4 commits into
mainfrom
fix/doctor-interactive-maintenance
Oct 9, 2026
Merged

RomneyDa merged 4 commits into
mainfrom
fix/doctor-interactive-maintenance

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Current conflict integration — October 9, 2026

Current candidate: e76d777ffde3631e3a2b6f7cda68669cb0888e5e, incorporating main bfe4592a7e8195d277ef14f3a458cf7396bc125e. Preserves upstream repair-preview documentation, deletion of obsolete upload tests/mocks, readiness warning behavior, and deletion of the obsolete stopped-activation test file. The PR's stopped-service preservation regression now uses the canonical readiness suite. Removed stale assertions for an update outcome upstream had deleted; successful/pending update handoff remains asserted before consent and custody.

Fresh integration proof:

  • node scripts/run-vitest.mjs src/commands/doctor-maintenance.readiness.test.ts src/flows/doctor-health.update.test.ts src/flows/doctor-health.managed-settlement.test.ts: 18/18 passed (readiness 5, update 5, managed settlement 8), runner wall 167.99 s.
  • After the dead-assertion cleanup, node scripts/run-vitest.mjs src/flows/doctor-health.update.test.ts: 5/5 passed, runner wall 94.04 s.
  • The former managed-settlement ancestry failures did not reproduce under permitted host inspection; all eight cases passed without weakening guards. Covered accepted/declined interactive custody, writer settlement, refusal/failure cleanup, unhealthy restoration, and stopped-service preservation.
  • Official selected lint using node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json on all nine changed TypeScript files: passed. Fresh independent autoreview of the complete staged PR delta against incorporated main: scoped-clean through P2.
  • Staged changed checks against the incorporated base passed formatting, conflict/line-cap/assertion/SQLite/mock-export ratchets, dependency/config-doc/plugin-boundary guards and wrapper checks. Aggregate check did not pass: the typecheck boundary rejects borrowed dependency symlinks before compiling. Shared dependencies were not reinstalled, modified, or bypassed.
  • Staged diff check passed before commit; native git merge-tree --write-tree HEAD origin/main was conflict-free against fetched main c75ff3cbf56ea8d00d1f33599482901999098f8d.

Conflict repair adds no production behavior beyond the previously proved scope. Against incorporated main, the complete PR is production +81/-6 (net +75), tests/support +88/-7, docs +13/-4. Production growth provides consent admission into the existing maintenance owner and preserves update-before-custody ordering; it does not introduce a competing lifecycle, store, or config option.

Native macOS PTY/launchd and published-driver proofs below remain historical original-head evidence at 0d8ecefc028a0c004ad519da40bd014c103d9928; they were not rerun on this integration and are not current-head CI. This refresh reuses those proofs only for unchanged behavior. Exact-head hosted CI run 37998267536 completed successfully; GitHub reports no pending or failed checks, including the final CI/security gate. The fresh exact-head ClawSweeper assessment is diamond lobster for readiness, proof and patch quality, with no findings or before-merge items. The PR is open, non-draft, conflict-free and ready for review. No merge, deployment, or operator Gateway/state change.


Related: #166927
Related: #144845

What Problem This Solves

Fixes interactive Doctor repairs racing a managed Gateway's startup and state writers while checking or migrating SQLite state.

User Impact

Interactive Doctor asks for maintenance custody before reviewing repairs. Individual repair approvals remain separate. Declining ends the repair flow without touching the service or state and points to doctor --lint for read-only diagnosis. Explicit repair and non-TTY behavior remain unchanged.

Why This Change Was Made

Reuse the existing offline maintenance owner rather than temporarily enabling automatic repair mode. The admitted scope excludes other writers, preserves original state, backs up migration inputs, drains reopened handles, validates startup readiness, and restores the service's prior state. Service ownership and refusal guards are retained. Ordinary interactive Doctor keeps its schema preflight and optional update handoff before custody. If an update handles the run, no custody prompt occurs. Remaining repairs take custody only after schema compatibility is established, then refresh discovery under maintenance ownership.

Evidence

  • The actual runDoctorHealthFlow regression failed before the fix because interactive repairs had no maintenance custody.
  • Consent coverage uses real isolated SQLite state and the existing synthetic managed-service adapter, checks that a subsequent repair can still be declined, and verifies reopened database handles close before service restoration.
  • Decline coverage checks no service action, no repair contribution, and byte-preserved config and agent database.
  • Canonical managed-settlement proof: 5 passed, 3 intentionally filtered (normal ready, interactive consent/decline, failed repair, unhealthy restoration), one worker through the repository runner. New consent/decline cases totaled 59.35 s of reported test time; Vitest wall was 343.36 s and runner wall 548.38 s including cold worker compilation and verification on the busy local host. No test sleeps or polling loops were added.
  • Independent P2 review of production and regression behavior: scoped-clean. The same cases were then moved into the existing integration-test owner without changing their semantics, preserving the repository's runtime-test routing.
  • Full final selected check:changed: passed, including core production types, all 27 test-type graphs, three dead-export scans, changed lint and the remaining repository guards. Exact-head hosted CI is green. Earlier primary regression proof also passed; a broader optional sibling invocation was interrupted during import and is not counted as passed.

No live operator Gateway, configuration, or database was changed for proof. The tests do not exercise an actual launchd crash loop or filesystem contention.

Follow-up review

Accepted ClawSweeper’s P1 finding: maintenance consent must not activate an owned service that was already stopped. Ordinary interactive custody now restores only a service it actually stopped; explicit --fix/--yes keeps its existing owned-offline activation policy. Documentation distinguishes those cases. The broader issue remains Related because declining custody cancels repairs and directs the operator to doctor --lint, rather than continuing read-only diagnosis in that same invocation.

The stopped-service regression failed on the prior PR head at the unexpected restart call while all seven explicit-repair controls passed. The repaired eight-case file passed (46.02 s repository-runner wall, 39.35 s Vitest; new case 3 ms). It uses the existing service-boundary fixture and adds no process boots, timers, sleeps, or polling. The prior full-flow proof still covers running-service restoration and failure cleanup. Fresh independent P2 review of the follow-up production change and regression: scoped-clean.

No stored schema, data format, migration transform, updater markers, or authority contract is introduced. The change admits interactive repairs to the existing maintenance owner and narrows activation consent; path-based migration/backfill flags do not identify a new migration here.

Final follow-up check:changed for the three changed paths completed with exit 0: core production types, all 27 test-type graphs, three Knip scans, changed formatting/lint and the schema/store/media/sidecar/import/webhook/pairing guards. These final-source checks are separate from the still-valid original flow evidence. The published-driver compatibility cell passed with published 2026.9.8 against final committed head 0d8ecefc028a0c004ad519da40bd014c103d9928, using isolated real SQLite and a synthetic native-service adapter; completed results follow.

Preserve ordinary Doctor update admission

Hosted CI on 5949b499b7bfd2a4bd1b852bc8e7e08858414915 exposed a related ordering regression: entering maintenance before the existing update offer suppressed the update escape hatch for newer agent schemas and changed refusal-before-prompt behavior for newer shared schemas. The follow-up restores state-only schema preflight and the existing update handoff before custody, refuses incompatible agent schemas if the update does not handle the run, and keeps fresh discovery under maintenance ownership. Existing schema-refusal tests are unchanged. The canonical update outcomes retain success, skipped, failed and pending behavior; handled outcomes do not prompt for custody. Guided-mode documentation now describes consent and update ordering consistently.

Final ordering follow-up 0d8ecefc028a0c004ad519da40bd014c103d9928 validation: full selected source check exit 0 (core production types, all 27 test-type graphs, three Knip scans, lint and repository guards); canonical update outcomes 14/14 passed in 17.19 s runner wall / 13.40 s Vitest with the existing maintenance boundary stub; unchanged schema E2E 4/4 passed (6.697 s case time / 37.16 s Vitest / 1142.13 s wrapper including its cold four-part runtime build and artifact/type-lock wait); interactive full-flow 2 selected passed, 6 filtered (consent 23.572 s, decline 1.706 s; 75.93 s Vitest / 96.84 s runner). The full-flow fixture retains real isolated SQLite and synthetic managed-service edges. No tests add sleeps, polling, process boots or production test seams.

The final test-only stub narrows the canonical update-owner fixture’s maintenance work; full custody and resource settlement remain covered by the separate flow regressions. Its final affected test-type graph, lint and fresh scoped P2 review passed. The ordering change also has a fresh scoped-clean P2 review. A failed preparation attempt due to concurrent lint temporary-file removal ran no tests; the serialized unchanged fixture passed. Guided-mode documentation and diff checks pass. A Git merge-tree check verifies this final head combines cleanly with the Tailscale preflight head 69ee5e1dc9282829bce36eb175f4fda9b127a262.

Published-driver × exact final candidate — passed

Published OpenClaw 2026.9.8 successfully updated to exact head 0d8ecef (candidate package SHA-256 4c844a0e60c914a4216a7bfd7a680180ba5e46b95a172ff54056d51bd4a348a4; build ID 2026.9.8-0d8ecefc028a-2026-10-08T05-02-12.338Z). Canonical Docker harness exit 0: durable update ledger finished/succeeded, exact installed and serving candidate identity, readiness HTTP 200, managed PID replacement, durable session/history preservation, incognito content removal and byte-preserved orphan OAuth sidecar. The update phase took 487.391 s, using the canonical CI’s verified published-driver cache seed, with the unchanged 1125 s total budget and final assertions. Owned service/container/volume cleanup completed. Official final-head build passed in 4m19.6s; canonical package integrity/import-graph verification passed.

This cell executes the real published CLI/updater, candidate runtime and SQLite in disposable state with a synthetic Linux native-service manager. It does not reproduce a live macOS launchd crash loop or filesystem contention and does not exercise interactive TTY consent; those decisions and settlement are covered by the separate production-flow regressions above. No operator installation, configuration, connectivity or database was changed. Reproduction: bash scripts/e2e/published-driver-update-docker.sh /absolute/candidate.tgz /absolute/proof-dir 2026.9.8, with the supported CI cache seed.

Compatibility proof is sufficient for the complete introduced delta: no stored format, schema or migration-transform change is added, and the completed published-driver replay verifies actual Doctor/update restoration and durable state continuity. This evidence addresses the path-based migration/backfill flags without an authorship exemption or waiver. Exact final-head hosted CI is green and the PR is out of draft.

Actual macOS interactive Doctor proof

Candidate: 0d8ecefc028a0c004ad519da40bd014c103d9928, version 2026.9.8, official build ID 2026.9.8-0d8ecefc028a-2026-10-08T05-30-37.011Z. An independent frozen dependency installation and the official pnpm build owner passed (7m12.6s). The actual built CLI and native LaunchAgent were used; no Vitest flow, native adapter mock, supervisor shim, or Docker service was involved.

The previously absent, task-owned profile proof166948 selected canonical state ~/.openclaw-proof166948, native label gui/501/ai.openclaw.proof166948, and free loopback port 19648. Default profile/port were not used. All CLI children received env -i with actual account HOME, USER/LOGNAME, normal Node/system PATH, and TERM only. The profile used a synthetic local authentication token, no channels, no inference, disabled plugins/browser/cron, and its own workspace. The real service installer generated its profile-specific environment and plist. Launchd retained its normal OS SSH socket environment; this proof did not use SSH or any API/service credential.

Commands used the absolute candidate built CLI, abbreviated here as node /Users/dallin/openclaw-native-maintenance/dist/entry.js:

openclaw --profile proof166948 gateway install --port 19648
/usr/bin/script -q <case-transcript> /usr/bin/env -i HOME=/Users/dallin USER=dallin LOGNAME=dallin PATH=/Users/dallin/.nvm/versions/node/v24.16.0/bin:/usr/bin:/bin:/usr/sbin:/sbin TERM=xterm-256color node <candidate>/dist/entry.js --profile proof166948 doctor
openclaw --profile proof166948 gateway stop --force

script provided a real PTY. Consent was entered at the displayed prompts. An independent read-only observer sampled actual launchctl print, plist/config/SQLite fingerprints and modes, and the profile-local ownership locks every 200ms.

Case Actual observations
Running service, custody declined Source-update No, custody No; CLI cancelled and exited 0. PID 59975 remained unchanged. Plist/config SHA256, file modes, and modification times stayed identical. The durable session ID and messages stayed identical. Readiness remained 200.
Running service, custody accepted Custody Yes, recommended canonical-agent-roster config repair Yes. CLI printed Stopped the managed Gateway for Doctor repair. PID 59975 disappeared; real launchctl reported the label absent and the port refused connections. Offline ownership showed Doctor PID 84895, role sqlite-maintenance. The first config write at 2026-10-08T05:42:00.105787Z occurred with native label absent and PID null; config mode became 0600. Plist stayed identical. CLI subsequently printed Gateway restarted and verified after Doctor repair. Actual restored PID 98301, readiness 200, exit 0. Durable session ID/messages survived.
Initially stopped service, custody accepted Explicit canonical stop first left the native job unloaded and port free, while retaining its plist. Custody Yes then ran Doctor to completion, exit 0. Every observed native state remained unloaded/PID null; no restart/start occurred. Plist/config stayed identical. The durable transcript marker survived and all three SQLite databases passed integrity_check.

The durable sentinel was created and injected through actual Gateway RPC (sessions.create, chat.inject), with runStarted=false and delivery none. Its session ID was 8614ba95-cf87-4539-8420-4cb1d1661a4e; marker native-proof166948-durable-marker-0d8ecefc. Before/after chat.history messages were exactly equal; only the expected response snapshotAt timestamp changed. After the stopped case, a read-only SQLite query confirmed the same transcript marker without starting the service.

Raw bytes of the serving SQLite/WAL/SHM files can change while the unchanged Gateway remains running. This proof therefore does not claim byte equality for that active database; it uses the logical session/message oracle, alongside unchanged native PID/plist/config and absence of Doctor custody/repair. Raw fingerprints remain recorded for transparency.

Unrelated skill disabling, shell completion, and service-definition replacement were declined. The initial shared-dependency build fixture failed workspace resolution, then passed after an isolated frozen install; source was not altered. A stop without --force was safely refused, and the authorized task-owned stop used the canonical --force option.

Evidence: maintenance-native-summary.json, official build log and build-info, raw/clean PTY transcripts for all cases, independent timeline JSONL, actual native plist/Gateway log, before/after sentinel RPC results, stopped sentinel query, and canonical uninstall log.

Cleanup passed: canonical profile-specific uninstall exited 0; real launchctl label remains absent and port 19648 is free. Only the owned profile, its two recorded captures and marker, matching trashed plist, and newly created profile-specific log were removed. Evidence and the clean exact-head source worktree remain for publication. maintenance-cleanup.json records the removed paths; the parent owns final worktree removal.

@clawsweeper

clawsweeper Bot commented Oct 8, 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 docs Improvements or additions to documentation commands Command implementations size: S labels Oct 8, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Interactive Doctor asks permission to pause the managed Gateway before repairs, keeps individual repair approvals, and restores the service’s previous running or stopped state.

Example: The user runs openclaw doctor and approves repairs while the managed Gateway is running.

  • Before: Approved repairs can overlap the Gateway’s startup and database writers.
  • After: Doctor reports “Stopped the managed Gateway for Doctor repair.” before repairs and “Gateway restarted and verified after Doctor repair.” after restoration.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The approved repair is clean and convincingly proven, but it remains a partial response to the linked issue’s complete expected behavior.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded actual CLI PTY and native launchd runs demonstrate decline without service changes, accepted repair while the Gateway is offline, verified restoration, and preservation of an initially stopped service. Those runs are tied to 0d8ecef; source comparison supports reuse for unchanged consent behavior, supplemented by current integration regressions. The published-driver replay verifies durable state continuity, and the diff introduces no stored-data contract change.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Interactive repairs can collide with a managed Gateway that is starting or writing state, causing repair refusals and repeated restarts.
Reason: The maintainer explicitly approved a bounded maintenance-custody repair, and its value exceeds the focused implementation cost. The linked issue also requests continued diagnostics after declining custody; the PR correctly uses Related because it cancels instead.

Merge readiness

✅ Ready for maintainer review

This remains a useful, maintainer-sponsored fix that current main does not provide. No actionable patch defects remain.

Priority: P2
Reviewed head: e76d777ffde3631e3a2b6f7cda68669cb0888e5e

Before merge

None.

Findings

None.

Agent review details

How this fits together

Doctor checks and repairs OpenClaw configuration and SQLite state. Its maintenance owner coordinates those repairs with the native service manager so the Gateway and Doctor do not write the same state concurrently.

flowchart TD
  A[Interactive Doctor] --> B[Schema checks and update offer]
  B --> C{Maintenance consent}
  C -->|Decline| D[Cancel and show read-only diagnosis command]
  C -->|Accept| E[Existing maintenance owner]
  E --> F[Pause owned Gateway and review repairs]
  F --> G[Settle database work and verify readiness]
  G --> H[Restore previous service state]
Loading

Technical review

Best possible solution:

Land the approved maintenance-custody repair while retaining the related issue for diagnostic continuation after declined consent.

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

Yes, from source: current main bypasses maintenance for ordinary interactive Doctor while allowing approved state repairs. The report identifies the macOS startup-overlap scenario, and the PR records a failing pre-fix flow regression; no target code was executed during this review.

Is this the best way to solve the issue?

Yes for the approved maintenance-custody scope: it extends the existing owner and preserves update admission, repair consent, and native ownership checks. It intentionally leaves same-invocation diagnostic continuation after decline to the related issue.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced changes: The pinned introduced delta adds consent admission to the existing maintenance owner, retains separate repair prompts, and prevents interactive consent from activating a previously stopped service. (src/commands/doctor-maintenance.ts:188, e76d777ffde3)
  • Still necessary on current main: Current main still admits maintenance only for explicit repair or yes mode and lacks interactive maintenance admission. No later main change modifies these production owners. (src/commands/doctor-maintenance.ts:58, 7b627f476aef)
  • Native behavior proof: The full PR body and fix: interactive doctor repairs race a managed gateway #166948 (comment) record actual built-CLI PTY and launchd runs: declining preserved PID 59975 and durable messages; accepting stopped that process before configuration publication and restored PID 98301 with readiness 200; an initially stopped service remained unloaded. These observations belong to the historical proof revision. (0d8ecefc028a)
  • Historical proof remains applicable: Comparison with the native-proof revision shows unchanged interactive admission and stopped-service preservation logic. Integration incorporates upstream readiness, backup-target, and lifecycle changes; the body separately records passing current-head readiness, update, and settlement cases rather than presenting historical native proof as a current-head run. (src/flows/doctor-health-startup.ts:46, e76d777ffde3)
  • Upgrade compatibility: The full body records a successful published 2026.9.8 updater-to-candidate replay with exact serving identity, readiness 200, session/history preservation, and preserved orphan OAuth bytes. The introduced delta changes coordination, not schemas, serialization, migration transforms, or stored settings defaults. (src/flows/doctor-health.ts:306, 0d8ecefc028a)
  • Accepted bounded scope: The MEMBER-authored scope clarification accepts independently reviewable maintenance custody, safe cancellation, writer settlement, and stopped-service preservation. Interactive Doctor repairs overlap managed Gateway startup #166927 additionally requests diagnostic continuation after decline; this PR uses Related and does not claim that behavior or resolution of the broader Tailscale incident.

PR surface

Source +75, Tests +81, Docs +9. Total +165 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 81 6 +75
Tests 5 88 7 +81
Docs 2 13 4 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 182 17 +165

Review metrics

Metric Value Why it matters
Production versus test growth Production +81/-6; tests and support +88/-7 Production growth is justified by consent admission and update ordering within the existing maintenance owner.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #166927
Summary: This PR addresses the reported interactive repair coordination failure; diagnostic continuation after declining custody remains outside its approved scope.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This fixes a bounded interactive repair race without changing ordinary runtime or explicit-repair defaults.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-08T03:43:21.894Z sha c898e9d :: blocked before merge. :: [P1] Preserve stopped-service state during interactive maintenance
  • reviewed 2026-10-08T04:28:23.347Z sha 5949b49 :: needs changes before merge. :: [P3] Update the remaining guided-mode documentation
  • reviewed 2026-10-08T05:08:41.344Z sha 0d8ecef :: needs changes before merge. :: none
  • reviewed 2026-10-08T05:23:06.512Z sha 0d8ecef :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T05:52:19.811Z sha 0d8ecef :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T06:00:23.439Z sha 0d8ecef :: needs maintainer review before merge. :: none
  • reviewed 2026-10-09T22:21:15.459Z sha e76d777 :: needs maintainer review before merge. :: none

Reviewed October 9, 2026, 6:31 PM ET / 22:31 UTC (Revision 8).

@RomneyDa
RomneyDa marked this pull request as ready for review October 8, 2026 04:20
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Oct 8, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 8, 2026
@RomneyDa

RomneyDa commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

The final exact head 0d8ecef now has green hosted CI and a complete passing published 2026.9.8 → candidate compatibility cell. Its body records the exact package/build, actual successful update, serving identity/readiness and durable state/session assertions, cleanup, and the synthetic-service/interactive-proof limits. Both accepted findings and the CI ordering regression are repaired with focused regressions and clean P2 review. No stored format, schema or migration transform changes are introduced; completed upgrade proof supports compatibility sufficiency.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa

RomneyDa commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

Completed the previously missing actual terminal/native-service proof at exact head 0d8ecefc028a0c004ad519da40bd014c103d9928: real launchd decline, consent/repair/restore, and initially stopped controls, with durable logical-state checks and native ownership observations. Full results and limits are now in the body.

Actual macOS interactive Doctor proof

Candidate: 0d8ecefc028a0c004ad519da40bd014c103d9928, version 2026.9.8, official build ID 2026.9.8-0d8ecefc028a-2026-10-08T05-30-37.011Z. An independent frozen dependency installation and the official pnpm build owner passed (7m12.6s). The actual built CLI and native LaunchAgent were used; no Vitest flow, native adapter mock, supervisor shim, or Docker service was involved.

The previously absent, task-owned profile proof166948 selected canonical state ~/.openclaw-proof166948, native label gui/501/ai.openclaw.proof166948, and free loopback port 19648. Default profile/port were not used. All CLI children received env -i with actual account HOME, USER/LOGNAME, normal Node/system PATH, and TERM only. The profile used a synthetic local authentication token, no channels, no inference, disabled plugins/browser/cron, and its own workspace. The real service installer generated its profile-specific environment and plist. Launchd retained its normal OS SSH socket environment; this proof did not use SSH or any API/service credential.

Commands used the absolute candidate built CLI, abbreviated here as node /Users/dallin/openclaw-native-maintenance/dist/entry.js:

openclaw --profile proof166948 gateway install --port 19648
/usr/bin/script -q <case-transcript> /usr/bin/env -i HOME=/Users/dallin USER=dallin LOGNAME=dallin PATH=/Users/dallin/.nvm/versions/node/v24.16.0/bin:/usr/bin:/bin:/usr/sbin:/sbin TERM=xterm-256color node <candidate>/dist/entry.js --profile proof166948 doctor
openclaw --profile proof166948 gateway stop --force

script provided a real PTY. Consent was entered at the displayed prompts. An independent read-only observer sampled actual launchctl print, plist/config/SQLite fingerprints and modes, and the profile-local ownership locks every 200ms.

Case Actual observations
Running service, custody declined Source-update No, custody No; CLI cancelled and exited 0. PID 59975 remained unchanged. Plist/config SHA256, file modes, and modification times stayed identical. The durable session ID and messages stayed identical. Readiness remained 200.
Running service, custody accepted Custody Yes, recommended canonical-agent-roster config repair Yes. CLI printed Stopped the managed Gateway for Doctor repair. PID 59975 disappeared; real launchctl reported the label absent and the port refused connections. Offline ownership showed Doctor PID 84895, role sqlite-maintenance. The first config write at 2026-10-08T05:42:00.105787Z occurred with native label absent and PID null; config mode became 0600. Plist stayed identical. CLI subsequently printed Gateway restarted and verified after Doctor repair. Actual restored PID 98301, readiness 200, exit 0. Durable session ID/messages survived.
Initially stopped service, custody accepted Explicit canonical stop first left the native job unloaded and port free, while retaining its plist. Custody Yes then ran Doctor to completion, exit 0. Every observed native state remained unloaded/PID null; no restart/start occurred. Plist/config stayed identical. The durable transcript marker survived and all three SQLite databases passed integrity_check.

The durable sentinel was created and injected through actual Gateway RPC (sessions.create, chat.inject), with runStarted=false and delivery none. Its session ID was 8614ba95-cf87-4539-8420-4cb1d1661a4e; marker native-proof166948-durable-marker-0d8ecefc. Before/after chat.history messages were exactly equal; only the expected response snapshotAt timestamp changed. After the stopped case, a read-only SQLite query confirmed the same transcript marker without starting the service.

Raw bytes of the serving SQLite/WAL/SHM files can change while the unchanged Gateway remains running. This proof therefore does not claim byte equality for that active database; it uses the logical session/message oracle, alongside unchanged native PID/plist/config and absence of Doctor custody/repair. Raw fingerprints remain recorded for transparency.

Unrelated skill disabling, shell completion, and service-definition replacement were declined. The initial shared-dependency build fixture failed workspace resolution, then passed after an isolated frozen install; source was not altered. A stop without --force was safely refused, and the authorized task-owned stop used the canonical --force option.

Evidence: maintenance-native-summary.json, official build log and build-info, raw/clean PTY transcripts for all cases, independent timeline JSONL, actual native plist/Gateway log, before/after sentinel RPC results, stopped sentinel query, and canonical uninstall log.

Cleanup passed: canonical profile-specific uninstall exited 0; real launchctl label remains absent and port 19648 is free. Only the owned profile, its two recorded captures and marker, matching trashed plist, and newly created profile-specific log were removed. Evidence and the clean exact-head source worktree remain for publication. maintenance-cleanup.json records the removed paths; the parent owns final worktree removal.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa

RomneyDa commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

Maintainer-requested product scope clarification: the restart/Doctor incident was deliberately split into five independent PRs (#166942, #166946, #166947, #166948, #166950). This PR completes ordinary interactive Doctor maintenance custody: obtain consent before writable admission/repairs, cancel safely on decline, settle SQLite writers before restoring the selected managed service, and preserve initially stopped activation state. The operator explicitly requested independently reviewable fixes; this PR does not claim to implement all of related #144845, change restart authority, or repair every reported warning.

Revision 5 accepts the exact-head actual PTY/native launchd consent, decline, repair/restore and initially stopped proof, plus existing upgrade compatibility. It reports diamond proof confidence with no findings or before-merge items. Please assess product completeness against this intended maintenance-custody scope. No proof exemption or rating override is requested.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 8, 2026
@RomneyDa

RomneyDa commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

Conflict integration pushed at e76d777ffde3631e3a2b6f7cda68669cb0888e5e. Preserved upstream repair-preview docs, removed upload-test cleanup, readiness changes and deleted stopped-activation suite. The stopped-service regression now lives in the canonical readiness suite; stale skipped-update assertions were removed.

Fresh focused proof passed 18/18 (readiness 5, update 5, settlement 8), plus the post-cleanup update replay 5/5. Previously sandbox-refused ancestry cases now pass under normal inspection with unchanged guards. Official scoped lint/format/diff and independent P0–P2 autoreview pass. The broad local changed checker stops at its borrowed-dependency type boundary, accurately recorded in the body.

Current integration evidence is separated from historical native PTY/launchd and published-updater proof. No merge or operator Gateway/state change. The prior review is older than 12 hours; please assess this exact integration with the updated evidence.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Oct 9, 2026
@RomneyDa
RomneyDa merged commit 4eff44b into main Oct 9, 2026
139 checks passed
@RomneyDa
RomneyDa deleted the fix/doctor-interactive-maintenance branch October 9, 2026 23:58
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
* fix: coordinate interactive doctor repairs with gateway maintenance

* fix: preserve stopped gateway during interactive doctor maintenance

* fix: preserve doctor update admission before interactive custody
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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