fix: support OPENCLAW_HOME for non-standard OpenClaw paths#275
Open
luoyanglang wants to merge 2 commits intocft0808:mainfrom
Open
fix: support OPENCLAW_HOME for non-standard OpenClaw paths#275luoyanglang wants to merge 2 commits intocft0808:mainfrom
luoyanglang wants to merge 2 commits intocft0808:mainfrom
Conversation
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
Issue: #271 - install scripts hardcode
~/.openclawand fail in non-standard OpenClaw environmentsType: Bug Fix
Severity: Medium
This PR adds
OPENCLAW_HOMEsupport across the install flow and runtime scripts that read OpenClaw state. It preserves the existing default behavior when the environment variable is not set, while allowing NAS and other non-standard deployments to point Edict at a custom OpenClaw home directory.Closes #271.
Root Cause
Several install and runtime entry points built OpenClaw paths directly from
~/.openclawinstead of using a shared resolution rule.install.sh:8,install.sh:134,install.sh:159install.ps1:9,install.ps1:122,install.ps1:148scripts/apply_model_changes.py:12scripts/skill_manager.py:31,scripts/skill_manager.py:232scripts/sync_agent_config.py:16,scripts/sync_agent_config.py:142,scripts/sync_agent_config.py:160,scripts/sync_agent_config.py:270,scripts/sync_agent_config.py:305,scripts/sync_agent_config.py:318,scripts/sync_agent_config.py:327scripts/sync_officials_stats.py:12scripts/sync_from_openclaw_runtime.py:18That meant the path flow was:
$HOME/Path.home()-> hardcoded.openclaw->openclaw.json/workspace-*/agents/*When OpenClaw was installed under a custom home, the install scripts failed early and some runtime scripts still pointed at the wrong directory even if the user manually worked around installation.
Fix Description
Changed files:
install.sh:8- useOPENCLAW_HOMEwith fallback to~/.openclawinstall.sh:134- update the embedded Python registration snippet to resolve config/workspace paths from the same home directoryinstall.ps1:9- add the same environment-variable fallback for Windows installsinstall.ps1:122- update the embedded Python registration snippet for Windowsscripts/utils.py:18- addget_openclaw_home()as the shared path resolverscripts/apply_model_changes.py:12- readopenclaw.jsonfrom the resolved OpenClaw homescripts/skill_manager.py:31- use the shared resolver for workspace andskills-hub-urlscripts/sync_agent_config.py:16- use the shared resolver for config, workspaces, deployed SOUL files, and agent session directoriesscripts/sync_officials_stats.py:12- use the shared resolver for agent stats and config readsscripts/sync_from_openclaw_runtime.py:18- use the shared resolver for session scanningRationale:
~/.openclawassumption.Test Results
python -m py_compileutils.py,apply_model_changes.py,skill_manager.py,sync_agent_config.py,sync_officials_stats.py,sync_from_openclaw_runtime.py)get_openclaw_home()with no env var set and confirmed fallback toC:\Users\Administrator\.openclawOPENCLAW_HOME=D:\tmp\custom-openclawand confirmedapply_model_changes,sync_agent_config,sync_officials_stats, andsync_from_openclaw_runtimeresolve to that directoryinstall.ps1syntaxinstall.ps1through the PowerShell parser after the path changesManual notes:
install.shflow end-to-end here becausebashis not installed in this environment and OpenClaw CLI initialization is not set upinstall.shwere reviewed directly in diff and kept equivalent to the PowerShell implementationDisprove Analysis
Is this already fixed elsewhere?
I checked the current
upstream/mainbefore branching and did not find existingOPENCLAW_HOMEhandling in these install/runtime paths.Impact range
The behavioral change is limited to OpenClaw home-directory resolution. If
OPENCLAW_HOMEis unset, all touched code paths still resolve to the original~/.openclawlocation.Edge cases
OPENCLAW_HOMEnow works for both install scripts and Python runtime scripts, so installation and follow-up maintenance tasks stay aligned.expanduser(), which also handles values such as~/custom-openclaw.openclaw.jsonare still respected becausesync_agent_config.pyonly uses the resolved home for fallback paths.Known limitations
install.shwas not executed end-to-end in this Windows workspace becausebashwas unavailable.Checklist
#271)Found during routine bug-fix work. Happy to adjust the scope if you prefer limiting this PR strictly to the originally reported files.