← Back to Pull requests

Document that --max_speech_ms discards a longer segment #949

Closed
unknown closed this pull request without merging on Dec 01, 2026 12:06 UTC
View on GitHub
unknown unknown commented on Dec 01, 2026 11:41 UTC
Author

Summary

--max_speech_ms is documented as:

Maximum length of continuous speech before forcing a split. Default is infinite, allowing for uninterrupted speech segments.

The VAD doesn't split anything. In VADHandler (src/speech_to_speech/VAD/vad_handler.py), a segment longer than max_speech_ms sets duration_exceeds_limit. It can't be held for merging (that branch needs duration_ms <= self.max_speech_ms), so the whole segment is dropped:

VAD: discarding segment=…ms active=…ms (active_min=…ms, segment_max=…ms)

There's no splitting code anywhere, and the discard is clearly intended: tests/test_speculative_turns.py::test_vad_max_speech_is_enforced_before_smart_turn sets max_speech_ms = 1500, drives a longer segment, and asserts nothing is emitted.

So the help text promises the opposite of what happens. Someone who sets --max_speech_ms 30000 to split long monologues into turns loses every utterance longer than 30 s. It isn't transcribed or answered, and the only sign is an INFO log line.

Change

Help text only, in src/speech_to_speech/arguments_classes/vad_arguments.py:

-        "Maximum length of continuous speech before forcing a split. Default is infinite, allowing for uninterrupted speech segments.",
+        "Maximum length of one speech segment, in ms. A longer segment is discarded (logged at INFO), not split. Default is infinite (no limit).",

The field's help as argparse shows it, before and after (read from dataclasses.fields(VADHandlerArguments) on main 6644d4f and on this branch):

before: Maximum length of continuous speech before forcing a split. Default is infinite, allowing for uninterrupted speech segments.
after:  Maximum length of one speech segment, in ms. A longer segment is discarded (logged at INFO), not split. Default is infinite (no limit).

I didn't implement splitting. That's a behaviour change with design choices (where to cut, and whether to commit the first part as a turn), and the existing test pins the discard. docs/configuration.md only says max_speech_ms: null means unbounded, which stays true.

Tests

This is a documentation fix, so there's no new test. test_vad_max_speech_is_enforced_before_smart_turn, the test that pins the behaviour the new text describes, passes unchanged.

Local gate (darwin/arm64, Python 3.12.16, uv sync --group dev, the steps in ci.yml):

  • ruff check src/ tests/, ruff format --check src/ tests/ and mypy src/ are clean.

  • pytest tests/ -q: 4190 passed, 11 skipped, 0 failed, the same as main at 6644d4f.
  • 🤖 Generated with Claude Code

    Diff: 331 lines (+248 / -83) across 4 files Reviewer: andimarafioti Review duration: 24m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 331 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.347
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #949"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%