Skip to content

fix: doctor stays silent when Windows state dir is under OneDrive - #123720

Merged
vincentkoc merged 19 commits into
openclaw:mainfrom
MohammedAlkindi:fix/doctor-windows-cloud-state-dir
Sep 13, 2026
Merged

vincentkoc merged 19 commits into
openclaw:mainfrom
MohammedAlkindi:fix/doctor-windows-cloud-state-dir

Conversation

@MohammedAlkindi

@MohammedAlkindi MohammedAlkindi commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #98470

What Problem This Solves

Fixes: Doctor stays silent when native Windows state is located under a OneDrive sync root, where sync locks and Files On-Demand can interfere with sessions, credentials, and SQLite files.

User Impact

Windows operators receive a warning and guidance for relocating the Gateway's whole state directory and service environment. Nothing relocates files, modifies configuration, or changes storage policy automatically.

Merged through the native workflow on September 13, 2026 at 17:12:52 UTC as 659faca280fab7ba4f04b4b58c5b3c41e35b838f, from exact reviewed head d5e1b3f8958d7baa2e2b15cf054e6c1cfc5ed784. Exact-head CI, native Windows proof, and recovered single-cell Linux upgrade evidence were accepted without gate bypass.

Why This Change Was Made

MohammedAlkindi's OneDrive diagnostic, relocation guidance, and contributor ancestry are preserved. The maintainer repair forwards the selected Doctor environment and uses the existing Windows case-insensitive resolver for the three OneDrive keys, without falling back to unrelated ambient values.

Pinned main 2700b9e34e6f79afba980dac67508af4c6eb707e is integrated through a signed merge to acquire the canonical UI budget baseline repair, not a local baseline edit. The five PR files are unchanged from 52d680348ad7b89522e2b27d9dd0ab21aa1b2e21. Other upstream inputs did change, including Doctor registry inspection, test routing, and dependency inputs; historical proof is not presented as execution on the integrated head.

Evidence

  • Native Windows red to green, including current head: the accepted pre-fix job on 6a981fb executed ten cases with exactly two intended selected/ambient-environment warning failures and eight passing controls. The repaired 52d execution passed ten cases historically. Fresh Windows CI on exact d5e1b3f also passed all ten named cases and completed September 13 at 16:40:18 UTC: consumer/business roots, local and prefix controls, missing paths, junctions, both environment disagreements, and later agent-family assertions.
  • Environment-key casing: isolated 52d counterfactual execution produced three intended alternate-case failures and three canonical passes. Its controller miscounted eighteen skipped rows; that failed controller result is retained, not presented as green. The separately reviewed continuation passed all 34 owner/environment tests with no skips and completed check:changed. These are historical 52d results.
  • State preservation boundary: native tests use the registered interactive contribution, real junctions, lint, and dry-run recommendations. Already-open seeded families retain exact config/DB/WAL/journal bytes and all tracked existence/mode/size checks. Only identified SQLite SHM coordination bytes are not frozen, following the SQLite WAL-index contract. Earlier invalid SHM-byte fixture attempts are historical, not successful control proof.
  • Current hosted CI: run 34768585746 on exact d5e1b3f is green, including the required gate. The UI budget job passed. One UI job failed to bind its test port; exactly one authorized job-only retry passed. The original failure is retained; the passing retry does not establish its root cause. Historical 52d dependency-acquisition and immutable UI-baseline failures are not relabeled as passes.
  • Accepted recovered Linux published-upgrade BASE proof: the original single-cell run used integrity-verified [email protected], trusted harness a891c3fb955e129f3baf109b62d5d30a4492ce01, and the exact d5e1b3f candidate package (2026.9.4, SHA256 4dcbee51cbb792baab45d897d23dab438afd276eb112a6cd8723e6bdb11e7d47). The recovered scheduler finished with exit 0 at 16:50:59 UTC. Original first-hop update steps exited 0; update status was ok, outcome success, with no recovery path. Automatic migration passed before standalone Doctor; candidate Doctor/post-core, state survival, and Gateway checks passed. Maintainer and independent review verified all 42 recovered report file hashes/sizes, candidate identity, process-exit records, and scoped resource quiescence.
  • Control failure retained: the outer Crabbox client exited 7 after local disk exhaustion disrupted ownership renewal and collection. Broker terminal recording failed, and the original driver final receipt/archive was not produced. Existing reports were recovered read-only; no BASE replay occurred. The recovered product proof is accepted separately from that incomplete outer-driver/control outcome, not represented as broker success.
  • Focused source reviews and the completed exact-head ClawSweeper review found no remaining actionable findings. Contributor code, hooks, tests, and checks were not executed locally. The author's earlier Windows captures remain historical evidence.

