Skip to content

Implement client-session routing for Agent Web Socket Server#2175

Draft
GeorgeNgMsft wants to merge 21 commits intomainfrom
dev/georgeng/websocket_session_map
Draft

Implement client-session routing for Agent Web Socket Server#2175
GeorgeNgMsft wants to merge 21 commits intomainfrom
dev/georgeng/websocket_session_map

Conversation

@GeorgeNgMsft
Copy link
Copy Markdown
Contributor

Problem
AgentWebSocketServer is a process-level singleton, but updateBrowserContext() was assigning its invoke handlers and connection/message callbacks as direct fields — overwriting them on every call. With multiple concurrent TypeAgent sessions, each new enable call would silently reroute all client traffic to the most recently activated session context, causing the wrong session to handle browser actions, web agent messages, and client connect/disconnect events.

Solution
Replace the shared callback fields with a Map<sessionId, SessionHandlers> so each session owns its own isolated handler set. Client connections are routed to the correct session by embedding sessionId in the WebSocket connection URL as a query parameter.

Notes
Added Architecture section documenting the WebSocket server, connection URL format, session routing, client type detection, and channel multiplexing

GeorgeNgMsft and others added 18 commits April 7, 2026 16:52
Set exit code instead of calling exit directly.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…, IPC bridge)

Implements /session slash commands (list, new, switch, rename, delete) in the
renderer, a dropdown session selector in the chat header, and the main-process
IPC bridge with a local backend stub for in-process dispatcher mode.

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

This is a bigger change, we'll want to review this when working on the shell/browser extension clients

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