Skip to content

#1035 Keep Home's cached paint stable on a cold start - #1036

Merged
ivanfenenko merged 2 commits into
mainfrom
fix/1035-home-cold-start-relabel
Nov 14, 2026
Merged

ivanfenenko merged 2 commits into
mainfrom
fix/1035-home-cold-start-relabel

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Worktree layout in the Session Cache. Each added path's worktree list and branches are remembered (new WorktreeLayout record, queued in order with project resolutions) and seeded, together with project resolutions, before the cold paint builds rows. Home's first frame now shows the worktree labels, branches and project chip the live load will, instead of relabeling every row 2–3 times within ~3 s of launch.
  • First live window matches the cache. When a directory's session loop seeds from the cache before any server load, its window starts at the cached row count rounded up to whole pages (max 4 pages). No 200 → 50 shrink on the first refresh.
  • Loader after a grace. OpenCodeStatusStack gets an afterGrace reveal variant (300 ms); Home and the app root use it, so a fast cached paint never flashes "Loading sessions".
  • Same behavior on iOS and Android. The profile-switch paint also seeds the target profile's layouts.

Checks

  • iOS: full OpenCode MobileTests suite passed (3378 tests / 332 suites). New tests: window seeding (SessionLiveStoreWindowTests), layout cache round trip and purge (DefaultSessionCacheTests), cold paint keeps worktree labels (ProjectListHomeViewModelTests).
  • Android: MainScreenViewModelTest 96/96, HomeBranchLookupsTest 7/7, DefaultSessionCacheTest 24/24, HomeSessionWindowsTest, SessionLiveStoreTest, OpenCodeStatusStackRevealTest passed; :app:assembleDebug succeeded. A wider ui.main.* + domain.* run has 2 failures in SseRecoveryFaultOracleTest that also fail on unchanged main.
  • ktlint / lint and gitleaks not run locally.
  • Manual: iOS simulator against the scenario harness (released v2 server, 400 ms proxy latency, one repository with 3 worktrees, ~290 sessions, 200 rows cached), cold launch before vs after for: no server change, 3 sessions turned busy, 1 new session, 25 new sessions. Visible changes after the cached paint: 3 → 0, 5 → 1, 4 → 2, 4 → 2 (the remaining ones are the real changes plus unread markers, see below).

Evidence

Before/after recordings in the evidence comment.

Issue

Fixes #1035

Risks / Follow-ups

  • Unread outcome markers (Done / Stopped) still appear with the live status, not in the cached paint: rows never show an outcome before the status snapshot confirms the session idle. A cached outcome needs care so the intermediate row build (sessions before statuses) does not hide it again. Follow-up.
  • Not recorded: Android, and v1 servers (unit tests only).
  • A cached layout can be stale if worktrees changed while the app was dead; the live inventory replaces it on load, as before.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Cache each added path's worktree list and branches and seed them, with project resolutions, before the cold paint builds rows, so the live load no longer relabels every row. Start the first live session window at the size the cache painted, and reveal the full-screen Home and app-root loader only after a 300 ms grace. iOS and Android.
@ivanfenenko
ivanfenenko marked this pull request as ready for review November 14, 2026 14:32
Port the cached worktree-layout seeding onto main's Home region split:
HomeWorktrees now seeds and remembers worktree layouts, and
HomeProjectList seeds them before the cached paint on both platforms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko
ivanfenenko merged commit d2cc073 into main Nov 14, 2026
@ivanfenenko
ivanfenenko deleted the fix/1035-home-cold-start-relabel branch November 14, 2026 19:16
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.

Home relabels every row after a cold start

1 participant