Skip to content

fix(gateway): retain membership checks across session reads - #184500

Merged
roboclaw-bot merged 4 commits into
mainfrom
fix/guest-access-03-rpc-reads-20261026
Oct 27, 2026
Merged

roboclaw-bot merged 4 commits into
mainfrom
fix/guest-access-03-rpc-reads-20261026

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

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 main 5bf0c41a03f1dba03d625460607ed5b959710458. 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 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 required openclaw/ci-gate passed. 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 main 32075f317aff05b0c20f66d69decb89d6458d177. 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.

  • 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 32075f317aff05b0c20f66d69decb89d6458d177 → 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. 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:

- 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.

@vincentkoc vincentkoc self-assigned this Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Oct 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.”

  • Before: The read filter receives no membership facts and hides the conversation from the member.
  • After: The member receives the conversation, while nonmembers and members removed during preparation receive no private content.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused owner-based repair with shipped-entry-point authority proof, meaningful regressions, and no actionable finding; exact-head CI is still pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): AWS qualification exercised authenticated WebSocket reads and public SDK inference against isolated Gateways with synthetic state and a local HTTP model fixture: members succeeded, unrelated and removed members received no content, and revocation blocked queued inference before I/O. All changed production blobs match that tested candidate; the inspected historical UI images are not used as authority proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Invited members cannot consistently read permitted conversations, and delayed reads must stop disclosing content when membership or policy changes.
Reason: The maintainer-authored direction completes already-merged membership policy at existing read boundaries without adding a configuration option or changing existing role defaults.

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
Reviewed head: a020f29e47fba3cf4e86741bdcaab6966f709a49

Before merge

None.

Findings

None.

Agent review details

How this fits together

Authenticated 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit da27b33 adds src/gateway/server-methods/session-scoped-read.ts:35 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: da27b336c0e9; files: src/gateway/server-methods/session-scoped-read.ts)
  • Peter Steinberger: Raw commit e1cb2b3 adds src/gateway/server-methods/chat-metadata-handler.ts:82 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e1cb2b3c22ac; files: src/gateway/server-methods/chat-metadata-handler.ts)
  • Shakker: Raw commit 282fc78 adds src/gateway/server-methods/chat-metadata-handler.ts:65 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 282fc78eaf64; files: src/gateway/server-methods/chat-metadata-handler.ts)
  • Ayaan Zaidi: Raw commit 164bd67 adds src/gateway/server-plugin-in-process-session-read.ts:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 164bd6756af1; files: src/gateway/server-plugin-in-process-session-read.ts)

PR surface

Source +102, Tests +621, Other 0. Total +723 across 11 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 6 181 79 +102
Tests 4 628 7 +621
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 11 810 87 +723

Review metrics

Metric Value Why it matters
Production versus test changes Production +181/-79; tests +628/-7 Production growth carries membership through existing consumers; tests cover distinct admission, revocation, publication, and retired-store compatibility failures.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a focused authorization repair preparing the approved invitation-only capability; configuration activation belongs to a later stack slice.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-26T10:51:10.148Z sha 3a63dc4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-27T11:54:07.095Z sha ce9ba1f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-27T13:15:33.088Z sha 3b7709a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-27T19:15:27.392Z sha a020f29 :: needs maintainer review before merge. :: none

Reviewed October 27, 2026, 3:22 PM ET / 19:22 UTC (Revision 5).

@roboclaw-bot
roboclaw-bot force-pushed the fix/guest-access-02-inventory-20261026 branch 2 times, most recently from 499bceb to fb2cd57 Compare October 27, 2026 04:35
@vincentkoc
vincentkoc force-pushed the fix/guest-access-03-rpc-reads-20261026 branch from 3a63dc4 to 44c5b6d Compare October 27, 2026 08:16
@roboclaw-bot
roboclaw-bot force-pushed the fix/guest-access-02-inventory-20261026 branch from 0485c52 to 7bffdd4 Compare October 27, 2026 08:17
@vincentkoc
vincentkoc marked this pull request as ready for review October 27, 2026 08:19
@roboclaw-bot
roboclaw-bot force-pushed the fix/guest-access-02-inventory-20261026 branch from ece41bf to dc19840 Compare October 27, 2026 08:59
@vincentkoc
vincentkoc force-pushed the fix/guest-access-03-rpc-reads-20261026 branch from 44c5b6d to 3f6a519 Compare October 27, 2026 09:29
@roboclaw-bot
roboclaw-bot force-pushed the fix/guest-access-02-inventory-20261026 branch from de6d086 to 87875a6 Compare October 27, 2026 10:05
Base automatically changed from fix/guest-access-02-inventory-20261026 to main October 27, 2026 10:44
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
roboclaw-bot pushed a commit that referenced this pull request Oct 27, 2026
## 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]>
Base automatically changed from fix/guest-access-runtime-fixtures-20261027 to main October 27, 2026 16:29
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 27, 2026
@roboclaw-bot
roboclaw-bot force-pushed the fix/guest-access-03-rpc-reads-20261026 branch from 3b7709a to bebf096 Compare October 27, 2026 18:39
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Oct 27, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

vincentkoc and others added 4 commits October 27, 2026 19:08
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]>
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@roboclaw-bot
roboclaw-bot force-pushed the fix/guest-access-03-rpc-reads-20261026 branch from 8b14693 to a020f29 Compare October 27, 2026 19:09
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants