Repository navigation
feat(openclaw-id): member roles come from gateway.roles.definitions - #197739
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. What this changesThis PR resolves OpenClaw ID member permissions from gateway.roles.definitions and installs editable Operator and Viewer presets. Example: An owner changes the operator definition to grant only operator.sessions.read.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep this maintainer-directed feature open; the role-definition cutover leaves existing HTTP and automation regression fixtures invalid. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Gateway maps authenticated OpenClaw ID membership to role definitions, then applies those permissions to connections, HTTP requests, retained work, and session continuations. flowchart TD
A[Authenticated tunnel peer] --> B[Membership authority]
B --> C[Configured role definition]
C --> D[Connection and HTTP admission]
C --> E[Required access policy]
D --> F[Agent and session work]
E --> F
C --> G[Recovered and scheduled work]
Technical reviewBest possible solution: Keep one configured member-role owner, complete the affected fixture cutover, and preserve existing settings and data through activation and upgrade. Do we have a high-confidence way to reproduce the issue? Source inspection establishes that four existing positive regression cases lack the operator definition now required for admission; no target code or tests were executed. Is this the best way to solve the issue? Reusing gateway.roles.definitions is a coherent minimal design, but its existing HTTP and automation consumers must receive valid fixtures together. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bfd85da11eeb. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +250, Tests +1305, Docs +70, Other +4. Total +1629 across 47 files. Added test files: 5. 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. 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 Reviewed November 12, 2026, 8:17 AM ET / 13:17 UTC. |
0aa7acd to
effd75b
Compare
e2b02c1 to
ec6da85
Compare
effd75b to
433d3c3
Compare
ec6da85 to
2b648ec
Compare
|
Live proof at Startup with OpenClaw ID off leaves the config unchanged. Enabling it writes the expected Operator/Viewer presets without adding a default, and the original browser reconnects using only its device token. I used the known isolated-Gateway restart workaround after enabling; Access then appeared in the same owner browser without a reload or another config edit. Owner, Operator and Viewer connected through the real tunnel with the expected allowed and denied methods. Editing Operator's approvals permission closes its live connection and removes that permission on reconnect. Deleting/restoring Viewer cuts off/restores admission. Startup preserves existing role definitions and a configured default while adding only a missing preset; a later restart preserves member access and permission boundaries. Custom-role publication now succeeds in staging: the snapshot write returned HTTP 204, and authenticated HTTP 200 readback showed The additional removal check proved that removing a member through Access closes the open connection and makes reconnect fail with Cleanup is complete: the throwaway claw was retired with all four database counts verified zero; all three account sessions were revoked and verified signed out; the isolated processes, port, state, checkout and recovery kit were removed. No real GitHub publication was attempted, so this proof does not validate that write path. Nothing was deployed or posted. Note on the head: this proof ran on |
|
Merged via squash.
|
…#198863) Make MEMBER_ROLE_PRESETS private and reuse the independent service activation fixture across test consumers. Keep reportStatusScanFailure private after its last external caller moved to the interrupt-aware wrapper. Fixes unused-export regressions from #197739 (4fc7acf) and #198651 (0640d39). Document the existing worker-GC logging mock isolation exposed by check:changed, introduced in #198857 (1b3e37b). Production bodies are unchanged; net production LOC 0. Full deadcode scan and 247 focused tests pass. Codex autoreview is scoped-clean through P2.
…penclaw#197739) * feat: resolve OpenClaw ID member roles from definitions Persist missing editable presets on activation without enabling named-role enforcement. Apply membership definitions and required access policies to ingress, live connections, retained runs, sandbox streams, and session continuations. Keep preset writes on the service-owned queue outside managed config publication to avoid recursive secrets-preflight deadlock. Allocate 634 test lines above the standard 400-line allowance for transport admission, current retained authority, required access policies, and real Gateway activation/reload regressions. * fix: order member role activation and fence profile merges Install missing member role presets before the startup runtime snapshot and managed config reloader. Carry the same activation owner into the service, preserving visible write failures without retrying the startup edge. Report saved activation that reload policy cannot apply as restart-required. Keep runtime reconciliation asynchronous to avoid the publication deadlock. Retain canonical member-profile authority through membership preparation and recheck it in the existing role-write commit guard so profile merges cannot redirect assignments onto members. Preserve nonmember writes and null clears. Document that installing presets rewrites config as JSON and removes JSON5 comments through the standard config writer. Test-line allocation: 905 for 1305 cumulative net test lines above the stacked feature base (400 ordinary allowance). The additional 271 lines prove delayed startup/reload-off activation and real canonical-profile merge write boundaries. * fix(gateway): reconcile member-role rebase validation Adapt linked-owner grant and named-role enforcement fixtures after replaying the member-role stack. Keep role-aware handlers and recovery fixtures within the existing line caps without changing their authority checks or assertions. * fix(gateway): preserve member authority after main restack Retain canonical role assignment, grant custody and membership roles during transient policy recovery. Seed ingress fixture catalogs without relaxing assertions. The 945-line allocation covers 1345 net test lines: existing independent authority boundaries plus explicit delegated ingress catalogs and transient member-policy recovery. * fix(gateway): align member-role callers and CI fixtures Rename the RPC role handler to avoid an export collision and pass retained authority through the current performance API options. Seed explicit member definitions in omitted transport and recovery fixtures without changing assertions or runtime authorization. Allocate exactly 41 added fixture lines. * fix(gateway): retain member authority for GitHub publication * test(gateway): seed member roles and recovery ownership in CI fixtures * fix(github): retain historical requester grants on retry
…openclaw#198863) Make MEMBER_ROLE_PRESETS private and reuse the independent service activation fixture across test consumers. Keep reportStatusScanFailure private after its last external caller moved to the interrupt-aware wrapper. Fixes unused-export regressions from openclaw#197739 (4085249) and openclaw#198651 (0dd531e). Document the existing worker-GC logging mock isolation exposed by check:changed, introduced in openclaw#198857 (4b33bc7). Production bodies are unchanged; net production LOC 0. Full deadcode scan and 247 focused tests pass. Codex autoreview is scoped-clean through P2.
What Problem This Solves
The Gateway hardcodes what the OpenClaw ID member roles
operatorandviewerallow, so an owner cannot change them or add a role of their own.User Impact
User impact: an owner can edit what Operator and Viewer members may do, and can define more member roles, by editing
gateway.roles.definitions. OpenClaw ID is a Labs feature and is off by default; with it off, nothing here runs.Changes an owner will notice:
operatorandviewerdefinitions into the config file. It writes nodefault, so the claw's other sign-ins behave as before. This rewrites the config file as JSON and removes JSON5 comments, as every config write does.operator.sessions.read). They no longer read logs or the user directory.operator.adminoroperator.pairinggives its members those scopes. No preset includes them.users.setRolewith a role name is refused for an OpenClaw ID member's profile. A member's role comes from membership.Known limit: a Viewer cannot open the Access page, because loading plugin pages needs
operator.read.Why This Change Was Made
gateway.roles.definitionson every admission and authority check: WebSocket connect, Gateway HTTP, the tunnel API, retained and recovered runs, sandbox streams and session continuations. Editing or deleting a definition closes the affected members' connections and stops their retained work.gateway.reload.mode: "off"), the OpenClaw ID status says a restart is needed.Evidence
users.setRolerefused for members.users.setRolecould skip the member check). The other P2 is the comment removal stated above. A second review of the fix commit found nothing.Test lines: this PR adds 1,824 net test lines, 1,424 over the 400-line allowance. The allocation record is
config/test-lines-allocations/member-role-definitions.txt. The tests cover separate transport, retained-authority and config-lifecycle boundaries, each of which can fail on its own.Rebased onto main after #197697 and #197712 merged; eight commits. The fourth adapts to main: it keeps the membership role when the access policy is re-evaluated during a transient failure (regression test added, seen failing first), follows main's newer publication grant call, and gives delegated-ingress fixtures an explicit catalog. After the rebase: 601 of 603 tests passed across 55 files, and the two failures plus one follow-up fixture failure were repaired and rerun green with their affected suites (26 tests in 3 files). The 55-file run was not repeated as a whole after the repairs.
The fifth commit fixes the first CI run: the
users.setRolehandler export is renamed to avoid a name collision, a perf script passes the new options object, and five fixtures with OpenClaw ID members gain role definitions. No assertion changed. 666 tests in 62 files pass with the static checks and ratchets.Later commits:
Reviews: two findings from independent exact-head reviews, both in GitHub publication for a Gateway that combines a visitor default role with OpenClaw ID members, are fixed by the commits above. A final review of head
093e77158ad5found no P0-P2. It notes that a request stored before this change identifies a profile, not a specific member, so it keeps running under its original stored grant while that grant is valid; that is unchanged behavior.Live proof (isolated Gateway, staging testnet): all ten checks passed on
8d8aa19b21aa; see the proof comment. Changes after that head are the publication retry fix, test fixtures and a rebase in which the earlier commits are patch-identical. GitHub publication was not exercised live. The Gateway was restarted once after enabling OpenClaw ID, because enabling it without a restart leaves the Access page unloaded; that behavior is the same on main.CI on
093e77158ad5: all checks pass.Not run: the full repository suite locally, a real GitHub publication, and an in-place upgrade of an installed Gateway.