Limits: only OneDrive-provided environment roots are detected; unset roots, lexical aliases, and other cloud providers can remain unreported. This is registered-flow preservation, not closed-family or full-CLI preservation. Linux upgrade evidence does not establish Windows update or service-restart behavior. No dependency overrides, copied baseline repair, or gate waiver were used.

…nc root

Doctor warns when the state directory is cloud-synced on macOS (iCloud
Drive, CloudStorage) and on risky Linux mounts, but stayed silent for
the equivalent Windows case, where OneDrive sync locks, delayed writes,
and Files On-Demand dehydration can make session, credential, and
SQLite state flaky.

Detect OneDrive roots from the OneDrive/OneDriveConsumer/
OneDriveCommercial environment variables the sync client maintains --
canonical roots rather than path-shape heuristics, so ordinary local
folders never match. Comparison is case-folded (Windows filesystems
are case-insensitive) and runs on the realpath-resolved target so
junction prefixes cannot misclassify a local dir.

Closes #98470
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: S labels Aug 14, 2026
@clawsweeper clawsweeper Bot added 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 13, 2026, 12:38 PM ET / 16:38 UTC (Revision 23).

ClawSweeper review

What this changes

Adds OneDrive storage warnings and service-wide relocation guidance to Windows Doctor, with documentation and native Windows regression coverage.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains useful work absent from current main and the latest release. The prior environment-forwarding finding is resolved, and no new blocking code defect was found; the explicitly outstanding published-updater proof still prevents a merge-ready verdict.

Priority: P2
Reviewed head: d5e1b3f8958d7baa2e2b15cf054e6c1cfc5ed784

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and the prior defect is resolved, but required upgrade evidence remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Historical native Windows Doctor output proves the warning and local-path control; the supplied 52d6803 registered-flow results support the environment repair and carry forward across unchanged relevant files. The stronger Doctor proof gate remains incomplete because the captured body explicitly reports no published-updater execution for the integrated candidate. The blocked job-log download is a reviewer limitation, not an additional contributor-proof defect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Historical native Windows Doctor output proves the warning and local-path control; the supplied 52d6803 registered-flow results support the environment repair and carry forward across unchanged relevant files. The stronger Doctor proof gate remains incomplete because the captured body explicitly reports no published-updater execution for the integrated candidate. The blocked job-log download is a reviewer limitation, not an additional contributor-proof defect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 9 items Current main still lacks Windows storage detection: The current Doctor owner calls the macOS, Linux SD, and Linux volatile-storage detectors; it has no Windows cloud-storage detector or OneDrive warning.
Latest release lacks the warning too: Reading the v2026.9.4 source through GitHub confirmed the same macOS/Linux-only detector calls. The local release-object inspection failed, so the release conclusion uses the successful GitHub contents read.
Introduced behavior and resolved finding: The complete production diff forwards the selected environment to Windows detection, uses the existing case-insensitive environment resolver, follows existing ancestors, and maps the result to warnings and recommendation-only effects. Interactive Doctor consistently uses its existing ambient environment. No configuration, schema, permission, or automatic relocation change is introduced.
Findings None None.
Security None None.

How this fits together

Doctor inspects OpenClaw’s state directory and reports conditions that could affect sessions, credentials, and databases. This change compares the resolved directory against OneDrive environment roots and emits advisory findings through interactive and structured Doctor output.

