fix: scope interruption verdicts to agent speech - #2417
Open
chenghao-mou wants to merge 1 commit into
Open
Conversation
Late adaptive-interruption responses could outlive one agent speech and resolve an overlap in the next. Ignore responses after their request cache entry is invalidated at the speech boundary. Co-authored-by: Manas Srivastava <mastermanas805@gmail.com>
🦋 Changeset detectedLatest commit: 4e405c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 38 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Comment on lines
+283
to
+292
| const entry = state.cache.updateValue(createdAt, { | ||
| totalDurationInS, | ||
| probabilities: message.probabilities, | ||
| isInterruption: true, | ||
| predictionDurationInS: message.prediction_duration, | ||
| detectionDelayInS: (Date.now() - overlapSpeechStartedAt) / 1000, | ||
| }); | ||
| if (!entry) { | ||
| logger.trace({ createdAt }, 'ignoring interruption verdict outside the current speech'); | ||
| break; |
Contributor
There was a problem hiding this comment.
🟡 Long overlaps discard valid verdicts
After ten newer requests, updateValue rejects an evicted request even when it belongs to the current speech. Delayed valid verdicts then disappear.
Prompt for agents
The missing-cache-entry check conflates speech-boundary invalidation with normal FIFO eviction. InterruptionStreamBase creates a BoundedCache with capacity 10, while detectionIntervalInS and inferenceTimeout are configurable. A current overlap can therefore evict a still-valid request before its bargein_detected or inference_done response arrives. Track the agent-speech generation independently from bounded request retention, retain pending requests for at least the configured timeout, or size and expire the cache from the request cadence and timeout. Apply the same validity rule to both response types in agents/src/inference/interruption/ws_transport.ts and add a test with more than ten requests in one speech followed by a delayed response for an early request.
Was this helpful? React with 👍 or 👎 to provide feedback.
Member
Author
There was a problem hiding this comment.
Model inference is sticky within a window.
theomonnom
approved these changes
Sep 4, 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.
Late adaptive-interruption responses could outlive one agent speech and resolve an overlap in the next. A missing request-cache entry now invalidates both verdict and inference-result responses instead of recreating state.
Ports livekit/agents#6957. Supersedes #2306, whose author is credited as a co-author.
Fixes #2119
Addresses AGT-3235
Initial prompt and agent context
Model: GPT-5.6