console: render agent-initiated messages in text mode - #6578
Open
ben-xiao-io wants to merge 4 commits into
Open
Conversation
Text mode printed agent output only from session.run() events, so any assistant turn produced outside a typed exchange never reached the screen: the on_enter greeting (generate_reply during session start), a background tool result delivered between turns, a handoff greeting. The streaming path can't cover them either — text mode detaches sess.output.transcription. Render assistant ChatMessages from conversation_item_added when text mode is active and no typed exchange is in flight, with a catch-up scan at IO acquisition for messages committed before the subscription existed. A printed-item id set deduplicates against run() rendering; audio mode is untouched (it hears these turns via the transcript synchronizer).
console_mode is set before the session exists, so the item_added handler is armed from the first commit — the acquire-time history scan defended a race that cannot happen. The module-level renderer had one caller.
abhay-strala
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6577.
What
Text mode rendered agent output only from
session.run()events, so any assistant turn produced outside a typed exchange never reached the screen: theon_entergreeting (generate_reply()during session start), a background tool result delivered between turns, a handoff greeting. The streaming path can't cover them either — text mode detachessess.output.transcription.This PR renders assistant
ChatMessages fromconversation_item_addedwhen text mode is active and no typed exchange is in flight. A printed-item id set deduplicates againstrun()rendering. Audio mode is untouched.Verification
A/B on a minimal FakeLLM agent that greets in
on_enter, driven through a pty runningconsole --textwithLIVEKIT_LOG_LEVEL=warn:● Agentblock (withllm_ttftmetrics) before any input; typed exchanges render exactly as before, with no duplicates:ruff check/ruff format --checkpass;tests/test_cli_log_level.pypasses.Notes
_text_run_active) is reset in afinally, so a failed run can't permanently mute agent-initiated output.cli/cli.py) has the same structural gap on the Python side; its rendering lives in the Go CLI, so this PR fixes the Python TUI only.