fix(profile): make default state paths consistently profile-aware (workspace + doctor migration) - #2
Closed
xiejiahao wants to merge 23 commits into
Closed
Conversation
…ocalFile On Windows, device IDs (dev) returned by handle.stat() and fs.lstat() may differ even for the same file, causing false-positive 'path-mismatch' errors when reading local media files. This fix introduces a statsMatch() helper that: - Always compares inode (ino) values - Skips device ID (dev) comparison on Windows where it's unreliable - Maintains full comparison on Unix platforms Fixes openclaw#25699
xiejiahao
force-pushed
the
codex/profile-aware-workspace-clean
branch
from
February 25, 2026 01:07
8f95e09 to
b471e1b
Compare
…#25435) Land PR openclaw#25435 from @Zjianru. Changelog: add 2026.2.24 fix entry with contributor credit. Co-authored-by: codez <codezhujr@gmail.com>
…penclaw#25682) Land PR openclaw#25682 from @lairtonlelis after maintainer rework: track dispatcher updates when network decision changes to avoid stale global fetch behavior. Co-authored-by: Ailton <lairton@telnyx.com>
…penclaw#25827) Carry fail-closed empty-allowlist guard clarity and changelog attribution for PR openclaw#25827. Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local>
) Land PR openclaw#25680 from @lairtonlelis. Retain explicit status/code/http 402 detection for oversized structured payloads. Co-authored-by: Ailton <lairton@telnyx.com>
…#25729) Land PR openclaw#25729 from @Suko. Use shared fallback-resolution helper and add regression coverage for default, override, and explicit-empty cases. Co-authored-by: suko <miha.sukic@gmail.com>
…directory
Change resolveDefaultAgentWorkspaceDir() to derive the workspace path
from resolveStateDir() instead of manual profile-based path construction.
Similarly update exec-approvals path resolution to use stateDir, with
legacy fallback for backward compatibility.
Before: ~/.openclaw/workspace-{profile}, ~/.openclaw/exec-approvals.json
After: <stateDir>/workspace, <stateDir>/exec-approvals.json
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add doctor checks that detect legacy profile workspace layouts
(~/.openclaw/workspace-{profile}) and exec-approvals files
(~/.openclaw/exec-approvals.json), offering interactive migration to
the new stateDir-based locations.
- Extract runDoctorMigrationPrompt() helper to deduplicate the
detect → preview → confirm → move → result pattern
- Remove dead detectLegacyWorkspaceDirs() stub (gutted during
moltbot→openclaw rename, always returned empty array)
- Fix config migration to remove agents.defaults.workspace key
(falls back to implicit stateDir-derived default) instead of
setting it to a new absolute path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update documentation and source string literals to reflect the new stateDir-based default paths. Documentation uses <stateDir>/... as a placeholder; runtime user-facing messages use dynamically resolved paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Clear OPENCLAW_STATE_DIR in tests that stub OPENCLAW_HOME, since Windows test harness sets OPENCLAW_STATE_DIR which takes precedence in resolveStateDir(). Also use JSON.parse instead of toContain for path assertions in doctor-exec-approvals to avoid backslash escaping mismatches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiejiahao
force-pushed
the
codex/profile-aware-workspace-clean
branch
from
February 25, 2026 01:40
b471e1b to
8549a68
Compare
Extension resolveStateDirFromEnv helpers were producing ~/.openclaw-default instead of ~/.openclaw when OPENCLAW_PROFILE=default was set without OPENCLAW_STATE_DIR. Align with the core CLI behaviour in src/cli/profile.ts which treats "default" as the empty suffix. Fixes review comment on feishu/dedup.ts, feishu/dynamic-agent.ts, voice-call/utils.ts, memory-lancedb/config.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Describe the problem and fix in 2–5 bullets:
~/.openclaw-<profile>, while some defaults/messages still pointed to~/.openclaw/....<stateDir>/workspace, explicit config overrides defaults.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
stateDir.<stateDir>/...defaults where applicable.Security Impact (required)
No)No)No)No)Yes)Yes, explain risk + mitigation:Repro + Verification
Environment
--profile <name>)Steps
Expected
Actual
Evidence
Local CI checks (macOS Apple Silicon, Node + pnpm)
Format (
oxfmt --check):Type check (
tsgo/@typescript/native-preview 7.0.0-dev):7 pre-existing errors on the base branch (
codex/upstream-main-sync), confirmed by runningtsgoon the base branch directly. None introduced by this PR.Lint (
oxlint --type-aware):Tests (
pnpm test:macmini— serial profile, 1 worker):Protocol check (
pnpm protocol:check):Docs check (
pnpm check:docs):Human Verification (required)
What you personally verified (not just CI), and how:
pnpm test:macmini): 1392 files, 11311 tests, 0 failures.blacksmith-16vcpu-ubuntu-2404custom runners)Compatibility / Migration
Yes)No)Recommendedfor legacy profile layouts)openclaw --profile <name> doctorFailure Recovery (if this breaks)
openclaw.jsonfrom backup (.bak) when needed.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.