Repository navigation
feat: support scoped session reading and organization - #155184
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: blocked before merge. Reviewed September 23, 2026, 9:51 AM ET / 13:51 UTC (Revision 8). ClawSweeper reviewWhat this changesExtends Gateway and Control UI access so session readers can browse conversations and session owners can rename, pin, archive, and restore them without broad Gateway permissions. Merge readiness⛔ Blocked before merge - 2 items remain This remains useful, distinct work with no blocking findings. The complete diff does not support the previous generic configuration or migration warning, and the retained evidence supports the scoped behavior. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway authorizes requests and conversation updates using authenticated identity, scopes, and session visibility. The Control UI consumes those permissions and ownership facts to expose appropriate reading and organization controls. flowchart TD
A[Authenticated user] --> B[Gateway scope admission]
C[Committed role policy] --> B
B --> D[Session ownership and visibility]
D --> E[Reads and organization]
D --> F[Authorized conversation events]
E --> G[Control UI]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep scoped admission, current-authority checks, and session ownership in their existing Gateway owners, with the UI consuming the shared policy. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature review; the supplied before/after browser cases and current-main source establish the scoped-access limitations being addressed. Is this the best way to solve the issue? Yes. Extending canonical admission alternatives and existing ownership guards avoids a competing permission system, and the UI uses the same shared method policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6f558f8ed70e. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
Added: scoped access to read visible sessions and organize owned conversations. |
Allow scoped users to read visible conversations and organize their own existing sessions while preserving separate execution permissions.
What Problem This Solves
People with session-only access can reach the own-session API but still encounter missing conversation updates, unavailable read controls, and disabled organization actions in the Control UI. Some bootstrap requests still demand general Gateway read access. Archived-only deletion also accepts the narrow session-write grant even though deleting a conversation requires broader maintainer authority.
User Impact
Session readers can browse visible conversation messages and metadata, receive updates, and copy history as Markdown. Session writers can rename, pin, archive, and restore their own existing sessions. The sidebar and session list check ownership for each selected session, including batch actions. Other people's visible conversations remain read-only under these grants.
Deletion and changes to sharing or visibility retain their broader permission requirements. Artifact listing and downloads still require general read access. Existing own-work permissions remain intact, with runtime, sandbox, and current-authority checks owned by the existing execution paths. This contribution adds read and organization controls; execution qualification remains separate. Saved sessions and their visibility are preserved, and a rejected configuration reload leaves the previous session permissions in effect.
Why This Change Was Made
The change extends the canonical method-admission alternatives introduced by #154991 instead of keeping a second scope table. The Gateway records when a request actually uses narrow session authority. Existing sharing and mutation owners enforce the person's access, and metadata patches cannot create or claim an unused session key. General staff access keeps its existing behavior.
Session read, organization, and event checks use the last committed role configuration. Physical session routing and prepared model data retain their runtime owners. Reads, subscriptions, and serialized events apply the same visibility and currentness boundaries, including hidden drafts and incognito sessions.
The UI consumes the shared method policy and projected ownership. Cached session-only credentials retain their negotiated scopes on reconnect. Organization controls opt into the narrow alternative, while ordinary local drafting and provider-review behavior remain available under their existing rules.
This PR builds on the model-discovery projection in #154839 and the landed common model policy in #156346 and native scope adapter in #154922. Discovery supplies the restricted catalog/default and scoped personal-preview contracts. The current integration preserves the newer worker-backed session and membership readers, ordinary question admission, and event-encoding reuse. Discovery is landed. This PR now integrates its actual main result at
d17bc212, preserving the complete read and organization contribution.Evidence
The published source is
89d506be(treee7433d11), with 86 contribution files against the landed prerequisite. Changed-path formatting, lint, line/assertion ratchets, conflict checks and diff hygiene pass. Structured source review and independent engineering review found no actionable P0–P2 issues. ClawSweeper's exact-head review rates89d506bePlatinum with no introduced findings. The complete 86-file audit confirms no changed config format, wire schema, persistent format or migration; generic compatibility flags came from its truncated file inventory.The retained remote proof at
57b2ec6passes 665 selected cases: 639 across the 23 changed Gateway/UI files, 17 worker-reader siblings and 9 composition controls. Core/UI production types, all 25 selected test-type graphs and selected static guards pass. The later discovery integration passes 52 approval/subscription/projection cases. Unchanged inputs retain their original execution identities; these totals are separate runs with overlapping coverage, not an additive case count. The native integration record is complete, but six duplicate raw result/log files were unavailable after that runner closed.The admission regression pauses real group-catalog preparation. Before the correction, broad-to-session and session-to-broad permission transitions both reached the registered handler; unchanged-mode controls passed. Moving the existing check after preparation makes all four cases pass. The full profile file passes 26/26. A subsequent correction to two ordinary-question fixtures reproduces the original 45-pass/2-fail result, then passes all 47 cases using the existing admitted admin fixture and explicit current-authority rejection. It changes no product behavior and adds no scenarios, retries or timeouts.
Preceding-source CI ran the composition of
0ce39aefand discoveryba60eee7. Dependencies and the Gateway-methods group pass. Remaining failures include independently reproduced upstream scroll/type fixtures and copied tooling fixtures, with existing repairs #156450 and #156136. The latter is landed; the repaired Gateway cleanup composition also passes all 177 cases in its three affected suites. The actual-main integration preserves these original results and the applicable repairs; unrelated failures do not hold landing.The Telegram terminal-error case failed once in that CI run. Full-file, original-order attempts at the exact CI merge and a clean main baseline each passed all 30 cases with the original worker cap. They ran on a larger host, so they do not establish a correction. Source inspection finds no SESSION change on this fixture's executed channel/dispatch path; its delivery cause remains unresolved. Historical Matrix timing failures are likewise preserved without treating a later pass as a causal repair.
The additional incoming-main composition passes 79 cases: 26 profile-authorization, 30 narrow-mutation, 22 transcript-access and one six-connection catalog case. Fresh source review qualifies these results through the actual landed prerequisite and its later session-activity and UI changes. The complete merge matches the independently composed tree; its seven-check publication preflight passes in 16.613 seconds. Existing exact-input CI receipts qualify incoming cold/resident profile counting, authenticated-owner reconnect and 44 worker-retirement cases. Current integrated CI additionally passes all 41 personal-file cases, including both authenticated-owner source-retirement paths and six denied-source controls.
The four-case production UI scenario has two expected scoped-control failures and two passing staff controls before the change, and four passes afterward. The fixture, relevant UI owners and browser dependencies support reuse on the inspected incoming composition. Original capture identity remains
57b2ec6/tree17dbf30e. The screenshots and recording passed anonymous byte verification and decoded in the public PR. Final CI passes on merged2291c4b(treef405bb49), containing this exact public head and main5a15cf46. Subsequent target changes are qualified against the complete resulting tree; unrelated historical failures remain preserved.Measured test costs
These are measured full-file command wall times in seconds, including runner preparation. Historical measurements retain their source tree; they are cost observations, not claims that an older run executed at the latest commit. No overlapping durations are added.
ac6ff4514393488a1132203f17dbf30e1132203f1132203f5ba18b924393488a1132203f4393488a4393488a4393488a4393488a17dbf30e48557d61¹The scope command includes both the shared scope tests and Gateway method-admission tests (104 cases). Gateway test preparation accounts for most of the displayed command cost; the existing real-profile/SQLite harness is reused. The browser command includes its maintained production build/server setup.
The remaining two changed UI files ran in UI shard 1 and UI shard 3, at tree
9cbcf0e2: session-menu navigation used 25.73 ms of reported module test time; composer actions used 1,283.93 ms. Those concurrent shard records do not supply isolated per-file command wall times. The earlier authority/type-only fixture updates and moved unchanged assertions added no test scenarios. The current integration adds only the four group-preparation cases described above. The four corrected fixture commands at tree4a173b77took 17.639, 25.657, 19.875, and 22.384 seconds, respectively, for subscription approvals, agent-key routing, sharing and HTTP scope handling; all 99 cases passed.Visual evidence
Owned-session organization — captioned, slowed playback
session-organization-aligned.mp4
Visual verification
57b2ec666662a807e703cfa82c9b81c3f57b7ca6