Conversation
|
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…into lukas/flatten-options
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
| const resolvedTurnHandling = migrateTurnHandling({ | ||
| turnDetection, | ||
| options: { turnHandling, allowInterruptions }, | ||
| allowInterruptions, | ||
| turnHandling, | ||
| }); |
There was a problem hiding this comment.
🟡 Deprecated endpointing delay fields are never forwarded into Agent turnHandling migration
migrateTurnHandling supports minEndpointingDelay and maxEndpointingDelay (agents/src/voice/turn_config/utils.ts:124-165), but the Agent constructor call only forwards turnDetection, allowInterruptions, and turnHandling at agents/src/voice/agent.ts:188-192. Because those deprecated delay fields are not forwarded (and are also missing from constructor destructuring at agents/src/voice/agent.ts:151-165), callers that still use deprecated endpointing delay fields are silently ignored and fall back to session defaults.
Prompt for agents
In agents/src/voice/agent.ts, update the Agent constructor migration path so deprecated endpointing fields are actually applied. Specifically: (1) extend AgentOptions<UserData> to include deprecated minEndpointingDelay and maxEndpointingDelay fields; (2) include those two fields in constructor parameter destructuring around lines 151-165; and (3) pass both fields into migrateTurnHandling(...) around lines 188-192. Verify that constructing new Agent({ minEndpointingDelay: X }) and new Agent({ maxEndpointingDelay: Y }) updates this._turnHandling.endpointing accordingly.
Was this helpful? React with 👍 or 👎 to provide feedback.
| get turnHandling(): Partial<TurnHandlingOptions> | undefined { | ||
| return this._turnHandling; | ||
| } | ||
|
|
||
| get allowInterruptions(): boolean | undefined { | ||
| return this._allowInterruptions; | ||
| get minConsecutiveSpeechDelay(): number | undefined { | ||
| return this._minConsecutiveSpeechDelay; |
There was a problem hiding this comment.
🟡 Deprecated Agent compatibility accessors were dropped, breaking runtime API compatibility
The getter block in agents/src/voice/agent.ts:262-267 now exposes turnHandling/minConsecutiveSpeechDelay only, while deprecated compatibility accessors previously used by consumers (allowInterruptions, interruptionDetection, minEndpointingDelay, maxEndpointingDelay) were removed. This changes the runtime surface of a shared public class and causes existing code reading these properties to get undefined instead of migrated values (the new migration tests also rely on these accessors, e.g. agents/src/voice/agent.test.ts:224-299).
Prompt for agents
In agents/src/voice/agent.ts, reintroduce deprecated compatibility getters near the existing turnHandling getter (around lines 262-268): allowInterruptions, interruptionDetection, minEndpointingDelay, and maxEndpointingDelay. Each getter should derive values from this._turnHandling (with sensible fallback behavior for deprecated mode=false semantics), so old consumer code and migration tests continue to work while still preferring the new turnHandling object.
Was this helpful? React with 👍 or 👎 to provide feedback.
| get allowInterruptions(): boolean { | ||
| // TODO(AJS-51): Allow options to be defined in Agent class | ||
| return this.agentSession.options.turnHandling.interruption?.mode !== false; | ||
| return ( | ||
| this.agent.turnHandling?.interruption?.enabled ?? | ||
| this.agentSession.sessionOptions.turnHandling.interruption.enabled | ||
| ); |
There was a problem hiding this comment.
🟡 allowInterruptions no longer honors interruption.mode === false
AgentActivity.allowInterruptions now returns only interruption.enabled (agents/src/voice/agent_activity.ts:471-475). This ignores explicit mode: false configurations, even though mode: false is still part of the interruption contract (agents/src/voice/turn_config/interruption.ts:18) and is still checked elsewhere (e.g. resolveInterruptionDetector, agents/src/voice/agent_activity.ts:2914-2923). With merged defaults (agents/src/voice/turn_config/utils.ts:112-117), this can incorrectly re-enable interruptions when a caller sets mode: false but leaves enabled unset.
| get allowInterruptions(): boolean { | |
| // TODO(AJS-51): Allow options to be defined in Agent class | |
| return this.agentSession.options.turnHandling.interruption?.mode !== false; | |
| return ( | |
| this.agent.turnHandling?.interruption?.enabled ?? | |
| this.agentSession.sessionOptions.turnHandling.interruption.enabled | |
| ); | |
| get allowInterruptions(): boolean { | |
| const agentInterruption = this.agent.turnHandling?.interruption; | |
| if (agentInterruption?.enabled !== undefined) { | |
| return agentInterruption.enabled; | |
| } | |
| if (agentInterruption?.mode === false) { | |
| return false; | |
| } | |
| const sessionInterruption = this.agentSession.sessionOptions.turnHandling.interruption; | |
| return sessionInterruption.enabled && sessionInterruption.mode !== false; | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
Description
Changes Made
Pre-Review Checklist
Testing
restaurant_agent.tsandrealtime_agent.tswork properly (for major changes)Additional Notes
Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.