Skip to content

bug: voice-call STT vadThreshold: 0 and silenceDurationMs: 0 silently ignored #39190

@scoootscooob

Description

@scoootscooob

Bug

In extensions/voice-call/src/providers/stt-openai-realtime.ts:65-66, the constructor uses || (logical OR) instead of ?? (nullish coalescing) for default values:

this.silenceDurationMs = config.silenceDurationMs || 800;
this.vadThreshold = config.vadThreshold || 0.5;

This drops valid 0 values:

  • vadThreshold: 0 means maximum VAD sensitivity (detect everything as speech) — valid per the schema z.number().min(0).max(1) and the OpenAI Realtime API
  • silenceDurationMs: 0 means no silence padding before triggering end-of-speech

When a user configures vadThreshold: 0, they silently get 0.5 instead.

Expected behavior

Use ?? so that 0 is respected and only undefined/null triggers the default:

this.silenceDurationMs = config.silenceDurationMs ?? 800;
this.vadThreshold = config.vadThreshold ?? 0.5;

Impact

Medium — users who set vadThreshold: 0 for maximum sensitivity get medium sensitivity (0.5) without any error or warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions