Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
On 2026.4.8 when you try to set your agents.list[] and have one set to default: true, sessions are still stored/routed to ~/.openclaw/agents/main/sessions. I also propose that we should have a agents.list[].sessionsDir to go with agents.list[].agentDir to help with this.
For example I have:
"agents": {
"list": [
{
"default": true,
"id": "ops",
"name": "Ops",
"workspace": "/home/node/.openclaw/workspace",
"agentDir": "/home/node/.openclaw/agents/ops/agent"
},
{
"id": "cipher",
"name": "Cipher",
"workspace": "/home/node/.openclaw/workspace-cipher",
"agentDir": "/home/node/.openclaw/agents/cipher/agent"
}
]
}
Cipher goes to agents/cipher/sessions no problem, but Ops goes to agents/main/sessions even though it isn't set to do so.
The channel I have configured is Discord - so that might help, since it could be that plugin causing this behaviour.
And in the official discord channel I have the thread #1491458068209471629 in the #help text channel. Where I was told I should mention #29683 and PR's: PR #30654, PR #57217.
fix options:
- pass cfg into resolveSessionKey() and use resolveDefaultAgentId(cfg) instead of the hardcoded constant
- wrap remaining resolveSessionKey() call sites with canonicalizeMainSessionAlias() (find with grep -r "resolveSessionKey(" extensions/ src/)
This next bit is TL;DR; but I'm putting it here as a summary from the discord thread just for completeness:
you're right — this is a real bug.
root cause:
resolveSessionKey() in src/config/sessions/session-key.ts hardcodes DEFAULT_AGENT_ID="main", ignoring your custom default agent. session keys are written incorrectly to ~/.openclaw/agents/main/sessions/ even when configured for ops.
existing partial fixes:
- PR #30654: wrapped 3 call sites but didn’t fix the core function
- PR #57217: only cleans up old orphaned keys, does not prevent new bad writes
why it still fails for you:
uncovered call sites (e.g., slack extension) still use the broken function directly.
help maintainers: share which channel you used (telegram/discord/slack/web/signal/mattermost)
how to file the bug:
1. github: https://github.com/openclaw/openclaw/issues/new (bug template)
2. title: session key write still hardcodes DEFAULT_AGENT_ID after PR #30654 (regression of #29683)
3. body: version, agents.list config snippet, channel, symptom, reference #29683, PR #30654, PR #57217
fix options:
- pass cfg into resolveSessionKey() and use resolveDefaultAgentId(cfg) instead of the hardcoded constant
- wrap remaining resolveSessionKey() call sites with canonicalizeMainSessionAlias() (find with grep -r "resolveSessionKey(" extensions/ src/)
tldr: i was wrong earlier — this is a real bug with an incomplete fix. please file the issue. ❤️
Steps to reproduce
- Start up OpenClaw 2026.4.8 using the docker image from github.
- Set up the initial agent. And use Discord as your channel.
- Add another agent.
- Stop the gateway.
- Go back and change the
main from the original agent, and set it as default: true.
5.1) [optional] go through and update all references of main e.g. the initially set up folders, any sessions used so far, etc. so that it no longer says main:main or similar and instead uses the agentId you changed to.
- Make sure you don't have a folder
~/.openclaw/agents/main.
- Start the server back up.
You should see the ~/.openclaw/agents/main folder return (expected, since it is the default hardcoded agentId). But if you now talk to your renamed agent via Discord, you will find the agents/main/session folder will start filling up again. Your second agent will work as expected though.
Expected behavior
I expected when talking to my default agent (not set as main) to go to its relevant sessions folder, and not the main folder.
Actual behavior
When talking via Discord, the default agent sessions get stored in the main folder.
OpenClaw version
2026.4.8
Operating system
Debian 12.13 (bookworm) - its a docker image based on node:24-bookworm. Host that the docker is on is Ubuntu 24.04
Install method
docker compose using: ghcr.io/openclaw/openclaw
Model
kimi-for-coding/k2p5
Provider / routing chain
openclaw -> kimi-for-coding
Additional provider/model setup details
No response
Logs, screenshots, and evidence
There are no errors in logs, its only visible by looking at the folder within `~/.openclaw/agents/main/sessions` and monitoring it as you speak with the agent via Discord. It is possible this affects other channels too.
Impact and severity
No response
Additional information
No response
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
On 2026.4.8 when you try to set your
agents.list[]and have one set todefault: true, sessions are still stored/routed to~/.openclaw/agents/main/sessions. I also propose that we should have aagents.list[].sessionsDirto go withagents.list[].agentDirto help with this.For example I have:
Cipher goes to
agents/cipher/sessionsno problem, but Ops goes toagents/main/sessionseven though it isn't set to do so.The channel I have configured is Discord - so that might help, since it could be that plugin causing this behaviour.
And in the official discord channel I have the thread
#1491458068209471629in the#helptext channel. Where I was told I should mention #29683 and PR's: PR #30654, PR #57217.fix options:
This next bit is TL;DR; but I'm putting it here as a summary from the discord thread just for completeness:
Steps to reproduce
mainfrom the original agent, and set it asdefault: true.5.1) [optional] go through and update all references of
maine.g. the initially set up folders, any sessions used so far, etc. so that it no longer says main:main or similar and instead uses the agentId you changed to.~/.openclaw/agents/main.You should see the
~/.openclaw/agents/mainfolder return (expected, since it is the default hardcoded agentId). But if you now talk to your renamed agent via Discord, you will find theagents/main/sessionfolder will start filling up again. Your second agent will work as expected though.Expected behavior
I expected when talking to my default agent (not set as main) to go to its relevant sessions folder, and not the
mainfolder.Actual behavior
When talking via Discord, the default agent sessions get stored in the
mainfolder.OpenClaw version
2026.4.8
Operating system
Debian 12.13 (bookworm) - its a docker image based on node:24-bookworm. Host that the docker is on is Ubuntu 24.04
Install method
docker compose using: ghcr.io/openclaw/openclaw
Model
kimi-for-coding/k2p5
Provider / routing chain
openclaw -> kimi-for-coding
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response