Summary
acp_get_session_status always returns recentMessages: [] and totalMessages: 0 for every session, despite the tool description promising "the most recent text messages from the conversation."
Root Cause
The message extraction code in backend_tools.py:404-414 expects a text field on TEXT_MESSAGE_CONTENT events, but AG-UI uses streaming deltas where:
- The actual text field is
delta (not text)
- The
role is on the TEXT_MESSAGE_START event (not on content events)
# Broken (line 408):
if event_type == "TEXT_MESSAGE_CONTENT" and event.get("text"):
# ^^^^^ always None — field is "delta"
Additionally, completed/stopped sessions don't have streaming delta events at all — they use MESSAGES_SNAPSHOT events containing the full conversation array, which the code never checks.
Actual AG-UI Event Structure
// Active sessions use streaming deltas:
{"type": "TEXT_MESSAGE_START", "role": "assistant", "messageId": "msg-1"}
{"type": "TEXT_MESSAGE_CONTENT", "delta": "Hello, ", "messageId": "msg-1"}
{"type": "TEXT_MESSAGE_CONTENT", "delta": "world!", "messageId": "msg-1"}
{"type": "TEXT_MESSAGE_END", "messageId": "msg-1"}
// Completed sessions use snapshots:
{"type": "MESSAGES_SNAPSHOT", "messages": [{"role": "user", "content": "..."}, ...]}
Verification
Confirmed from a live session (2026-04-30):
- Export endpoint returns 3,796 AG-UI events for an active session with 77
TEXT_MESSAGE_CONTENT events — all have delta, none have text
- Stopped sessions have 0
TEXT_MESSAGE_CONTENT events but MESSAGES_SNAPSHOT events contain the full conversation (135 messages in one test case)
- After applying the fix, active sessions correctly yield reassembled messages from streaming deltas, and stopped sessions correctly yield messages from the last snapshot
Impact
acp_get_session_status messages are completely broken for all sessions (active and completed)
- Blocks cross-session introspection use cases (retrospectives, monitoring, debugging)
- The
max_messages parameter has never worked since launch
Affected File
components/runners/ambient-runner/ambient_runner/bridges/claude/backend_tools.py — lines 404-414
Summary
acp_get_session_statusalways returnsrecentMessages: []andtotalMessages: 0for every session, despite the tool description promising "the most recent text messages from the conversation."Root Cause
The message extraction code in
backend_tools.py:404-414expects atextfield onTEXT_MESSAGE_CONTENTevents, but AG-UI uses streaming deltas where:delta(nottext)roleis on theTEXT_MESSAGE_STARTevent (not on content events)Additionally, completed/stopped sessions don't have streaming delta events at all — they use
MESSAGES_SNAPSHOTevents containing the full conversation array, which the code never checks.Actual AG-UI Event Structure
Verification
Confirmed from a live session (2026-04-30):
TEXT_MESSAGE_CONTENTevents — all havedelta, none havetextTEXT_MESSAGE_CONTENTevents butMESSAGES_SNAPSHOTevents contain the full conversation (135 messages in one test case)Impact
acp_get_session_statusmessages are completely broken for all sessions (active and completed)max_messagesparameter has never worked since launchAffected File
components/runners/ambient-runner/ambient_runner/bridges/claude/backend_tools.py— lines 404-414