Skip to content

[Bug]: ACP truncates final assistant chunk before end_turn on node-connected path #15377

@jaesbit

Description

@jaesbit

Summary

ACP streaming sometimes drops the final tail of assistant output.
The run still finishes with stopReason: "end_turn", but the last chunk text is incomplete.

Steps to reproduce

  1. Start ACP bridge:
    openclaw acp --verbose
  2. Send:
    {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1}}
  3. Create session:
    {"jsonrpc":"2.0","id":2,"method":"session/new","params":{"cwd":"/home/jaesbit/Work/openclaw-tests","mcpServers":[]}}
  4. Send long prompt with explicit end marker:
    {"jsonrpc":"2.0","id":3,"method":"session/prompt","params":{"sessionId":"<SESSION_ID>","prompt":[{"type":"text","text":"Please write a long test message in English, around 25 lines, with a title, a numbered list, and a final closing marker: END-OF-LONG-TEST-OK."}]}}
  5. Inspect session/update notifications and final id:3 response.

Expected behavior

Final streamed assistant text should be complete (including the full tail/end marker context) before end_turn.

Actual behavior

  • Multiple session/update events arrive with sessionUpdate: "agent_message_chunk".
  • The final text chunk is truncated (tail missing).
  • Then ACP returns:
    {"jsonrpc":"2.0","id":3,"result":{"stopReason":"end_turn"}}

Environment

  • Clawdbot version: OpenClaw CLI 2026.2.9 observed locally (openclaw --version)
  • OS: Linux (host environment)
  • Install method (pnpm/npx/docker/etc): global npm install (~/.npm-global/...)

Logs or screenshots

Raw ACP sample (redacted):

  • initialize succeeds with protocolVersion:1
  • session/new succeeds and returns sessionId
  • session/update emits several agent_message_chunk events
  • Last chunk ends early (example tail: ...missing/c)
  • Final response is still stopReason:"end_turn"

Additional scope notes:

  • Reproduced on node-connected path (paired node setup).
  • In OpenClaw Web UI, full message is visible.
  • Direct same-instance ACP→gateway path has not been tested yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    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