flowchart TD
  A[Selected state directory] --> C[Resolve existing ancestors]
  B[OneDrive environment roots] --> D[Windows path comparison]
  C --> D
  D --> E[Interactive warning]
  D --> F[Structured health finding]
  E --> G[Operator relocation guidance]
  F --> G
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Historical native Windows Doctor output proves the warning and local-path control; the supplied 52d6803 registered-flow results support the environment repair and carry forward across unchanged relevant files. The stronger Doctor proof gate remains incomplete because the captured body explicitly reports no published-updater execution for the integrated candidate. The blocked job-log download is a reviewer limitation, not an additional contributor-proof defect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The integrated candidate has no completed published-updater result establishing its original update outcome and subsequent state survival.
  • Complete next step (P2) - Add the outstanding published-updater result and state-survival evidence for the integrated candidate. Redacted terminal output or logs are appropriate; screenshots or recordings also count when they show the result. Remove private paths, endpoints, credentials, and other private details. Update the PR body to trigger re-review; if it does not, ask a maintainer to comment @clawsweeper re-review.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +104, Tests +426, Docs +1, Config 0. Total +531 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 104 0 +104
Tests 2 428 2 +426
Docs 1 1 0 +1
Config 1 1 1 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 534 3 +531

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +104/-0; tests +428/-2 Production growth extends the existing diagnostic owner; most added coverage exercises platform controls and registered-flow preservation.

Stored data model

Persistent data-model change detected: migration/backfill/repair: package.json, migration/backfill/repair: src/commands/doctor-state-integrity.ts, unknown-data-model-change: src/commands/doctor-state-integrity.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep OneDrive detection within the existing Doctor owner as an advisory check, with service-scoped relocation guidance and verified published-updater compatibility.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep OneDrive detection within the existing Doctor owner as an advisory check, with service-scoped relocation guidance and verified published-updater compatibility.

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

Not applicable as a new platform diagnostic: current main and v2026.9.4 demonstrably lack Windows cloud-storage classification, while the discussion supplies native Windows before/after observations.

Is this the best way to solve the issue?

Yes. Reusing the existing ancestor resolver, environment semantics, and Doctor finding paths is a focused solution; the documented OneDrive-only scope avoids unreliable folder-name heuristics.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded Windows diagnostic improvement that helps operators identify risky storage without changing runtime storage policy.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Historical native Windows Doctor output proves the warning and local-path control; the supplied 52d6803 registered-flow results support the environment repair and carry forward across unchanged relevant files. The stronger Doctor proof gate remains incomplete because the captured body explicitly reports no published-updater execution for the integrated candidate. The blocked job-log download is a reviewer limitation, not an additional contributor-proof defect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the already-scoped published-updater validation for the integrated candidate, recording package identity, the original update outcome before standalone Doctor, and subsequent state survival.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-25T16:53:59.333Z sha 0bb6c9c :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T10:31:21.704Z sha ecee78e :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T15:06:01.195Z sha 891d5b6 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-27T18:49:30.709Z sha 0f8a117 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-28T00:56:27.155Z sha 87a9478 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-03T05:04:10.530Z sha 87a9478 :: blocked before merge. :: none
  • reviewed 2026-09-13T15:14:06.906Z sha 957aba8 :: needs real behavior proof before merge. :: [P2] Forward the selected environment to OneDrive detection
  • reviewed 2026-09-13T15:59:33.937Z sha 52d6803 :: needs real behavior proof before merge. :: none

The OneDrive warning is only ever shown on Windows, but its recovery
line copied the macOS branch's POSIX form:

    OPENCLAW_STATE_DIR=%USERPROFILE%\.openclaw openclaw doctor

Neither Windows shell accepts inline assignment as a prefix. Verified on
Windows 11: cmd.exe answers "'OPENCLAW_STATE_DIR' is not recognized as an
internal or external command" and PowerShell answers "The term
'OPENCLAW_STATE_DIR=...' is not recognized". Every operator who followed
the hint hit an error instead of a fix.

Emit one line per supported shell instead, both confirmed to set the
variable for the command that follows:

    PowerShell: $env:OPENCLAW_STATE_DIR="$env:USERPROFILE\.openclaw"; openclaw doctor
    cmd.exe:    set "OPENCLAW_STATE_DIR=%USERPROFILE%\.openclaw" && openclaw doctor

