Skip to content

feat: support scoped session reading and organization - #155184

Merged
shakkernerd merged 37 commits into
mainfrom
fix/session-read-management
Sep 23, 2026
Merged

shakkernerd merged 37 commits into
mainfrom
fix/session-read-management

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

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 (tree e7433d11), 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 rates 89d506be Platinum 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 57b2ec6 passes 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 0ce39aef and discovery ba60eee7. 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 merge d2291c4b (tree f405bb49), containing this exact public head and main 5a15cf46. 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.

Test group Command wall, s Tested tree
Gateway scope policy¹ 3.477 ac6ff451
Serialized session events 18.052 4393488a
Connection state 19.450 1132203f
Profile authorization 52.664 17dbf30e
Own-session mutations 26.837 1132203f
Scoped session reads 28.937 1132203f
Progress-card authorization 25.506 5ba18b92
Suggestion visibility 28.383 4393488a
Preferences 26.426 1132203f
UI Gateway reconnect 5.904 4393488a
UI batch organization 2.624 4393488a
UI Gateway method policy 1.532 4393488a
UI session access 2.196 4393488a
Matched browser scenario, AFTER 52.788 17dbf30e
Ordinary question access 69.252 48557d61

¹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 tree 4a173b77 took 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

Open preview

View Before After
Session reader — shared history Before: shared notes are visible but the session reader composer remains editable After: shared notes remain visible and the composer explains that sending is unavailable
Session writer — owned conversation Before: pin, rename and archive are disabled for the session writer on an owned conversation After: pin, rename and archive are enabled for the owned conversation while broader controls remain restricted

Owned-session organization — captioned, slowed playback

session-organization-aligned.mp4

Visual verification

  • Baseline: Discovery preparation tree b59344d3d9764a08f81d6b1f10bb0a0bd58d2006 plus the unchanged browser fixture; execution e9fa3ee3b222d20d544d250623cd1144c5effde9
  • Exact head: 57b2ec666662a807e703cfa82c9b81c3f57b7ca6
  • Scenario: Read a shared conversation, inspect own and foreign controls, then rename, pin, archive and restore an owned conversation. Production Control UI with the maintained mocked Gateway fixture.
  • Runtime/build: Fresh production UI at tree 17dbf30e2db33e0f13bb630e38a7fd359c876fdf; 1,560 manifest assets verified; served index SHA256 e3c74abea4b95aafb8d338f2670d8bfeb7b40a46628656b67d264bac070fa2a9 differs from baseline fd7962df; all 8 startup assets matched HTTP.
  • Baseline result: 2 expected scoped-control failures; 2 broad staff controls passed.
  • Updated result: All 4 browser cases passed; execution 57b2ec6, tree 17dbf30e.
  • Permitted changes: Five exact owned-session patches: two labels, pin, archive, restore.
  • Protected controls: Session-scoped flows emitted no foreign or privileged mutations; both staff deletion controls passed.
  • Playback: Original 9.8 s interaction retained; published 40.44 s recording slows actions for legibility. It is not a latency benchmark.
  • Same 1280×900 viewport, theme, routes, selected conversations and synthetic fixture in both runs. Sidebar row order differs; each menu targets the same owned row.
  • Fresh production builds and served index/manifest/startup asset hashes verified. Fixture SHA256 3cce6d52acab1cfdf98726008ee96c69bb92d0eb8319e827233d1722dadf91e6 is unchanged.
  • Before failures are product assertions, without setup or timeout failures.
  • Selected screenshots inspected at original size; all 245 source recording frames inspected in temporal order, followed by the full rendered timeline and caption phases.
  • No live credentials, private messages or user data appear in the selected media.
  • The original recording is retained. Playback compresses startup and uniformly slows the action sequence without rearrangement; the archived Restore/Delete menu has no caption overlay.
  • Capture identity remains 57b2ec6. These media qualify reading and organization, not unrelated transcript scrolling or performance changes.

@shakkernerd shakkernerd self-assigned this Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 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 docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 23, 2026, 9:51 AM ET / 13:51 UTC (Revision 8).

ClawSweeper review

What this changes

