openclaw - 💡(How to fix) Fix ACP thread-bound child session key misses `acp` metadata, causing `ACP_SESSION_INIT_FAILED` [1 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#60904Fetched 2026-04-08 02:45:52
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Error Message

ACP error (ACP_SESSION_INIT_FAILED): ACP metadata is missing for agent:codex:acp:<uuid>:thread:<chatId>:<topicId>. Recreate this ACP session with /acp spawn and rebind the thread.

Root Cause

Local root cause

In ~/.openclaw/agents/codex/sessions/sessions.json:

Fix Action

Fix / Workaround

Local workaround patch

@@ -12543,13 +12543,15 @@
  const storeSessionKey = resolveStoreSessionKey(store, sessionKey);
  const entry = store[storeSessionKey];
+ const parentSessionKey = stripThreadSuffixFromSessionKey(storeSessionKey);
+ const inheritedAcp = parentSessionKey && parentSessionKey !== storeSessionKey ? store[resolveStoreSessionKey(store, parentSessionKey)]?.acp : void 0;
  return {
    cfg,
    storePath,
    sessionKey,
    storeSessionKey,
    entry,
-   acp: entry?.acp,
+   acp: entry?.acp ?? inheritedAcp,
    storeReadFailed
  };
 }

## Verification
After this local patch and gateway restart, messages in the bound Telegram thread are routed correctly.

Code Example

@@ -12543,13 +12543,15 @@
  const storeSessionKey = resolveStoreSessionKey(store, sessionKey);
  const entry = store[storeSessionKey];
+ const parentSessionKey = stripThreadSuffixFromSessionKey(storeSessionKey);
+ const inheritedAcp = parentSessionKey && parentSessionKey !== storeSessionKey ? store[resolveStoreSessionKey(store, parentSessionKey)]?.acp : void 0;
  return {
    cfg,
    storePath,
    sessionKey,
    storeSessionKey,
    entry,
-   acp: entry?.acp,
+   acp: entry?.acp ?? inheritedAcp,
    storeReadFailed
  };
 }

@@ -12589,7 +12591,9 @@
  return await updateSessionStore(storePath, (store) => {
    const storeSessionKey = resolveStoreSessionKey(store, sessionKey);
    const currentEntry = store[storeSessionKey];
-   const nextMeta = params.mutate(currentEntry?.acp, currentEntry);
+   const parentSessionKey = stripThreadSuffixFromSessionKey(storeSessionKey);
+   const inheritedAcp = parentSessionKey && parentSessionKey !== storeSessionKey ? store[resolveStoreSessionKey(store, parentSessionKey)]?.acp : void 0;
+   const nextMeta = params.mutate(currentEntry?.acp ?? inheritedAcp, currentEntry);
RAW_BUFFERClick to expand / collapse

ACP thread-bound child session key misses acp metadata, causing ACP_SESSION_INIT_FAILED

Environment

  • OpenClaw: 2026.4.2
  • ACP backend: acpx
  • Channel: Telegram topic
  • acp.enabled=true
  • acp.backend=acpx

Reproduction

  1. In a Telegram topic, send: /acp spawn codex --bind here --cwd /some/absolute/path
  2. OpenClaw replies that the ACP session was spawned and bound.
  3. Send a normal message in the same topic.

Expected

The message should be routed to the spawned ACP session.

Actual

OpenClaw replies:

ACP error (ACP_SESSION_INIT_FAILED): ACP metadata is missing for agent:codex:acp:<uuid>:thread:<chatId>:<topicId>. Recreate this ACP session with /acp spawn and rebind the thread.

Local root cause

In ~/.openclaw/agents/codex/sessions/sessions.json:

  • parent key agent:codex:acp:<uuid> has entry.acp
  • child thread alias key agent:codex:acp:<uuid>:thread:<chatId>:<topicId> does not have entry.acp

Then readAcpSessionEntry() reads the child key directly and returns entry?.acp, so resolveMissingMetaError() is thrown.

Source locations observed locally

Built dist file: /opt/homebrew/lib/node_modules/openclaw/dist/pi-embedded-BYdcxQ5A.js

  • stripThreadSuffixFromSessionKey() at line 5756
  • resolveMissingMetaError() at line 12041
  • readAcpSessionEntry() at line 12529
  • upsertAcpSessionMeta() at line 12584

Local workaround patch

@@ -12543,13 +12543,15 @@
  const storeSessionKey = resolveStoreSessionKey(store, sessionKey);
  const entry = store[storeSessionKey];
+ const parentSessionKey = stripThreadSuffixFromSessionKey(storeSessionKey);
+ const inheritedAcp = parentSessionKey && parentSessionKey !== storeSessionKey ? store[resolveStoreSessionKey(store, parentSessionKey)]?.acp : void 0;
  return {
    cfg,
    storePath,
    sessionKey,
    storeSessionKey,
    entry,
-   acp: entry?.acp,
+   acp: entry?.acp ?? inheritedAcp,
    storeReadFailed
  };
 }

@@ -12589,7 +12591,9 @@
  return await updateSessionStore(storePath, (store) => {
    const storeSessionKey = resolveStoreSessionKey(store, sessionKey);
    const currentEntry = store[storeSessionKey];
-   const nextMeta = params.mutate(currentEntry?.acp, currentEntry);
+   const parentSessionKey = stripThreadSuffixFromSessionKey(storeSessionKey);
+   const inheritedAcp = parentSessionKey && parentSessionKey !== storeSessionKey ? store[resolveStoreSessionKey(store, parentSessionKey)]?.acp : void 0;
+   const nextMeta = params.mutate(currentEntry?.acp ?? inheritedAcp, currentEntry);

Verification

After this local patch and gateway restart, messages in the bound Telegram thread are routed correctly.

extent analysis

TL;DR

Apply a patch to readAcpSessionEntry() and upsertAcpSessionMeta() to inherit acp metadata from the parent session key when it's missing in the child thread alias key.

Guidance

  • Identify the readAcpSessionEntry() and upsertAcpSessionMeta() functions in the OpenClaw codebase and apply the provided patch to inherit acp metadata from the parent session key.
  • Verify that the patch fixes the issue by checking if messages in the bound Telegram thread are routed correctly after applying the patch and restarting the gateway.
  • Review the sessions.json file to ensure that the child thread alias key has the correct acp metadata after applying the patch.
  • Consider reporting the issue to the OpenClaw maintainers to ensure the patch is incorporated into future releases.

Example

The provided patch demonstrates how to modify the readAcpSessionEntry() and upsertAcpSessionMeta() functions to inherit acp metadata from the parent session key:

const inheritedAcp = parentSessionKey && parentSessionKey !== storeSessionKey ? store[resolveStoreSessionKey(store, parentSessionKey)]?.acp : void 0;
return {
  ...
  acp: entry?.acp ?? inheritedAcp,
  ...
};

Notes

The provided patch is a local workaround and may not be suitable for production environments. It's essential to verify the patch and report the issue to the OpenClaw maintainers to ensure a proper fix is incorporated into future releases.

Recommendation

Apply the provided workaround patch to fix the issue, as it has been verified to work locally. However, it's crucial to monitor the issue and wait for an official fix from the OpenClaw maintainers to ensure the patch is properly incorporated into the codebase.

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…

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 - 💡(How to fix) Fix ACP thread-bound child session key misses `acp` metadata, causing `ACP_SESSION_INIT_FAILED` [1 participants]