The text moves into formatWindowsCloudSyncedStateDirWarning, mirroring
formatLinuxSdBackedStateDirWarning, so the rendered string is assertable
without stubbing platform and filesystem. The guard test greps for the
POSIX prefix shape and fails against the old line.
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Aug 15, 2026
…sent

The detector called realpath on the state dir itself and fell back to the
lexical path when that failed. A state dir that does not exist yet - a
fresh install - cannot be resolved, so a not-yet-created leaf beneath a
OneDrive-named junction that actually points at local storage fell back
to its OneDrive-prefixed lexical path and produced a false warning.

Resolve through the nearest existing ancestor and re-append the missing
segments, which is what the two Linux detectors in this file already do
via resolvePathThroughExistingAncestor. The junction is then followed
even when the leaf is absent.

Adds two tests: the false-warning case, and a guard that a missing leaf
whose ancestor really does resolve inside OneDrive still warns.
@MohammedAlkindi

Copy link
Copy Markdown
Contributor Author

Fixed the P2. Thanks for catching it — the case is real and I could reproduce the reasoning directly.

What was wrong. The detector called realpath on the state dir itself:

const realPath = (deps?.resolveRealPath ?? tryResolveRealPath)(stateDir);
const candidates = realPath ? [path.resolve(realPath)] : [path.resolve(stateDir)];

realpath fails on a path that does not exist, which is exactly the fresh-install case. So a state dir whose leaf has not been created yet fell through to path.resolve(stateDir) — the lexical path — and a leaf beneath a OneDrive-named junction that actually resolves to local storage got warned about anyway.

The fix. Resolve through the nearest existing ancestor and re-append the missing segments, so the junction is followed even when the leaf is absent. That is not a new mechanism: resolvePathThroughExistingAncestor is already in this file and both Linux detectors (detectLinuxSdBackedStateDir, detectLinuxVolatileStateDir) already use it. This makes the Windows detector consistent with them.

Evidence, on the new test file:

Tests
product change reverted, new tests present 1 failed, 17 passed
with the fix 18 passed

The one failure in the before-run is the new ignores a junction prefix when the state dir leaf does not exist yet, so the test discriminates the fix rather than describing it. I added a second test alongside it — still warns when a missing leaf resolves to a path inside OneDrive — because the risk in this change is over-correcting into silence, and that one pins the warning still firing when the ancestor genuinely does resolve inside the sync root.

One thing I deliberately did not change. detectMacCloudSyncedStateDir has the identical shape — direct realpath, lexical fallback — so it has the same false-warning behaviour for a missing leaf under an iCloud-named symlink. I left it alone to keep this PR to one concern. Happy to send it as a separate PR if you want it.

Scope note on my test run. src/commands/doctor-state-integrity.test.ts shows 24 failures on this branch on my Windows machine, but it shows the same 24 with my changes stashed, so they are pre-existing here and unrelated. I did not touch them.

Ran on Windows 11 (10.0.26200), Node 24.18.0.


