From 83a8a03905cd31f5ae26e6c8cab07f2347df1693 Mon Sep 17 00:00:00 2001 From: Joar von Arndt Date: Sun, 11 Oct 2026 17:22:21 +0800 Subject: [PATCH 1/2] Never sends empty messages via ACP --- src/acp/observer.lisp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/acp/observer.lisp b/src/acp/observer.lisp index d2e224be..5a426898 100644 --- a/src/acp/observer.lisp +++ b/src/acp/observer.lisp @@ -139,10 +139,11 @@ (defmethod agent-observer-text ((observer acp-observer) text) "Stream assistant text and retain its length for nonstreamed response reconciliation." (acp-session-check-cancelled (acp-observer-session observer)) - (with-lock-held ((acp-observer-lock observer)) - (text-buffer-append (acp-observer-streamed-text observer) text) - (acp-observer--send observer - (agentcomms:acp-update-agent-message (agentcomms:acp-text-content text)))) + (when (plusp (length text)) + (with-lock-held ((acp-observer-lock observer)) + (text-buffer-append (acp-observer-streamed-text observer) text) + (acp-observer--send observer + (agentcomms:acp-update-agent-message (agentcomms:acp-text-content text))))) nil) (defmethod agent-observer-reasoning ((observer acp-observer) text) From 01fff8a1fea51de589d6f0c59dc28f0e30da32f2 Mon Sep 17 00:00:00 2001 From: Joar von Arndt Date: Sun, 11 Oct 2026 17:49:29 +0800 Subject: [PATCH 2/2] Covers empty ACP messages in thought batches --- tests/acp-observer-tests.lisp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/acp-observer-tests.lisp b/tests/acp-observer-tests.lisp index 35a27ff7..0c07b6f9 100644 --- a/tests/acp-observer-tests.lisp +++ b/tests/acp-observer-tests.lisp @@ -200,6 +200,9 @@ (agent-observer-status observer ':provider-request-started nil) (agent-observer-reasoning observer "before ") (agent-observer-reasoning observer "approval") + (agent-observer-reasoning observer "continued ") + (agent-observer-text observer "") + (agent-observer-reasoning observer "thought") (test-assert (acp-observer--approval observer "shell.run" (json-object "command" "pwd") '(:command)) "the editor can approve after receiving pending thoughts") @@ -209,7 +212,8 @@ (mapcar #'agentcomms:acp-update-kind updates)) "thought batches precede the next message and permission request") (test-assert - (equal (list (format nil "first thought~2%next thought") "answer" "before approval") + (equal (list (format nil "first thought~2%next thought") "answer" + (format nil "before approvalcontinued thought")) (mapcar (lambda (update) (agentcomms:acp-content-text (agentcomms:json-get update "content"))) updates))