Repository navigation
fix: filter watched-session presence by recipient visibility - #130764
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready proof for The canonical recipient projection now protects hello snapshots, Exact local commands (all exit 0): node scripts/run-vitest.mjs src/gateway/server-broadcast.serialization.test.ts src/gateway/server.auth.identity-scopes.test.ts src/gateway/session-message-events.test.ts src/gateway/server/health-state.test.ts src/gateway/server/ws-connection/connect-hello.update-scope.test.ts src/gateway/server/ws-connection/connect-hello.setup-completion.test.ts src/gateway/server/ws-connection/message-handler.post-connect-health.test.ts src/gateway/gateway-misc.test.ts src/gateway/session-sharing.test.ts src/gateway/session-viewer-presence.test.ts src/gateway/server-methods/sessions-viewers.test.ts src/infra/system-presence.test.ts
node scripts/check-changed.mjs
git diff --check HEAD^ HEAD
pnpm buildCI run 33047015467 completed successfully on the exact head, with no failed-job retry. Production +109/-5 (net +104); tests +435/-6 (net +429). The growth adds the missing recipient boundary and shared read-only exact resolution; no auth, config, schema, persistence, dependency, UI/person-card, timing or health-summary policy was changed. Proof limits: this is real authenticated Gateway/WebSocket fixture execution with synthetic state, not a separately packaged UI or external provider/channel test. No visual change or operator Gateway mutation is involved. Fresh Codex autoreview had no actionable P0 findings, and independent source review found no verified blocker; the automated review was P0-scoped. The latest ClawSweeper comment still says review started and contains no findings or rank-up moves; its review is not represented as complete. Proceeding through native |
|
Merged via squash.
|
Closes #130732 — watched-session presence references ignore recipient visibility.
Related: #130664 (People activity cards) and #130649 (feature context); those remain separate work.
Additional instructions
This branch is in the main repository and remains editable by maintainers.
What Problem This Solves
Resolves a problem where Gateway clients receive watched-session references that their own session list omits. Hello snapshots,
system-presence, and presence events previously returned the raw watched-key array, including creator-only drafts, incognito sessions, role-hidden sessions, and stale references. Pairing-only and node connections could also receive those nested references.Why This Change Was Made
One recipient projection now applies the existing
createSessionListEntryFilterpolicy at all three presence transport boundaries. It resolves sessions read-only, caches exact lookups only within a synchronous fanout, preserves agent-qualified sentinel keys, and omits missing sessions even for admins. The broadcaster never falls back to a raw roster when its projector is absent.Filtering declarations cannot account for other recipients, and UI-only masking leaves the references on the wire. This leaves the raw producer and existing authorization policy intact, including established admin grants, while removing the three unprojected egress paths. It does not change UI/person cards, timing/time-zone policy, health summaries, configuration, protocol schemas, storage schemas, or dependencies.
User Impact
Presence carries only watched-session references visible to the receiving operator under the existing session-list policy. Clients without session read access, and pending non-admin identities, retain the non-session roster without watched references. Person/device metadata, timestamps, event sequence numbers, and state versions remain unchanged. Hidden and missing references have no counts or omission markers.
This is a consistency repair within the existing shared-agent trust model, not a new multi-tenant isolation guarantee. Documentation: https://docs.openclaw.ai/concepts/presence.
Evidence
The pre-fix isolated Gateway/WebSocket reproduction at
99539badfd6fac6a4daa7d903ada250bfa5a2da3recorded 16 failing recipient/surface assertions while 13 existing identity-scope tests passed. The regression uses disposable state, synthetic trusted-proxy identities, real authentication/profile/session paths, and real WebSocket clients; TypeBox validates the returned presence shape. It compares hello, RPC, and event output with each recipient's canonicalsessions.listresult.Synchronized candidate:
00410f54ed1eaca596a26485cabc805e6e75db7d. The rebase was conflict-free andgit range-diffconfirmed the reviewed patch was unchanged.Local validation on the candidate (all exit 0):
web-tree-sittereval warnings match the prior build; no ineffective-dynamic-import warning was emitted.Exact commands:
Hosted CI run 33047015467 completed successfully on this exact head. The exact-head watcher and native
OPENCLAW_TESTBOX=1 scripts/pr prepare-run 130764both exited 0; preparation reused the hosted proof without changing the head.Coverage includes creator, ordinary reader, restricted reader, admin, pairing-only and node clients; pending identity and solo/system authority; both fanout orders; targeted delivery; frozen raw input; current visibility, deletion and role-policy changes; agent-qualified
global/unknown; and absence of missing-store creation. Subscription and hello/update siblings remain covered.This is authenticated Gateway/WebSocket fixture proof, not a separately built live UI or external provider/channel test. The absence of raw references is a wire assertion; there is no visual change to screenshot. No operator Gateway or live state was modified.
Production LOC: +109/-5 (net +104). Tests: +435/-6 (net +429). Docs: +37/-10 (net +27). The production growth adds the missing recipient ownership boundary and read-only exact resolution shared by three egress paths; no existing net-neutral equivalent could preserve these contracts without duplicating or changing the session policy.
Fresh Codex autoreview reported no actionable P0 findings; its requested threshold was P0, not an exhaustive lower-priority review. Independent source review also found no verified blocker. The watched-session field was introduced by #111225 (authored and merged by @steipete, commit
5c9916950e63ca0fbfb52abf7e9ecb2e43a4d43d, 2026-07-19); this report proves current source behavior and makes no stable-release impact claim.AI-assisted. The repair, owning visibility policy, transport call paths, and regression evidence were inspected before publication.