feat: surface agent backchannel opportunity as a public event - #6985
Open
AinaLuc wants to merge 1 commit into
Open
feat: surface agent backchannel opportunity as a public event#6985AinaLuc wants to merge 1 commit into
AinaLuc wants to merge 1 commit into
Conversation
Promote the previously-internal _AgentBackchannelOpportunityEvent to a public AgentBackchannelOpportunityEvent, emitted on AgentSession and dispatched to a new Agent.on_backchannel_opportunity() hook so agents can react to mid-turn pauses with acknowledgment phrases. Also fixes a race in AudioRecognition.update_vad(): the old VAD task was cancelled after the new one was already created/assigned, so a rapid update could have the old task's cleanup clobber the new stream/channel. Introduces a generation counter so a stale VAD task's events and cleanup are ignored once superseded. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AinaLuc
force-pushed
the
feat/agent-backchannel-opportunity-event
branch
from
August 26, 2026 09:53
e970a88 to
5c591ec
Compare
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.
Summary
_AgentBackchannelOpportunityEventto a publicAgentBackchannelOpportunityEvent, emitted onAgentSession(agent_backchannel_opportunity) and dispatched to a newAgent.on_backchannel_opportunity()hook, so agents can react to mid-turn pauses with short acknowledgment phrases ("mm-hmm", "right", etc).end_of_turn_marginproperty to the event as a risk axis for picking an appropriate phrase.AudioRecognition.update_vad(): the previous VAD task was cancelled after the new one was already created, so a rapidupdate_vadcall could let a stale task's cleanup clobber the new stream/channel. Adds a generation counter so a superseded VAD task's events and cleanup are ignored.Test plan
make check(format, lint, type-check)uv run pytest --uniton_backchannel_opportunityfires andupdate_vadswap doesn't leave the session in a stuck speaking state🤖 Generated with Claude Code