Skip to content

fix(sidebar): show newly created sessions immediately - #808

Open
Raymond8196 wants to merge 2 commits into
org2AI:developfrom
Raymond8196:codex/fix-session-list-new-session
Open

fix(sidebar): show newly created sessions immediately#808
Raymond8196 wants to merge 2 commits into
org2AI:developfrom
Raymond8196:codex/fix-session-list-new-session

Conversation

@Raymond8196

@Raymond8196 Raymond8196 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Problem

A newly launched session is inserted into the local session entity cache, but the sidebar renders only IDs owned by its paginated roster once that roster has loaded. The new row is therefore filtered out until a later refresh. If an older first-page request completes after the launch, it can also overwrite a local roster registration.

Solution

Register each newly inserted top-level native session in the sidebar roster at the same write boundary as the authoritative launch result. Preserve only registrations that occurred after an in-flight roster read began when that read commits, so a stale first page cannot hide the new row. Child and imported sessions remain outside the primary native roster.

Closes #809.

Potential risks

A session whose backend record is removed immediately after launch can remain locally visible until the next authoritative roster read; this is bounded by the existing refresh lifecycle and is preferable to hiding a successful launch. No schema, persistence format, public API, or background cadence changes are introduced.

Verification

  • NODE_OPTIONS='--localstorage-file=/private/tmp/org2-vitest-localstorage' pnpm exec vitest run src/store/session/sessionAtom/__tests__/mutations.test.ts src/store/session/sessionAtom/__tests__/sidebarRoster.test.ts src/store/session/sessionAtom/__tests__/sidebarLoaders.test.ts — 37 tests passed.
  • pnpm typecheck — passed.
  • pnpm lint:file -- src/store/session/sessionAtom/sidebarRoster.ts src/store/session/sessionAtom/loaders.ts src/store/session/sessionAtom/mutations.ts src/store/session/sessionAtom/__tests__/mutations.test.ts src/store/session/sessionAtom/__tests__/sidebarLoaders.test.ts — passed.
  • Prettier checks and git diff --check — passed.

Performance audit

  • Background work: no timer, listener, retry loop, or request cadence added.
  • Memory: the generation boundary is a function-local map released when the roster request settles; no app-lifetime cache was added.
  • Stale writes: roster reads retain only registrations made after that read began; subsequent authoritative reads converge normally.

Manual verification

Not run: desktop UI smoke test and screenshot/recording. The regression is covered at the store-to-render matcher boundary, including the stale-first-page ordering case; this PR remains Draft pending visual confirmation.

Pre-commit hook ran. Total eslint: 2, total circular: 0
@Raymond8196
Raymond8196 requested a review from Harry19081 August 14, 2026 15:39
@Harry19081
Harry19081 marked this pull request as ready for review August 15, 2026 06:24
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.

Sidebar does not show a newly created session immediately

2 participants