Skip to content

Keep Session Chat screens in the tablet pane and share the model catalog - #366

Merged
ivanfenenko merged 13 commits into
mainfrom
feature/split-view-chat-lifecycle
Oct 11, 2026
Merged

ivanfenenko merged 13 commits into
mainfrom
feature/split-view-chat-lifecycle

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to the tablet split view (#356). Closes #357.

Android: chat-pushed screens stay in the trailing pane

  • Session Context, Changes, tool groups, child sessions and Terminal opened from Session Chat now push onto a nested NavDisplay inside the trailing pane instead of covering the split. iOS already did this with its per-pane NavigationStack.
  • The chat-flow entries are shared between the root display and the pane through a small ChatFlowNavigator, so compact width keeps its exact behaviour.
  • System back (including predictive back) pops the pane stack first, then clears the selection. Only the pane root shows the sidebar toggle; pushed screens show Back.
  • Selecting another session replaces the pane stack without a push animation; reselecting the current session keeps it. Narrowing the window hands the whole pane stack to the root stack, and pane ViewModels are cleared on selection change, reset and handoff.

iOS and Android: shared model catalog per Connection Profile

  • New ModelCatalogStore (app singleton) keyed by profile, server URL, username and worktree. It holds the catalog and selectable agents, shares in-flight fetches, keeps the last good catalog when a refresh fails or comes back empty, and is cleared through ProjectionCaches on profile switch/save/remove and Clear cache.
  • The composer seeds the catalog and agents synchronously from the store. A session with its own remembered selection shows it immediately with no "Loading model…", and refreshes quietly. A session never opened before waits only for its history (no network wait) so it never flashes the server default before its real model.
  • A refreshed catalog that drops the selected model falls back with the existing "unavailable" notice; a pick made before history reconciles wins.

Checks

  • Android: :app:assembleDebug and :app:testDebugUnitTest for the touched areas: 345 tests, 0 failures. connectedDebugAndroidTest for HomeSessionPaneNavigationTest and MainNavEntryDecoratorsTest on a Pixel Tablet emulator: 5 tests, 0 failures. No new ktlint violations in changed files.
  • iOS: xcodebuild test for SessionChatViewModelTests, ModelCatalogStoreTests, SessionModelSelectionStoreTests, SessionChatComposerStateTests, ConnectionSessionCoordinatorTests, SessionChatViewModelReuseTests, ProjectListHomeViewModelTests: 219 tests passed.
  • Manual against a local opencode serve:
    • Pixel Tablet: Session Context opens inside the pane with Back; system back returns to the chat in the pane, then clears the selection. Switching sessions shows the model chip immediately.
    • iPad Pro 13: switching to a session opened earlier shows its model straight away while messages are still loading; a never-opened session goes straight to its real model with no server-default flash.

Risks / Follow-ups

  • Android: widening the window does not move a compact chat stack back into the pane (narrowing handoff only).
  • Android: a session opened for the first time after an app restart still shows "Loading model…" until its persisted selection and history load; DataStore has no synchronous read. iOS reads the persisted selection synchronously.
  • iOS: optimistic (new) sessions still get a provisional pick from the New Session Model Preference, matching the create resolver.
  • Settings split pushes are unchanged (out of scope).

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.


Note

Medium Risk
Navigation stack and back/handoff behavior changed on Android tablets, and model selection now depends on a shared cache cleared on profile switches—both are user-visible and easy to regress without the new tests.

Overview
Android tablet home replaces a single selected-session state with a nested pane NavBackStack so Session Chat and screens opened from it (context, changes, tools, terminal, etc.) stay in the trailing split pane. Shared chatFlowEntries plus ChatFlowNavigator keep compact root navigation behavior while the pane uses its own stack, back order, and ViewModel scoping. Narrowing the window hands off pane routes to the root stack via rememberHomeSessionPaneHandoff so entries leave the pane cleanly before ViewModels are cleared.

iOS and Android add a singleton ModelCatalogStore (keyed by connection profile and worktree) that caches model catalogs and selectable agents, dedupes refreshes, and keeps the last good catalog on empty/failed refresh. Session chat composers seed from the store for instant model chips on revisit, reconcile against persisted/history selection, and ProjectionCaches clears the store on profile/cache clears. Instrumentation tests cover pane back/handoff/VM clearing and catalog caching semantics.

Reviewed by Cursor Bugbot for commit 1bb6b9a. Bugbot is set up for automated code reviews on this repo. Configure here.

@ivanfenenko ivanfenenko added enhancement New feature or request ios Primary iOS work android Primary Android work tablet Tablet and wide-screen layout labels Oct 11, 2026
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1bb6b9a. Configure here.

A slower unforced catalog load no longer replaces a newer forced result,
and an older persist no longer hides a newer in-memory model pick.
…at-lifecycle

# Conflicts:
#	android/app/src/main/java/dev/opencode/mobile/Navigation.kt
@ivanfenenko
ivanfenenko merged commit 889dd39 into main Oct 11, 2026
@ivanfenenko
ivanfenenko deleted the feature/split-view-chat-lifecycle branch October 11, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android Primary Android work enhancement New feature or request ios Primary iOS work tablet Tablet and wide-screen layout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session Chat lifecycle in the split view

1 participant