Skip to content

Handle STT error tolerance in AgentSession#6001

Open
jmolz wants to merge 1 commit into
livekit:mainfrom
jmolz:codex/stt-error-tolerance
Open

Handle STT error tolerance in AgentSession#6001
jmolz wants to merge 1 commit into
livekit:mainfrom
jmolz:codex/stt-error-tolerance

Conversation

@jmolz

@jmolz jmolz commented Jun 7, 2026

Copy link
Copy Markdown

Summary

  • add an STT unrecoverable-error counter to AgentSession
  • apply max_unrecoverable_errors to stt_error the same way it already applies to LLM and TTS errors
  • reset the STT counter alongside the existing LLM/TTS counters when the session closes or the agent starts speaking
  • add a focused regression test for the STT tolerance behavior

Fixes #5665.

Tests

  • uv run pytest tests/test_agent_session.py::test_stt_errors_use_session_tolerance_before_closing
  • uv run pytest tests/test_agent_session.py::test_interruption_detection_error_is_not_session_error tests/test_agent_session.py::test_stt_errors_use_session_tolerance_before_closing tests/test_agent_session.py::test_vad_fallback_uses_next_vad_inference_event
  • uv run ruff format --check livekit-agents/livekit/agents/voice/agent_session.py tests/test_agent_session.py
  • uv run ruff check livekit-agents/livekit/agents/voice/agent_session.py tests/test_agent_session.py

@CLAassistant

CLAassistant commented Jun 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: STT errors close AgentSession immediately, lacking the tolerance counter that LLM and TTS errors have

2 participants