Repository navigation
fix(gateway): scope session events and mention notifications - #184502
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR applies session membership to presence and ancestor events, validates targeted Inbox invalidations, and registers mention-failure notifications. Example: An invited reader watches agent:main:shared.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful, maintainer-approved authorization repair with no actionable findings; exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway broadcaster receives session, presence, and Inbox events, applies current recipient scopes and sharing authority, and sends projected frames over each connection. flowchart LR
A[Session and Inbox producers] --> B[Gateway broadcaster]
C[Current profiles and memberships] --> D[Recipient projections]
B --> D
D --> E[Scope and delivery checks]
E --> F[WebSocket recipients]
Technical reviewBest possible solution: Land this focused event slice through the existing sharing owners once required exact-head checks pass. Do we have a high-confidence way to reproduce the issue? Current main explicitly supplies no membership to presence filtering and uses a membership-blind ancestor filter; the supplied main/head Gateway comparison independently demonstrates the presence and malformed-invalidation differences. Is this the best way to solve the issue? The patch is the smallest coherent repair: it supplies existing membership facts to existing projections, replaces the broad invalidation exemption, and adds the bounded failure-event contract without another state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 189e653d99ad. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +67, Tests +53, Other +3. Total +123 across 16 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
Reviewed October 27, 2026, 9:19 PM ET / October 28, 2026, 01:19 UTC (Revision 6). |
ce0d080 to
a04d554
Compare
3a63dc4 to
44c5b6d
Compare
a04d554 to
d639c52
Compare
44c5b6d to
3f6a519
Compare
3f6a519 to
4f8b756
Compare
d639c52 to
0db3b01
Compare
3037b45 to
0430e19
Compare
85c7e94 to
04e7cc8
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
58ef39f to
35b285e
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
35b285e to
4ce3374
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
4ce3374 to
ad889b6
Compare
Co-authored-by: jalehman <[email protected]> Co-authored-by: vincentkoc <[email protected]>
ad889b6 to
4c0830b
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Resolves the test-line ceiling conflict with #184502: main at beb12fa counts 6,293,568 test lines against its ceiling of 6,293,290, and this PR adds 74, so the ceiling is the merged total of 6,293,642 with no extra slack. Co-authored-by: jalehman <[email protected]>
…#184500) ## What Problem This Solves Direct session reads can cross asynchronous preparation while a guest's membership or committed role policy changes. ## User Impact History, metadata, session descriptions, progress cards, legacy search and in-process reads use current session access at publication. ## Why This Change Was Made Carry retained membership facts through the existing read owners and repeat authorization after awaited preparation. Legacy search selects requests using the committed policy in the synchronous publication frame. Unrestricted retired-store searches retain copied-transcript deduplication; role-filtered reads still reject ambiguous metadata. Preserves the concurrent [publication-policy follow-up](openclaw@3037b45) with its authorship. Stack step **4/17**, based on [fix/guest-access-runtime-fixtures-20261027](https://github.com/openclaw/openclaw/tree/fix%2Fguest-access-runtime-fixtures-20261027). Review and merge in order; each upper PR contains only its own slice against its predecessor. Previous: [repair fixtures and refresh worker inventory](openclaw#185780). Next: [scope live events and Inbox notifications](openclaw#184502). Stack order: [complete stack](openclaw#184515 (comment)). ## Evidence Slice head: `3b7709a811b1d7902321dd77ae1eb8c568579f91`, on fixed main `2a97a1e02a3085cded2db1cb0f971bd99d918252`. The complete 13-file integration matrix passed 46/46 on pinned Bun at `ddc49fd63d3b82e41eb6c74af4ad935a56aebc8f` before this main rebase. Main's canonical fixture repairs are preserved and duplicate prerequisite changes removed. Prefixes are not separately built locally; each requires its own current-head hosted CI and review. The final integration exercises authenticated metadata reads and the production subagent transport. An unrelated guest receives no private result and sends no provider request; membership enables both. Removing membership after metadata or real DNS/SSRF preparation rejects publication/dispatch. The provider case uses the production runtime caller and a loopback HTTP provider, not the authenticated WebSocket fork entry point. The four-file RPC regression set also passed 29/29 on Node and pinned Bun at `5cd3488508bfbd52b4c59ad7736f84831e60ed22`. The [stack evidence ledger](openclaw#184515 (comment)) records runtime results, prior build/upgrade proof and limits. Integration tests are owned by the final activation PR. Current-head hosted CI and review remain required before landing. ### Current-head qualification At `3b7709a811b1d7902321dd77ae1eb8c568579f91`, [hosted CI](https://github.com/openclaw/openclaw/actions/runs/40508432889) and the required `openclaw/ci-gate` passed. The [current-head ClawSweeper review](openclaw#184500 (comment)) reports no findings or required rank-up moves. Maintainer review and the documented stack order still apply. ## Change size Production **+174/-80**; tests **+620/-8**. Current membership is rechecked at retained/asynchronous read publication, using the existing authorization owner. ### Test-line allowance `config/test-lines-baseline.txt`: **6,282,239 → 6,283,321** (**+1,082**). Retained-read and committed-policy regressions require 612 added test lines. This first test-growing slice also accounts for the fixed main's existing 472-line overage, less the prerequisite's two-line reduction. The ceiling equals this prefix's measured 6,283,321 test lines; no spare allowance is added. This is a bounded baseline exception under the repository testing workflow, not a functional-test waiver. No runtime assertion, SDK budget or required CI check is weakened. Change-size test counts include the baseline metadata edit. ## Final-head AWS qualification — October 27, 2026 This section supersedes the earlier head-specific qualification and test-line numbers above; the original stack description, credit, and complete-stack evidence are retained. Final candidate: `a020f29e47fba3cf4e86741bdcaab6966f709a49`, rebased on main `868c09e1a1b618cc898be1545084f23e0504952a`. The three existing slice commits were retained patch-identically apart from resolving the measured ceiling; the additional follow-up fixes the independently reproduced search-publication gap described below. A later main update conflicted only in the global ceiling; the four product/test patches remained unchanged through that restack, confirmed by range-diff. The complete fresh AWS matrix below was repeated on this exact resulting head rather than relabeling the earlier successful run. Prerequisite openclaw#185780 is merged, and this PR now targets main. ### Final-effect regression and local checks A real legacy, unfiltered search handler regression failed on `bebf096d87566de82f727b780161770b91d1ee6b`: changing the session from shared to draft after the final metadata worker read still returned its private snippet plus indexing/truncation/archive metadata. The fix checks the existing projection owner's committed sharing facts with the existing access-change predicate, synchronously before selection/publication. The cap-downgrade companion and draft-transition regression now both pass. This preserves Vincent's unrestricted retired-store deduplication behavior; no new authorization owner, config option, schema, or protocol is shipped. - Final candidate: **100 tests passed across 9 scoped files**, including the new regression and affected read, metadata, scoped-search, and in-process consumers. - The focused search set passed **25/25 across 3 files**; the draft case was red on the prior candidate. Earlier base-red member-admission evidence remains distinct from this additional red/green result. - **Core typecheck, scoped typed lint (10 files), formatting, and diff whitespace checks passed.** Fresh independent P0–P2 review of the repair was scoped-clean. Canonical local autoreview also reviewed the final committed range (main `868c09e1a1b618cc898be1545084f23e0504952a` → candidate `a020f29e47fba3cf4e86741bdcaab6966f709a49`) through P2: one complete frozen-input pass, exit 0, scoped-clean, with no actionable findings. The reviewer did not run code; runtime and test evidence are reported separately. - Final diff against the pinned main base: production **+181/-79**, regression tests **+628/-7**, plus the ceiling metadata **+1/-1**. - Canonical ratchet: **6,287,068 test lines; ceiling 6,287,068; zero slack**. The ceiling is 665 above the base's recorded 6,286,403: 621 new test lines and the base's existing 44-line overage. The invited-membership regressions guard a security boundary, and offsetting them by deleting other tests would remove coverage. This is the exact measured final-tree allowance authorized for this stack, not a test waiver. - Final-head hosted CI: [40566580413](https://github.com/openclaw/openclaw/actions/runs/40566580413). Its required ci-gate and exact-head review remain required before landing. ### Fresh AWS behavior proof AWS doctor passed before a fresh `openclaw-check` / `c7a.2xlarge` lease (measured **8 CPUs, 15,613 MiB RAM**). The trusted secretless bootstrap verified that the instance-role credentials endpoint returned 404. Independent runtime builds used the exact candidate and its pinned main base, then booted real isolated Gateways with synthetic state. All reads crossed authenticated **WebSocket protocol 4**, trusted-proxy identities, and only `operator.read` / `operator.write` scopes—**no admin scope**. No Team Gateway, real conversation, or real model credential was used. The seven RPCs were `chat.history`, `chat.startup`, `chat.metadata`, `sessions.describe`, `sessions.get`, `sessions.preview`, and `sessions.search`. Content reads asserted the synthetic canary, not just success flags. | Scenario | Disclosing reads | Result | |---|---:|---| | Existing view / none policies, owner/member/unrelated, before and after membership removal | Identical normalized content/authorization results on base and head | Pass | | Invited head, member | 7/7 | Pass | | Invited head, unrelated principal | 0/7 | Pass | | Invited head, member immediately after real membership removal | 0/7 | Pass | | Main negative control with the same proof-only enum enablement, member | 0/7 | Pass | A disposable plugin also drove the real public SDK `subagent.forkSession` path from the authenticated WebSocket caller to a local HTTP model fixture. An admitted member caused real inference I/O; a nonmember caused none. The next member fork was held in the model response, and another member fork reached the real subagent queue after retained-read preparation. Membership was then removed through the real RPC. **Both active and queued responses were withheld; the queued request made no model call: request count 2 → 2.** The queue observation used public diagnostics, not mocked authorization or inference. **Wrapper result: exit 0, succeeded**, with both protocol phases and the final AWS proof assertion passing. The corrected idempotent held-response finalizer completed cleanly. Candidate/base build times were 144.29 / 131.00 seconds; invitation-variant builds were 107.39 / 117.37 seconds. ### Proof-only enablement and cleanup Invitation config activation still belongs to the final stack slice. Only in disposable, unpushed proof variants of **both** candidate and main, the enum was enabled as follows: ```diff - others: z.enum(["none", "view", "suggest", "write"]), + others: z.enum(["none", "view", "suggest", "write", "invited"]), ``` The canonical `pnpm config:docs:gen` regenerated the two affected hashes in `docs/.generated/config-baseline.sha256`; these were the only additional tracked proof-variant changes. Normal commit hooks ran. Neither enablement variant was pushed. After collecting the sanitized summaries, source/tree identities and both enablement diffs, blocking release and an independent inspection confirmed **released, no host, not ready, cleanup complete, no provisioning resource remaining** at **2026-10-27T19:30:13.175Z**. The collected archive was readable with the same SHA-256 after release: `e63aa15f834bcf74a74253880db6003cbdcd2560627897a94d56dca397c295ed`. Lease identifiers, principal/session IDs, addresses, keys and endpoints are omitted from this public evidence. Co-authored-by: vincentkoc <[email protected]> Co-authored-by: jalehman <[email protected]>
…w#184502) Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: jalehman <[email protected]>
What Problem This Solves
Session-only clients lose targeted Inbox invalidations, while session and presence events must respect invitation membership.
User Impact
Deliver bounded mentions.changed notifications only to intended connections; scope session events and the additive mentions.failed envelope to current readers.
Why This Change Was Made
Reuse canonical sharing projections for presence/events. The keyless invalidation exception requires a targeted, validated payload; it is not a general broadcast exemption.
Stack step 5/17, based on fix/guest-access-03-rpc-reads-20261026. Review and merge in order; each upper PR contains only its own slice against its predecessor.
Previous: recheck access before RPC reads return.
Next: guard collaboration reads and interactions.
Stack order: complete stack.
Evidence
Slice head:
85c7e9427eccd6bbf9ebf9f1c182420a19065aed, on fixed main5bf0c41a03f1dba03d625460607ed5b959710458. The complete 13-file integration matrix passed 46/46 on pinned Bun atddc49fd63d3b82e41eb6c74af4ad935a56aebc8fbefore this main rebase. Main's canonical fixture repairs are preserved and duplicate prerequisite changes removed. Prefixes are not separately built locally; each requires its own current-head hosted CI and review.The final authenticated TLS/WebSocket integration covers child-only versus parent membership, current viewers/presence, scope preservation, and a text event already queued behind a held send. Removing membership before queue drain prevents disclosure. Event payloads are synthetic; recipient projection, broadcaster, queue and transport are real. Existing targeted Inbox, malformed-envelope and serialization regressions remain.
The stack evidence ledger records runtime results, prior build/upgrade proof and limits. Integration tests are owned by the final activation PR. Current-head hosted CI and review remain required before landing.
Current-head qualification
At
85c7e9427eccd6bbf9ebf9f1c182420a19065aed, hosted CI and the requiredopenclaw/ci-gatepassed. The current-head ClawSweeper review reports no findings or required rank-up moves. Maintainer review and the documented stack order still apply.Change size
Production +49/-7; tests +55/-2; generated +6094/-6066.
Session event authorization and bounded targeted Inbox notifications share the canonical membership projection.
The large generated diff is predicate renumbering from the additive mention-failure event; protocol version is unchanged.
Test-line allowance
config/test-lines-baseline.txt: 6,283,321 → 6,283,374 (+53). Covers targeted Inbox envelopes and session-event authorization. The ceiling equals this prefix's measured 6,283,374 test lines; no spare allowance is added. This is a bounded baseline exception under the repository testing workflow, not a functional-test waiver. No runtime assertion, SDK budget or required CI check is weakened. Change-size test counts include the baseline metadata edit.Current landing qualification — October 28
This section supersedes prior-head qualifications retained above. Current head: 4c0830b, restacked only the event slice onto main 27a0be4. Main's existing UI lint repair is preserved. The prerequisite #186308 was closed as superseded, not merged: main c8df2834 / #186330 independently fixes the shared-observer startup failure, and latest scheduled-main evidence shows the exact case passing in 69 ms and all 18 tests in that file passing (the aggregate job has other failures).
The ceiling is 6,293,290, exactly the canonical test-line total of verified GitHub merge candidate e3967fab8aa77007824707bcdaa6f8d4eaebb942, whose parents are the pre-counter-correction head ad889b64b4825441a3848454206f79f36d0a3bce and main d249181: zero candidate slack. The head-only count is 6,293,049; 241 existing main test lines explain the difference. No tests are deleted and no future allowance is added. Current-head CI’s baseline ratchet passes.
Local validation and review
Fresh AWS behavior proof
The range from the original tested main 91e8cd0 to the new base touched event/sharing/mention owners, so the earlier AWS run was not simply carried over. A fresh AWS openclaw-check c7a.2xlarge lease (observed 8 CPUs, 16,371,785,728 bytes RAM) ran the complete four-build/six-scenario comparison. AWS doctor passed; secretless execution used Node 24.22.1, pinned pnpm, no hydration or instance-IAM credentials, isolated synthetic state/free ports, signed real WebChat devices, trusted-proxy authentication, exact proxy scope caps, protocol 4, and no admin scopes. Connections started only after /readyz reported ready.
Runtime-tested and published head: 4c0830b, versus main 27a0be4. A new baseline-only merge conflict was resolved under existing landing authority. The newly integrated main range changes session-row preparation/presentation and sharing-related tests, so another fresh lease reran the entire proof rather than carrying over the preceding run. Both previously completed fresh proof leases were already independently verified released.
All stages passed: main/head original builds, each proof-enabled build, main/head × view/none/invited, generated-hash checks, exact proof-diff guards, comparison and source restoration. All six Gateway processes and their process groups exited cleanly; all WebSockets closed, without forced cleanup.
Synthetic plugin ingress uses the real request-context broadcaster; public RPCs own session creation, membership, subscriptions, viewers and label mutations. No authorization predicate, projection, client or transport is mocked. This proves delivery, not Inbox ingestion/persistence or inference. Ancestor recaps were absent for both owner/member in the real label-event scenario, so no live ancestor-recap claim is made.
Compute release was independently verified at 2026-10-28T01:47:08.613Z: released, no host, not ready, cleanup complete, and no possible provisioning resource remaining. Evidence was downloaded before release and re-read afterward with matching SHA-256. Archive digest: f2b45b26f01a27328fb7e3b3b3e6f6d6405dec3e2bc87432a1a40c74eca79128. Raw identities, keys, endpoints, state and logs are not published.
Main owner-path changes requiring the fresh run
Exact proof-only enablement — never pushed
Generated with pnpm config:schema:gen and pnpm config:docs:gen; pnpm config:docs:check passed. Only the enum and generated hash file changed; both restored after proof. Diff SHA-256: ff868bcacf47b9b12e6a5e0acc6705189ff3b696dc4e6d0fff2973e4fda93923.
Current CI attribution
Prior run 40605493581 also failed Android Play: NodeRuntimeAgentSelectionTest.failedDiscoveryRetryInitializesChatEvenWhenTheMainKeyIsUnchanged, assertFalse(history.isCompleted), line 1062 (3,634 tests, one failure). The Android source tree is unchanged between the passing scheduled-main Android Play job, this head, and that failing merge parent. Its fixture uses an in-process synthetic Gateway, so this TypeScript event patch is not exercised. This is an unrelated flaky result, not a proven deterministic defect; no Android code, assertions or timeouts were changed and no CI rerun/dispatch was requested. The current metadata correction repairs the actual ratchet defect and legitimately triggers new exact-head CI. ci-gate success, clean exact-head ClawSweeper and CLEAN merge state remain mandatory; no inherited-failure bypass is selected.
Exact-head CI
Run 40613787535 is green for 4c0830b, including the baseline ratchet and Android lanes. No CI rerun, dispatch or empty green-only push was used. This remains separate from required exact-head ClawSweeper and CLEAN merge state.