Repository navigation
Closed
Labels
androidPrimary Android workimprovementFollow-up, refactor, or extra coverageiosPrimary iOS workpriority: mediumNon-blocking V1 work and polishready-for-agentReady for an agentsharedShared or cross-platform implementation
Milestone
Description
Parent
OPE-12 — Model Selection
What to build
Make the first effective model shown in Session Chat reliably match the user's latest intent on iOS and Android. Existing sessions reconcile timestamped device state with newer user-message history, while sessions created from mobile inherit the explicit New Session Model Preference for the same Connection Profile and Added Project before navigation. Never allow a transient catalog fallback to be sent while stronger sources are unresolved.
Remaining
- Make existing-session selection initialization deterministic, observable, atomic, and readiness-gated on iOS and Android.
- Add New Session Model Preference persistence and copy-before-navigation handoff on iOS and Android.
- Complete ordered-write, timestamp-reconciliation, migration, stale-value, scoping, deletion, retention, failure, and completion-order coverage on both platforms.
Acceptance criteria
- Reconcile valid session state with the latest user message by timestamp; newer user history wins, a cache wins ties, and legacy entries yield to available user history once.
- Use assistant-message model metadata only when neither session state nor user-message metadata resolves the selection.
- Fall through to the New Session Model Preference, server default, then first usable catalog model.
- Scope persisted state by normalized server URL, effective username, exact server-provided worktree, and session id where applicable; never include passwords.
- Only explicit model or Variant picks update the New Session Model Preference. Successful sends confirm session state only.
- Copy the resolved preference or catalog fallback into a mobile-created session before opening Session Chat. Forked sessions derive selection from copied user history.
- Keep Send disabled and show a loading model control until selection resolution reaches a terminal result.
- Preserve unavailable session models while falling through with a non-blocking notice; keep a valid model and use Default with a notice when its remembered Variant is unavailable.
- Cache failures degrade to history/catalog without blocking navigation. Catalog failure keeps Send disabled, shows an actionable error, and supports retry.
- Serialize writes per scope so the latest user action survives restart.
- Remove a session entry after successful session deletion, retain the New Session Model Preference, cap session entries at 500 per Connection Profile, and clear both scopes plus migration metadata from Clear All Data.
- Remove reliance on stale session-level model DTO fields after confirming no remaining consumers.
- Emit privacy-safe diagnostics for the chosen source without credentials or prompt content.
- iOS and Android pass equivalent focused unit tests and manual cold-open checks for cached, history-only, cross-client, stale-value, failure, and newly created session scenarios.
Blocked by
None.
Docs: docs/features/model-selection/
Detailed plan: docs/features/model-selection/reliable-selection-plan.md
Imported from Linear OPE-45. Linear status: Done. Priority: Medium. Created 2026-07-15. Completed 2026-07-15.
Parent: OPE-12.
Related: OPE-214, OPE-164.
Metadata
Metadata
Assignees
Labels
androidPrimary Android workimprovementFollow-up, refactor, or extra coverageiosPrimary iOS workpriority: mediumNon-blocking V1 work and polishready-for-agentReady for an agentsharedShared or cross-platform implementation
Activity