Extends 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
Reviewed head: 89d506be94a3e48c5a3e5f94246cbd5e79a4735b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation with strong retained visual and boundary evidence and no actionable review findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Inspected session-control before/after screenshots and the source-bound production UI scenario at 57b2ec6, whose core scenario and permission owners remain unchanged. Its mocked Gateway proves browser controls; separate reported registered-Gateway runs and reviewed assertions cover foreign access, revocation, replacement, and denied subscription effects. No stored-data contract changes require migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Inspected session-control before/after screenshots and the source-bound production UI scenario at 57b2ec6, whose core scenario and permission owners remain unchanged. Its mocked Gateway proves browser controls; separate reported registered-Gateway runs and reviewed assertions cover foreign access, revocation, replacement, and denied subscription effects. No stored-data contract changes require migration.
Evidence reviewed 9 items Complete introduced contribution: Inspected all 86 introduced file diffs, including the six paths omitted from the prompt inventory. Changes remain in session authorization, projections, UI controls, documentation, and supporting tests; no configuration schema, wire schema, dependency, plugin API, or persistent-format change was found.
Current main still needs the contribution: Fetched main retains the smaller session-read method set and the separate discovery scope table. The merged authorization and model-discovery prerequisites do not supply this PR's complete reading and organization behavior.
Admission and retained authority: Admission rechecks scopes after asynchronous preparation and rejects a changed broad/narrow admission mode. The retained operator guard checks identity, scope loss, canonical profile, and committed role policy; request handling composes it with existing response and mutation guards.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus test growth Production net +464 lines; tests/support net +1341 lines Production growth supplies scoped authorization and UI integration through existing owners; test growth exercises ownership and asynchronous authority boundaries.
Configuration and storage surface 0 new configuration options; 0 wire or stored-format changes The complete contribution does not support the previous generic migration blocker.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Technical review

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded improvement to session-only reading and organization with preserved broader permission boundaries.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Inspected session-control before/after screenshots and the source-bound production UI scenario at 57b2ec6, whose core scenario and permission owners remain unchanged. Its mocked Gateway proves browser controls; separate reported registered-Gateway runs and reviewed assertions cover foreign access, revocation, replacement, and denied subscription effects. No stored-data contract changes require migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected session-control before/after screenshots and the source-bound production UI scenario at 57b2ec6, whose core scenario and permission owners remain unchanged. Its mocked Gateway proves browser controls; separate reported registered-Gateway runs and reviewed assertions cover foreign access, revocation, replacement, and denied subscription effects. No stored-data contract changes require migration.

Evidence

What I checked:

  • Complete introduced contribution: Inspected all 86 introduced file diffs, including the six paths omitted from the prompt inventory. Changes remain in session authorization, projections, UI controls, documentation, and supporting tests; no configuration schema, wire schema, dependency, plugin API, or persistent-format change was found. (89d506be94a3)
  • Current main still needs the contribution: Fetched main retains the smaller session-read method set and the separate discovery scope table. The merged authorization and model-discovery prerequisites do not supply this PR's complete reading and organization behavior. (src/shared/session-method-scopes-base.ts:8, 6f558f8ed70e)
  • Admission and retained authority: Admission rechecks scopes after asynchronous preparation and rejects a changed broad/narrow admission mode. The retained operator guard checks identity, scope loss, canonical profile, and committed role policy; request handling composes it with existing response and mutation guards. (src/gateway/server-methods/session-mutation-guards.ts:288, 89d506be94a3)
  • Ownership and forbidden-case coverage: Reviewed registered-request coverage for foreign drafts, incognito rows, missing rows, revoked request sources, replaced session generations, and subscription registration. Narrow metadata patches reject unused keys, while the existing mutation owner rechecks ownership and exact session identity before committing. (src/gateway/server-methods.session-scoped-reads.test.ts:53, 89d506be94a3)
  • Compatibility warning resolved: The previous completed review examined the same head and reported no findings. Its generic compatibility next step has no schema or configuration trigger in the complete diff. The maintainer-authored body explicitly retains broader deletion authority; v2026.9.5 already requires operator.write for supported archived-only deletion and operator.admin otherwise. Existing credential storage is read without changing its format. (src/shared/session-method-scopes-base.ts, ec9c1a13db89)
  • Captured body and visual proof: Verified the complete body against captured SHA-256 dd90424353542e0dfa9d2c13f7336e4456f0bc8a99ea37d40d4d665b04f0460a and read the omitted test-cost section. The prepared manifest contained prerequisite images, so the four session-control attachments were separately fetched into memory and inspected: shared history remains visible, the reader receives a sending restriction, and owner pin/rename/archive controls become enabled. The reported production-browser run uses the maintained mocked Gateway and retains capture identity 57b2ec6; it is not live Gateway security proof. (ui/src/e2e/session-management.operator-scopes.e2e.test.ts:58, 57b2ec666662)

Likely related people:

  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed 2026-09-21T20:48:50.849Z sha 441e78c :: needs changes before merge. :: none
  • reviewed 2026-09-21T22:44:57.574Z sha c30739a :: blocked before merge. :: none
  • reviewed 2026-09-22T04:46:49.698Z sha bbf25a8 :: needs changes before merge. :: none
  • reviewed 2026-09-22T05:13:57.176Z sha feaebbc :: blocked before merge. :: none
  • reviewed 2026-09-22T06:02:35.189Z sha feaebbc :: blocked before merge. :: none
  • reviewed 2026-09-23T10:53:45.201Z sha 4f3f2d8 :: blocked before merge. :: none
  • reviewed 2026-09-23T13:21:37.734Z sha 89d506b :: blocked before merge. :: none

@shakkernerd
shakkernerd deleted the fix/session-read-management branch September 23, 2026 13:56
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Added: scoped access to read visible sessions and organize owned conversations.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
Allow scoped users to read visible conversations and organize their own existing sessions while preserving separate execution permissions.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: XL 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.

1 participant