I used an AI assistant while working on this, as the contributing guidelines ask contributors to disclose. The reproduction reasoning, both test runs quoted above, and the stashed-baseline comparison that separates the 24 pre-existing failures from this change were all carried out by me on the machine described.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 15, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Aug 15, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 3, 2026
@vincentkoc vincentkoc self-assigned this Sep 9, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 11, 2026
Merge pinned main a891c3f while preserving the contributor history. Add registered-flow Windows coverage and retain the original selected-environment omission for the explicitly non-land-ready counterfactual. Restore env forwarding only after the named Windows result is captured.
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@vincentkoc
vincentkoc merged commit 659faca into openclaw:main Sep 13, 2026
420 of 422 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '201f11afefdb19a9c75e9d3542bf7425c80df7a7': (141 commits)
  fix: keep catalog discovery scoped and execution lazy (#147159)
  fix: serialize reclamation worker shutdown with foreground writes (#147178)
  test(sessions): cover abrupt committed transcript recovery (#143984)
  fix: stop transcript storms during context overflow recovery (#147202)
  fix: reduce CPU overhead for small history and usage reads (#147205)
  fix: resume tasks after tools finish and the model times out (#147203)
  refactor(scripts): share SQLite reliability message waits (#146900)
  feat(exec): configure approval reviewer thinking and fastMode (#147192)
  test: remove redundant Bonjour module headers (#146981)
  refactor: share streaming media tail boundary update (#146989)
  refactor(tui): classify resume candidates once (#146983)
  improve: skip unused toast dismissal work (#147196)
  fix(linux): recover saved remote connections without replacing active sessions (#146047)
  fix: doctor stays silent when Windows state dir is under OneDrive (#123720)
  feat: announce successful Daybreak retries (#147146)
  feat(code-mode): reuse results across code cells (#147154)
  refactor(test): reuse CLI plugin fixture writer (#147186)
  test: skip unused compiler setup in routing fixtures (#147194)
  test: reuse LINE webhook runtime fixture (#146710)
  fix(code-mode): check automation and process result types (#147143)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…enclaw#123720)

* fix(doctor): warn when Windows state dir resolves under a OneDrive sync root

Doctor warns when the state directory is cloud-synced on macOS (iCloud
Drive, CloudStorage) and on risky Linux mounts, but stayed silent for
the equivalent Windows case, where OneDrive sync locks, delayed writes,
and Files On-Demand dehydration can make session, credential, and
SQLite state flaky.

Detect OneDrive roots from the OneDrive/OneDriveConsumer/
OneDriveCommercial environment variables the sync client maintains --
canonical roots rather than path-shape heuristics, so ordinary local
folders never match. Comparison is case-folded (Windows filesystems
are case-insensitive) and runs on the realpath-resolved target so
junction prefixes cannot misclassify a local dir.

Closes openclaw#98470

* fix(doctor): use Windows shell syntax in the OneDrive recovery hint

The OneDrive warning is only ever shown on Windows, but its recovery
line copied the macOS branch's POSIX form:

    OPENCLAW_STATE_DIR=%USERPROFILE%\.openclaw openclaw doctor

Neither Windows shell accepts inline assignment as a prefix. Verified on
Windows 11: cmd.exe answers "'OPENCLAW_STATE_DIR' is not recognized as an
internal or external command" and PowerShell answers "The term
'OPENCLAW_STATE_DIR=...' is not recognized". Every operator who followed
the hint hit an error instead of a fix.

Emit one line per supported shell instead, both confirmed to set the
variable for the command that follows:

    PowerShell: $env:OPENCLAW_STATE_DIR="$env:USERPROFILE\.openclaw"; openclaw doctor
    cmd.exe:    set "OPENCLAW_STATE_DIR=%USERPROFILE%\.openclaw" && openclaw doctor

The text moves into formatWindowsCloudSyncedStateDirWarning, mirroring
formatLinuxSdBackedStateDirWarning, so the rendered string is assertable
without stubbing platform and filesystem. The guard test greps for the
POSIX prefix shape and fails against the old line.

* fix(doctor): follow a OneDrive junction when the state dir leaf is absent

The detector called realpath on the state dir itself and fell back to the
lexical path when that failed. A state dir that does not exist yet - a
fresh install - cannot be resolved, so a not-yet-created leaf beneath a
OneDrive-named junction that actually points at local storage fell back
to its OneDrive-prefixed lexical path and produced a false warning.

Resolve through the nearest existing ancestor and re-append the missing
segments, which is what the two Linux detectors in this file already do
via resolvePathThroughExistingAncestor. The junction is then followed
even when the leaf is absent.

Adds two tests: the false-warning case, and a guard that a missing leaf
whose ancestor really does resolve inside OneDrive still warns.

* fix(doctor): describe gateway-wide relocation instead of one-shot state-dir hints

* test(doctor): preserve open database families in Windows proof

* test(doctor): identify native state snapshot mismatches

* test(doctor): preserve SQLite data without freezing reader metadata

* fix(doctor): honor selected Windows OneDrive environment

---------

Co-authored-by: Vincent Koc <[email protected]>
@MohammedAlkindi
MohammedAlkindi deleted the fix/doctor-windows-cloud-state-dir branch October 15, 2026 16:00
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: L stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants