Skip to content

fix(voice): capture the full on_enter output when starting with capture_run - #6872

Open
biztex wants to merge 1 commit into
livekit:mainfrom
biztex:fix/4662-capture-run
Open

fix(voice): capture the full on_enter output when starting with capture_run#6872
biztex wants to merge 1 commit into
livekit:mainfrom
biztex:fix/4662-capture-run

Conversation

@biztex

@biztex biztex commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Problem: start(capture_run=True) completed its RunResult as soon as the first speech handle finished, because nothing watched the on_enter task on the run state. An on_enter that awaits a say() and then calls generate_reply() had the reply silently dropped from the run's events — and an on_enter that produces no speech left the run with no watched handle at all, hanging start() forever.

The handoff path already solved this: _update_activity_task watches on_enter on the active run so the run stays open for everything on_enter triggers, without blocking on it. start() bypassed that by calling _update_activity directly.

Start the activity through _update_activity_task instead, so session start and handoff share the one implementation. A hermetic regression test covers both shapes: a two-speech on_enter whose second reply must land in the run's events, and a silent on_enter that must still complete the run.

Of the other observations in the issue: the duplicated handoff events no longer reproduce on current main (the run-state watch and created_at-ordered insertion resolved them), and chat-context-change events are a separate enhancement.

Fixes #4662

…re_run

start(capture_run=True) never watched the on_enter task on the run state,
unlike the handoff path (_update_activity_task). The run completed as soon
as the first speech handle did, so a generate_reply issued after an awaited
say never reached the RunResult, and an on_enter that produced no speech
left the run without any watched handle, hanging start() forever.

Start the activity through _update_activity_task so on_enter is watched
the same way a handoff already does.

Fixes livekit#4662
@biztex
biztex requested a review from a team as a code owner August 16, 2026 03:28

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate_reply not captured by capture_run=True, and duplicate events on_enter

1 participant