openclaw - ✅(Solved) Fix ACP: session/prompt fails with Gateway disconnected (1005/1006) and timeout [1 pull requests, 1 comments, 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#59334Fetched 2026-04-08 02:25:48
View on GitHub
Comments
1
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1cross-referenced ×1locked ×1

Error Message

{"jsonrpc":"2.0","id":2,"error":{"code":-32603,"message":"Internal error","data":{"details":"Gateway disconnected: 1005: "}}} {"jsonrpc":"2.0","id":null,"error":{"code":-32070,"message":"Timed out after 40000ms","data":{"acpxCode":"TIMEOUT","origin":"cli"}}}

  • Actual: initialize and session/new succeed, but session/prompt fails with Internal error + Gateway disconnected: 1005/1006, then timeout.
  • Post-disconnect retry/error mapping (-32603 + TIMEOUT combination)

Fix Action

Fix / Workaround

7) Current workaround

PR fix notes

PR #59473: fix: keep ACP prompts alive across gateway reconnects

Description (problem / solution / changelog)

Summary

  • stop treating ACP prompt completion as both a long-lived chat.send request and an event stream; the translator now waits only for send acceptance and keeps completion event-driven
  • keep in-flight ACP prompts alive across transient gateway reconnects
  • lock the regression with a reconnect-focused translator test

Testing

  • pnpm test -- src/acp/translator.stop-reason.test.ts src/acp/translator.prompt-prefix.test.ts src/acp/translator.cancel-scoping.test.ts src/acp/translator.session-rate-limit.test.ts
  • pnpm tsgo

Fixes #59334 Fixes #31686 Fixes #28708

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/acp/translator.prompt-prefix.test.ts (modified, +9/-9)
  • src/acp/translator.stop-reason.test.ts (modified, +530/-0)
  • src/acp/translator.ts (modified, +190/-6)

Code Example

openclaw --version
openclaw gateway --version
acpx --version
claude --version
gemini --version

---

openclaw gateway probe

---

acpx --timeout 40 --format json claude-code exec "Reply exactly OK"

---

acpx --timeout 40 --format json openclaw exec "Reply exactly OK"

---

{"jsonrpc":"2.0","id":2,"method":"session/prompt", ...}
{"jsonrpc":"2.0","id":2,"error":{"code":-32603,"message":"Internal error","data":{"details":"Gateway disconnected: 1005: "}}}
{"jsonrpc":"2.0","id":null,"error":{"code":-32070,"message":"Timed out after 40000ms","data":{"acpxCode":"TIMEOUT","origin":"cli"}}}
RAW_BUFFERClick to expand / collapse

OpenClaw ACP minimal repro: disconnect at session/prompt (Gateway disconnected: 1005/1006)

  • Report time (Asia/Shanghai): 2026-04-02 09:42:40 CST
  • Impact: acpx -> openclaw acp frequently fails to return model output; CLI times out
  • Severity: High (ACP path becomes unreliable/unusable for production workflows)

1) Environment

openclaw --version
openclaw gateway --version
acpx --version
claude --version
gemini --version

Observed output:

  • OpenClaw 2026.3.28 (f9b1079)
  • OpenClaw 2026.3.28 (f9b1079)
  • acpx 0.3.0
  • Claude Code 2.1.69
  • Gemini CLI 0.34.0

Gateway probe:

openclaw gateway probe

Key output:

  • Reachable: yes
  • Local loopback ws://127.0.0.1:18799
  • Connect: ok (40ms) · RPC: ok

2) Minimal repro steps

Step A (control, succeeds)

acpx --timeout 40 --format json claude-code exec "Reply exactly OK"

Result: succeeds and returns OK.

Step B (problem path, fails)

acpx --timeout 40 --format json openclaw exec "Reply exactly OK"

Consistent output pattern:

{"jsonrpc":"2.0","id":2,"method":"session/prompt", ...}
{"jsonrpc":"2.0","id":2,"error":{"code":-32603,"message":"Internal error","data":{"details":"Gateway disconnected: 1005: "}}}
{"jsonrpc":"2.0","id":null,"error":{"code":-32070,"message":"Timed out after 40000ms","data":{"acpxCode":"TIMEOUT","origin":"cli"}}}

