openclaw - ✅(Solved) Fix [Bug]: ACP turns fail with "Internal error" after upgrade to 2026.4.25 — gateway WS handshake rejected [1 pull requests, 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#73071Fetched 2026-04-28 06:27:53
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1

After upgrading from OpenClaw 2026.4.24 to 2026.4.25, all ACP sessions_spawn calls fail instantly (~2s, 0 tokens) with AcpRuntimeError: Internal error / ACP_TURN_FAILED; gateway logs show a WS client sending sessions.list before the required connect frame, and the bundled acpx v0.6.1 backend registers but never reaches "ready."

Error Message

Gateway log (relevant lines across multiple boots on 2026-04-27):

2026-04-26T16:33:02 [plugins] embedded acpx runtime backend ready ← last "ready" (2026.4.24)

2026-04-27T13:23:11 [plugins] embedded acpx runtime backend registered ← first boot on 2026.4.25, never "ready" 2026-04-27T13:48:01 [plugins] embedded acpx runtime backend registered ← second boot, never "ready" 2026-04-27T14:43:51 [plugins] embedded acpx runtime backend registered ← third boot, never "ready"

2026-04-27T14:47:09 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED 2026-04-27T14:48:42 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED 2026-04-27T14:58:43 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED 2026-04-27T15:08:16 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED 2026-04-27T15:32:27 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED

WS handshake failure (from /tmp/openclaw/openclaw-2026-04-27.log, structured fields):

{ "cause": "invalid-handshake", "handshake": "failed", "lastFrameType": "req", "lastFrameMethod": "sessions.list", "handshakeError": "invalid handshake: first request must be connect", "host": "127.0.0.1:18789" }

[ERROR] gateway connect failed: Error: gateway closed (1008): invalid handshake: first request must be connect [WARN] acp startup identity reconcile (renderer=v1): checked=22 resolved=0 failed=22

openclaw doctor (relevant):

Model auth: anthropic:claude-cli expiring (8h) Claude CLI: Binary ~/.local/bin/claude, workspace writable Gateway service: PATH includes nvm, Node from version manager Plugins: Loaded 12, Errors 0

openclaw gateway status:

Service: LaunchAgent (loaded) Runtime: running, state active Connectivity probe: ok Listening: 127.0.0.1:18789

Standalone ACP agent test (works fine outside OpenClaw):

$ echo '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":1,...}}' | node claude-agent-acp/dist/index.js → {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":1,"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","version":"0.26.0"}}}

Root Cause

After upgrading from OpenClaw 2026.4.24 to 2026.4.25, all ACP sessions_spawn calls fail instantly (~2s, 0 tokens) with AcpRuntimeError: Internal error / ACP_TURN_FAILED; gateway logs show a WS client sending sessions.list before the required connect frame, and the bundled acpx v0.6.1 backend registers but never reaches "ready."

Fix Action

Fix / Workaround

Workaround: Use runtime="subagent" instead of runtime="acp" for agent spawns.

PR fix notes

PR #73094: fix: address WS handshake ordering in ACP runtime

Description (problem / solution / changelog)

Summary

Fixes ACP turns failing with Internal error after upgrade to 2026.4.25 by addressing WS handshake frame ordering in acpx v0.6.1. The WS client was sending sessions.list before the required connect frame, causing gateway to reject the handshake.

Changes

  • Made backend health check defensive to avoid blocking ACP sessions
  • Wrapped isHealthy() in try-catch to handle edge cases

Testing

All 11 service.test.ts tests pass.

Fixes openclaw/openclaw#73071

Changed files

  • extensions/acpx/src/service.ts (modified, +14/-1)
  • src/gateway/server/ws-connection/message-handler.ts (modified, +3/-5)

Code Example

Gateway log (relevant lines across multiple boots on 2026-04-27):


2026-04-26T16:33:02 [plugins] embedded acpx runtime backend ready          ← last "ready" (2026.4.24)

2026-04-27T13:23:11 [plugins] embedded acpx runtime backend registered     ← first boot on 2026.4.25, never "ready"
2026-04-27T13:48:01 [plugins] embedded acpx runtime backend registered     ← second boot, never "ready"
2026-04-27T14:43:51 [plugins] embedded acpx runtime backend registered     ← third boot, never "ready"

2026-04-27T14:47:09 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T14:48:42 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T14:58:43 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T15:08:16 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T15:32:27 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED


WS handshake failure (from /tmp/openclaw/openclaw-2026-04-27.log, structured fields):


{
  "cause": "invalid-handshake",
  "handshake": "failed",
  "lastFrameType": "req",
  "lastFrameMethod": "sessions.list",
  "handshakeError": "invalid handshake: first request must be connect",
  "host": "127.0.0.1:18789"
}



[ERROR] gateway connect failed: Error: gateway closed (1008): invalid handshake: first request must be connect
[WARN] acp startup identity reconcile (renderer=v1): checked=22 resolved=0 failed=22


openclaw doctor (relevant):


Model auth: anthropic:claude-cli expiring (8h)
Claude CLI: Binary ~/.local/bin/claude, workspace writable
Gateway service: PATH includes nvm, Node from version manager
Plugins: Loaded 12, Errors 0


openclaw gateway status:


Service: LaunchAgent (loaded)
Runtime: running, state active
Connectivity probe: ok
Listening: 127.0.0.1:18789


Standalone ACP agent test (works fine outside OpenClaw):


$ echo '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":1,...}}' | node claude-agent-acp/dist/index.js
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":1,"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","version":"0.26.0"}}}
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After upgrading from OpenClaw 2026.4.24 to 2026.4.25, all ACP sessions_spawn calls fail instantly (~2s, 0 tokens) with AcpRuntimeError: Internal error / ACP_TURN_FAILED; gateway logs show a WS client sending sessions.list before the required connect frame, and the bundled acpx v0.6.1 backend registers but never reaches "ready."

Steps to reproduce

  1. Upgrade OpenClaw from 2026.4.24 to 2026.4.25 (npm install -g [email protected]).
  2. Restart gateway (openclaw gateway restart).
  3. Spawn any ACP session: sessions_spawn({ task: "Say hello", runtime: "acp", agentId: "claude", mode: "run" }).
  4. Observe instant failure (~2s, 0 tokens): AcpRuntimeError: Internal error.
  5. Check gateway log: gateway connect failed: Error: gateway closed (1008): invalid handshake: first request must be connect.

Expected behavior

In 2026.4.24 (bundled acpx v0.5.3), ACP sessions spawned successfully. The acpx backend showed "registered" then "ready" within ~0.2s, and ACP turns completed normally with token output.

Actual behavior

In 2026.4.25 (bundled acpx v0.6.1), the acpx backend shows "registered" but never "ready." Every ACP turn fails in ~2s with 0 tokens processed. Gateway log shows:

[gateway/ws] cause: invalid-handshake, lastFrameMethod: sessions.list, handshakeError: invalid handshake: first request must be connect [ERROR] gateway connect failed: Error: gateway closed (1008): invalid handshake: first request must be connect [gateway] acp startup identity reconcile (renderer=v1): checked=22 resolved=0 failed=22

Reproduced across 6+ gateway restarts, fresh auth token, cleaned session state, and bumped maxConcurrentSessions to 100. Non-ACP subagent spawns work fine.

OpenClaw version

2026.4.25 (aa36ee6)

Operating system

macOS 15.4 (Darwin 25.4.0, arm64, Apple M5 Max)

Install method

npm global (nvm, Node v22.22.2)

Model

anthropic/claude-sonnet-4-6 (for the parent agent); ACP agents: claude-agent-acp v0.26.0, codex-acp

Provider / routing chain

openclaw -> anthropic (via claude-cli auth profile)

Additional provider/model setup details

  • Auth profile: anthropic:claude-cli (OAuth, re-authed fresh during debugging — did not resolve the issue)
  • OPENCLAW_ACPX_RUNTIME_STARTUP_PROBE: not set
  • plugins.entries.acpx.config.permissionMode: approve-all
  • plugins.entries.acpx.config.agents.claude.command: claude-agent-acp
  • plugins.entries.acpx.config.agents.codex.command: codex-acp
  • acp.maxConcurrentSessions: 100
  • acp.runtime.ttlMinutes: 45
  • Plugin runtime deps path: ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.25-1674699698bd/ (acpx v0.6.1)
  • Previous working: ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.24-1674699698bd/ (acpx v0.5.3)

Logs, screenshots, and evidence

Gateway log (relevant lines across multiple boots on 2026-04-27):


2026-04-26T16:33:02 [plugins] embedded acpx runtime backend ready          ← last "ready" (2026.4.24)

2026-04-27T13:23:11 [plugins] embedded acpx runtime backend registered     ← first boot on 2026.4.25, never "ready"
2026-04-27T13:48:01 [plugins] embedded acpx runtime backend registered     ← second boot, never "ready"
2026-04-27T14:43:51 [plugins] embedded acpx runtime backend registered     ← third boot, never "ready"

2026-04-27T14:47:09 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T14:48:42 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T14:58:43 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T15:08:16 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED
2026-04-27T15:32:27 [ws] res ✗ agent errorCode=UNAVAILABLE errorMessage=AcpRuntimeError: Internal error code=ACP_TURN_FAILED


WS handshake failure (from /tmp/openclaw/openclaw-2026-04-27.log, structured fields):


{
  "cause": "invalid-handshake",
  "handshake": "failed",
  "lastFrameType": "req",
  "lastFrameMethod": "sessions.list",
  "handshakeError": "invalid handshake: first request must be connect",
  "host": "127.0.0.1:18789"
}



[ERROR] gateway connect failed: Error: gateway closed (1008): invalid handshake: first request must be connect
[WARN] acp startup identity reconcile (renderer=v1): checked=22 resolved=0 failed=22


openclaw doctor (relevant):


Model auth: anthropic:claude-cli expiring (8h)
Claude CLI: Binary ~/.local/bin/claude, workspace writable
Gateway service: PATH includes nvm, Node from version manager
Plugins: Loaded 12, Errors 0


openclaw gateway status:


Service: LaunchAgent (loaded)
Runtime: running, state active
Connectivity probe: ok
Listening: 127.0.0.1:18789


Standalone ACP agent test (works fine outside OpenClaw):


$ echo '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":1,...}}' | node claude-agent-acp/dist/index.js
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":1,"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","version":"0.26.0"}}}

Impact and severity

Affected: All ACP agent spawns (Claude Code, Codex) on this installation Severity: High — blocks all ACP-based coding agent workflows (Boris/Vlad delegation) Frequency: 100% — every ACP spawn fails, across 6+ gateway restarts and multiple debugging attempts Consequence: Cannot use ACP runtime for coding agents; forced to fall back to non-ACP subagent spawns which work but use a different execution model

Additional information

Last known good: 2026.4.24 (bundled acpx v0.5.3) — ACP working normally on 2026-04-26 First known bad: 2026.4.25 (bundled acpx v0.6.1) — ACP broken on first boot 2026-04-27

Ruled out during debugging:

  • Auth: Claude CLI re-authed, fresh token (8h), same failure
  • Session state: Cleaned 585 stale session files + 273 orphaned registry entries + 330 transcript files
  • Concurrent limit: Bumped maxConcurrentSessions from 40 to 100
  • ACP agents: Both claude-agent-acp and codex-acp work correctly standalone

Workaround: Use runtime="subagent" instead of runtime="acp" for agent spawns.

extent analysis

TL;DR

The most likely fix is to revert to OpenClaw version 2026.4.24, which had a working ACP runtime with acpx v0.5.3, until the issue with acpx v0.6.1 in version 2026.4.25 is resolved.

Guidance

  • The issue seems to be related to the upgrade of acpx from v0.5.3 to v0.6.1, which is bundled with OpenClaw 2026.4.25. The error messages indicate a handshake failure due to an invalid first request.
  • To verify the issue, check the gateway logs for the "invalid handshake" error and ensure that the acpx backend never reaches the "ready" state.
  • As a temporary workaround, using runtime="subagent" instead of runtime="acp" for agent spawns can bypass the ACP runtime issue.
  • Downgrade OpenClaw to version 2026.4.24 to use the previous working version of acpx (v0.5.3) as a potential fix.

Example

No code snippet is provided as the issue seems to be related to a version conflict rather than a code error.

Notes

The exact cause of the issue is not entirely clear, but it appears to be related to the change in acpx version. Further investigation into the differences between acpx v0.5.3 and v0.6.1 may be necessary to resolve the issue.

Recommendation

Apply the workaround by using runtime="subagent" for agent spawns until the issue with acpx v0.6.1 is resolved, as downgrading OpenClaw might not be feasible or desirable for all users.

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

In 2026.4.24 (bundled acpx v0.5.3), ACP sessions spawned successfully. The acpx backend showed "registered" then "ready" within ~0.2s, and ACP turns completed normally with token output.

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 [Bug]: ACP turns fail with "Internal error" after upgrade to 2026.4.25 — gateway WS handshake rejected [1 pull requests, 1 participants]