openclaw - 💡(How to fix) Fix Nested workspace (workspace-local/local) is accepted, initialized, and recreated after deletion [4 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#63431Fetched 2026-04-09 07:53:47
View on GitHub
Comments
4
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
commented ×4

OpenClaw can accept and operate on a non-canonical nested workspace path (e.g. ). Once activated, the runtime bootstraps it as a valid workspace, writes state and memory inside it, and recreates it after manual deletion, indicating an active re-seeding source.


Root Cause

  • Nested workspace persisted and reused
  • Deletion does not fix issue → runtime re-seeds it
  • Config is correct → issue not caused by user configuration
RAW_BUFFERClick to expand / collapse

🐛 Bug: Nested workspace () is accepted, initialized, and re-created after deletion

Summary

OpenClaw can accept and operate on a non-canonical nested workspace path (e.g. ). Once activated, the runtime bootstraps it as a valid workspace, writes state and memory inside it, and recreates it after manual deletion, indicating an active re-seeding source.


Environment

  • OS: Linux (Debian-based)
  • Install: global via npm ()
  • Workspace config ():

Observed Behavior

  1. A nested path appears:

  2. This path is treated as a valid workspace root:

  • Contains its own
  • Contains markdown/memory files (, , etc.)
  • Has its own directory
  1. Evidence of initialization:

  2. Evidence of active usage:

  3. Critical behavior:

  • After manually deleting
  • OpenClaw recreates it and repopulates it with markdown/state files
  • This happened during / consolidation work

Expected Behavior

  • Only the configured canonical workspace root should be used:

  • Subdirectories like should never be:

  • treated as independent workspaces

  • bootstrapped

  • persisted as workspace roots


Technical Analysis (evidence-based)

From code inspection (dist build):

  • Workspace selection prioritizes:

  • Workspace is then used directly:

  • Session persistence:

Observations

  • is accepted without canonical validation

  • can override canonical resolution

  • is used as fallback in several modules:

  • No evidence of defensive canonicalization or rejection of subpaths

Important distinction

The first injection point is not fully proven, but strong candidates include:

  • when running inside a subdirectory
  • persisted session metadata ()
  • runtime propagation via

Impact

  • Nested workspace creation
  • Data duplication across workspaces
  • Recursive or repeated workspace initialization
  • Non-deterministic behavior depending on runtime context
  • Difficult-to-debug state contamination

Proposed Fix

Introduce defensive canonicalization and validation:

  1. Normalize all candidate workspace paths:
  • resolve absolute path
  • remove symlinks
  • compare with canonical root
  1. Reject or sanitize subpaths:
  • if is inside the canonical root but not equal → reject or normalize
  1. Do not use as implicit workspace root unless explicitly intended

  2. Validate before:

  • session persistence ()
  1. Optionally log warnings when non-canonical paths are detected

Additional Evidence

  • Nested workspace persisted and reused
  • Deletion does not fix issue → runtime re-seeds it
  • Config is correct → issue not caused by user configuration

Conclusion

This is not just a stale directory issue. The runtime actively accepts, initializes, and reuses nested workspace paths, and can recreate them after deletion, indicating a missing validation layer and a potential feedback loop via runtime or persisted state.

Summary

OpenClaw is bootstrapping a descendant path (e.g. .../workspace-local/local) as a workspace root, without validating it against the configured canonical workspace.

This leads to multiple active workspace roots, state divergence, and non-deterministic behavior.

extent analysis

TL;DR

Introduce defensive canonicalization and validation to reject or sanitize subpaths and ensure only the configured canonical workspace root is used.

Guidance

  • Normalize all candidate workspace paths by resolving absolute paths, removing symlinks, and comparing with the canonical root.
  • Reject or sanitize subpaths that are inside the canonical root but not equal to it.
  • Validate workspace paths before bootstrapping and session persistence to prevent the use of implicit workspace roots.
  • Consider logging warnings when non-canonical paths are detected to aid in debugging.

Example

// Example of normalizing a workspace path
const canonicalRoot = '/path/to/canonical/workspace';
const candidatePath = '/path/to/canonical/workspace/subdir';

const normalizedPath = path.resolve(candidatePath);
if (normalizedPath.startsWith(canonicalRoot) && normalizedPath !== canonicalRoot) {
  // Reject or sanitize the subpath
  throw new Error(`Non-canonical workspace path: ${candidatePath}`);
}

Notes

The proposed fix requires careful consideration of the implications of rejecting or sanitizing subpaths, as this may affect existing workflows or use cases. Additionally, the introduction of defensive canonicalization and validation may require updates to error handling and logging mechanisms.

Recommendation

Apply the proposed fix to introduce defensive canonicalization and validation, as this will help prevent the acceptance and initialization of nested workspace paths, and ensure that only the configured canonical workspace root is used. This will help mitigate the issues of data duplication, non-deterministic behavior, and state contamination.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING