Repository navigation
fix: doctor stays silent when Windows state dir is under OneDrive - #123720
vincentkoc merged 19 commits into
Conversation
…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
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs real behavior proof before merge. Reviewed September 13, 2026, 12:38 PM ET / 16:38 UTC (Revision 23). ClawSweeper reviewWhat this changesAdds 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 Review scores
Verification
How this fits togetherDoctor 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
Before merge
Agent review detailsSecurityNone. PR surfaceSource +104, Tests +426, Docs +1, Config 0. Total +531 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest 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. 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 (22 earlier review cycles; latest 8 shown)
|
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.
…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.
|
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)];
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: Evidence, on the new test file:
The one failure in the before-run is the new One thing I deliberately did not change. Scope note on my test run. 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. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
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.
|
Merged via squash.
|
* 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) ...
…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]>
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 headd5e1b3f8958d7baa2e2b15cf054e6c1cfc5ed784. 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
2700b9e34e6f79afba980dac67508af4c6eb707eis integrated through a signed merge to acquire the canonical UI budget baseline repair, not a local baseline edit. The five PR files are unchanged from52d680348ad7b89522e2b27d9dd0ab21aa1b2e21. 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
6a981fbexecuted ten cases with exactly two intended selected/ambient-environment warning failures and eight passing controls. The repaired52dexecution passed ten cases historically. Fresh Windows CI on exactd5e1b3falso 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.52dcounterfactual 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 completedcheck:changed. These are historical52dresults.34768585746on exactd5e1b3fis 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. Historical52ddependency-acquisition and immutable UI-baseline failures are not relabeled as passes.[email protected], trusted harnessa891c3fb955e129f3baf109b62d5d30a4492ce01, and the exactd5e1b3fcandidate package (2026.9.4, SHA2564dcbee51cbb792baab45d897d23dab438afd276eb112a6cd8723e6bdb11e7d47). The recovered scheduler finished with exit 0 at 16:50:59 UTC. Original first-hop update steps exited 0; update status wasok, outcomesuccess, 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.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.