From decf1f8dc4decce78d2b85c66b9a722df75fedf2 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Sat, 7 Feb 2026 03:42:10 +0530 Subject: [PATCH] fix: expand ~ for workspace files and ignore backend tilde dir --- .gitignore | 3 +++ backend/app/services/agent_provisioning.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 81fd7fc4..be2b5ab3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ node_modules/ # Worktrees .worktrees/ + +# Accidental literal "~" directories (e.g. when a configured path contains "~" but isn't expanded) +backend/~/ diff --git a/backend/app/services/agent_provisioning.py b/backend/app/services/agent_provisioning.py index a1214d3d..c3640f9e 100644 --- a/backend/app/services/agent_provisioning.py +++ b/backend/app/services/agent_provisioning.py @@ -130,7 +130,9 @@ def _ensure_workspace_file( ) -> None: if not workspace_path or not name: return - root = Path(workspace_path) + # `gateway.workspace_root` is sometimes configured as `~/.openclaw`. + # Expand user here to avoid creating a literal `./~` directory under the backend cwd. + root = Path(workspace_path).expanduser() path = root / name if not overwrite and path.exists(): return