openclaw - ✅(Solved) Fix ACP sessions_spawn thread binding fails on Discord: 'Session binding adapter failed to bind target conversation' [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#63927Fetched 2026-04-10 03:41:37
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1
  • threadBindings.enabled: true and threadBindings.spawnAcpSessions: true are set
  • The bot CAN create threads (verified via message(action="thread-create") — succeeds)
  • Discord plugin has defaultTopLevelPlacement: "child", which means top-level channels expect thread-based binding
  • The bot has permissions to create threads in the target channels
  • acp.enabled: true, acp.backend: "acpx", acp.allowedAgents includes the target agent
  • plugins.entries.acpx.config.permissionMode: "approve-all"

Error Message

  1. Error: thread_binding_invalid — "Session binding adapter failed to bind target conversation"

Root Cause

  • threadBindings.enabled: true and threadBindings.spawnAcpSessions: true are set
  • The bot CAN create threads (verified via message(action="thread-create") — succeeds)
  • Discord plugin has defaultTopLevelPlacement: "child", which means top-level channels expect thread-based binding
  • The bot has permissions to create threads in the target channels
  • acp.enabled: true, acp.backend: "acpx", acp.allowedAgents includes the target agent
  • plugins.entries.acpx.config.permissionMode: "approve-all"

Fix Action

Workaround

Using the direct acpx CLI path works fine:

ACPX_CMD=".../node_modules/.bin/acpx"
$ACPX_CMD claude sessions new --name <session-name>
$ACPX_CMD claude -s <session-name> "<prompt>"

PR fix notes

PR #63993: fix(discord): normalize channel snowflakes for ACP thread binding

Description (problem / solution / changelog)

Summary

  • Problem: sessions_spawn with runtime: "acp" and thread: true failed on Discord with Session binding adapter failed to bind target conversation because thread binding called Discord REST Routes.channel() using OpenClaw channel:<snowflake> conversation ids instead of raw snowflakes.
  • Why it matters: ACP session spawns could not bind to a new thread in guild channels despite correct permissions and config.
  • What changed: Strip channel:<digits> to the numeric snowflake in resolveChannelIdForBinding before REST lookup (and when an explicit channelId override uses the same form).
  • What did NOT change (scope boundary): No changes to conversation identity strings outside this REST resolution path; other channels and binding flows are untouched.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #63927
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: Discord plugin resolveInboundConversation returns normalized targets like channel:<id>; resolveChannelIdForBinding passed that string to Routes.channel(), which requires a numeric snowflake, so the GET failed and binding returned null.
  • Missing detection / guardrail: Unit tests used raw snowflake ids; prefixed form was not covered.
  • Contributing context (if known): Same channel targets are normalized for other Discord actions (e.g. thread-create) via resolveDiscordChannelId, but thread binding used the raw string.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/discord/src/monitor/thread-bindings.discord-api.test.ts
  • Scenario the test should lock in: resolveChannelIdForBinding with threadId / explicit channelId of channel:<snowflake> issues REST Routes.channel(<snowflake>) and returns the resolved parent or channel id.
  • Why this is the smallest reliable guardrail: Exercises the exact REST route construction that failed in production.
  • Existing test that already covers this (if any): N/A for prefixed ids.
  • If no new test is added, why not: N/A — tests added.

User-visible / Behavior Changes

  • Discord: sessions_spawn with ACP and thread: true can complete thread binding in guild channels when the active conversation id uses the channel:<snowflake> form.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (No)

Made with Cursor

Changed files

  • CHANGELOG.md (modified, +2/-0)
  • extensions/discord/src/monitor/thread-bindings.discord-api.test.ts (modified, +30/-1)
  • extensions/discord/src/monitor/thread-bindings.discord-api.ts (modified, +15/-3)

Code Example

Session binding adapter failed to bind target conversation

---

ACPX_CMD=".../node_modules/.bin/acpx"
$ACPX_CMD claude sessions new --name <session-name>
$ACPX_CMD claude -s <session-name> "<prompt>"
RAW_BUFFERClick to expand / collapse

Bug

sessions_spawn with runtime: "acp" and thread: true fails on Discord channels with:

Session binding adapter failed to bind target conversation

Environment

  • OpenClaw 2026.4.9 (0512059)
  • Discord plugin
  • Node v22.22.2, Linux arm64

Steps to reproduce

  1. Have a Discord channel configured in channels.discord.guilds.<id>.channels.<id>
  2. Call sessions_spawn({ runtime: "acp", agentId: "claude", thread: true, mode: "session", task: "..." })
  3. Error: thread_binding_invalid — "Session binding adapter failed to bind target conversation"

Context

  • threadBindings.enabled: true and threadBindings.spawnAcpSessions: true are set
  • The bot CAN create threads (verified via message(action="thread-create") — succeeds)
  • Discord plugin has defaultTopLevelPlacement: "child", which means top-level channels expect thread-based binding
  • The bot has permissions to create threads in the target channels
  • acp.enabled: true, acp.backend: "acpx", acp.allowedAgents includes the target agent
  • plugins.entries.acpx.config.permissionMode: "approve-all"

Expected

ACP session should spawn and bind to a newly created thread in the Discord channel.

Actual

Thread binding adapter fails before the ACP session is created.

Workaround

Using the direct acpx CLI path works fine:

ACPX_CMD=".../node_modules/.bin/acpx"
$ACPX_CMD claude sessions new --name <session-name>
$ACPX_CMD claude -s <session-name> "<prompt>"

extent analysis

TL;DR

The issue can be worked around by using the direct acpx CLI path to spawn ACP sessions instead of relying on the sessions_spawn function.

Guidance

  • Verify that the threadBindings configuration is correctly set up and enabled for the Discord plugin.
  • Check the Discord channel permissions to ensure the bot has the necessary permissions to create threads.
  • Consider using the message(action="thread-create") function to create a thread before attempting to spawn an ACP session.
  • Review the acp configuration to ensure that acp.enabled and acp.backend are correctly set.

Example

No code snippet is provided as the issue does not require a code change, but rather a configuration or workflow adjustment.

Notes

The provided workaround using the direct acpx CLI path suggests that the issue may be related to the sessions_spawn function or the Discord plugin integration. Further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Use the direct acpx CLI path to spawn ACP sessions until the root cause of the issue is determined and a fix is implemented. This approach allows for continued functionality while the issue is being investigated.

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 - ✅(Solved) Fix ACP sessions_spawn thread binding fails on Discord: 'Session binding adapter failed to bind target conversation' [1 pull requests, 1 comments, 2 participants]