3) Expected vs actual

  • Expected: openclaw acp completes session/prompt and returns model text (e.g. OK).
  • Actual: initialize and session/new succeed, but session/prompt fails with Internal error + Gateway disconnected: 1005/1006, then timeout.

4) Key log points (/tmp/openclaw/openclaw-2026-04-02.log)

4.1 session/prompt disconnect errors

  • line 361 @ 2026-04-02T09:23:27.494+08:00: Gateway disconnected: 1005
  • line 404 @ 2026-04-02T09:24:50.054+08:00: Gateway disconnected: 1005
  • line 608 @ 2026-04-02T09:28:03.654+08:00: Gateway disconnected: 1005
  • line 735 @ 2026-04-02T09:30:50.477+08:00: Gateway disconnected: 1006
  • line 907 @ 2026-04-02T09:35:13.678+08:00: Gateway disconnected: 1006

4.2 Accompanying errors (possibly related)

  • [lcm] Migration failed: database is locked: 15 occurrences, latest:
    • line 989 @ 2026-04-02T09:42:02.184+08:00
  • ERR_USE_AFTER_CLOSE: readline was closed: 2 occurrences
    • line 742 @ 2026-04-02T09:30:50.932+08:00
    • line 744 @ 2026-04-02T09:30:51.017+08:00

5) What has already been ruled out

  • Not "all ACP is broken": claude-code succeeds on the same machine with the same style command.
  • Not "gateway fully unreachable": openclaw gateway probe reports Reachable: yes, RPC: ok.
  • claude-code was previously misconfigured as a plain CLI command; after fixing to ACP adapter command it works, while openclaw path still fails.

6) Initial hypothesis

This looks like an instability in openclaw acp bridge handling at session/prompt (WS close 1005/1006), rather than simple network unreachability or pure model timeout.

Likely hotspots to inspect:

  • ACP session/prompt forwarding path and websocket lifecycle handling
  • Post-disconnect retry/error mapping (-32603 + TIMEOUT combination)
  • Potential amplification by LCM DB lock contention during high-concurrency/backfill workloads

7) Current workaround

  • Use acpx -> claude-code / acpx -> codex for external dev-agent workflows.
  • Avoid concurrent long backfill tasks and ACP stress on the same session.
  • Split high-load tasks and throttle to reduce session saturation.

If helpful, I can also provide a single zipped diagnostics bundle (commands output + log snippets + timeline).

extent analysis

TL;DR

Inspect and stabilize the openclaw acp bridge handling at session/prompt, focusing on websocket lifecycle and post-disconnect retry/error mapping to resolve the gateway disconnection issue.

Guidance

  • Investigate the ACP session/prompt forwarding path for potential issues with websocket connection closure (1005/1006) and how it affects the openclaw acp bridge.
  • Review the error handling and retry mechanism for Gateway disconnected errors to prevent timeouts and ensure robust connection management.
  • Consider the impact of LCM DB lock contention on the stability of openclaw acp during high-concurrency workloads and explore strategies to mitigate this issue.
  • Analyze logs and diagnostics to identify patterns or correlations between Gateway disconnected errors, ERR_USE_AFTER_CLOSE errors, and LCM DB lock contention.

Example

No specific code example is provided due to the complexity and specificity of the issue, but inspecting the openclaw acp bridge code for proper websocket handling and error management is crucial.

Notes

The provided information suggests an instability in the openclaw acp bridge, but without direct access to the code or more detailed diagnostics, pinpointing the exact cause requires further investigation. The current workaround using acpx -> claude-code / acpx -> codex and avoiding concurrent high-load tasks may help mitigate the issue temporarily.

Recommendation

Apply the workaround of using acpx -> claude-code / acpx -> codex for external dev-agent workflows and avoid concurrent long backfill tasks to reduce the load on the openclaw acp bridge until a more permanent fix can be implemented. This approach allows for continued functionality while minimizing the impact of the instability.

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