fix(frontend): session UX follow-ups: sidebar liveness, composer handoff race, archive fixes - #5974
Conversation
…ser handoff, archive fixes - Sidebar shows the currently-open session immediately (withActiveLocalSession) and refreshes on first-turn completion; all session-list invalidation routed through one shared helper (the sidebar's nested query key never matched the old prefix invalidations) - Session rows show a running spinner from backend liveness (covers other tabs/devices) and carry the same rename/pin/archive/delete menu as the playground via a generic wrapRow sidebar capability - Overview/home composer race fixed: the new session id is minted at the composer and the first-run seed is addressed to it, so an old session can never claim the message; claim logic extracted to shouldConsumeSeed with unit tests; hydrating sessions refuse legacy seeds - Pre-existing archive bugs: mutations now awaited before revalidate, and archive/unarchive no longer gated on serverKnown (same hole deleteSession already fixed)
… the thinking animation - A first-turn session has no server references yet, so its sidebar row only existed via the active-session injection; switching sessions dropped the whole row (and its spinner). localPlaygroundSessionRefsAtom now injects the active session plus any running/awaiting session in scope - New shared SessionRunSpinner is the single thinking indicator for the sidebar, tab strip, session rail, and history menu (same glyph, motion, and colorInfo tone; !important beats the antd menu-icon color override); awaiting keeps its pulsing needs-you dot
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (26)
Disabled knowledge base sources:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR coordinates preassigned session IDs, hydration-aware first-run seed consumption, awaited session mutations, broad session-list invalidation, local sidebar sessions, running indicators, and session row actions. ChangesSession lifecycle and sidebar
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant useStartAgentSession
participant pendingSessionOpen
participant AgentChatPanel
participant addSessionAtomFamily
participant useFirstRunSeed
useStartAgentSession->>pendingSessionOpen: Store newSessionId
useStartAgentSession->>useFirstRunSeed: Store sessionId seed
AgentChatPanel->>addSessionAtomFamily: Create session with newSessionId
useFirstRunSeed->>useFirstRunSeed: Validate session and hydration state
Possibly related PRs
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Railway Preview Environment
|
What this does
Fixes four session-UX problems found in founder QA after the #5943–#5945 merge, in one connected package: sessions now appear in the sidebar the moment you create them, show a live running indicator that survives switching sessions, carry the same actions menu as the playground, and the overview/home composer can no longer lose your first message to a stale session.
Fixes
New sessions appear in the sidebar immediately. Two real causes, neither the empty-session filter: (1) a new session exists only client-side until its first turn lands, so the server-backed sidebar had nothing to show; (2) the sidebar nests the session-list query under a
["sidebar", ...]key, so every existing["session-list"]prefix invalidation silently missed it and rows refreshed only on the 30s stale timer. Now: one sharedinvalidateSessionListQueries()helper is the single invalidation path (ProjectWatch, session actions, gateway triggers, and the turn that first persists a session all use it), andwithLocalSessionsmerges locally-known sessions (the active one, plus any running/awaiting in scope) into the list until the server catches up. Stale empty sessions stay hidden.Running spinner that tracks the run, not the viewport. Sidebar rows show a spinner while that session's agent run is in flight, driven by the same status atom that layers backend liveness under local run state, so it also picks up runs started in other tabs or by other devices via the existing 15s poll. Founder-reported bug fixed along the way: a first-turn session's row (and spinner) vanished when you switched sessions, because the injected local row was keyed to the active session alone; running/awaiting sessions now stay injected regardless of which session is active.
One thinking animation everywhere. New shared
SessionRunSpinnerrenders the running state in all four surfaces (sidebar, playground tab strip, session rail, history menu): same glyph, same motion, samecolorInfotone in both themes (an antd menu-icon CSS rule was silently recoloring the sidebar copy; fixed). Theawaitingstate keeps its pulsing "needs you" dot on purpose.Sidebar session actions menu. Right-click or kebab on any sidebar session row: Rename, Pin, Archive, Delete, identical to the playground because it reuses
useSessionActionsoutright (a genericwrapRowcapability in the sidebar engine carries it). Two pre-existing archive bugs found and fixed while wiring it, both also affecting the playground bar: archiving a young session silently never reached the server (serverKnowngate, same hole #5543 closed for delete), and the list refetch raced the archive write (mutations now return promises and are awaited).Composer handoff race (flaky "message lands in an old session or disappears"). The overview/home composer stored the draft and "create a session" as two unaddressed atoms; whichever session pane mounted first claimed the message. With a warm route chunk that was the PREVIOUS session, which either ran the message in an old conversation or, if its history hydrated first, dropped the message entirely. The composer now mints the session id up front and addresses both atoms to it; claiming is exact (
shouldConsumeSeed, extracted and unit-tested), and hydrating sessions refuse legacy unaddressed seeds. Reproduced both failure modes live before the fix; 4/4 correct runs after, including the home composer and the mid-hydration case.Verification
archived_atconfirmed on the wire, row gone in <700ms); composer scenario correct 4/4 with the failing preconditions deliberately recreated.withLocalSessionscases including a direct regression pin, 10shouldConsumeSeedcases, 3 archive cases), 974 in @agenta/entities, 49 in @agenta/sessions.tsc --noEmitclean for oss and ee.Known limits (deliberate)