Skip to content

fix(mobile): keep voice settings in the order you change them - #31691

Merged
AmoabaKelvin merged 9 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-voice-mutations
Oct 28, 2026
Merged

AmoabaKelvin merged 9 commits into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-voice-mutations

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​152 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​81 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​52

ELI5

Change a voice setting twice quickly while the desktop is slow to answer, and the first change's answer can arrive last and put the old setting back on screen. Switching desktops could also let a late answer from the previous desktop land on the new one's screen. Now the screen only takes the newest answer and keeps each desktop's settings separate.

What Changed

  • The Voice screen applies only the newest change's reply. If a reply was skipped or a change failed, the screen re-reads once every pending change has settled. It skips reads while a change is pending, because the desktop clears a deleted model's selection only after removing its files, so a read sent mid-delete can come back with the deleted model.
  • Errors from a failed change stay on screen until your next change; a successful read clears only a failed load. A failed switch change re-reads to undo its optimistic flip, and its error shows only if no newer change replaced it.
  • The screen remounts when the connected desktop changes (keyed on the last connected desktop, so a reconnect of the same desktop doesn't reset it).

Neil's first version queued saves on the phone, one screen instance at a time. That isn't needed: the desktop applies speech.dictation.setup as soon as it arrives (runtime-mobile-speech-catalog.ts configure updates settings before its first await), so saves already land in the order they were sent. The phone only has to ignore stale replies. Dropping the queue also removes a bug in it: a closed screen's queue could still send after a reopened screen's newer choice.

Why

Your latest choice should stay selected, and the screen should show what the desktop actually has.

Linked Issue

Maintainer-discovered regression; no issue. Related #31349 fences dictation reads; this fences Voice settings writes and desktop switches.

Visual Proof

No image: this is a timing race, and a screenshot of a switch can't show order. Evidence from the iOS simulator (dev client, Metro from this branch) paired to a headless desktop built from this branch, with one temporary, uncommitted host edit that holds the enabled: false reply for 4 s. Tap the switch on, off, on, 0.6 s apart, then sample the switch every ~0.5 s:

host received replies reached the phone switch after the late reply
main (93ff4832e46) on, off, on on, on, off off (desktop is on)
this PR on, off, on on, on, off on

Testing

  • mobile/src/settings/ vitest: 33 passed. New tests: an older switch save that replies last (fails on main); a model delete that succeeds after a newer change (re-reads, selection cleared); a save then a delete, where the re-read must wait for the delete; a delete that fails after a newer change keeps its error through the re-read.
  • Changed-file oxlint, oxfmt and React Doctor gate: clean.
  • iOS simulator check above, main vs this branch.

AI Disclosure

Review

Reviewed in four rounds by Codex and Claude, plus Greptile and CodeRabbit. Fixed along the way: model-action errors hidden by a newer change; the screen remounting on every reconnect of the same desktop; an older failed save skipping its re-read; a re-read sent during a pending model delete bringing the deleted model back (Greptile/CodeRabbit); a background re-read clearing a failed change's error (Codex, Claude, Greptile). Left as-is (P3): starting a download while a model select is pending leaves the drawer open.

Merge risk: low. Mobile only, no protocol or host change, so mixed phone/desktop versions are unaffected.

Agent skill upstream boundary

  • Not applicable; this change copies no upstream skill-installer implementation.

Notes

Folder workspaces and remote hosts use the same Voice screen and RPCs; nothing here depends on the workspace kind. Desktop has its own Voice settings UI, which this doesn't touch.

Checklist

  • Focused change with a root-cause explanation.
  • Automated regression coverage and independent review.
  • Before/after evidence with its scope stated.
  • Cross-platform and remote compatibility considered.
  • Required PR CI checks have passed.

@nwparker nwparker changed the title fix(mobile): serialize voice settings writes by host fix(mobile): keep voice settings in the order you change them Oct 22, 2026
@AmoabaKelvin
AmoabaKelvin force-pushed the nwparker/mobile-monkey-voice-mutations branch from 2cf9041 to 17e2d8c Compare October 28, 2026 22:04
nwparker and others added 6 commits October 28, 2026 22:33
An older save that replies last could put the previous setting back on screen. Ignore mutation replies and errors that a newer change has superseded.
Key the screen by host so a late reply from a desktop the phone switched away from cannot land on the newly connected desktop's settings.
The host finishes a model delete only after removing its files, so a newer change can reply first with the model still selected. Dropping the older reply left the deleted model shown as in use; re-read instead.
A newer setting change does not replace a failed model select, download or delete, so show those errors again. Key the screen on the last connected desktop so a reconnect of the same desktop no longer remounts it.
@AmoabaKelvin
AmoabaKelvin force-pushed the nwparker/mobile-monkey-voice-mutations branch from 17e2d8c to 2f7512c Compare October 28, 2026 22:33
@AmoabaKelvin
AmoabaKelvin marked this pull request as ready for review October 28, 2026 22:34
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no new actionable issues remain.

Summary

The Voice screen keeps the newest settings reply, waits for pending changes before re-reading, and resets its state when the connected desktop changes.

  • Voice settings keep the newest change reply on screen.
  • Voice settings reset when you connect to a different desktop.

Reviews (3) · Last reviewed commit: "fix(mobile): let Voice reads clear only ..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The voice settings route tracks the connected desktop host ID and keys the settings screen by that ID. The screen uses request epochs to prevent stale successful responses from overwriting newer state. Stale successes trigger a setup refresh. Tests cover overlapping Voice saves and model deletion during a dictation mode change.

Priority: Normal

Merge Risk: Moderate · up to 2f751

Rapidly toggling Voice settings can still leave the switch showing an older value until the next refresh trigger. The race needs overlapping saves plus a read that resolves in a particular order, and the fix is small. Resolve it before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description covers all template sections and clearly explains the user impact, implementation, rationale, testing, visual evidence, review history, and compatibility considerations. However, the L… Add a direct issue link in the Fixes # section, or explicitly confirm that the author is a member of the stablyai organization and that the maintainer exception applies. Complete the AI Disclosure section if the author is not an interna…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the mobile Voice settings ordering fix and matches the main change.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Description check

Explanation

The description covers all template sections and clearly explains the user impact, implementation, rationale, testing, visual evidence, review history, and compatibility considerations. However, the Linked Issue section states that no issue exists and only references a related issue, which does not meet the template requirement unless the author is confirmed to be a repository maintainer. The AI Disclosure section is also empty, although this is acceptable for an internal maintainer.

Resolution

Add a direct issue link in the Fixes # section, or explicitly confirm that the author is a member of the stablyai organization and that the maintainer exception applies. Complete the AI Disclosure section if the author is not an internal maintainer.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b1b0f30-3927-4ac6-aa26-f88ebb5d7bf7
Commits

Reviewing files that changed from the base of the PR and between a55bfbb and 2f7512c.

Files selected for processing: 3
  • mobile/app/voice-settings.tsx
  • mobile/src/settings/settings-screen-state.test.tsx
  • mobile/src/settings/voice-settings-screen.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

…ettles

A read sent while a model delete is still running can return the deleted model after the delete's own reply. Skip reads while a change is pending, and re-read once when all settle if any reply was skipped.
A lone failed select or delete changed nothing on the phone, so it no longer starts a re-read that clears its error. A failed switch still re-reads to undo its optimistic flip.
A re-read after a failed or superseded change cleared the change's error before the user could read it. Keep load and change errors apart; re-read after any failure again, which also undoes a failed switch flip.
@AmoabaKelvin
AmoabaKelvin merged commit 737ba15 into stablyai:main Oct 28, 2026
26 checks passed
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.

2 participants