Skip to content

chore: remove dead code in inference.VAD - #2600

Open
detail-app[bot] wants to merge 1 commit into
mainfrom
detail/dead-code/chore-remove-dead-code-in-inference-vad-19d21b
Open

detail-app[bot] wants to merge 1 commit into
mainfrom
detail/dead-code/chore-remove-dead-code-in-inference-vad-19d21b

Conversation

@detail-app

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

Copy link
Copy Markdown
Contributor

Description

Removed unused getters, the updateOptions cascade, and the #streams
registry from the bundled inference VAD, plus the vad.test.ts file
which only exercised updateOptions propagation.

Changes Made

  • Dropped VAD.model and VAD.provider getters plus the backing
    protected _model field and its constructor assignment — these had no
    callers anywhere in the repo (production or otherwise).
  • Dropped VAD.updateOptions, InferenceVADStream.updateOptions, and
    the #streams WeakRef set used to fan option updates to live streams.
    These had no production callers; only vad.test.ts invoked them.
  • Removed vad.test.ts entirely, since it was solely dedicated to
    exercising the now-removed updateOptions propagation.
  • Simplified VAD.stream() to drop the now-unused #streams.add and the
    stale snapshot comment.

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

Context: model/provider getters were invoked nowhere in the repo.
updateOptions and its stream counterpart were test-only (tests don't
count as production consumers); AudioRecognition/AgentActivity replace
the whole VAD instance rather than mutate options. The silero plugin's
analogous updateOptions is similarly test-only, confirming the parallel
convention no longer has live callers.

Tooling: Detail: Dead Code

History


Dead Code PRs can be configured here.

@detail-app
detail-app Bot requested a review from a team as a code owner September 28, 2026 23:52
@detail-app
detail-app Bot requested a review from chenghao-mou September 28, 2026 23:52
@changeset-bot

changeset-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1b3de78

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 found 2 potential issues.

Devin Review

Comment on lines -89 to -100
/** Update one or more knobs at runtime, propagating to live streams. */
updateOptions(opts: Partial<VADOptions>): void {
this._opts = { ...this._opts, ...opts };
for (const ref of this.#streams) {
const stream = ref.deref();
if (stream === undefined) {
this.#streams.delete(ref);
continue;
}
stream.updateOptions(opts);
}
}

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.

🔴 Live VAD option updates crash

Existing JavaScript callers of VAD.updateOptions now get a TypeError because the exported method has been removed. Active streams can no longer receive runtime threshold or buffer changes.

Learn more

The inference VAD is exported through inference. Its former public updateOptions method updated both the VAD instance and the streams it had already created. Removing it breaks existing runtime callers and eliminates live updates to streams; keeping just a method that changes _opts would leave active streams on stale settings.

Example: An existing JavaScript service calls vad.updateOptions({ minSilenceDuration: 800 }) during a call. Before this change, its active stream begins using 800 ms; now that call throws a TypeError.

Recommended fix: Retain VAD.updateOptions and its live-stream propagation, including the stream buffer resizing when padding or maximum speech changes, or introduce a compatibility path before removing the public method.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified no callers: rg "vad\.updateOptions|VAD\.updateOptions" (excluding *.test.ts) returns nothing across the repo. The silero plugin's analogous updateOptions (plugins/silero/src/vad.ts:67) is only invoked by its own internal stream propagation at line 70, with no external non-test callers — matching this PR's premise. Restoring the method would reverse the PR's stated dead-code-removal intent, so I'm not making that change. Whether removing an exported member warrants a version bump for external consumers is a maintainer versioning-policy call, not something the repo's code can settle.

Comment on lines -77 to -83
get model(): string {
return this._model;
}

get provider(): string {
return 'livekit-local-inference';
}

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.

🟡 VAD model and provider metadata disappear

Existing JavaScript callers reading VAD.model or VAD.provider now receive undefined. Integrations using these public getters lose the configured model and provider labels.

Learn more

The inference VAD is exported through inference, and both public getters previously returned stable model identity. Removing them changes observable runtime behavior even though no internal callers read them. This is separate from the base VAD's label, which identifies the implementation rather than supplying the old provider and model fields.

Example: A deployed JavaScript agent records vad.model and vad.provider as silero and livekit-local-inference. After upgrading, both values are undefined and its model attribution disappears.

Recommended fix: Preserve the getters if this is not an explicitly managed breaking API change, or provide a compatible metadata accessor and migration plan for downstream consumers.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified no readers: rg "vad\.(model|provider)\b|VAD\.(model|provider)" returns nothing across the repo. These getters lived only on the concrete inference.VAD (agents/src/inference/vad.ts), not on the abstract VAD contract in agents/src/vad.ts (which only requires label and stream()), so nothing typed against the base VAD read them. Restoring them would reverse the PR's stated dead-code-removal intent, so I'm not making that change. Whether removing exported members warrants a version bump for external consumers is a maintainer versioning-policy call.

@detail-app

detail-app Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

Re: #2600 (review) — addressed both flagged issues on their threads (the updateOptions thread and the model/provider thread): verified no non-test callers/readers exist in the repo and that these members are not part of the abstract VAD contract (agents/src/vad.ts only requires label and stream()). Restoring them would reverse the PR's dead-code-removal intent, so I'm not making that change; any version-bump decision for external consumers is a maintainer versioning-policy call, not something the repo's code can settle.

1 similar comment
@detail-app

detail-app Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

Re: #2600 (review) — addressed both flagged issues on their threads (the updateOptions thread and the model/provider thread): verified no non-test callers/readers exist in the repo and that these members are not part of the abstract VAD contract (agents/src/vad.ts only requires label and stream()). Restoring them would reverse the PR's dead-code-removal intent, so I'm not making that change; any version-bump decision for external consumers is a maintainer versioning-policy call, not something the repo's code can settle.

@detail-app
detail-app Bot force-pushed the detail/dead-code/chore-remove-dead-code-in-inference-vad-19d21b branch from 8875631 to 1b3de78 Compare October 12, 2026 08:03
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.

1 participant