Blog

OpenClaw Discord ACP turn failed in threads? Start with permissions

Problem statement: you launch a coding task from Discord, OpenClaw creates the ACP child session, and then the session dies almost immediately with AcpRuntimeError: Internal error or code=ACP_TURN_FAILED. The really confusing part is that a direct acpx smoke test on the same host works fine. That combination usually means the adapter itself is alive, but the Discord-to-ACPX execution path is not allowed to do the kind of non-interactive coding work you asked it to do.

Why this error wastes so much time
  • The visible error says “internal error,” which sounds like a deep product bug instead of a fixable config mismatch.
  • Direct adapter tests can succeed, which makes the whole setup look healthy when the Discord launch path is still broken.
  • The child session often dies before useful work starts, so you do not get a clean user-facing permission hint.
  • Teams can spend hours blaming Discord, Codex, or ACP itself when the real issue is the permission profile for non-interactive work.

Evidence from the field

  • GitHub issue #72064 was opened on 2026-04-26 after a reproducible Discord thread session failure on current OpenClaw.
  • In that report, Discord-launched ACP coding sessions failed with ACP_TURN_FAILED while the underlying acpx adapter succeeded directly on the same host.
  • The practical field fix explicitly set plugins.entries.acpx.config.permissionMode to approve-all and plugins.entries.acpx.config.nonInteractivePermissions to deny, then restarted the gateway.
  • After that config change, Discord-session ACP children could spawn and perform shell and file actions successfully, which strongly narrows the problem to the Discord-to-ACPX path rather than the adapter binary itself.

The key idea: direct ACP success does not prove Discord is healthy

This is the part most operators miss on the first pass. When you run a direct acpx smoke test, you are proving that the adapter can launch and complete a simple request locally. That is useful, but it is not the same thing as proving that Discord thread sessions can launch non-interactive coding work through OpenClaw's embedded ACPX runtime.

Discord-spawned ACP sessions are subject to the OpenClaw configuration that wraps that work. If the effective permission mode is too restrictive for shell execution or file writes, the child can fail during the first real coding turn even though the adapter itself is fine. That is why “direct acpx works” should narrow the investigation, not end it.

What usually triggers this failure

  • Discord thread bindings are enabled: users can launch ACP coding work from a thread, but the runtime path is non-interactive.
  • The adapter can run: direct smoke tests succeed, which rules out the simplest adapter install failure.
  • The effective permission profile is too narrow for coding work: file writes or shell execution are not compatible with the current ACPX permissions.
  • The failure message is generic: OpenClaw reports an internal error instead of a human-friendly config hint.

How to tell this apart from other Discord coding failures

Symptom Most likely branch
Direct acpx smoke passes, Discord ACP child fails almost immediately Discord-to-ACPX config or permission mismatch
Direct acpx smoke also fails Adapter or local install problem
Discord bot never receives the request Discord integration or event-routing issue
Child session runs but cannot finish one specific repo task Project-specific task or sandbox issue, not necessarily this guide

Diagnostic checklist before you change anything

1) Prove the direct adapter path separately

Run one clean direct ACP smoke test and save the result. If that works, you have learned something important: the adapter binary and baseline environment are not completely broken.

/path/to/acpx --timeout 180 --format text codex exec 'Reply exactly ACP_SMOKE_READY.'

2) Confirm the Discord path is the one failing

Launch the same kind of small task from the Discord thread path. If that fails quickly while the direct test works, you have isolated the problem to the embedded launch path.

3) Inspect the ACPX permission settings that matter for non-interactive work

The fresh report showed that Discord coding sessions were effectively running with defaults that were too restrictive for real coding tasks. Look especially at permission mode and non-interactive permissions, because Discord thread sessions are not waiting around for someone to click through a prompt.

4) Stop treating “internal error” as final diagnosis

ACP_TURN_FAILED tells you the turn failed. It does not tell you why. In this incident pattern, you need to look one level lower at the execution profile that Discord-spawned sessions inherit.

Step-by-step fix workflow

1) Set ACPX permissions for actual coding work

The field fix that worked was explicit. Set the ACPX permission mode so Discord-launched coding sessions can perform the actions they need instead of dying on the first write or shell step.

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

