Repository navigation
fix(gateway): gate session.tool mirrors behind session subscriptions - #124732
Merged
Merged
Conversation
session.tool mirrors the raw agent tool event (full args/result snapshots) onto session subscribers, but the event name was missing from SESSION_SUBSCRIPTION_EVENTS. Clients with the session-scoped-events cap (or browser copilot) that subscribed to one session's messages therefore received every session's tool payloads through the mirror — the exact data the registry gate suppresses on the raw agent event. session.observer was added to the set for precisely this mirror-event class; session.tool carries strictly more data. Root cause: the gate is an allowlist and the newer mirror event never joined it. One set entry; the payload already carries sessionKey so registry keying works unchanged, and unscoped Control UI clients keep full fanout. Regression: new board test drives the server-chat-style targeted fanout and asserts a scoped client subscribed to a different session receives nothing — fails pre-fix.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 16, 2026 18:22
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 17, 2026
…penclaw#124732) session.tool mirrors the raw agent tool event (full args/result snapshots) onto session subscribers, but the event name was missing from SESSION_SUBSCRIPTION_EVENTS. Clients with the session-scoped-events cap (or browser copilot) that subscribed to one session's messages therefore received every session's tool payloads through the mirror — the exact data the registry gate suppresses on the raw agent event. session.observer was added to the set for precisely this mirror-event class; session.tool carries strictly more data. Root cause: the gate is an allowlist and the newer mirror event never joined it. One set entry; the payload already carries sessionKey so registry keying works unchanged, and unscoped Control UI clients keep full fanout. Regression: new board test drives the server-chat-style targeted fanout and asserts a scoped client subscribed to a different session receives nothing — fails pre-fix.
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.
What Problem This Solves
session.toolmirrors the raw agent tool event — full tool args and result snapshots — onto session subscribers so operator UIs attaching mid-run can render live tool cards. But the event name was missing fromSESSION_SUBSCRIPTION_EVENTS, the allowlist that scopes session-bearing broadcasts for clients with the session-scoped-events cap (and browser copilot clients). A scoped client subscribed to one session's messages therefore received every session's tool payloads through the mirror — the exact data the registry gate correctly suppresses on the rawagentevent. The gate's own comment promises "opt-in scoped clients never receive session-bearing broadcasts without an authoritative registry key";session.observerwas added to the set for precisely this mirror-event class, andsession.toolcarries strictly more data.Why This Change Was Made
Root cause: the gate is an allowlist and the newer mirror event never joined it. The fix is one set entry with an invariant comment. The payload already carries
sessionKey(server-chat spreads it intoagentPayload), soresolveBroadcastSessionScopekeys the registry check without any producer change, and unscoped Control UI clients keep full fanout per the existing design.User Impact
Session-scoped clients (browser copilot, cap-gated integrations) no longer see tool arguments and results from sessions they did not subscribe to. No change for regular Control UI clients.
Evidence
src/gateway/server-broadcast.board.test.tsdrives the server-chat-style targetedsession.toolfanout: scoped client subscribed to the same session receives it, scoped client on a different session receives nothing, unscoped client keeps full fanout — fails pre-fix (cross-session leak).node scripts/run-vitest.mjs run src/gateway/server-broadcast.board.test.ts src/gateway/server-chat.agent-events.test.ts— 161 tests pass.