openclaw - ✅(Solved) Fix [Bug]: Control UI ignores agents.defaults.workspace, creates duplicate workspace-main [1 pull requests, 4 comments, 3 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#59789Fetched 2026-04-08 02:40:29
View on GitHub
Comments
4
Participants
3
Timeline
15
Reactions
0
Author
Timeline (top)
commented ×4referenced ×4cross-referenced ×2closed ×1

When using the Control UI to create a "main" session, OpenClaw creates/uses ~/.openclaw/workspace-main instead of respecting the configured agents.defaults.workspace path. This results in duplicate workspace folders and potential data fragmentation.

Root Cause

When using the Control UI to create a "main" session, OpenClaw creates/uses ~/.openclaw/workspace-main instead of respecting the configured agents.defaults.workspace path. This results in duplicate workspace folders and potential data fragmentation.

Fix Action

Fixed

PR fix notes

PR #59858: fix: respect agents.defaults.workspace for non-default agents

Description (problem / solution / changelog)

Closes #59789

Summary

  • resolveAgentWorkspaceDir in src/agents/agent-scope.ts now consults agents.defaults.workspace for all agents, not just the default agent.
  • Non-default agents that have no per-agent workspace configured use agents.defaults.workspace/<agentId> as their workspace directory, keeping workspaces isolated while honoring the user's configured base path.
  • Previously, non-default agents fell through to <stateDir>/workspace-<id> regardless of the agents.defaults.workspace config, causing duplicate workspace folders and data fragmentation (the Control UI's "main" session creates workspace-main even when the user configured a different default workspace.

Root Cause

had a conditional that only checked when . Any agent that wasn't the configured default skipped that fallback entirely and derived its workspace from the state directory.

Changes

**** — hoisted the lookup above the default-agent branch so non-default agents also benefit, using for isolation.

**** — added 3 new tests:

  • non-default agent uses as base (#59789)
  • default agent still uses directly
  • non-default agent without falls back to stateDir

**** — updated assertion to match the new workspace resolution (and removed now-unused / imports).

Test Plan

  • RUN v4.1.2 /Users/nishanthreddy/Documents/SideQuests/openclaw

Test Files 1 passed (1) Tests 22 passed (22) Start at 13:33:44 Duration 2.45s (transform 197ms, setup 2.36s, import 24ms, tests 7ms, environment 0ms) — 22/22 pass

  • RUN v4.1.2 /Users/nishanthreddy/Documents/SideQuests/openclaw

Test Files 1 passed (1) Tests 7 passed (7) Start at 13:33:47 Duration 2.68s (transform 249ms, setup 2.10s, import 515ms, tests 5ms, environment 0ms) — 7/7 pass

  • No lint errors on touched files

Risks and Mitigations

  • Existing non-default agents may see a workspace path change if is configured. This is the correct/expected behavior per the issue — previously the config was silently ignored for those agents.
  • No breaking API changes; signature is unchanged.

Joel Nishanth · offlyn.AI

Made with Cursor EOF )

Changed files

  • src/agents/agent-scope.test.ts (modified, +34/-0)
  • src/agents/agent-scope.ts (modified, +6/-1)
  • src/commands/agents.test.ts (modified, +1/-5)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When using the Control UI to create a "main" session, OpenClaw creates/uses ~/.openclaw/workspace-main instead of respecting the configured agents.defaults.workspace path. This results in duplicate workspace folders and potential data fragmentation.

Steps to reproduce

  1. Set an explicit workspace path in ~/.openclaw/openclaw.json
  2. Start the OpenClaw Gateway: openclaw gateway
  3. Open the Control UI in browser: http://127.0.0.1:18789
  4. Start a new chat session (the default "main" session from Control UI)
  5. Observe that ~/.openclaw/workspace-main is created alongside ~/.openclaw/workspace
  6. Check session transcript — cwd is set to workspace-main instead of the configured workspace

Expected behavior

The configured workspace in openclaw.json should be respected:

Actual behavior

Control UI sessions use workspace-main derived from agentId: "main", ignoring the config. Source code shows:

agent-scope-*.js: workspace-${id} — derives workspace from agent ID
workspace-*.js: workspace-${profile} — derives from OPENCLAW_PROFILE

Neither path checks agents.defaults.workspace.

OpenClaw version

2026.4.1

Operating system

Pop OS

Install method

No response

Model

ollama/glm-5:cloud

Provider / routing chain

ollama (Ollama cloud endpoint)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Users with custom workspace configs get duplicate folders Memory, skills, and configs become fragmented across folders Silent data divergence between sessions

Additional information

Suggested Fix

The workspace resolution logic should check agents.defaults.workspace first before deriving from agent ID or profile.

extent analysis

TL;DR

Update the workspace resolution logic to prioritize checking agents.defaults.workspace before deriving from agent ID or profile.

Guidance

  • Review the agent-scope-*.js and workspace-*.js files to understand the current workspace derivation logic.
  • Modify the logic to check agents.defaults.workspace first, and use its value if set, before falling back to deriving from agent ID or profile.
  • Verify the fix by setting an explicit workspace path in ~/.openclaw/openclaw.json, starting a new chat session, and checking that the session uses the configured workspace instead of creating a new workspace-main folder.
  • Test the fix with different agent IDs and profiles to ensure the correct workspace is used in all cases.

Example

// Example of updated workspace resolution logic
const getWorkspace = (agentId, profile) => {
  const configuredWorkspace = agents.defaults.workspace;
  if (configuredWorkspace) {
    return configuredWorkspace;
  }
  // Fallback to deriving from agent ID or profile
  return `workspace-${agentId || profile}`;
};

Notes

The suggested fix assumes that the agents.defaults.workspace value is correctly set and accessible in the relevant code files. Additional debugging may be necessary if the issue persists after applying the fix.

Recommendation

Apply the workaround by updating the workspace resolution logic to prioritize checking agents.defaults.workspace, as this should resolve the issue of duplicate workspace folders and data fragmentation.

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…

FAQ

Expected behavior

The configured workspace in openclaw.json should be respected:

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Control UI ignores agents.defaults.workspace, creates duplicate workspace-main [1 pull requests, 4 comments, 3 participants]