Skip to content

ACP: session/prompt fails with Gateway disconnected (1005/1006) and timeout #59334

@DSVinC

Description

@DSVinC

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions