Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(claude): stop surfacing SDK task receipts as chat messages (#2151)

Call White03a512de3884
diff --git a/modules/agents/claude_agent.py b/modules/agents/claude_agent.py
index e6e70db66..25ca75003 100644
--- a/modules/agents/claude_agent.py
+++ b/modules/agents/claude_agent.py
@@ -3191,13 +3191,16 @@ class ClaudeAgent(BaseAgent):
(existing_activity is not None and existing_activity.foreground)
or (tool_use_id and tool_use_id in foreground_tool_ids)
)
+ # The SDK task ``summary`` is a CLI-generated receipt such as
+ # 'Background command "..." completed (exit code 0)'. It is not
+ # assistant output, so it never becomes the Activity's visible
+ # fallback text; a completion without assistant text settles silently.
metadata = {
key: value
for key, value in {
"task_type": task_type or None,
"last_tool_name": self._task_field(message, "last_tool_name"),
"output_file": self._task_field(message, "output_file"),
- "summary": self._task_field(message, "summary"),
}.items()
if value not in (None, "")
}
diff --git a/tests/test_claude_agent_initiated_turn.py b/tests/test_claude_agent_initiated_turn.py
index b770d6aef..9ca58817c 100644
--- a/tests/test_claude_agent_initiated_turn.py
+++ b/tests/test_claude_agent_initiated_turn.py
@@ -983,7 +983,7 @@ class ReceiverOpensAgentInitiatedTurnTests(unittest.IsolatedAsyncioTestCase):
"slack::channel::C-ORIGIN",
)
- async def test_completed_task_notification_at_eof_delivers_summary(self):
+ async def test_completed_task_notification_at_eof_settles_without_sdk_summary(self):
agent, service = _build_agent()
composite_key = "session-eof:/tmp/work"
context = SimpleNamespace(
@@ -997,7 +997,8 @@ class ReceiverOpensAgentInitiatedTurnTests(unittest.IsolatedAsyncioTestCase):
"agent_session_id": "sess-eof",
},
)
- agent.emit_result_message = _dispatcher_owned_emit(service)
+ agent.emit_result_message = AsyncMock()
+ agent.controller.emit_agent_message = _dispatcher_owned_emit(service)
await agent._receive_messages(
_completed_task_notification_client(),
@@ -1007,12 +1008,16 @@ class ReceiverOpensAgentInitiatedTurnTests(unittest.IsolatedAsyncioTestCase):
composite_key=composite_key,
)
- agent.emit_result_message.assert_awaited_once()
- self.assertEqual(
- agent.emit_result_message.await_args.args[1],
- "Background verification finished",
- )
- output = agent.emit_result_message.await_args.kwargs["output"]
+ # The SDK summary is a CLI receipt, not assistant output: it stays
+ # invisible and the Activity settles through the silent result path.
+ agent.emit_result_message.assert_not_awaited()
+ silent_calls = [
+ call
+ for call in agent.controller.emit_agent_message.await_args_list
+ if call.args[1:3] == ("result", "")
+ ]
+ self.assertEqual(len(silent_calls), 1)
+ output = silent_calls[0].kwargs["output"]
self.assertTrue(output.detached)
self.assertFalse(output.completes_turn)
self.assertTrue(output.completes_run)
@@ -1034,12 +1039,15 @@ class ReceiverOpensAgentInitiatedTurnTests(unittest.IsolatedAsyncioTestCase):
},
)
emitted = asyncio.Event()
+ dispatcher_emit = _dispatcher_owned_emit(service)
- async def _emit(*_args, **_kwargs):
- emitted.set()
- return "message-id"
+ async def _emit(*args, **kwargs):
+ if args[1:3] == ("result", ""):
+ emitted.set()
+ return await dispatcher_emit(*args, **kwargs)
- agent.emit_result_message = AsyncMock(side_effect=_emit)
+ agent.emit_result_message = AsyncMock()
+ agent.controller.emit_agent_message = AsyncMock(side_effect=_emit)
release = asyncio.Event()
receiver = asyncio.create_task(
agent._receive_messages(
@@ -1053,7 +1061,12 @@ class ReceiverOpensAgentInitiatedTurnTests(unittest.IsolatedAsyncioTestCase):
try:
await asyncio.wait_for(emitted.wait(), timeout=1)
self.assertFalse(receiver.done())
- output = agent.emit_result_message.await_args.kwargs["output"]
+ agent.emit_result_message.assert_not_awaited()
+ output = next(
+ call.kwargs["output"]
+ for call in agent.controller.emit_agent_message.await_args_list
+ if call.args[1:3] == ("result", "")
+ )
self.assertTrue(output.detached)
self.assertFalse(output.completes_turn)
self.assertTrue(output.completes_run)