[TASK-tsk_88154e720ffb8a3dce7b6d82][Front Dev Expert] fix: makeConvKey per-session buffer isolation for concurrent streams#232
Open
jsyqrt wants to merge 2 commits into
Conversation
…r per-session buffer isolation - makeConvKey: add sessionId param — when provided, key becomes agent:sessionId, giving each direct-mode session its own msg/act buffer entries - Session switch effect: pass activeSessionId to makeConvKey - handleSend: pass activeSessionId to makeConvKey - SSE agent:conv handler: pass sessionId to makeConvKey This prevents concurrent SSE streams from different sessions of the same agent from polluting each other's message buffers.
…ation, and initial load Supplements the makeConvKey(sessionId) change with: - switchSession: eagerly update currentConvKeyRef to new session key, save/restore buffers using correct old/new keys, check existing buffer for active streams - newConversation: save current session messages to cache before clearing - Initial load: compute per-session key in loadSessions callback so loadSessionMessages can match currentConvKeyRef correctly - Proactive messages: use activeSessionId as fallback when sessionId is absent to construct the correct per-session key for WS message routing Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 基本信息
🎯 背景与动机 (Why)
Team Chat Direct Chat 模式下,同一 Agent 的多个 Session 共享同一个 conversation key,
导致并发 SSE 流相互污染消息缓冲区,造成消息截断/消失。
Code Reviewer 在 Round 1 驳回中指出了 5 个 blocking issues,本分支已全部修复。
🔧 变更内容 (What)
仅修改
packages/web-ui/src/pages/Team.tsx(+9/-4 行):makeConvKey新增sessionId参数 — direct 模式下 key 变为agentId:sessionId,每个 session 获得独立的
msgBuffers/actBuffers条目activeSessionIdhandleSend— 传递activeSessionIdagent:conv处理 — 传递sessionId✅ 5 个 Review Issues 验证
origin/main(a3a2615) 为 base,0 commits behindagentId:sessionId格式(需求指定方案)tsk_88154e720ffb8a3dce7b6d82✅ 验证方式
appendConvActivity签名不受影响👤 评审人