Skip to content

[Feat] Let deployment admins turn Voice off when the key comes from the environment - #2722

Merged
mrubens merged 1 commit into
developfrom
feat/voice-env-key-disable
Sep 15, 2026
Merged

mrubens merged 1 commit into
developfrom
feat/voice-env-key-disable

Conversation

@mrubens

@mrubens mrubens commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

When the Voice key comes from R_VOICE_OPENAI_API_KEY (a self-hosted operator's key, or the fleet-wide key Cloud now installs on managed deployments), Voice was forced on: the key resolver returned the environment key before consulting the deployment's enablement, and the Settings card hid every control behind a "configured by the environment variable" line. A deployment admin had no way to turn it off.

This separates the two concerns. The environment key decides which OpenAI account pays for Voice; the deployment's admins decide whether Voice is on, using the same per-deployment enablement every other integration has.

Changes

  • lib/server/voice.ts: resolveVoiceOpenAiKey honors the deployment's Voice enablement for the environment key too. The enablement is read on every call (one indexed read) so a toggle applies immediately; only the environment key value itself stays cached.
  • trpc/commands/mcp-connections: getVoiceConnectionCommand reports enabled so the card can offer the switch (no enablement row means on). setDeploymentMcpEnabledCommand accepts enabling Voice without a stored connection when the environment provides the key, and does not delete a stored key when disabling in that case, so the deployment falls back to its own key if the environment key is ever removed.
  • Settings › Integrations: the environment-keyed Voice card shows Enable Voice / Disable Voice for admins and nothing for members. The "Configured by the R_VOICE_OPENAI_API_KEY environment variable." line is gone. The Settings-keyed path is unchanged.
  • The shared integration-status invalidation now includes the Voice connection query so the card flips right after the toggle.
  • Docs updated; changeset added.

Tests

  • Key resolver: environment key with enablement off returns nothing; on or missing returns the key; the stored connection is never read.
  • Enable mutation: without an environment key Voice still requires a stored connection (existing behavior); with one, enabling succeeds with no connection row, disabling keeps a stored key and records enabled: false, and the connection query reports enabled: false.
  • Settings card: admins see Disable Voice (no environment-variable text), clicking it calls the mutation and toasts; a disabled deployment shows Voice under Available with Enable Voice; members get no switch.
  • Invalidation helper covers the added query.

pnpm lint:fast and web tsc --noEmit pass.

…he environment

An R_VOICE_OPENAI_API_KEY environment variable (an operator's or a
fleet-wide key) previously forced Voice on: the key resolver returned it
before checking the deployment's enablement, and the Settings card hid
every control. The environment key now decides which account pays for
Voice while the deployment's admins decide whether it is on. The resolver
and the connection-status query honor the existing per-deployment
enablement for the environment key too, the enable mutation accepts Voice
without a stored connection when the environment provides the key and
keeps a stored key when disabling, and the card offers Enable/Disable
Voice instead of naming the environment variable.
@roomote-community

roomote-community Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

No code issues found. See task

Reviewed c80cd50

@mrubens
mrubens merged commit 0a81720 into develop Sep 15, 2026
20 checks passed
@mrubens
mrubens deleted the feat/voice-env-key-disable branch September 15, 2026 11:54
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