Skip to content

fix(acp): flush on error and filter whitespace text blocks in Claude API#828

Merged
bug-ops merged 2 commits intomainfrom
fix/acp-flush-on-error
Feb 25, 2026
Merged

fix(acp): flush on error and filter whitespace text blocks in Claude API#828
bug-ops merged 2 commits intomainfrom
fix/acp-flush-on-error

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 25, 2026

Summary

  • Move flush_chunks() inside error handler in handle_text() so ACP sessions recover from LLM errors (529 overloaded, timeouts) without double-flushing on success path
  • Filter messages with agent_visible=false in split_messages and split_messages_structured to prevent sending hidden context to Claude API
  • Guard all text content blocks against whitespace-only content which Claude API rejects with 400 "text content blocks must contain non-whitespace text"

Test plan

  • Send prompt via ACP while LLM returns error — session should recover and accept next prompt
  • Normal prompt flow works without double-flush
  • Messages hidden by tool summarization are not sent to Claude API
  • Whitespace-only text blocks are silently dropped

@github-actions github-actions bot added bug Something isn't working size/XS rust core and removed size/XS labels Feb 25, 2026
@bug-ops bug-ops enabled auto-merge (squash) February 25, 2026 00:55
When process_response() fails (e.g. 529 overloaded), the error handler
sends the error message but never flushes, leaving the ACP drain loop
waiting indefinitely. Move flush_chunks() after the error block so it
runs on both success and failure paths.
@bug-ops bug-ops force-pushed the fix/acp-flush-on-error branch from 09837a1 to 9b6c10a Compare February 25, 2026 01:01
…ude API

Skip messages with agent_visible=false in split_messages and
split_messages_structured to prevent sending hidden context to the API.
Guard all text content blocks against whitespace-only content which
Claude API rejects with 400 "text content blocks must contain
non-whitespace text".
@github-actions github-actions bot added llm LLM provider related size/S and removed size/XS labels Feb 25, 2026
@bug-ops bug-ops changed the title fix(acp): flush chunks on LLM error to prevent session hang fix(acp): flush on error and filter whitespace text blocks in Claude API Feb 25, 2026
@bug-ops bug-ops merged commit 2e4e99c into main Feb 25, 2026
23 checks passed
@bug-ops bug-ops deleted the fix/acp-flush-on-error branch February 25, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core llm LLM provider related rust size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant