feat(kitchen-sink): persist conversation ids and feedback - #229
feat(kitchen-sink): persist conversation ids and feedback#229gabrielelpidio wants to merge 4 commits into
Conversation
commit: |
bbfa8d6 to
c0dc545
Compare
…LITY_NAME constant - Add conversation persistence with localStorage via useConversations hook - Add conversation list/selector UI component - Pass conversationId to API and set as span attribute for telemetry - Export CAPABILITY_NAME constant and use it across all eval files Amp-Thread-ID: https://ampcode.com/threads/T-019c05e1-7db0-7084-a8e0-fa92e3e8d21d Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c06fe-acb5-763e-a0a2-3b8e0c5799d3 Co-authored-by: Amp <amp@ampcode.com>
…aces - Pass conversationId from frontend through API to all support agent spans - Add gen_ai.conversation.id attribute to GenAI spans via withSpan - Include conversationId in FeedbackLinks for trace correlation - Update categorizeMessage and extractTicketInfo to accept conversationId - Follows OpenTelemetry GenAI semantic conventions Amp-Thread-ID: https://ampcode.com/threads/T-019c0b09-d2b6-71a9-8710-1361f8cfe781 Co-authored-by: Amp <amp@ampcode.com>
- Store traceId/spanId with each assistant message in localStorage - Use per-message links for sendFeedback instead of latest result - Add StoredMessage and FeedbackLinksData types to conversations.ts - Enables accurate feedback for any message in conversation history Amp-Thread-ID: https://ampcode.com/threads/T-019c0b09-d2b6-71a9-8710-1361f8cfe781 Co-authored-by: Amp <amp@ampcode.com>
c0dc545 to
47a2af8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| return remaining.length > 0 ? remaining[0].id : null; | ||
| } | ||
| return prev; | ||
| }); |
There was a problem hiding this comment.
Stale closure in deleteConversation selects deleted conversation
Medium Severity
The setCurrentId updater inside deleteConversation reads conversations from the outer closure instead of the latest state. The setConversations call above correctly uses a functional updater with prev, but the conversations variable referenced on line 124 is the stale value captured in the useCallback closure. If multiple deletions occur before a re-render, the fallback logic may select an already-deleted conversation as currentId.
| setMessages, | ||
| updateTitle: updateConversationTitle, | ||
| }); | ||
|
|
There was a problem hiding this comment.
Feedback state not reset on conversation switch
Medium Severity
The feedbackGiven state (keyed by message index) is never cleared when switching conversations. After giving feedback on, say, message index 2 in one conversation, switching to another conversation will incorrectly show that same feedback indicator on its message index 2. The state needs to be reset when currentId changes.
| setResult(null); | ||
| setError(null); | ||
| } | ||
| }, [conversationId, getMessages]); |
There was a problem hiding this comment.
Conversation switch doesn't reset loading state, corrupts UI
Medium Severity
When switching conversations, the useEffect resets result and error but not isLoading. If a request is in-flight for conversation A and the user switches to conversation B, the "Thinking..." indicator shows on conversation B and the input is disabled — even though B has no pending request. Worse, when A's response arrives, the stale handleSubmit closure calls setLocalMessages and setResult with A's data, overwriting B's view with the wrong conversation's messages.


Summary
Adds persistent conversation ID support to the kitchen-sink support agent example to enable multi-turn conversation correlation in traces and feedback.
Changes
Note
Medium Risk
Touches both UI state/persistence and the support-agent request/trace plumbing; regressions could break chat history, conversation selection, or feedback/trace correlation, though changes are scoped to the kitchen-sink example.
Overview
Adds persistent, multi-conversation support to the kitchen-sink
support-agentconsole page: a sidebarConversationList, create/select/delete flows, and localStorage-backed message history via newuseConversations.Threads
conversationIdend-to-end by updatinguseSupportChatand thesupport-responseAPI to include it, and propagates it into support-agent capability spans/feedback links (plus centralizes the capability name constant). Feedback submission now uses the specific assistant message’s storedlinksrather than the last agentresult, enabling correct per-message trace correlation across conversations.Written by Cursor Bugbot for commit 47a2af8. This will update automatically on new commits. Configure here.