fix(mobile): picking a model shows its remembered options before saving #15719
main fromrefs/pull/15719/head·merged by juliusmarminge View on GitHubSelecting a different model in the mobile picker showed catalog defaults even though Save applied remembered options. New-task and existing-thread pickers now restore those options when staging a model. Repeated taps retain pending edits; scheduled-task picks keep catalog defaults. Native Save now reads the latest staged selection even when the toolbar retains an older callback.
Fixes #15518. Credit: @nekohasekai’s original fix in #15719; contributor history is preserved. Merged main 729924a. Verification head: e66455b.
Verification:
- 15 focused tests pass in the existing sheet-state and option-memory suites, 15 → 15 relative to the original PR. Real memory and descriptor assertions replace callback stubs. The preview regression fails without hydration. Repeat taps and scheduled defaults are covered.
- Mobile typecheck, targeted formatting and lint pass; five lint warnings match main. Three changed-file React Compiler coverage cases pass.
- Two independent whole-diff review rounds, each with Claude Opus 5.5 and GPT-6 Sol: no actionable code findings. Round two covers the latest Save fix. No new Save unit test was added: there is no existing real-picker integration harness; native behavior is verified below.
Real EAS iPhone 17, iOS 26.5, driven with agent-device on this head. Exact main picker sources and exact head were loaded through Metro against the same isolated showcase state. Both entry points show Medium/Standard before and remembered High/Fast after. Save/reopen retains Astra High/Fast in both. Staging Astra then Sol before Save applies Sol in both; reselecting applied Sol discards the staged Astra choice in the new-task flow. No agent turn was sent. The session was stopped after capture.
Existing thread — before (main):

Existing thread — after (PR):

New task — before (main):

New task — after (PR):

Save/reopen on iOS — existing thread:

Save/reopen on iOS — new task:

Real EAS Android emulator (720 × 1600), driven with agent-device on the same head and isolated showcase state. Exact main and head picker sources were loaded for matching captures. Both entry points preview remembered High/Fast on the PR versus Medium/Standard on main, and Save/reopen retains Astra High/Fast. Staging multiple models before Save applies the last choice; reselecting applied Sol clears the staged Astra choice in the new-task flow. Session stopped after capture.
New task on Android — before (main):

New task on Android — after (PR):

Existing thread on Android — before (main):

Existing thread on Android — after (PR):

