openclaw - 💡(How to fix) Fix Discord ACP sessions fail with ACP_TURN_FAILED under default acpx permissions while direct acpx succeeds [2 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#72064Fetched 2026-04-27 05:35:26
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
commented ×2cross-referenced ×2closed ×1

We hit a reproducible Discord -> OpenClaw -> ACPX/Codex failure where Discord-launched ACP coding sessions failed almost immediately with AcpRuntimeError: Internal error / code=ACP_TURN_FAILED, while the underlying acpx + Codex adapter worked directly on the same host.

The practical fix was to override the bundled ACPX runtime config so non-interactive Discord-launched coding sessions run with full ACPX harness permissions:

openclaw config set plugins.entries.acpx.config.permissionMode approve-all
openclaw config set plugins.entries.acpx.config.nonInteractivePermissions deny
openclaw gateway restart

After that, Discord-session ACP children could spawn successfully and perform real coding-style actions, including shell execution and file writes.

Related/background: #29195 and #28708 appear to describe nearby ACPX permission/silent failure behavior, but this report is the concrete Discord thread/session path we observed on current 2026.4.24.

Error Message

AcpRuntimeError: Internal error: code=ACP_TURN_FAILED

Root Cause

We hit a reproducible Discord -> OpenClaw -> ACPX/Codex failure where Discord-launched ACP coding sessions failed almost immediately with AcpRuntimeError: Internal error / code=ACP_TURN_FAILED, while the underlying acpx + Codex adapter worked directly on the same host.

The practical fix was to override the bundled ACPX runtime config so non-interactive Discord-launched coding sessions run with full ACPX harness permissions:

openclaw config set plugins.entries.acpx.config.permissionMode approve-all
openclaw config set plugins.entries.acpx.config.nonInteractivePermissions deny
openclaw gateway restart

After that, Discord-session ACP children could spawn successfully and perform real coding-style actions, including shell execution and file writes.

Related/background: #29195 and #28708 appear to describe nearby ACPX permission/silent failure behavior, but this report is the concrete Discord thread/session path we observed on current 2026.4.24.

Fix Action

Fix / Workaround

{
  "enabled": true,
  "dispatch": { "enabled": true },
  "backend": "acpx",
  "allowedAgents": ["codex"]
}

Workaround/fix applied locally

Verification after workaround

Code Example

openclaw config set plugins.entries.acpx.config.permissionMode approve-all
openclaw config set plugins.entries.acpx.config.nonInteractivePermissions deny
openclaw gateway restart

---

{
  "enabled": true,
  "dispatch": { "enabled": true },
  "backend": "acpx",
  "allowedAgents": ["codex"]
}

---

{
  "enabled": true,
  "config": {
    "probeAgent": "codex",
    "timeoutSeconds": 120
  }
}

---

{
  "runtime": "acp",
  "requesterSessionKey": "agent:main:discord:channel:<redacted>",
  "childSessionKey": "agent:codex:acp:<uuid>",
  "status": "failed",
  "error": "Internal error"
}

---

AcpRuntimeError: Internal error: code=ACP_TURN_FAILED

---

/opt/homebrew/lib/node_modules/openclaw/dist/extensions/acpx/node_modules/.bin/acpx \
  --timeout 180 --format text codex exec \
  'OpenClaw ACP smoke test. Reply exactly ACP_SMOKE_READY.'

---

ACP_SMOKE_READY
[done] end_turn

---

{
  "enabled": true,
  "config": {
    "probeAgent": "codex",
    "timeoutSeconds": 300,
    "permissionMode": "approve-all",
    "nonInteractivePermissions": "deny",
    "agents": {
      "codex": {
        "command": "npx -y @zed-industries/[email protected]"
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Summary

We hit a reproducible Discord -> OpenClaw -> ACPX/Codex failure where Discord-launched ACP coding sessions failed almost immediately with AcpRuntimeError: Internal error / code=ACP_TURN_FAILED, while the underlying acpx + Codex adapter worked directly on the same host.

The practical fix was to override the bundled ACPX runtime config so non-interactive Discord-launched coding sessions run with full ACPX harness permissions:

openclaw config set plugins.entries.acpx.config.permissionMode approve-all
openclaw config set plugins.entries.acpx.config.nonInteractivePermissions deny
openclaw gateway restart

After that, Discord-session ACP children could spawn successfully and perform real coding-style actions, including shell execution and file writes.

Related/background: #29195 and #28708 appear to describe nearby ACPX permission/silent failure behavior, but this report is the concrete Discord thread/session path we observed on current 2026.4.24.

Environment

  • OpenClaw: 2026.4.24 (cbcfdf6)
  • Install kind: package/Homebrew global node install path
  • macOS: 26.3 arm64
  • Node: v22.22.0
  • Codex CLI: codex-cli 0.125.0
  • Codex ACP adapter: @zed-industries/[email protected]
  • Bundled/local ACPX observed: 0.5.3; npm latest checked: [email protected]
  • ACP backend: acpx
  • Discord plugin enabled and running
  • channels.discord.threadBindings.spawnAcpSessions=true

Starting config that failed

Top-level ACP config:

{
  "enabled": true,
  "dispatch": { "enabled": true },
  "backend": "acpx",
  "allowedAgents": ["codex"]
}

ACPX plugin config before the full fix:

{
  "enabled": true,
  "config": {
    "probeAgent": "codex",
    "timeoutSeconds": 120
  }
}

The plugin defaults resolved to permissionMode=approve-reads and nonInteractivePermissions=fail.

Failure symptoms

Discord/requester ACP tasks failed with task state like:

{
  "runtime": "acp",
  "requesterSessionKey": "agent:main:discord:channel:<redacted>",
  "childSessionKey": "agent:codex:acp:<uuid>",
  "status": "failed",
  "error": "Internal error"
}

Gateway log examples:

AcpRuntimeError: Internal error: code=ACP_TURN_FAILED

From the user side, this looked like Discord could start the ACP flow but the coding child died before useful work started. The error surfaced as a generic internal failure, not as a permission/config hint.

Direct adapter check

The underlying ACP adapter itself was not broken. Running the bundled adapter directly succeeded:

/opt/homebrew/lib/node_modules/openclaw/dist/extensions/acpx/node_modules/.bin/acpx \
  --timeout 180 --format text codex exec \
  'OpenClaw ACP smoke test. Reply exactly ACP_SMOKE_READY.'

Result:

ACP_SMOKE_READY
[done] end_turn

That narrowed the issue to OpenClaw's embedded ACPX runtime/config path rather than Codex ACP itself.

Workaround/fix applied locally

We configured ACPX explicitly for non-interactive Discord coding sessions:

{
  "enabled": true,
  "config": {
    "probeAgent": "codex",
    "timeoutSeconds": 300,
    "permissionMode": "approve-all",
    "nonInteractivePermissions": "deny",
    "agents": {
      "codex": {
        "command": "npx -y @zed-industries/[email protected]"
      }
    }
  }
}

Then restarted the gateway.

Verification after workaround

After the config change and restart:

  • openclaw config validate passed
  • Gateway became reachable
  • Discord, Codex, and ACPX plugins reported loaded/no plugin error
  • Direct ACP smoke passed
  • OpenClaw ACP spawn passed with marker OPENCLAW_ACPX_TASK_READY
  • Discord-session ACP spawn passed with marker DISCORD_SESSION_ACPX_READY
  • Full-access smoke passed: a Discord-session ACP child created a temporary file via shell, verified its contents, and returned DISCORD_ACP_FULL_ACCESS_OK
  • openclaw tasks list --runtime acp --status running returned no stuck ACP jobs

Expected behavior

One of these would make the failure mode much easier to operate:

  1. For ACPX-backed non-interactive sessions launched from Discord/thread bindings, either default to a config that can actually perform coding tasks (approve-all or an equivalent explicit profile), or
  2. fail loudly before spawning when permissionMode=approve-reads + nonInteractivePermissions=fail means writes/exec will likely crash, and surface the remediation to the Discord/requester session, or
  3. include a doctor/preflight check that warns: “Discord ACP coding sessions are non-interactive; set plugins.entries.acpx.config.permissionMode=approve-all if you expect file writes or shell commands.”

Actual behavior

The task was accepted, the child ACP session failed shortly after with ACP_TURN_FAILED, and the user-facing/task-level error was just Internal error. The actionable permission/config cause was only discoverable by inspecting logs/source/config and comparing direct acpx execution against the OpenClaw embedded ACPX path.

extent analysis

TL;DR

To fix the Discord-launched ACP coding session failure, override the bundled ACPX runtime config to allow non-interactive sessions to run with full ACPX harness permissions.

Guidance

  • Identify the current ACPX plugin configuration and check the permissionMode and nonInteractivePermissions settings.
  • Update the ACPX plugin configuration to set permissionMode to approve-all and nonInteractivePermissions to deny to allow non-interactive Discord-launched coding sessions to run with full permissions.
  • Restart the OpenClaw gateway after applying the configuration changes.
  • Verify the fix by checking the Discord-session ACP spawn and running a full-access smoke test.

Example

The updated ACPX plugin configuration should look like this:

{
  "enabled": true,
  "config": {
    "probeAgent": "codex",
    "timeoutSeconds": 300,
    "permissionMode": "approve-all",
    "nonInteractivePermissions": "deny"
  }
}

Notes

This fix assumes that the underlying ACP adapter is working correctly, as verified by running the direct adapter check. If the issue persists, further debugging may be required.

Recommendation

Apply the workaround by updating the ACPX plugin configuration to allow non-interactive Discord-launched coding sessions to run with full permissions, as this fixes the immediate issue and allows for successful ACP coding sessions.

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…

FAQ

Expected behavior

One of these would make the failure mode much easier to operate:

  1. For ACPX-backed non-interactive sessions launched from Discord/thread bindings, either default to a config that can actually perform coding tasks (approve-all or an equivalent explicit profile), or
  2. fail loudly before spawning when permissionMode=approve-reads + nonInteractivePermissions=fail means writes/exec will likely crash, and surface the remediation to the Discord/requester session, or
  3. include a doctor/preflight check that warns: “Discord ACP coding sessions are non-interactive; set plugins.entries.acpx.config.permissionMode=approve-all if you expect file writes or shell commands.”

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 Discord ACP sessions fail with ACP_TURN_FAILED under default acpx permissions while direct acpx succeeds [2 comments, 2 participants]