Skip to content

fix(frontend): session UX follow-ups: sidebar liveness, composer handoff race, archive fixes - #5974

Merged
mmabrouk merged 2 commits into
release/v0.112.0from
fix/session-ux-followups
Aug 12, 2026
Merged

fix(frontend): session UX follow-ups: sidebar liveness, composer handoff race, archive fixes#5974
mmabrouk merged 2 commits into
release/v0.112.0from
fix/session-ux-followups

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

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 shared invalidateSessionListQueries() helper is the single invalidation path (ProjectWatch, session actions, gateway triggers, and the turn that first persists a session all use it), and withLocalSessions merges 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 SessionRunSpinner renders the running state in all four surfaces (sidebar, playground tab strip, session rail, history menu): same glyph, same motion, same colorInfo tone in both themes (an antd menu-icon CSS rule was silently recoloring the sidebar copy; fixed). The awaiting state 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 useSessionActions outright (a generic wrapRow capability 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 (serverKnown gate, 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

  • Live on the dev stack: new session appears instantly; spinner survives session switches for the full run and clears on settle (measured, including the founder's exact repro); menu actions land server-side (archived_at confirmed on the wire, row gone in <700ms); composer scenario correct 4/4 with the failing preconditions deliberately recreated.
  • Both themes verified with computed styles and screenshots (spinner color identical chip vs sidebar in light and dark; menu renders antd dark surfaces).
  • Tests: ~410 passing across Sidebar/AgentChatSlice/Layout (new: 6 withLocalSessions cases including a direct regression pin, 10 shouldConsumeSeed cases, 3 archive cases), 974 in @agenta/entities, 49 in @agenta/sessions. tsc --noEmit clean for oss and ee.

Known limits (deliberate)

  • A session still on its FIRST turn stops being visible if you leave the playground page entirely before the turn completes: the server row has no open target yet, and rendering rows that link nowhere is the exact thing the null-drop guard exists to prevent. It reappears when the turn lands.
  • The drawer and onboarding chat scopes do not show the injected local row (they override the chat scope via React context, which the sidebar cannot read); they showed nothing before either.
  • On playground arrival the auto-created blank tab shows as "Untitled session" in the sidebar while you are in it; it disappears on navigate-away. Founder-flagged as acceptable.

…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
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Blocked Blocked Aug 12, 2026 11:08am

Request Review

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. frontend ux labels Aug 12, 2026
@mmabrouk
mmabrouk merged commit ab084b5 into release/v0.112.0 Aug 12, 2026
31 of 33 checks passed
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a75e823-b417-4230-98d8-150a009003b0

📥 Commits

Reviewing files that changed from the base of the PR and between 50da580 and 71c65a5.

📒 Files selected for processing (26)
  • web/oss/src/components/AgentChatSlice/AgentChatPanel.tsx
  • web/oss/src/components/AgentChatSlice/AgentConversation.tsx
  • web/oss/src/components/AgentChatSlice/components/SessionRunSpinner.tsx
  • web/oss/src/components/AgentChatSlice/components/SessionTagBar.tsx
  • web/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.ts
  • web/oss/src/components/AgentChatSlice/hooks/useFirstRunSeed.test.ts
  • web/oss/src/components/AgentChatSlice/hooks/useFirstRunSeed.ts
  • web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx
  • web/oss/src/components/AgentChatSlice/hooks/useStartAgentSession.ts
  • web/oss/src/components/AgentChatSlice/state/firstRunSeed.ts
  • web/oss/src/components/AgentChatSlice/state/pendingSessionOpen.ts
  • web/oss/src/components/AgentChatSlice/state/sessions.delete.test.ts
  • web/oss/src/components/AgentChatSlice/state/sessions.ts
  • web/oss/src/components/Layout/ProjectWatch.test.tsx
  • web/oss/src/components/Layout/ProjectWatch.tsx
  • web/oss/src/components/Sidebar/dynamic/SessionRowActions.tsx
  • web/oss/src/components/Sidebar/dynamic/dropArchivedAgentSessions.test.ts
  • web/oss/src/components/Sidebar/dynamic/registry.ts
  • web/oss/src/components/Sidebar/dynamic/sessionsSource.ts
  • web/oss/src/components/Sidebar/dynamic/types.ts
  • web/oss/src/components/Sidebar/dynamic/useSidebarDynamicChildren.ts
  • web/oss/src/components/Sidebar/engine/SidebarMenu.tsx
  • web/oss/src/components/Sidebar/engine/types.ts
  • web/packages/agenta-entities/src/gatewayTrigger/state/invalidate.ts
  • web/packages/agenta-entities/src/session/index.ts
  • web/packages/agenta-entities/src/session/state/invalidate.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added clearer running-session indicators with animated spinners in the sidebar.
    • Added quick session actions through context menus and hover controls.
    • Newly created sessions now retain their intended identity and appear promptly in session lists.
  • Bug Fixes

    • Improved first-run message targeting and hydration handling.
    • Session lists now refresh reliably after chat completion, renaming, archiving, unarchiving, and deletion.
    • Improved display and ordering of local, active, pinned, and running sessions.

Walkthrough

The 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.

Changes

Session lifecycle and sidebar

Layer / File(s) Summary
Session identity and first-run seeding
web/oss/src/components/AgentChatSlice/state/firstRunSeed.ts, web/oss/src/components/AgentChatSlice/state/pendingSessionOpen.ts, web/oss/src/components/AgentChatSlice/hooks/useStartAgentSession.ts, web/oss/src/components/AgentChatSlice/AgentChatPanel.tsx, web/oss/src/components/AgentChatSlice/AgentConversation.tsx, web/oss/src/components/AgentChatSlice/hooks/useFirstRunSeed.ts, web/oss/src/components/AgentChatSlice/hooks/useFirstRunSeed.test.ts
New sessions share a caller-provided ID across pending-open state and first-run seeds. Seed consumption validates agent, session, hydration, transcript, and revision conditions.
Session writes and list invalidation
web/oss/src/components/AgentChatSlice/state/sessions.ts, web/oss/src/components/AgentChatSlice/state/sessions.delete.test.ts, web/oss/src/components/AgentChatSlice/hooks/useSessionActions.tsx, web/oss/src/components/AgentChatSlice/hooks/useAgentChatSession.ts, web/packages/agenta-entities/src/session/state/invalidate.ts, web/packages/agenta-entities/src/session/index.ts, web/packages/agenta-entities/src/gatewayTrigger/state/invalidate.ts, web/oss/src/components/Layout/ProjectWatch.tsx, web/oss/src/components/Layout/ProjectWatch.test.tsx
Session mutations return remote requests for awaiting. The shared invalidation helper covers nested session-list queries after session, chat, project, and trigger updates.
Local session sidebar sources
web/oss/src/components/Sidebar/dynamic/sessionsSource.ts, web/oss/src/components/Sidebar/dynamic/dropArchivedAgentSessions.test.ts
Sidebar rows include running state and qualifying local playground sessions. Local rows are deduplicated and inserted according to pinned and server-row ordering.
Sidebar row actions and status presentation
web/oss/src/components/Sidebar/dynamic/SessionRowActions.tsx, web/oss/src/components/Sidebar/dynamic/registry.ts, web/oss/src/components/Sidebar/dynamic/types.ts, web/oss/src/components/Sidebar/dynamic/useSidebarDynamicChildren.ts, web/oss/src/components/Sidebar/engine/types.ts, web/oss/src/components/Sidebar/engine/SidebarMenu.tsx, web/oss/src/components/AgentChatSlice/components/SessionRunSpinner.tsx, web/oss/src/components/AgentChatSlice/components/SessionTagBar.tsx
Sidebar rows support context-menu and hover actions. Running sessions use the shared spinner, while other status indicators retain their existing semantic states and animations.

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
Loading

Possibly related PRs

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/session-ux-followups

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-5974.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-5974-7ee7b29
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-12T11:20:18.274Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend size:XL This PR changes 500-999 lines, ignoring generated files. ux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant