Skip to content

feat: integrate session lifecycle protocol into chat hooks and sidebar#188

Closed
bbsngg wants to merge 1 commit intosplit/d-frontend-scopefrom
split/e-chat-hooks
Closed

feat: integrate session lifecycle protocol into chat hooks and sidebar#188
bbsngg wants to merge 1 commit intosplit/d-frontend-scopefrom
split/e-chat-hooks

Conversation

@bbsngg
Copy link
Copy Markdown
Contributor

@bbsngg bbsngg commented Apr 15, 2026

Summary

  • useChatComposerState: queued turn management (enqueue/dequeue/steer/pause/resume), session scope key tracking, provider-scoped draft persistence
  • useChatRealtimeHandlers: handle session-accepted/session-busy/session-state-changed WebSocket messages, provider-aware message filtering
  • useChatSessionState: provider-scoped message cache reads, session snapshot cache for fast session switching, session load guards
  • Sidebar: scope-based React keys, provider-aware session display
  • CHANGELOG with full upstream sync notes

Part of the session lifecycle PR split (6/6, final). Depends on #184 (foundation) and the frontend scope PR.

Note: ~25-30% of the diff in the three large hook files is quote style formatting ('"). Use git diff --ignore-all-space for cleaner review.

Test plan

  • npx tsc --noEmit passes
  • npx vitest run src/components/sidebar/utils/__tests__/sessionListBehavior.test.ts src/components/chat/hooks/__tests__/useChatSessionState.test.ts passes
  • Create new session → sidebar shows immediately (optimistic)
  • Switch between sessions → snapshot cache preserves scroll/messages
  • WebSocket reconnect → active session resumes without data loss
  • Multi-provider sessions tracked independently in sidebar

🤖 Generated with Claude Code

Wire the session lifecycle protocol (session-accepted, session-busy,
session-state-changed) into the frontend chat hooks and sidebar.

Chat hooks:
- useChatComposerState: queued turn management (enqueue/dequeue/steer/
  pause/resume), session scope key tracking, provider-scoped draft
  persistence, optimistic session creation via custom events
- useChatRealtimeHandlers: handle session-accepted/busy/state-changed
  WebSocket messages, provider-aware message filtering, session filter
  debug logging
- useChatSessionState: provider-scoped message cache reads, session
  snapshot cache for fast session switching, session load guards

Type changes:
- Add QueuedTurn types, extend session callback signatures with
  provider and projectName parameters
- ChatInterfaceProps: add onShowAllTasks, nullable onStartWorkspaceQa

Sidebar:
- Session list uses scope key for React keys
- SidebarSessionItem shows provider-aware display
- Session list behavior tests added

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bbsngg
Copy link
Copy Markdown
Contributor Author

bbsngg commented Apr 15, 2026

Split from #170 (6/6, final). Depends on #187#184. Once merged, #170 can be closed. See #170 for full split plan.

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.

1 participant