Repository navigation
fix(gateway): decide session-scoped read access once at admission - #206792
Conversation
- Delete the post-admission visibility, role and membership re-check in retainSessionScopedRead; keep request lifetime, routing and row fences. Co-authored-by: obviyus <[email protected]>
|
🦞👀 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. |
…r revocation - The in-flight progressCard.get read now finishes; the next read after revocation stays hidden. Co-authored-by: obviyus <[email protected]>
|
Codex review: needs changes before merge. What this changesThis PR checks session-read access once at admission while retaining request-lifetime, routing, and session-row fences. Example: An invited reader opens note.txt in agent:main:scoped-read, then loses membership while the read runs.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR addresses a current admission-contract violation, with one affected consumer test still requiring repair. Reviewed head: Before merge
Findings
Agent review detailsHow this fits togetherGateway session-read handlers combine authenticated caller access and session membership with a retained session row, then consume that admission through asynchronous file, diff, subscription, and application reads. flowchart TD
A[Authenticated read request] --> B[Session read admission]
C[Config and membership] --> B
B --> D[Retained row and admitted access]
D --> E[Asynchronous read]
E --> F[Lifetime routing and row fences]
F --> G[Response]
H[Next request] --> B
Technical reviewBest possible solution: Keep the existing admission owner and data fences, and align the affected progress-card regression with completion of admitted reads and refusal of later reads. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically rereads membership after asynchronous reads, and the author reports the matching regression failing on base and passing on head; this read-only review executed no target code. Is this the best way to solve the issue? Moving policy decisions out of the repeated guard is the smallest repair using existing owners, and the removed actor-swap expectation contradicts the approved admission contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ebabd17b7d79. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource -4, Tests +8. Total +4 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel 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 Reviewed November 27, 2026, 11:05 AM ET / 16:05 UTC. |
|
One-admission E2E (real isolated Gateway + gpt-5.5), verdicts per check:
R detail, base and head: |
|
Landed as aad2719. Session-scoped reads (files, diff, branches, subscriptions, MCP app, canvas, progress card) now decide visibility once at admission; an admitted read finishes after a membership or role change, and the next read is refused. Data fences (request lifetime, routing, row incarnation/revision) unchanged. Proof: regression test red on base / green on head, CI green on the exact head, clean local review, Q/S E2E pass (R identical on base and head). |
…enclaw#206792) ## Problem `retainSessionScopedRead()` (session file, diff, branch, subscription, MCP app and canvas reads) decided visibility at admission and then re-decided it in `assertCurrent()` after every awaited step: it re-read the role actor, the sharing identity, the connect scopes, the startable-main rule from the live config and the invited membership. A read that was admitted could then fail with "Session … was not found" when the creator removed the invited person, or the role changed, while the read was running. Repo rule (AGENTS.md "Decide authority once", openclaw#206706): a started request finishes; only data fences may stop it. openclaw#206747 removed the newer membership re-read in `isInvitedWorkspaceTarget` and named this older guard as a follow-up. ## Fix - Visibility, narrow-reader identity/scope and the startable-main rule are decided once, at admission, from the admission config and the membership captured then. - `assertCurrent()` keeps only data fences: request lifetime (abort signal, commit guard), session routing, and the retained row (`isCurrentAtResponse`: incarnation, lifecycle revision, access-relevant row fields, physical store). - No new hook, flag, state or refusal text. Production: `session-scoped-read.ts` +7/−14 against main. ## User impact - An invited reader whose access is removed while a file/diff read is running gets that read's result; the next read is refused (same answer as admission at start, no widening). - Row changes during a read (reset, archive, workspace move, visibility change on the row) still refuse it, unchanged. ## Tests - New `finishes an admitted invited read after membership removal` (`server-methods.session-scoped-reads.test.ts`): red on base `2626bc1ae892` (`Session "agent:main:scoped-read" was not found`), green on head; the follow-up read after removal is refused. - Deleted the `changed` case of `separates a trusted solo operator from its sharing exemption`: it asserted that swapping the operator actor mid-read refuses the read, i.e. the removed mid-request re-check. - `sessions-read-invited.test.ts` `progressCard.get`: it asserted that revoking the invitation during a card read refuses that read (CI round 1 red, the removed re-check). Now the in-flight read returns the card and the next read is hidden. - Pre-push: one `ocx test` run of the touched test plus every test that imports `session-scoped-read.ts` and the direct callers' tests; oxfmt, oxlint, `pnpm check:changed`. - `no-operator-permission-read` counts: unchanged (the file is not on any list; no listed site removed). ## E2E (one-admission Q/R/S, real Gateway + real model) - Head `b40d1bf3f5d3`: Q pass, Q sentence pass, S pass. R fails identically on base `2626bc1ae892` (`state: final`, 3 tool ends after revoke): the shared proof's R check was changed on 11-27 to expect the not-yet-landed "stop on access loss" feature (`stopReason: access-reduced`, not present on `main`). This PR touches only session-scoped RPC reads, not chat runs, so R does not measure it. Same verdict on base and head. - That approved rule ("a writer that removes a named person's access stops the work that person started; all other changes apply to the next request") covers runs, subagents, exec and queued/owed work, not a read RPC. This PR is consistent with it: the read decides once; the next read sees the removal. Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
retainSessionScopedRead()(session file, diff, branch, subscription, MCP app and canvas reads) decided visibility at admission and then re-decided it inassertCurrent()after every awaited step: it re-read the role actor, the sharing identity, the connect scopes, the startable-main rule from the live config and the invited membership. A read that was admitted could then fail with "Session … was not found" when the creator removed the invited person, or the role changed, while the read was running. Repo rule (AGENTS.md "Decide authority once", #206706): a started request finishes; only data fences may stop it. #206747 removed the newer membership re-read inisInvitedWorkspaceTargetand named this older guard as a follow-up.Fix
assertCurrent()keeps only data fences: request lifetime (abort signal, commit guard), session routing, and the retained row (isCurrentAtResponse: incarnation, lifecycle revision, access-relevant row fields, physical store).session-scoped-read.ts+7/−14 against main.User impact
Tests
finishes an admitted invited read after membership removal(server-methods.session-scoped-reads.test.ts): red on base4d7e00b86313(Session "agent:main:scoped-read" was not found), green on head; the follow-up read after removal is refused.changedcase ofseparates a trusted solo operator from its sharing exemption: it asserted that swapping the operator actor mid-read refuses the read, i.e. the removed mid-request re-check.sessions-read-invited.test.tsprogressCard.get: it asserted that revoking the invitation during a card read refuses that read (CI round 1 red, the removed re-check). Now the in-flight read returns the card and the next read is hidden.ocx testrun of the touched test plus every test that importssession-scoped-read.tsand the direct callers' tests; oxfmt, oxlint,pnpm check:changed.no-operator-permission-readcounts: unchanged (the file is not on any list; no listed site removed).E2E (one-admission Q/R/S, real Gateway + real model)
b40d1bf3f5d3: Q pass, Q sentence pass, S pass. R fails identically on base4d7e00b86313(state: final, 3 tool ends after revoke): the shared proof's R check was changed on 11-27 to expect the not-yet-landed "stop on access loss" feature (stopReason: access-reduced, not present onmain). This PR touches only session-scoped RPC reads, not chat runs, so R does not measure it. Same verdict on base and head.