Bug type
Behavior bug
Summary
In a multi-agent setup, native /new / before_reset hook handling derives agent identity incorrectly and can cause the bundled session-memory hook to write reset/session memory into workspace-main even when the live bound agent is a different agent (for example, Navi with workspace-navi).
Steps to reproduce
- Configure a non-main agent bound to a channel/DM, for example:
agentId: navi
agents.list[navi].workspace = ~/.openclaw/workspace-navi
- Ensure bundled internal hooks include:
- Use the bound non-main agent in a real chat surface (Discord DM in my case).
- Trigger
/new or /reset.
- Inspect the resulting session-memory artifacts under
~/.openclaw/.
Expected behavior
Reset/session-memory flow should resolve to the bound active agent and write memory/session bridge files into that agent's workspace.
Example:
- bound agent
navi → writes to ~/.openclaw/workspace-navi/memory/
Actual behavior
Session-start/reset memory artifacts are being written into ~/.openclaw/workspace-main/memory/ instead of the bound agent workspace.
Observed files:
~/.openclaw/workspace-main/memory/2026-03-07-2106.md
~/.openclaw/workspace-main/memory/2026-03-07-session-greeting.md
~/.openclaw/workspace-main/memory/2026-03-08-session-start.md
These are session-start style summaries and reference:
Session Key: agent:main:main
Meanwhile the actual bound agent continuity files live in:
~/.openclaw/workspace-navi/memory/
So the system ends up in a workspace split-brain state.
OpenClaw version
2026.3.7
Also checked on current main source as of 2026-03-08; the relevant code path still appears unchanged there.
Operating system
Linux (WSL2 / Ubuntu-style environment)
Install method
Git/source install (main) and stable release both inspected.
Logs, screenshots, and evidence
Current stable tag inspected:
- v2026.3.7
- commit: 42a1394c5c0fb86706f61598e68e0db30e8c99c1
Current upstream main still contains this in src/auto-reply/reply/commands-core.ts:
await hookRunner.runBeforeReset(
{ sessionFile, messages, reason: params.action },
{
agentId: params.sessionKey?.split(":")[0] ?? "main",
sessionKey: params.sessionKey,
sessionId: prevEntry?.sessionId,
workspaceDir: params.workspaceDir,
},
);
For a session key like:
- agent:navi:main
split(":")[0] returns:
- "agent"
not:
- "navi"
Bundled session-memory handler resolves workspace from session identity:
src/hooks/bundled/session-memory/handler.ts
const agentId = resolveAgentIdFromSessionKey(event.sessionKey);
const workspaceDir = cfg
? resolveAgentWorkspaceDir(cfg, agentId)
: path.join(resolveStateDir(process.env, os.homedir), "workspace");
Observed split on disk:
- Navi configured workspace: ~/.openclaw/workspace-navi
- stray session-memory files created in: ~/.openclaw/workspace-main/memory/
Example files created there:
- 2026-03-07-2106.md
- 2026-03-07-session-greeting.md
- 2026-03-08-session-start.md
Impact and severity
Affected:
- multi-agent setups using non-main agents
- bundled
session-memory on /new / /reset
- likely any workflow that assumes reset/session-memory writes land in the active bound agent workspace
Severity:
Frequency:
Consequence:
- session/reset memory written into the wrong workspace
- split-brain continuity (
workspace-navi for real agent files, workspace-main for reset/session-memory artifacts)
- likely contributes to stale continuity, wrong memory reads, and reset weirdness in multi-agent setups
Additional information
Regression timing
This appears to have been introduced when native reset hooks were backfilled in:
- commit
aec41a588b
- message:
fix(hooks): backfill reset command hooks for native /new path
- date: 2026-02-24
That commit is contained in releases including:
Related issues
Potentially related, but not the same exact bug:
Suggested fix direction
At minimum:
- stop using
params.sessionKey?.split(":")[0]
- use proper session-key parsing such as
resolveAgentIdFromSessionKey(params.sessionKey)
But ideally:
- reset hooks should prefer the bound/active agent identity (or explicit hook context agent/workspace) rather than relying on a legacy-looking session key that can be
agent:main:main
Why I think this is runtime, not config
The relevant config values remained stable across backups and live config:
agents.defaults.workspace = ~/.openclaw/workspace
agents.list[navi].workspace = ~/.openclaw/workspace-navi
So this does not look like a plain config-path mistake. It looks like a hook/runtime identity-resolution bug.
Bug type
Behavior bug
Summary
In a multi-agent setup, native
/new/before_resethook handling derives agent identity incorrectly and can cause the bundledsession-memoryhook to write reset/session memory intoworkspace-maineven when the live bound agent is a different agent (for example, Navi withworkspace-navi).Steps to reproduce
agentId: naviagents.list[navi].workspace = ~/.openclaw/workspace-navisession-memory/newor/reset.~/.openclaw/.Expected behavior
Reset/session-memory flow should resolve to the bound active agent and write memory/session bridge files into that agent's workspace.
Example:
navi→ writes to~/.openclaw/workspace-navi/memory/Actual behavior
Session-start/reset memory artifacts are being written into
~/.openclaw/workspace-main/memory/instead of the bound agent workspace.Observed files:
~/.openclaw/workspace-main/memory/2026-03-07-2106.md~/.openclaw/workspace-main/memory/2026-03-07-session-greeting.md~/.openclaw/workspace-main/memory/2026-03-08-session-start.mdThese are session-start style summaries and reference:
Session Key: agent:main:mainMeanwhile the actual bound agent continuity files live in:
~/.openclaw/workspace-navi/memory/So the system ends up in a workspace split-brain state.
OpenClaw version
2026.3.7
Also checked on current
mainsource as of 2026-03-08; the relevant code path still appears unchanged there.Operating system
Linux (WSL2 / Ubuntu-style environment)
Install method
Git/source install (
main) and stable release both inspected.Logs, screenshots, and evidence
Impact and severity
Affected:
session-memoryon/new//resetSeverity:
Frequency:
Consequence:
workspace-navifor real agent files,workspace-mainfor reset/session-memory artifacts)Additional information
Regression timing
This appears to have been introduced when native reset hooks were backfilled in:
aec41a588bfix(hooks): backfill reset command hooks for native /new pathThat commit is contained in releases including:
Related issues
Potentially related, but not the same exact bug:
session-memory/command-loggerdo not fire on/newor/resetsessionKeyagent_endhook passes wrongagentIdusing the samesplit(":")[0]patternSuggested fix direction
At minimum:
params.sessionKey?.split(":")[0]resolveAgentIdFromSessionKey(params.sessionKey)But ideally:
agent:main:mainWhy I think this is runtime, not config
The relevant config values remained stable across backups and live config:
agents.defaults.workspace = ~/.openclaw/workspaceagents.list[navi].workspace = ~/.openclaw/workspace-naviSo this does not look like a plain config-path mistake. It looks like a hook/runtime identity-resolution bug.