Skip to content

[Bug] Session switching can skip opening state and get stuck blank #965

@Astro-Han

Description

@Astro-Han

What happened?

Switching between existing sessions can visibly flicker and can sometimes leave the main session view stuck in a half-loaded blank state.

Observed stuck state:

  • Sidebar selection points at the target session.
  • Header falls back to the raw session id, e.g. ses_..., instead of the session title.
  • Main timeline area is blank.
  • Composer shows the loading placeholder (正在加载提示...).
  • The existing session.opening / session-opening-state UI is not shown, even though the target session is not display-ready yet.

A local screen recording captured the transition and the stuck state on 2026-05-28. The affected session exists in the local database and has messages, so this does not look like missing session data.

Which area seems affected?

App flow or product behavior; UI or design system.

How much does this affect you?

Breaks an important workflow. Session switching is a core navigation path, and the blank half-loaded state makes the app look stuck.

Steps to reproduce

  1. Open PawWork desktop.
  2. Use a workspace with several existing sessions in the sidebar.
  3. Switch quickly between existing sessions, especially from a loaded session to another session whose cache is still hydrating.
  4. Watch for a target session route where the sidebar/header/composer update, but the timeline does not render and the opening state is skipped.

What did you expect to happen?

When the target session is not ready, the app should show the existing "opening session" state or a stable skeleton for the target session.

The UI should have only two valid states during a cross-session switch:

  1. Target session cache is display-ready: show the target session timeline.
  2. Target session cache is not display-ready: show the target session opening/loading state.

It should not expose a third state where the target route is active but the title is a raw ses_..., the timeline is blank, and the composer is still loading.

PawWork version

2026.5.28

OS version

macOS 26.5

Can you reproduce it again?

Sometimes.

Diagnostics

Initial code read points to a ready-state mismatch rather than missing data:

  • packages/app/src/pages/session/use-session-timeline-data.ts defines routeMessagesReady as message[id] !== undefined.
  • packages/app/src/pages/session.tsx passes that message-only readiness into SessionMainView as routeReady.
  • packages/app/src/pages/session/session-main-view-state.ts only shows session-opening-state when routeReady is false.
  • packages/app/src/components/session/session-header.tsx falls back to the raw route id when sessionInfo is not hydrated yet.
  • packages/app/src/components/prompt-input.tsx shows the loading placeholder when submit readiness is still false.

This means message[id] = [] can make the route look ready before sessionInfo is available. In that window, the opening state is bypassed and the UI can show the half-loaded blank session view.

Suggested fix direction:

  • Keep the current target-session-first switching model.
  • Do not keep showing the previous session for cross-session switches.
  • Gate target session display readiness on both target sessionInfo and target message cache being present.
  • Keep status/local/provider readiness scoped to composer actions, not the main timeline opening gate.

A focused regression test should cover: target route has a defined message cache but missing session info, so the session opening state remains visible instead of rendering the blank timeline state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityappApplication behavior and product flowsbugSomething isn't workinguiDesign system and user interface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions