Skip to content

fix(mobile): restore last picked model and effort on new session - #6094

Open
iscekic wants to merge 1 commit into
mainfrom
kwf/persist-last-model-effort-choice-30cb
Open

fix(mobile): restore last picked model and effort on new session#6094
iscekic wants to merge 1 commit into
mainfrom
kwf/persist-last-model-effort-choice-30cb

Conversation

@iscekic

@iscekic iscekic commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Changelog for users

  • The New session screen restores the model and thinking effort the user picked last, instead of resetting to an automatic default.
  • The restored selection includes the chosen effort, not just the model.
  • If the saved model is no longer offered, the screen falls back to the usual default: the dev efficient model, then the organization default, then the first catalog model.
  • If the saved model still exists but its saved effort is gone, the model's first offered effort is used.

Changelog for maintainers

  • pickAutoSelectedModel now resolves in this order: server lastSelected, local stored preference, dev kilo-auto/efficient, org default, first catalog entry.
  • The dev efficient default previously short-circuited before both persisted sources, so dev builds ignored a saved combo; the persisted sources now win.
  • Release builds already resolved server and local before the fallback, so the reorder changes dev-build selection only.
  • A stored model missing from the catalog is dropped by resolveModelForContext and falls through to the next source.
  • An unavailable stored variant falls back to the model's first variant; an invalid server variant does too via pickVariant.
  • The picker already writes each pick to device storage and the server in handleModelSelect; this change fixes the restore priority, not the save path.
  • Remote CLI-catalog picks still return early and are not persisted; unchanged.
  • Tests now cover dev restore of the server combo, dev restore of the local combo, and catalog-missing fallback to the efficient default.

E2E proof

Recording of the verified flow (waits trimmed)

scripted-shard1.mp4

[e1] On the mobile New session page, pick a non-default model and a thinking effort, leave the page (back), reopen New session: the same model and effort are preselected. — scripted-shard1/e1.png

[e2] On the mobile New session page, pick a model/effort, force-quit and relaunch the app, open New session: the same combo is restored from device-local storage. — scripted-shard1/e2.png

E2E proof — log excerpts

[p1] New session keeps the picked model and thinking effort across back/reopen -> pass :: Scripted scene proof: 'SCENE p1 OK' with digest line 'android.widget.Button Claude Opus 4 ($$$$), Extra High thinking effort tappable [319,707][957,781]'; not replayed per the runbook's scripted-OK rule.
[p2] New session restores the picked model/effort after force-quit and relaunch -> pass :: Picked Claude Opus 5 + High, nulled the server last_selected fixture (p2-server-cleared.log), then adb force-stop + monkey relaunch (p2-forcequit.log); after reopening New session the digest shows 'android.widget.Button Claude Opus 5, High thinking effort tappable [319,707][780,781]' under 'SCENE p2 OK', proving the device-local restore.
/home/igor_kilocode_ai/.local/share/kwf/sections/persist-last-model-effort-choice-30cb/e2e-mobile-app/scripted-p1.log
android.widget.TextView Extra High tappable [736,725][866,762]
android.widget.TextView Run on tappable [37,857][1045,903]
android.widget.Button Run on: Cloud Agent tappable [37,921][909,1037]
android.widget.TextView Cloud Agent tappable [67,951][844,1007]
android.widget.Button Refresh tappable [928,921][1043,1037]
android.widget.TextView Run `kilo remote` on your computer, or `/remote` in a running CLI session, to control a local kilo process. tappable [36,1056][1044,1130]
android.widget.TextView Repository tappable [37,1176][1045,1222]
android.widget.Button Repository: Select repository tappable [37,1240][1043,1356]
android.widget.TextView Select repository tappable [67,1270][978,1326]
android.widget.TextView Connect GitLab tappable [76,1423][1004,1469]
android.widget.TextView Connect GitLab in your browser, then return here to pick a repository. tappable [76,1478][1004,1570]
android.widget.Button Open GitLab tappable [76,1598][870,1714]
android.widget.TextView Open GitLab tappable [412,1632][594,1678]
android.widget.Button Refresh repositories tappable [888,1598][1004,1714]
android.widget.TextView Changes tappable [37,1799][1045,1845]
android.view.View Changes tappable [37,1863][1043,1982]
android.widget.RadioButton Leave changes tappable [46,1872][540,1973]
android.widget.TextView Leave changes tappable [182,1899][403,1945]
android.widget.RadioButton Commit and push tappable [540,1872][1034,1973]
android.widget.TextView Commit and push tappable [656,1899][917,1945]
android.widget.TextView Environment tappable [37,2029][1045,2075]
android.widget.TextView Default environment tappable [37,2093][1045,2139]
android.widget.Button Start session [37,2195][1043,2311]
android.widget.TextView Start session tappable [442,2229][638,2275]
/home/igor_kilocode_ai/.local/share/kwf/sections/persist-last-model-effort-choice-30cb/e2e-mobile-app/p2-verify.log
android.widget.TextView High tappable [630,725][689,762]
android.widget.TextView Run on tappable [37,857][1045,903]
android.widget.Button Run on: Cloud Agent tappable [37,921][909,1037]
android.widget.TextView Cloud Agent tappable [67,951][844,1007]
android.widget.Button Refresh tappable [928,921][1043,1036]
android.widget.TextView Run `kilo remote` on your computer, or `/remote` in a running CLI session, to control a local kilo process. tappable [36,1056][1044,1130]
android.widget.TextView Repository tappable [37,1176][1045,1222]
android.widget.Button Repository: Select repository tappable [37,1240][1043,1357]
android.widget.TextView Select repository tappable [67,1270][978,1326]
android.widget.TextView Connect GitLab tappable [76,1423][1004,1469]
android.widget.TextView Connect GitLab in your browser, then return here to pick a repository. tappable [76,1478][1004,1570]
android.widget.Button Open GitLab tappable [76,1598][870,1714]
android.widget.TextView Open GitLab tappable [412,1632][594,1678]
android.widget.Button Refresh repositories tappable [888,1598][1004,1714]
android.widget.TextView Changes tappable [37,1799][1045,1845]
android.view.View Changes tappable [37,1863][1043,1982]
android.widget.RadioButton Leave changes tappable [46,1872][540,1973]
android.widget.TextView Leave changes tappable [182,1899][403,1945]
android.widget.RadioButton Commit and push tappable [540,1872][1034,1973]
android.widget.TextView Commit and push tappable [656,1899][917,1945]
android.widget.TextView Environment tappable [37,2029][1045,2075]
android.widget.TextView Default environment tappable [37,2093][1045,2139]
android.widget.Button Start session [37,2195][1043,2311]
android.widget.TextView Start session tappable [442,2229][638,2275]
/home/igor_kilocode_ai/.local/share/kwf/sections/persist-last-model-effort-choice-30cb/e2e-mobile-app/p2-server-cleared.log
=== clear server last_selected (isolate device-local storage) ===
UPDATE 1
=== select after clear ===
af622f55-12ab-49e0-b865-4e88a983eec3|
/home/igor_kilocode_ai/.local/share/kwf/sections/persist-last-model-effort-choice-30cb/e2e-mobile-app/p2-forcequit.log
=== adb force-stop ===
exit=0
=== adb monkey launch ===
data="android.intent.category.LAUNCHER"
Events injected: 1
## Network stats: elapsed time=15ms (0ms mobile, 0ms wifi, 15ms not connected)
Owner request

Surface: the mobile app (apps/mobile).

On the new session page, the last selected model/effort combo is not persisted, so the user is forced to pick for every new session. Persist the last picked model/effort combo and restore it on the new session page, with a reasonable fallback in case the persisted choice is not available.

Surface: the mobile app (apps/mobile).

On the new session page, the last selected model/effort combo is not persisted, so the user is forced to pick for every new session. Persist the last picked model/effort combo and restore it on the new session page, with a reasonable fallback in case the persisted choice is not available.
@kilo-code-bot

kilo-code-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • apps/mobile/src/lib/hooks/auto-select-model.ts
  • apps/mobile/src/lib/hooks/auto-select-model.test.ts

Reviewed the reordered resolution in pickAutoSelectedModel: server lastSelected → local stored preference → dev kilo-auto/efficient → org default → models[0]. Release ordering is unchanged, dev now correctly prefers a persisted combo, and missing models/variants fall through via resolveModelForContext and pickVariant. Updated tests cover the new dev restore paths and the catalog-missing fallback. No security, logic, or memory concerns found in the changed code.


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@iscekic iscekic added the human-ready The PR is ready for human review. label Sep 12, 2026
@iscekic iscekic self-assigned this Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

human-ready The PR is ready for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant