fix(talkio): Harden provider interruption handling#1
Merged
Conversation
Ignore stale LLM and TTS callbacks after timeout, abort, or replacement so old provider responses cannot leak into the active turn. Track active TTS request IDs and surface VAD provider errors through the public error event path. Co-Authored-By: OpenAI Codex <noreply@openai.com>
958c43c to
ff139f6
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.
Harden provider interruption handling in the core agent.
The agent could still react to callbacks from LLM and TTS providers after a timeout, abort, or replacement. That made duplicate error emissions and stale TTS audio possible, especially when filler speech was interrupted and the real response started. This change tracks settled actor state and correlates TTS events with the active request so only current provider work can affect the turn.
VAD failures now use the same provider error path as STT, LLM, and TTS. Providers can report
ctx.error(error), and the machine emitsagent:errorwithsource: "vad"while preserving the running session.I considered only clearing actor refs on interruption, but that does not protect against late callbacks from provider code that keeps running after abort. Request IDs and settled-state guards make the stale callback behavior explicit and testable.
The branch was verified locally with typecheck, tests, lint, format check, and
git diff --checkafter the VAD error callback was wired through the public provider context.