Skip to content

fix: don't truncate final ACP message chunk (#15377)#1

Open
pjeby wants to merge 1 commit intomainfrom
pjeby-fix-15377
Open

fix: don't truncate final ACP message chunk (#15377)#1
pjeby wants to merge 1 commit intomainfrom
pjeby-fix-15377

Conversation

@pjeby
Copy link
Copy Markdown
Owner

@pjeby pjeby commented Feb 16, 2026

Fix openclaw#15377 (ACP truncates final assistant chunk before end_turn). The issue was that the "final" state doesn't forward its messageData before emitting an end_turn, causing some part of the message to be silently discarded.

This change checks for the presence of messageData in the final state, so it can be properly passed on before the end_turn is issued.

Summary

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

None

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: Windows
  • Runtime/container: WSL
  • Model/provider: z.ai
  • Integration/channel (if any): ACP
  • Relevant config (redacted): N/A

Steps

  1. Use openclaw acp client to talk to openclaw's acp gateway
  2. Send a prompt that requires a multi-chunk response

Expected

  • Full response output

Actual

  • Truncated response

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Before:

OpenClaw ACP client
Session: <redacted>
Type a prompt, or "exit" to quit.

> How about now?
Working
[end_turn]

> Nope.  This is me checking with OpenClaw's own ACP client, so it's definitely the openclaw issue.
Confirmed
[end_turn]

After:

[acp] ready
[acp] newSession: <redacted> -> agent:main:test

[commands] /help /commands /status /context /whoami /id /subagents /config /debug /usage /stop /restart /dock-telegram /dock-discord /dock-slack /activation /send /reset /new /think /verbose /reasoning /elevated /model /queue /bash /compact
[acp] gateway reconnected
OpenClaw ACP client
Session: <redacted>
Type a prompt, or "exit" to quit.

> Alright, I want to see if this works any better - I tweaked the code in question.
Testing the fix. This is a longer message to see if the truncation at the end is now resolved. If this entire message comes through properly, then the code change should have fixed the issue with the final state not being forwarded to the ACP client. The bug was that `handleChatEvent` was dropping the message data when `state === "final"`, so the final chunk of text was never sent. Let me know how much of this you can see on your end.
[end_turn]

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: See above
  • Edge cases checked: N/A
  • What you did not verify: if there's any path where this works without the fix, i.e. if there's ever a final chunk with no messageData. But that's why I made it check for that case

Compatibility / Migration

  • Backward compatible? Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: remove the patch
  • Files/config to restore: N/A
  • Known bad symptoms reviewers should watch for: N/A

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

None

…nclaw#15377)

Fix openclaw#15377 (ACP truncates final assistant chunk before end_turn).  The issue was that the "final" state doesn't forward its `messageData` before emitting an `end_turn`, causing some part of the message to be silently discarded.

This change checks for the presence of `messageData` in the final state, so it can be properly passed on *before* the `end_turn` is issued.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant