fix(frontend): reconnect useMultiSSE when session id changes#7257
fix(frontend): reconnect useMultiSSE when session id changes#7257wilmerdooley wants to merge 1 commit into
Conversation
Signed-off-by: wilmerdooley <wilmerdooley1@gmail.com>
PR Requirements WarningThis PR does not meet the contribution requirements. PR Author: @wilmerdooley To fix:
Exception: To bypass this requirement, you can:
Micro-fix requirements (must meet ALL):
Why is this required? See #472 for details. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesSession ID change detection in SSE reconnection
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Description
The
useMultiSSEhook incore/frontend/src/hooks/use-sse.tsonly checked whether anagentTypekey already existed in its connection map, so a session restart that reused the same agent type left the oldEventSourceconnected and never opened one for the new session. This diff tracks the session id alongside eachEventSourceand reopens the connection when the session id changes (or the agent is removed).Resolves #6391
Type of Change
Related Issues
Resolves #6391
Changes Made
EventSourceand itssessionIdper agent type in the hook's internal map.sessionsupdate, close the existing connection when theagentTypeis removed or itssessionIddiffers from the desired one.EventSourcefor any agent whose session is new or whosesessionIdchanged, filtering out entries with an emptysessionId.useMultiSSEto reflect the diff-and-reconnect behavior.Testing
Describe the tests you ran to verify your changes:
Manually verified by starting a conversation, restarting the agent session, and confirming the frontend closes the old
EventSource(logged via the existing[SSE] closingdebug line) and opens a new one for the newsessionId, after which streaming responses, typing indicators, and tool call updates resume without a page refresh.Checklist
Summary by CodeRabbit