Note
Currently processing new changes in this PR. This may take a few minutes, please wait...
โ๏ธ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c7eec426-8a92-4710-88c8-07f7b520127c
๐ฅ Commits
Reviewing files that changed from the base of the PR and between 985f34ab7c51f531b856866e2b659b59ef605c2d and f71a5c00243c3cefcb4a6fb9c81e10eb5911d37d.
๐ Files selected for processing (1)
dashboard/src/components/agent-sidebar/agent-sidebar.tsx
| 1 | ____________________ |
| 2 | < Expecto bugtronum! > |
| 3 | -------------------- |
| 4 | \ |
| 5 | \ \ |
| 6 | \ /\ |
| 7 | ( ) |
| 8 | .( o ). |
๐ Summary
Summary by CodeRabbit
- New Features
- Added chat history to the agent sidebar, showing up to 30 recent chats with titles and the newest chats first.
- Select a past chat to reopen it, or start a new chat from the sidebar.
- Chat titles are based on the first message, with long titles shortened for display.
- Chat history refreshes after a conversation ends or is stopped, and offers a retry if loading fails.
The agent panel now supports recent chat history for the current organization. Members can view chat titles, select a prior chat, or start a new chat. The panel refreshes thread history as conversations change. A server function returns up to 30 recent threads for the authorized member and organization.
Changes: Agent Chat History
Layer / File(s) Summary Thread titles and persistence
dashboard/src/modules/agent/thread-title.ts,dashboard/src/modules/agent/thread-title.test.ts,dashboard/src/modules/agent/persistence.server.tsThread titles use user message text, exclude page-context content, normalize whitespace, and truncate long titles. The persistence query returns up to 30 titled threads for an organization and member, ordered by update time and thread ID. Thread listing API and query
dashboard/src/modules/agent/agent.functions.ts,dashboard/src/components/agent-sidebar/threads.queries.ts,dashboard/src/collections/data-sources.ts,dashboard/src/collections/data-boundaries.static.test.tsThe server function returns recent threads after checking organization access. The client query caches results for 30 seconds and provides an invalidation helper. The data-source registry and boundary test include the thread query. Agent panel history controls
dashboard/src/components/agent-sidebar/agent-panel.tsx,dashboard/src/components/agent-sidebar/agent-sidebar.tsx,dashboard/src/components/agent-sidebar/agent-panel.test.tsxThe panel displays chat history, derives the current chat title, and passes selected or newly generated thread IDs through onChat. Tests cover history selection, title updates, and history invalidation after a turn ends or a reply stops.Priority: โ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Sequence Diagram(s)
mermaid1 sequenceDiagram 2 participant Member 3 participant AgentPanel 4 participant agentThreadsOptions 5 participant listAgentThreadsServerFn 6 participant recentThreads 7 Member->>AgentPanel: open chat history 8 AgentPanel->>agentThreadsOptions: load organization threads 9 agentThreadsOptions->>listAgentThreadsServerFn: request thread list 10 listAgentThreadsServerFn->>recentThreads: query authorized member threads 11 recentThreads-->>listAgentThreadsServerFn: return titled thread summaries 12 listAgentThreadsServerFn-->>agentThreadsOptions: return thread summaries 13 agentThreadsOptions-->>AgentPanel: provide chat history 14 Member->>AgentPanel: select a thread 15 AgentPanel-->>Member: open selected chat - New Features
Merge Risk: ๐ต Low ยท up to 985f3
Chat history can show fewer than 30 chats, or none, when recent chats have no usable title, even though older titled chats exist. Access scoping looks correct. This is a bounded display gap that can be fixed as a follow-up.
Security architecture risk: ๐ต Low ยท up to 985f3
History requests are restricted to the authorized organization and signed-in member, and reopening a conversation independently checks ownership. No new authorization bypass was established. Normal sign-out replaces the browserโs cached state, but rapid conversation switching and other session-change scenarios retain some unverified cleanup behavior.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
- observed โ A successful listing exposes message-derived titles, thread identifiers, and timestamps for the requesting actorโs threads in one authorized organization. Existing support access still uses the support actorโs own user ID, not another memberโs history.
Security Findings and Attack Paths
- observed โ The deferred cache candidate concerns member-specific results stored under an organization-only key. Normal sign-out performs a document reload, and router creation constructs a new QueryClient, providing counterevidence to reuse across that transition. This does not establish behavior for every same-document or cross-tab session change; the candidate remains unverified rather than an observed disclosure.
Trust Boundaries and Controls
- observed โ History-list membership is not the authority for opening or modifying a conversation. Both hydration and streaming derive organization/member scope from the authenticated caller and independently check thread ownership, so supplying another memberโs existing thread ID is rejected at the chat boundary.
Resilience and Maintainability Implications
- observed โ Conversation state is separated by organization and thread, and the chat server propagates request abort into its stream controller. Client-side abort and stale-event suppression when an active conversation unmounts remain unverified; the inspected code does not establish a new cross-identity state leak.
Hardening Proposals
- proposed โ Partition cached history by authenticated user or session as well as organization, making privacy isolation explicit rather than dependent on document replacement during identity changes.
Pre-merge checks ยท Passed 4 ยท Failed 1
Failed Failed checks (1 warning)
Check name Status Explanation Resolution Docstring Coverage Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold. Passed Passed checks (4 passed)
Check name Status Explanation Title check Passed The title clearly summarizes the main changes: adding chat titles and a Chat history list in the agent panel. Description check Passed The description directly explains the chat titles, Chat history behavior, permissions, refresh behavior, and related tests. Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
- Fix all pre-merge checks with AI
โจ Finishing Touches
๐ Generate docstrings
- Commit to this branch
- Create a new PR
๐งช Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix ยท Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.