The important point is not the exact command syntax alone. The important point is that non-interactive Discord coding sessions need a permission profile that matches coding work.

2) Restart the gateway

ACPX config changes are not meaningful if the live runtime never reloads them. Restart the gateway and wait for the Discord, ACPX, and coding-related plugins to load cleanly.

openclaw gateway restart

3) Re-run the direct smoke test

This step is not because you expect it to fail. It is because you want a clean baseline after the restart. If direct ACP suddenly breaks now, you introduced a different problem and should stop there.

4) Re-run the Discord thread test with a tiny task

Start with a disposable task that proves the session can do shell and file work without risking a real repo. The fresh report validated success by having the Discord-launched child create a temporary file, verify its contents, and return a success marker.

5) Only then return to real coding work

Once the path can perform a minimal file or shell action, move on to your real repo task. That order matters. Production debugging is faster when you prove the infrastructure path first.

Fix once. Stop recurring Discord ACP thread failures.

If this keeps coming back, you can move your existing setup to managed OpenClaw cloud hosting instead of rebuilding the same stack. Import your current instance, keep your context, and move onto a runtime with lower ops overhead.

  • Import flow in ~1 minute
  • Keep your current instance context
  • Run with managed security and reliability defaults

If you would rather compare options first, review OpenClaw cloud hosting or see the best OpenClaw hosting options before deciding.

OpenClaw import first screen in OpenClaw Setup dashboard (light theme) OpenClaw import first screen in OpenClaw Setup dashboard (dark theme)
1) Paste import payload
OpenClaw import completed screen in OpenClaw Setup dashboard (light theme) OpenClaw import completed screen in OpenClaw Setup dashboard (dark theme)
2) Review and launch

Result verification

  • Direct ACP smoke still passes after the config change.
  • Discord-launched ACP thread sessions no longer die immediately with ACP_TURN_FAILED.
  • A minimal task can perform the kind of write or shell action that previously failed.
  • No stuck ACP jobs remain after the test run.
  • You can complete one real coding task from Discord without a permission-related crash.

Edge cases and judgment calls

Your direct smoke test is too simple

A direct test that only prints a marker proves less than you think. It may confirm the adapter launches while still saying nothing about whether the Discord path can perform file writes or shell commands.

You changed permissions but skipped the restart

Then you did not actually test the new runtime path. This is one of the most common avoidable mistakes in ACP troubleshooting.

The child now starts but still fails on one repo

That may be a repo-specific task problem rather than the original ACP thread-permission problem. Once the infrastructure path is healthy, debug the repo on its own terms.

You are worried that approve-all sounds broad

That concern is reasonable. The lesson from the field report is not “be careless.” The lesson is that the permission profile must match the work. If you want Discord to launch real coding sessions, the runtime cannot behave as if it is only allowed to read. If that tradeoff feels uncomfortable for your environment, that is exactly when managed operating patterns become attractive.

Typical mistakes

  • Assuming direct acpx success means the Discord thread path is proven healthy.
  • Treating ACP_TURN_FAILED as a final diagnosis instead of an umbrella symptom.
  • Changing permission config but forgetting to restart the gateway.
  • Testing the fix with a big production task instead of a tiny disposable one.
  • Blaming Discord, Codex, or the repo before checking the ACPX permission model.

If Discord coding needs to feel boring and reliable

If your goal is dependable coding workflows instead of more runtime tuning, start with OpenClaw Setup, compare the tradeoffs on /compare/, and review OpenClaw cloud hosting if you want a path with less Discord-side operating friction.

Import your current OpenClaw instance in 1 click

FAQ

Does this mean Discord ACP is broken for everyone?

No. It means the Discord thread path can fail when the permission model for non-interactive coding work does not match the task you expect it to perform.

Why is the error message so vague?

Because the user-visible failure is the turn failing, not the full internal reason chain. That is why this guide focuses on the config branch that the fresh report actually fixed.

Should I downgrade immediately?

Not first. Start with the permission-path fix that already worked in the field. Downgrades make more sense only after you have ruled out the config mismatch that caused this specific incident.

What should I read next?

Start with OpenClaw Setup if you want a cleaner operator path, visit /compare/ if you are weighing self-hosted against managed tradeoffs, and read OpenClaw cloud hosting if reliability is now the deciding factor.

Cookie preferences