Skip to content

Session Chat header changes from branch to worktree after opening #783

Closed

Description

@ivanfenenko

Opening a session that runs in a worktree shows its checkout identity at once, without the header changing a moment later.

Observed (reported after #780 merged): opening a session from a worktree first shows the branch in the Session Chat top bar and its repo strip pill, then a moment later it switches to the worktree name. It happens on every open of a worktree session.

Expected: the header shows the final worktree identity from the first frame, using what Home already knows (the session's directory, its project and worktree inventory, and the branch), or shows a stable placeholder that doesn't change shape.

Acceptance:

  • Opening a worktree session from Home shows the worktree identity immediately, on iOS and Android, on v1 and v2.
  • Opening a main-checkout session doesn't flicker either.
  • A unit test covers the initial header state of a worktree session.

Remaining:

  • Root cause and fix on iOS
  • Root cause and fix on Android
  • Real-app check

Related: #780.

Activity

  1. added
    bug
    shared
    priority: medium
    in-progress
    on Oct 21, 2026
  2. ivanfenenko commented on Oct 21, 2026

    @ivanfenenko
    CollaboratorAuthor

    Root cause and fix

    Session Chat's top bar opened with the folder name and the project letter, and switched to the worktree icon only after its own chain of requests had finished (added paths, then each path's current project, then the worktree list; on v2, list, refresh and list again). It ignored what Home had already loaded. The label text never changed, only its badge. The repo-strip branch pill was stable.

    Both platforms now share a small WorktreeInventoryCache. Home writes its added paths and worktree inventories to it. Session Chat reads it synchronously when it opens, so the first frame is already final. The server fetch still runs, but only republishes if its answer differs, and a failed refresh keeps the cached identity. The one remaining case that can change after opening is a cold open before Home ever loaded, for example from a deep link. A test covers it.

    Real-app evidence

    Both apps were run against the scenario harness: real opencode v1 1.19.1 and v2 dev, worktree acme-invoices-tax on feature/tax-rounding. Each image is a strip of consecutive frames from a screen recording of tapping the session on Home.

    Before After
    iOS v2
    iOS v1
    Android v2
    Android v1

    Before the fix the letter showed for about one frame on iOS and about 1 s on Android, then changed to the worktree icon. After the fix the worktree icon is there from the first frame on all four. A main-checkout session (checked on v2, both platforms) keeps its letter with no change:

    Checks

    • Android: ./gradlew :app:testDebugUnitTest :app:assembleDebug passed, 2479 tests (1 skipped).
    • iOS: full unit target, 2385 tests. One failure was in an unrelated suite, ProjectionReconciliationTests, which passed 8/8 when re-run alone.
  3. added a commit that references this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugin-progresspriority: mediumshared

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions