fix(sessions): keep new sessions visible in sidebar - #725
Open
beruro wants to merge 2 commits into
Open
Conversation
Pre-commit hook ran. Total eslint: 0, total circular: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A newly created backend session was written to
sessionsAtom, so ChatPanel could resolve and open it by ID, but the Sidebar also filters through the paginatedsessionPaginationAtomroster. Because creation paths did not register roster membership, the new session could exist in a tab while disappearing from the Sidebar after an authoritative page had loaded.The same cache-only creation pattern existed across the standard launcher,
SessionService.create, ADE Manager, collaboration fork/import, session-file import, and E2E seed paths.Solution
Introduce
registerCreatedSessionas the single client-side creation boundary. One Jotai write transaction now stores the session entity and registers top-level native sessions in a separatelocalSessionIdsoverlay.The overlay preserves these invariants:
sessionIdsand keyset cursors remain authoritative and are never rewritten by local creation;A shared
buildCreatedSessionRecordnow mapssession_launchresponses consistently, and all known creation/import/fork entry points use the new registration boundary. Cache-only reconciliation of existing sessions continues to useupsertSession.Potential risks
The local overlay retains a backend-confirmed creation until a native roster response encounters it, it is deleted, or the app process resets. For a row behind the current cursor this may last until pagination reaches it; growth is bounded to locally created, not-yet-acknowledged IDs. No new timer, subscription, polling loop, IPC call, persistence format, database migration, or wire-protocol change was introduced.
Rollback is a single-commit revert. No stored data migration or recovery step is required.
Audit
sessionLaunchcall sites were reviewed. Wire protocol and resolver layers were unchanged.Verification
npx vitest run src/store/session/sessionAtom/__tests__/paginationAtoms.test.ts src/store/session/sessionAtom/__tests__/sidebarRoster.test.ts src/store/session/sessionAtom/__tests__/sidebarLoaders.test.ts src/store/session/sessionAtom/__tests__/mutations.test.ts src/scaffold/NavigationSidebar/connectors/useSessionMenuItems/__tests__/paginationHelpers.test.ts src/scaffold/NavigationSidebar/connectors/useSessionMenuItems/__tests__/createdSessionVisibility.test.ts src/engines/SessionCore/hooks/session/__tests__/launchPayload.test.ts src/engines/SessionCore/services/SessionService.create.test.ts src/scaffold/GlobalSpotlight/palettes/AgentControlPalette/utils.test.ts src/features/TeamCollaboration/forkSession.test.ts src/features/TeamCollaboration/engine/collabSessionFork.test.ts src/features/TeamCollaboration/engine/collabSyncEngineHelpers.test.ts— 12 files, 170 tests passed.npx tsc --noEmit --pretty false— passed.git diff --name-only origin/develop...HEAD -- '*.ts' '*.tsx' | xargs npx eslint— passed.git diff --check origin/develop...HEAD— passed.