openclaw - ✅(Solved) Fix Discord ACP thread spawn fails with thread_binding_invalid when parent conversation resolves to channel:<id> [1 pull requests, 1 comments, 2 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#64455Fetched 2026-04-11 06:14:55
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
commented ×1cross-referenced ×1

On my installed OpenClaw build (2026.4.5 from npm), Discord ACP thread spawns fail with:

  • thread_binding_invalid
  • Session binding adapter failed to bind target conversation

This happens for sessions_spawn({ runtime: "acp", thread: true, mode: "session" }) in a normal Discord guild text channel, even when:

  • session.threadBindings.enabled = true
  • channels.discord.threadBindings.enabled = true
  • channels.discord.threadBindings.spawnAcpSessions = true
  • the bot has Administrator, CreatePublicThreads, SendMessagesInThreads, and ManageThreads

Error Message

  • conversationId = "channel:1487184723871531109" + child placement => fails with the same binding error

Root Cause

On my installed OpenClaw build (2026.4.5 from npm), Discord ACP thread spawns fail with:

  • thread_binding_invalid
  • Session binding adapter failed to bind target conversation

This happens for sessions_spawn({ runtime: "acp", thread: true, mode: "session" }) in a normal Discord guild text channel, even when:

  • session.threadBindings.enabled = true
  • channels.discord.threadBindings.enabled = true
  • channels.discord.threadBindings.spawnAcpSessions = true
  • the bot has Administrator, CreatePublicThreads, SendMessagesInThreads, and ManageThreads

Fix Action

Fixed

PR fix notes

PR #64456: test: cover Discord ACP thread spawn target normalization

Description (problem / solution / changelog)

Summary

Adds a regression test for Discord ACP thread spawns when the parent conversation is addressed through a canonical Discord channel target like channel:<id>.

Why

I hit a real-world regression on an installed OpenClaw build where:

  • Discord permissions were correct
  • normal thread creation worked
  • webhook creation worked
  • but sessions_spawn({ runtime: "acp", thread: true, mode: "session" }) failed with thread_binding_invalid

The failure narrowed down to the ACP thread-binding path behaving differently when the parent conversation was represented as channel:<id> versus a raw numeric channel id.

This PR adds coverage so that ACP Discord thread spawns keep normalizing the parent channel target correctly.

Issue

  • Closes #64455

Notes

I was not able to run the repo test suite locally in this checkout because dependencies were not installed in the fresh clone (vitest/package.json missing), so this change is intentionally small and isolated.

Changed files

  • src/agents/acp-spawn.test.ts (modified, +57/-0)
  • src/agents/acp-spawn.ts (modified, +11/-0)

Code Example

sessions_spawn({
  runtime: "acp",
  agentId: "claude",
  thread: true,
  mode: "session",
  cwd: "...",
  task: "Say hi"
})
RAW_BUFFERClick to expand / collapse

Summary

On my installed OpenClaw build (2026.4.5 from npm), Discord ACP thread spawns fail with:

  • thread_binding_invalid
  • Session binding adapter failed to bind target conversation

This happens for sessions_spawn({ runtime: "acp", thread: true, mode: "session" }) in a normal Discord guild text channel, even when:

  • session.threadBindings.enabled = true
  • channels.discord.threadBindings.enabled = true
  • channels.discord.threadBindings.spawnAcpSessions = true
  • the bot has Administrator, CreatePublicThreads, SendMessagesInThreads, and ManageThreads

What I verified

Discord itself is healthy:

  • normal Discord thread creation succeeds
  • webhook creation succeeds
  • direct use of the thread binding manager succeeds when given a raw numeric channel id

The failure reproduces specifically when the ACP thread-binding path uses a canonical Discord target like:

  • channel:1487184723871531109

instead of the raw parent channel id:

  • 1487184723871531109

Minimal diagnosis

In the installed build, the ACP thread-binding preparation path appears to resolve the Discord conversation as channel:<id>, then later passes that canonical target into child thread binding as if it were the parent channel id.

For Discord child thread creation, that value needs to be normalized back to the raw channel id before binding.

I verified this by reproducing both cases directly against the installed build:

  • conversationId = "1487184723871531109" + child placement => works
  • conversationId = "channel:1487184723871531109" + child placement => fails with the same binding error

Repro shape

Discord channel context:

sessions_spawn({
  runtime: "acp",
  agentId: "claude",
  thread: true,
  mode: "session",
  cwd: "...",
  task: "Say hi"
})

Expected:

  • OpenClaw creates a Discord thread
  • binds the ACP session to that thread

Actual:

  • thread_binding_invalid
  • Session binding adapter failed to bind target conversation

Notes

I looked at current upstream source and it seems this normalization path may already be correct on main, so this may be a release/bundled artifact regression rather than a source-of-truth logic bug.

I’m sending a small regression-test PR alongside this issue so the Discord ACP thread-spawn path stays covered.

extent analysis

TL;DR

Normalizing the Discord conversation ID by removing the "channel:" prefix before passing it to the child thread binding may resolve the thread_binding_invalid error.

Guidance

  • Verify that the issue is indeed caused by the canonical Discord target being used instead of the raw parent channel ID by testing with a raw numeric channel ID.
  • Check the OpenClaw build version and consider updating to a newer version if available, as the issue may be a release/bundled artifact regression.
  • Temporarily modify the code to normalize the conversation ID before binding, for example by using a string replacement to remove the "channel:" prefix.
  • Review the regression-test PR to ensure the Discord ACP thread-spawn path is properly covered.

Example

const conversationId = "channel:148718

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