Skip to content

chore: remove dormant reconnectEvent infrastructure in inference STT - #2439

Open
detail-app[bot] wants to merge 1 commit into
mainfrom
detail/dead-code/chore-remove-dormant-reconnectevent-infrastructure-b1d026
Open

chore: remove dormant reconnectEvent infrastructure in inference STT#2439
detail-app[bot] wants to merge 1 commit into
mainfrom
detail/dead-code/chore-remove-dormant-reconnectevent-infrastructure-b1d026

Conversation

@detail-app

@detail-app detail-app Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

Removed the dormant reconnectEvent-based reconnect loop infrastructure from SpeechStream.run() in agents/src/inference/stt.ts. This simplifies the connection loop to a single iteration: await ThrowsPromise.all(taskResults); break;.

Changes Made

  • Removed private reconnectEvent = new Event(); field
  • Removed waitReconnectTask Task definition and the ThrowsPromise.race([..., waitReconnectTask.result]) race (replaced with await ThrowsPromise.all(taskResults))
  • Removed the if (!waitReconnectTask.done) break; conditional and this.reconnectEvent.clear(); (simplified to a straight break;)
  • Removed waitReconnectTask from the cleanup tasks array
  • Removed Event and waitForAbort from the ../utils.js import (no longer referenced)

Context

The reconnectEvent was the trigger for a mid-stream reconnect cycle: updateOptions previously called this.reconnectEvent.set() to make waitReconnectTask win the race and restart the outer run() loop for a fresh WebSocket. Commit 6dc619f replaced that trigger with a mid-stream session.update WebSocket message and deleted the .set() call, but left the reconnect infrastructure in place. Since reconnectEvent.set() was never called anywhere in stt.ts (no other caller in the repo), waitReconnectTask could only resolve via the waitForAbort branch — which fires in the finally block after the inner tasks had already finished. The all(taskResults) branch always won the race and the outer while (true) loop always broke on the first iteration, making the reconnect path dead and the loop effectively single-iteration.

Runtime behavior is unchanged. Verification: pnpm build, tsc typecheck, eslint on stt.ts, and all 73 tests in src/inference/stt.test.ts pass (1 pre-existing skip). api-extractor confirms the public API surface is unchanged.

History

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included
  • Video demo: A small video demo showing changes works as expected and did not break any existing functionality using Agent Playground (if applicable)

Testing

  • Automated tests added/updated (if applicable)
  • All tests pass
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes)

Additional Notes

This is a dead-code removal only; no refactor of live consumers was performed. The reconnect-via-session.update path in updateOptions (the live replacement for reconnectEvent.set()) is untouched.

Detail: Dead Code


Dead Code PRs can be configured here.

@detail-app
detail-app Bot requested a review from a team as a code owner September 8, 2026 06:00
@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: eabb6bf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@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 bugs or issues to report.

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.

0 participants