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
Harry19081
requested changes
Aug 7, 2026
Harry19081
left a comment
Member
There was a problem hiding this comment.
Requesting changes before merge.
- Fix roster ownership for non-native creations.
- Collaboration imports are created with
category: "external_history"and animported-session-...ID.sidebarCategoryForSessioncannot assign that shape to a roster category, soregisterCreatedSessionWithNativeRosterreturns unchanged state. Please give collaboration replays an explicit authoritative roster projection and test it after an authoritative roster page has loaded. - JSON imports and collaboration forks are client-created rows, not native-roster rows. They therefore may never be acknowledged by a native page. The current volatile
localSessionIdsoverlay can lose visibility after restart or a flat-list replacement, and it has no growth bound for never-acknowledged rows. Please either persist these rows through the native owning boundary or introduce a durable, bounded local-roster registry with explicit deletion/eviction semantics.
- Add regression coverage for the actual lifecycle boundaries:
- collaboration import visibility after an authoritative roster load;
- JSON import and collaboration fork visibility across restart/rehydration and
loadSessionsreplacement; - stale in-flight page protection;
- overlay/registry bounds and cleanup on deletion.
The current rendered test covers only a warm, same-process native sdeagent-* creation and does not exercise these paths.
- Split commit
339f491d6(fix(ui): tolerate missing ResizeObserver) into a separate PR. It is unrelated to the session-roster invariant and violates this repository single-responsibility PR contract.
CI is green, but these owning-boundary and lifecycle gaps should be resolved before merge.
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.