Skip to content

Settings › Voice: switches update as soon as they're tapped - #27

Merged
Tarquinen merged 1 commit into
mainfrom
fix/voice-toggle
Nov 10, 2026
Merged

Tarquinen merged 1 commit into
mainfrom
fix/voice-toggle

Conversation

@Tarquinen

Copy link
Copy Markdown
Member

Bug

Users whose server runs voice calls through its OpenCode Console workspace (footer: "Calls are billed to your server's OpenCode Console workspace.") tap Enable Voice or Raise to Talk in Settings › Voice and the switch looks stuck. The setting does change; the switch only catches up after leaving the page and coming back. Reported on v0.3.10; still on main after #5, which makes this the default path for everyone. Users with their own phone key weren't affected.

Cause

VoiceSettingsFeature.State reads these settings through getters, so a tap leaves the state object unchanged. The page's list rows capture only state and the key source (a singleton for OpenCode), so Compose skipped them and the switch never redrew.

Fix

rememberVoiceState() gives the Voice pages a fresh copy of the state whenever the state or a shared setting changes, so rows reading settings through it redraw. Used by Settings › Voice, the call voice picker, Voice Provider (detail and account) and the Delegator page, which all had the same pattern. iOS reads these through observable state and never had the bug.

Verified

  • scripts/check.sh :feature:settings passes.
  • Emulator, session-lab patched to list its voice models under provider opencode, default settings (no Experimental switch): reproduced on v0.3.10 and on main d174905b. With this branch, Enable Voice on/off, three quick taps, and Raise to Talk on/off all update at once.

With a server that brokers calls through OpenCode Console (Server Voice), tapping Enable Voice or
Raise to Talk set the shared value but the switch didn't move until the page was opened again.
VoiceSettingsFeature.State reads its shared values through getters, so tapping a switch leaves the
store's state equal and the same instance. The page recomposed on the shared-value revision, but
its LazyColumn rows capture only `state` and `keySource`; with the OpenCode key source (a data
object) nothing they captured changed, so Compose skipped them and the switch stayed put. With a
phone key the row happened to refresh because keySource was a new Phone(...) each time.

rememberVoiceState() now hands the Voice pages a fresh copy of the state whenever the state or a
shared value changes, so rows reading shared values through it recompose. Used by Settings › Voice,
Call Voice picker, Voice Provider (detail and account) and the Delegator page, which shared the
pattern. iOS reads @shared values through observable state, so it never had this bug.

Verified: scripts/check.sh :feature:settings (vm.sh check) passes. On the emulator against
session-lab patched to list its voice models as provider "opencode" (Server Voice on): reproduced on
v0.3.10 and on main b1c62c0 (Enable Voice and Raise to Talk stay put until re-entering); with this
change Enable Voice on/off, three quick taps and Raise to Talk on/off all update at once.
@Tarquinen
Tarquinen merged commit bf6f80d into main Nov 10, 2026
3 checks passed

This branch was previously deployed

1 inactive deployment
release — 4dbfefda Deployed Nov 10, 2026 by Tarquinen via check #89
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