Repository navigation
fix(gateway): retain membership checks across session reads - #184500
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 carries current membership through asynchronous session reads and rechecks access before publishing content or permitting inference. Example: An invited member reads agent:main:invited-read containing “Synthetic member-only history.”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR completes membership-aware session reads, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAuthenticated Gateway RPCs and in-process plugin reads consume prepared session rows, committed membership, and caller policy to authorize responses and subsequent inference. flowchart TD
A[Authenticated caller] --> B[Gateway read handler]
B --> C[Session row and sharing owners]
C --> D[Asynchronous preparation]
D --> E[Current membership and policy check]
E --> F[Authorized response or inference]
Technical reviewBest possible solution: Keep membership and policy checks in the existing sharing owners and consume their current facts synchronously at disclosure and inference boundaries. Do we have a high-confidence way to reproduce the issue? Current main passes no membership facts to affected read filters; the supplied base-negative runtime control and reported red/green search regression corroborate that source path, without this review executing target code. Is this the best way to solve the issue? The patch uses the existing authorization, retained-read, and projection owners, preserves established exemptions and search deduplication, and needs no additional state or public API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 161c376d51b8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +102, Tests +621, Other 0. Total +723 across 11 files. Added test files: 3. View PR surface stats
Review metrics
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 (4 earlier review cycles)
Reviewed October 27, 2026, 3:22 PM ET / 19:22 UTC (Revision 5). |
499bceb to
fb2cd57
Compare
3a63dc4 to
44c5b6d
Compare
0485c52 to
7bffdd4
Compare
ece41bf to
dc19840
Compare
44c5b6d to
3f6a519
Compare
de6d086 to
87875a6
Compare
## What Problem This Solves The session-visibility fixture closes shared state before its agent borrowers retire. The conversation-capture fixture targets a stale optional-audit boundary. ## User Impact Validation prerequisite with no production changes. Teardown uses the existing asynchronous cleanup owners; the audit fixture keeps the durable reply and waiter assertions. ## Why This Change Was Made - Await agent-state retirement before shared-state cleanup in the session-visibility fixture. - Fail optional audit append at its actual boundary and reuse canonical capture defaults. - Regenerate the database worker inventory without changing classifications. The fixed main already contains the canonical Doctor cleanup, required-terminal-reply and runtime-harness fixture repairs. Their duplicate changes were removed from this PR. Stack step **3/17**, based on main `5bf0c41a03f1dba03d625460607ed5b959710458`, which includes the merged [session inventory membership](#184495). Next: [retained session reads](#184500). Review and merge in order. ## Evidence [Current-head CI](https://github.com/openclaw/openclaw/actions/runs/40508436815) passed at `738152457fa4d3b5a8e0025a7f4f90405411eb96`. The [ClawSweeper review](#185780 (comment)) covers the same head and reports no actionable findings or required rank-up moves. Slice head: `738152457fa4d3b5a8e0025a7f4f90405411eb96`. Before the main rebase, the complete conversation-capture fixture passed **26/26 under Node** and session-visibility fixture passed **9/9 under pinned Bun** in original order. Current-head hosted CI qualifies this prefix. Canonical worker inventory: **695 non-test files / 2,482 call expressions**. The prerequisite reduces test LOC by two and leaves the test-line ceiling unchanged. The [stack evidence ledger](#184515 (comment)) distinguishes integrated proof from each prefix's hosted CI. ## Change size Production **+0/-0**; tests **+22/-24**; generated **+46/-33**. Two test files plus generated documentation. Co-authored-by: vincentkoc <[email protected]> Co-authored-by: jalehman <[email protected]>
3b7709a to
bebf096
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep Vincent's invitation-aware read slice and select legacy search requests with committed policy after awaited preparation. Add handler regressions for invited admission and revoked publication/provider dispatch. Co-authored-by: jalehman <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Compare final worker metadata with current projection-owned access facts before publishing legacy search content or page metadata. Preserve the invited-read and retired-search deduplication patches. Co-authored-by: vincentkoc <[email protected]> Co-authored-by: jalehman <[email protected]>
8b14693 to
a020f29
Compare
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 with its authorship.
Stack step 4/17, based on fix/guest-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.
Next: scope live events and Inbox notifications.
Stack order: complete stack.
Evidence
Slice head:
3b7709a811b1d7902321dd77ae1eb8c568579f91, 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 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 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 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 +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 main32075f317aff05b0c20f66d69decb89d6458d177. 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 #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.32075f317aff05b0c20f66d69decb89d6458d177→ candidatea020f29e47fba3cf4e86741bdcaab6966f709a49) 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.Fresh AWS behavior proof
AWS doctor passed before a fresh
openclaw-check/c7a.2xlargelease (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 onlyoperator.read/operator.writescopes—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, andsessions.search. Content reads asserted the synthetic canary, not just success flags.A disposable plugin also drove the real public SDK
subagent.forkSessionpath 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:
The canonical
pnpm config:docs:genregenerated the two affected hashes indocs/.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.