Android Save/reopen: new task, existing thread. Latest-selection/reselect proof: existing thread, new task.
Known baseline limits: the iOS native checkmark still has the accessibility label Done while a choice is pending; its Save action now commits correctly. A separate development-header error during pairing reproduces on main; it was dismissed before the picker checks and is not fixed here. Provider-availability changes and scheduled-task defaults were checked with focused tests/source, not native fault injection. Web/desktop, contracts, providers and server behavior are unchanged.
The iOS development binary uses the documented temporary arm64-only simulator build setup; both native binaries load current source through Metro. Native configuration and dependencies did not change during this head update. All screenshots contain isolated synthetic data, and no evidence assets are committed.
Model: GPT-6.1 Sol implementation/integration, GPT-6 Astra tests, Claude Opus 5.5 and GPT-6 Sol review. Harnesses: Codex and Claude Code through T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c9527029-8178-47b2-a107-e6e648d017e5
📥 Commits
-
Reviewing files that changed from the base of the PR and between 8b971252ab54e8fab6220c1e0a4ecb4e22937cd8 and 89155c11b48681303f7f5d62c456de6d84adcb2d.
📒 Files selected for processing: 4
-
apps/mobile/src/features/threads/ThreadComposer.tsxapps/mobile/src/features/threads/ThreadSettingsSheet.tsxapps/mobile/src/features/threads/thread-settings-sheet-state.test.tsapps/mobile/src/features/threads/thread-settings-sheet-state.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
📝 Walkthrough
-
Mobile thread settings now apply remembered model options when a route provides a selection-restoration callback. The new-task and existing-thread routes provide
withRememberedModelOptions. Tests cover remembered values, in-progress edits, and catalog defaults when no callback is provided.Changes: Model selection restoration
Layer / File(s) Summary Transform staged model selections
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx,apps/mobile/src/features/threads/thread-settings-sheet-state.ts,apps/mobile/src/features/threads/thread-settings-sheet-state.test.tsThe settings session passes an optional callback to pendingModelAfterPress. When a pressed model has a different key from the current model, the function applies the callback to its selection. Tests check remembered options and catalog defaults when no callback is supplied.Provide remembered options from routes
apps/mobile/src/features/threads/ThreadComposer.tsx,apps/mobile/src/features/threads/ThreadSettingsSheet.tsxThe new-task and existing-thread routes provide withRememberedModelOptionsas the selection-restoration callback.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
89155-
The changed picker behavior appears ready to merge after normal checks. Scheduled-task picks retain their defaults.
Security architecture risk: ⚪ Minimal · up to
8b971-
The change restores saved preferences earlier so the picker previews them before saving. The reviewed paths preserve the selected provider and model, existing availability checks, and in-progress edits. No material security risk was found in the changed behavior.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The established impact is mobile picker presentation and selection using existing cross-thread preference memory. The inspected callback preserves provider/model identity and does not establish expanded tenant, credential, service, or deployment authority.
Trust Boundaries and Controls
- observed — The new callback is supplied by local route code. Commit still requires the pending key to exist in the current provider catalog and not be unavailable. Restoration does not replace this check or modify the provider/model identity being committed.
Resilience and Maintainability Implications
- observed — Save checks the pending model before closing; cancel/back closes without committing it. Option edits persist preferences immediately, independently of Save, and this behavior is unchanged in the inspected diff. Staging is not an atomic preference transaction: the existing-thread Save path rereads memory, so intervening preference changes can still affect the applied options.
-
Pre-merge checks:
4-
Check name Status Explanation Title check The title is concise, conventional, and clearly describes the main mobile picker fix. Linked Issues check [ #15518]pendingModelAfterPressnow acceptsrestoreSelectionand applies it when a different model is staged. The New Task and existing-thread flows passwithRememberedModelOptions. Focused test…Out of Scope Changes check The changes stay within the mobile model-picker behavior described by [ #15518]. The production changes update picker staging and route wiring. The test changes cover the affected state behavior. No un…Description check The description is complete in substance. It explains the problem, implementation, scope, linked issue, verification results, platform coverage, known limitations, and agent details. It does not use t… Full details: Linked Issues check
-
Explanation
[
#15518]pendingModelAfterPressnow acceptsrestoreSelectionand applies it when a different model is staged. The New Task and existing-thread flows passwithRememberedModelOptions. Focused tests cover remembered options after switching, repeat taps, and catalog defaults without a restore callback. The implementation meets the linked issue's coding requirement.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within the mobile model-picker behavior described by [
#15518]. The production changes update picker staging and route wiring. The test changes cover the affected state behavior. No unrelated product area is changed.
Full details: Description check
-
Explanation
The description is complete in substance. It explains the problem, implementation, scope, linked issue, verification results, platform coverage, known limitations, and agent details. It does not use the template headings or include an explicit maintainer approval comment, but the focused bug, linked issue, and extensive verification provide sufficient context.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge added labelsmacroscope-review
juliusmarminge assignedjuliusmarminge
Taking over this one as maintainer for batch mobile-01. I will retain the remembered-option preview behavior in new-task and existing-thread pickers, preserve scheduled-task defaults, merge current main, and refresh focused tests and independent reviews. Thanks @nekohasekai for the fix and native reproduction.
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged thisad50f62
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Approved at
e66455bMacroscope's review found this PR approvable — This is a narrow mobile picker bug fix that aligns pre-save previews with already-remembered model options while preserving scheduled-task defaults. The changes are localized, tested, and introduce no schema, deployment, security, billing, or static-analysis configuration impact.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).