Skip to content

feat(openclaw-id): member roles are opaque names in the protocol - #197697

Merged
jalehman merged 2 commits into
mainfrom
ocf-517-opaque-member-role
Nov 12, 2026
Merged

jalehman merged 2 commits into
mainfrom
ocf-517-opaque-member-role

Conversation

@jalehman

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw ID members can only be operator or viewer, because the protocol package fixes that list and ranks the two. Owners need roles between those two and roles of their own, which a closed, ordered list in the signed protocol cannot carry.

User Impact

User impact: none yet. Operator and viewer members, owner devices and nodes behave as before, and the Access page still offers Operator and Viewer. A member whose role name the Gateway does not know is refused access.

OpenClaw ID is a Labs feature and its protocol is an unreleased v1 draft, so this changes the draft schema with no version bump. Discovery and the claw loader carry their own copy of the protocol and must update before any claw publishes a role other than operator or viewer.

Why This Change Was Made

  • A member role is now an opaque name in the protocol: 1 to 64 characters, lowercase ASCII letters, digits, - and _, starting with a letter. The same validator covers invites, the add and set_role operations, and membership snapshots.
  • Role ranking is removed. Approving an invite must use the invite's exact role; before, an approval could grant a lower role than the invite named.
  • The Gateway still gives meaning only to operator and viewer. Any other role name is refused at WebSocket connect, on Gateway HTTP, on the tunnel API (/_openclaw-id/v1/*), and for retained and recovered runs. Stored membership keeps the name, so a later change can define what it allows.
  • The Access page and account menu show an unknown role by its name.

This is the first step of customizable member roles. Resolving role names from gateway.roles.definitions comes in a follow-up.

Evidence

  • Protocol package: 29 files, 224 tests pass, including new cases for valid and malformed names in all four signed fields and for exact invite-role matching in both directions.
  • Gateway: tunnel-principal, tunnel-api, remote-signout (21 tests), server.auth.openclaw-id-tunnel.test.ts (20) and operator-run-recovery.test.ts (41) pass. New tests cover refusal of an unknown role at connect, HTTP, every tunnel API route and recovery.
  • UI and Access page suites for the changed files pass.
  • tsgo for core, UI and extensions, scoped lint, format and the line ratchets pass.
  • An independent review found one P1, that the tunnel API skipped the unknown-role check (a member with an unknown role could call sign-out). The second commit fixes it and adds a regression test over every tunnel API route.

Not run: the full repository suite, a live tunnel or Discovery end-to-end test, and browser screenshots (no visible UI change for existing roles).

@clawsweeper

clawsweeper Bot commented Nov 12, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR permits opaque member-role names, requires exact invite-role approval, and denies Gateway access for names without a permission policy.

Example: An owner signs an invitation assigning acct_bob the role guest.

  • Before: The protocol rejects guest as malformed.
  • After: The protocol preserves guest in membership, but the Gateway denies that member access until a policy defines its permissions.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is coherent and has focused boundary coverage, but required production behavior evidence is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Owners cannot represent intermediate or custom member roles in signed OpenClaw ID membership.
Reason: The feature owner has chosen this bounded protocol foundation; configurable role permissions remain an explicit follow-up rather than an implied capability of this PR.

Merge readiness

✅ Ready for maintainer review

Keep this PR open as a useful, owner-directed protocol foundation. Current main still fixes member roles to operator and viewer; inspection found no discrete introduced correctness bug.

Priority: P2
Reviewed head: 8723304dbf6f3ba4d11f38fe9d34c00465fab125

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted production-entry-point traces showing opaque membership survives restart, unknown-role requests are refused through the real tunnel, and built-in access still works, plus before/after captures of changed role labels; base-red/head-green results are not recorded.
Agent review details

How this fits together

Signed invitations and membership changes enter the shared protocol authority; stored membership feeds Discovery snapshots, Gateway admission and recovery checks, and role labels in the Control UI.

flowchart LR
  A[Owner signed invitation] --> B[Protocol validation]
  B --> C[Membership authority]
  C --> D[Discovery snapshot]
  C --> E[Gateway role policy]
  E --> F[Request and recovery admission]
  C --> G[Control UI role labels]
Loading

Technical review

Best possible solution:

Keep protocol names opaque and Gateway permissions authoritative, preserving built-in access while coordinating new-name publication with Discovery and loader support.

Do we have a high-confidence way to reproduce the issue?

This is a capability addition, and current-main source directly establishes the operator/viewer restriction; no target code was executed.

Is this the best way to solve the issue?

The implementation uses the existing protocol validator and membership authority, with one shared Gateway admission predicate; it is a coherent first stage without adding configurable permissions prematurely.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 83e3641e0921.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit ed57ed7 adds packages/openclaw-id-protocol/src/statements/types.ts:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ed57ed752e35; files: packages/openclaw-id-protocol/src/statements/types.ts)
  • Vyctor H. Brzezowski: Raw commit 4ff4f33 adds extensions/openclaw-id-access/browser/people-format.ts:74 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4ff4f33e0cff; files: extensions/openclaw-id-access/browser/people-format.ts)

PR surface

Source +217, Tests +353, Docs +25. Total +595 across 27 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 13 256 39 +217
Tests 10 479 126 +353
Docs 4 29 4 +25
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 27 764 169 +595

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a useful foundation for a Labs feature with no demonstrated urgent user regression.
  • merge-risk: 🚨 compatibility: Exact invite matching changes the draft contract, and older Discovery/loader copies reject newly permitted names; the maintainer-authored PR explicitly accepts coordinated rollout before those names are published.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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.

Reviewed November 12, 2026, 6:03 AM ET / 11:03 UTC.

@jalehman
jalehman force-pushed the ocf-517-opaque-member-role branch from 8723304 to 82b2811 Compare November 12, 2026 20:03
@jalehman
jalehman marked this pull request as ready for review November 12, 2026 20:03
@jalehman

Copy link
Copy Markdown
Contributor Author

Live proof on the staging testnet (build 82b2811, this PR's head)

An isolated Gateway on a Mac Studio, with its own checkout, port and state, was built from 82b2811 and linked as a throwaway staging claw (roleproof517-akmx5.crabd.xyz). Real Chromium browsers used the real staging OpenClaw ID, Discovery, loader and relay. All 17 assertions in the final run passed:

Check Result
Owner signs in, saves the recovery kit and reaches the Control UI over the tunnel pass; owner gets six scopes including admin
Owner invites an operator; member redeems; owner approves pass; signed approval carries the exact invite role; operator scopes exclude admin
Owner invites a viewer; member redeems; owner approves pass; signed approval carries the exact invite role; only operator.read granted
Discovery and loader after both grants pass; snapshots published; loader shows Operator / Viewer
Approval role differs from invite, in either direction refused with target_mismatch; invitation and membership seq unchanged
Owner changes viewer to guest with a signed statement accepted as opaque membership data; fresh Gateway WebSocket connect refused and ordinary HTTP returns 401
Guest calls membership, statements, invites, node-invites or signout tunnel API every route returns 403 not_admitted; no token/seq change or sign-out side effect
Owner/operator while Discovery rejects the guest snapshot both still connect with their normal scopes
Restore viewer snapshot publication recovers; viewer reconnects read-only
Owner removes viewer connection cut; claw disappears from that member's list

Staging Discovery still has the closed role validator. Its response to the guest snapshot was HTTP 400 invalid_statement, “expected one of operator, viewer.” The Gateway reported the failed publication without changing its own membership authority. This is the expected deployed-service incompatibility; restoring viewer recovered publication.

Afterwards the throwaway claw was retired in Discovery staging (no claw, member, relay-key or live-hostname rows remain), all test-account issuer sessions were revoked, browsers closed, and the isolated Gateway, state and checkout were removed. No shared claw was changed.

Separate observations: the old test harness needed updates for current UI controls; the model-free fixture displays its existing model-setup/empty-session UI. Guest/removal denial is proven by the protocol receipts—the browser displayed “Reconnecting…” rather than a dedicated refusal screen. No chat turn, node enrollment or retained/recovered run was exercised by this live fixture.

@jalehman
jalehman merged commit fc6c25e into main Nov 12, 2026
192 of 195 checks passed
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: openclaw-id-access rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

1 participant