-
-
Notifications
You must be signed in to change notification settings - Fork 69.2k
ACP sessions invisible to sessions_list when agents.list is configured #32804
Description
Bug
When agents.list is configured in openclaw.json, ACP sessions spawned via sessions_spawn with runtime: "acp" are invisible to sessions_list and related tools.
Root Cause
loadCombinedSessionStoreForGateway() in src/gateway/session-utils.ts calls listConfiguredAgentIds() which, when agents.list is populated, only returns agent IDs from the config (e.g. main, leon). It never falls through to the disk scan path (listExistingAgentIdsFromDisk()).
ACP sessions are stored under dynamically-created agent dirs like agents/codex/sessions/ and agents/claude/sessions/. Since codex and claude aren't in agents.list, their session stores are never scanned.
Steps to Reproduce
- Have
agents.listconfigured with at least one agent (e.g.main) - Enable ACP:
acp.enabled: true, backend: "acpx", allowedAgents: ["claude", "codex"] - Spawn an ACP session:
sessions_spawn({ runtime: "acp", agentId: "codex", task: "...", mode: "run" }) - Session returns
status: "accepted"with achildSessionKey sessions_listdoes not show the session- The session IS present in
~/.openclaw/agents/codex/sessions/sessions.jsonwith ACP metadata
Expected Behavior
ACP sessions should be visible in sessions_list regardless of whether their agent ID is in agents.list.
Suggested Fix
listConfiguredAgentIds() should merge the config list with the disk scan, so dynamically-created ACP agent directories are included:
function listConfiguredAgentIds(cfg: OpenClawConfig): string[] {
const ids = new Set<string>();
const defaultId = normalizeAgentId(resolveDefaultAgentId(cfg));
ids.add(defaultId);
// Always include configured agents
for (const entry of cfg.agents?.list ?? []) {
if (entry?.id) ids.add(normalizeAgentId(entry.id));
}
// Always include agents that exist on disk (covers ACP-created dirs)
for (const id of listExistingAgentIdsFromDisk()) {
ids.add(id);
}
const sorted = Array.from(ids).filter(Boolean);
sorted.sort((a, b) => a.localeCompare(b));
return sorted.includes(defaultId)
? [defaultId, ...sorted.filter((id) => id !== defaultId)]
: sorted;
}Additional Issues Observed
- No
.jsonltranscript files are created for ACP sessions (the ACP code path indispatch-acp.tsnever writes toSessionManager) - ACP sessions show
state: errorwithacpx exited with code 5even when the agent successfully completed work (commits were made). This suppresses completion announcements.
Environment
- OpenClaw version: 2026.3.3
- acpx version: 0.1.15
- Config:
agents.listwithmainandleon;acp.allowedAgents: ["claude", "codex"]