Bug Description
When setting EVOLVER_SESSION_SCOPE to a workspace name (e.g. workspace-helperclaw), the evolver falls back to reading ALL sessions from the main agent directory, ignoring the scope.
Expected: Only read sessions whose cwd field contains workspaces/<scope>.
Actual: Logs show [SessionScope] No sessions match scope "workspace-helperclaw". Using all 15 session(s) (fallback). — reading from ~/.openclaw/agents/main/sessions instead of ~/.openclaw/agents/helperclaw/sessions.
Environment
- evolver: v1.62.1 (tested on origin/main, commit 0bffa8c)
- Node.js: v24
- Platform: Linux
Steps to Reproduce
EVOLVER_SESSION_SCOPE=workspace-helperclaw EVOLVE_BRIDGE=false node index.js run
Observe log output:
[SessionScope] No sessions match scope "workspace-helperclaw". Using all 15 session(s) (fallback).
Root Cause Analysis
Two bugs cause this:
Bug 1: AGENT_SESSIONS_DIR is derived from AGENT_NAME env var (defaults to "main" from .env), not from EVOLVER_SESSION_SCOPE. Even when scope is set, the code reads from ~/.openclaw/agents/main/sessions instead of ~/.openclaw/agents/helperclaw/sessions.
Bug 2: The scope matching logic uses f.name.toLowerCase().includes(scopeLower) — but session files are UUIDs (e.g. c982d748-b38e-4b58-bd99-adf064741790.jsonl) which never contain the workspace scope string. Additionally, readRecentLog() reads from the tail of each file, but the session header (containing cwd) is at the head of the file.
Workaround
From bash, set both variables:
AGENT_NAME=helperclaw EVOLVER_SESSION_SCOPE=workspace-helperclaw EVOLVE_BRIDGE=false node index.js run
Result: [SessionScope] Using all 3 session(s) (fallback). — correctly reads 3 sessions from helperclaw instead of 15 from main. The content-based matching still fails (falls back to all 3 sessions) due to Bug 2.
Suggested Fix
-
Add deriveSessionsDir() that extracts the agent name from EVOLVER_SESSION_SCOPE (e.g. workspace-helperclaw → helperclaw) and reads from that agent's sessions directory.
-
For scope content matching, read the first ~800 bytes of each session file (not the tail) and match the cwd field which contains workspaces/<scopeName>.
A reference implementation for v1.32.4 (readable source) is available at: https://github.com/Bozhu12/evolver/commit/db31a1f
Bug Description
When setting
EVOLVER_SESSION_SCOPEto a workspace name (e.g.workspace-helperclaw), the evolver falls back to reading ALL sessions from themainagent directory, ignoring the scope.Expected: Only read sessions whose
cwdfield containsworkspaces/<scope>.Actual: Logs show
[SessionScope] No sessions match scope "workspace-helperclaw". Using all 15 session(s) (fallback).— reading from~/.openclaw/agents/main/sessionsinstead of~/.openclaw/agents/helperclaw/sessions.Environment
Steps to Reproduce
Observe log output:
Root Cause Analysis
Two bugs cause this:
Bug 1:
AGENT_SESSIONS_DIRis derived fromAGENT_NAMEenv var (defaults to "main" from .env), not fromEVOLVER_SESSION_SCOPE. Even when scope is set, the code reads from~/.openclaw/agents/main/sessionsinstead of~/.openclaw/agents/helperclaw/sessions.Bug 2: The scope matching logic uses
f.name.toLowerCase().includes(scopeLower)— but session files are UUIDs (e.g.c982d748-b38e-4b58-bd99-adf064741790.jsonl) which never contain the workspace scope string. Additionally,readRecentLog()reads from the tail of each file, but the session header (containingcwd) is at the head of the file.Workaround
From bash, set both variables:
Result:
[SessionScope] Using all 3 session(s) (fallback).— correctly reads 3 sessions fromhelperclawinstead of 15 frommain. The content-based matching still fails (falls back to all 3 sessions) due to Bug 2.Suggested Fix
Add
deriveSessionsDir()that extracts the agent name fromEVOLVER_SESSION_SCOPE(e.g.workspace-helperclaw→helperclaw) and reads from that agent's sessions directory.For scope content matching, read the first ~800 bytes of each session file (not the tail) and match the
cwdfield which containsworkspaces/<scopeName>.A reference implementation for v1.32.4 (readable source) is available at: https://github.com/Bozhu12/evolver/commit/db31a1f