Skip to content

feat(gateway): generic operator roles for non-maintainer access - #128548

Merged
steipete merged 3 commits into
mainfrom
steipete/openclaw-non-maintainer-access-b93bdf
Aug 24, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/openclaw-non-maintainer-access-b93bdf

Conversation

@steipete

@steipete steipete commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Team gateways have no way to give a person less than full operator access. Anyone who can authenticate can see every session, run every agent (with that agent's credentials), and mutate anything their token scopes allow. That blocks the common team shape: a maintainer-owned gateway where guests or teammates should only see their own sessions, use a designated low-privilege agent, and stay inside a scope ceiling.

Why This Change Was Made

Adds gateway.roles: named role bundles over a closed capability set, assigned per person.

  • sessions.others: none / view / suggest / write — maximum access to another person's sessions without explicit membership.
  • agents: allowlist (or "*") of agents available for session creation and run-start on existing sessions — this is what pins a guest to a dedicated low-privilege agent (e.g. one with its own GitHub identity that can open PRs but not merge).
  • scopes: ceiling applied to the profile's granted operator scopes.

Design choices:

  • Person-level, not token-level. Roles attach to the durable user profile (additive user_profiles.role column; SQLite stays at schema v9 per the additive-surface rules). users.setRole (admin-only) assigns them.
  • Deny-by-default from host-minted identity. Authorization derives from a closed actor union — system vs operator+profileId — minted only by the host on server-only client.internal, never accepted from the wire. Unknown/unidentified actors under an active role boundary resolve to a denied role.
  • Every entry point enforces. WS RPCs, OpenAI-compat and Responses HTTP, /tools/invoke, cron, questions, usage aggregation, task suggestions, session catalog/sharing/reads. Internal host dispatch (plugin runs, subagent completion announce, descendant wake) explicitly mints system authority so role boundaries never silently drop host-owned deliveries.
  • Narrow authz vocabulary. Enforcement reads as intent (operatorSessionCap, hasOperatorBoundary, authorizeSessionSharing) instead of per-handler policy internals; the raw role definition is exported only where scope ceilings genuinely need it.
  • No config = no change. Without gateway.roles, solo deployments behave exactly as before.

User Impact

Operators can define roles in openclaw.json and assign them with users.setRole. Role-capped users see only their own sessions (plus shared ones up to their cap), can start sessions/runs only on allowlisted agents, and keep their scope ceiling across WS and HTTP. Solo deployments are untouched.

Known follow-ups (deliberately out of scope): Control UI for role assignment, openclaw doctor warnings for roles-without-default and shared-secret-plus-roles footguns, and docs for the guest-agent GitHub setup.

Evidence

  • Adversarial security review: four independent reviewers chartered to break the boundary found run-start/HTTP-header/allowlist bypasses in the initial build; all fixed at the root (host-minted actor identity, deny-by-default, run-start allowlist composition) with regression tests that fail on pre-fix code. Two focused re-reviews of the fix confirmed system authority is unforgeable and every entry point is covered, and caught a silent over-denial (subagent completion announce / descendant wake) — fixed with regressions.
  • Targeted security matrix green: 330 tests across session-sharing, question, cron, tools-invoke-http, http-utils authorize-request, method-scopes, openai/openresponses HTTP, operator-role-policy, usage, subagent announce, agent-turn.
  • pnpm check:changed green (typecheck core + tests, lint, ratchets; assertion-safety baseline shrank by one entry).
  • Structured Codex review (gpt-5.6-sol, high reasoning, chunked over the full bundle): clean, zero findings, "patch is correct" (0.95/0.96 across two runs, before and after the enforcement-surface refactor).
  • Proof gap stated plainly: no live Control UI flow yet — role assignment has no UI surface in this PR (named follow-up above), so live proof of the capped experience end-to-end is deferred to that change.

Production/test LOC: ~+2.2k production (capability + security boundary across ~15 entry points; compression pass applied — raw policy exposure reduced to one file), ~+4.1k tests (~2:1 test-to-prod, mostly the per-entry-point "capped user cannot X" regression matrix).

Live final-effect trace (rank-up evidence)

Recorded against the reviewed head on an isolated loopback rig (OPENCLAW_STATE_DIR sandbox, port 19811, trusted-proxy auth with deviceAutoApprove, roles: maintainer {others: write, agents: "*", admin scopes} / default guest {others: none, agents: ["guestbot"]}). Raw WS protocol-v4 clients with signed device identities; redacted to step/actor/outcome:

[
 {"step":"connect","actor":"maintainer","ok":true,"note":"maintainer role via gateway.roles.definitions"},
 {"step":"setup","actor":"maintainer","method":"sessions.patch agent:main:maint-557702","ok":true,"note":"final effect persisted (verified in agents/main session_windows row)"},
 {"step":"connect","actor":"guest","ok":true,"note":"default role guest: sessions.others=none, agents=[guestbot]"},
 {"step":"deny-hidden-read","actor":"guest","method":"sessions.resolve foreign","ok":false,"error":{"code":"INVALID_REQUEST","message":"Session \"agent:main:maint-557702\" was not found."},"note":"non-disclosing"},
 {"step":"deny-hidden-write","actor":"guest","method":"chat.send foreign","ok":false,"error":{"code":"INVALID_REQUEST","message":"Session \"agent:main:maint-557702\" was not found."},"note":"denied before dispatch, non-disclosing"},
 {"step":"deny-agent","actor":"guest","method":"sessions.patch agent:main:*","ok":false,"error":{"code":"FORBIDDEN","message":"Your operator role cannot create sessions for agent \"main\"..."}},
 {"step":"allow-agent","actor":"guest","method":"sessions.patch agent:guestbot:own-557702","ok":true,"note":"allowlisted agent, own session: final effect persisted (verified in agents/guestbot session_windows row)"},
 {"step":"promote","actor":"maintainer","method":"users.setRole guest->maintainer","ok":true},
 {"step":"revoke-connection","actor":"gateway","method":"ws.close","ok":true,"note":"role change closed the live guest connection (close code 4001); stale connection authority does not survive reassignment"},
 {"step":"post-promote-read","actor":"guest (reconnected)","method":"sessions.resolve foreign","ok":true,"note":"promoted guest now sees the foreign session"},
 {"step":"demote","actor":"maintainer","method":"users.setRole guest->guest","ok":true},
 {"step":"post-demote-read","actor":"guest (reconnected)","ok":false,"error":{"code":"INVALID_REQUEST","message":"Session ... was not found."},"note":"reassignment revokes authority before further reads"},
 {"step":"post-demote-write","actor":"guest (reconnected)","method":"chat.send foreign","ok":false,"error":{"code":"INVALID_REQUEST","message":"Session ... was not found."},"note":"revoked write denied before dispatch"}
]

Compat and bootstrap findings from the live rig (review P1s)

  • Identity-less access under roles is intentionally fail-closed. With gateway.roles configured, shared-secret (token/password) callers keep their existing access (resolveAuthenticatedHttpUserProfile returns no policy for shared-secret methods); callers with no durable identity on identity-bearing auth paths resolve to the denied role. Role reassignment closes live connections (trace above) — deliberate revocation, not a regression. Solo deployments without gateway.roles are byte-for-byte unaffected.
  • Bootstrap footgun confirmed live: a roles config whose default role lacks operator.admin locks everyone out of users.setRole on identity-only auth (trusted-proxy) — there is no shared-secret superuser to bootstrap the first maintainer. Documented here as a known limitation; the planned openclaw doctor warnings follow-up (roles-without-default, shared-secret-superuser, and now default-without-admin-bootstrap) covers it.
  • Pre-existing sibling bug surfaced (filed as follow-up, not fixed here): sessions created through the sessions.patch create path are persisted without createdActor, so any identity-filtered gateway (multi-identity on main today, roles here) hides such a session from its own creator on the next access. Root cause is in the patch engine (missing buildSessionCreationStamp threading), predates this PR, and is filed as a spawned follow-up task with the live repro.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@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 labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 06:00
@steipete
steipete requested a review from a team as a code owner August 24, 2026 06:00
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 24, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 24, 2026, 4:08 AM ET / 08:08 UTC.

ClawSweeper review

What this changes

This PR adds profile-bound Gateway roles that cap cross-session access, allowed agents, and operator scopes for authenticated team users.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 11 items remain

Keep open: a role downgrade can retain an old admin scope through an awaited tool hook, and the documented identity-only setup has no safe first-maintainer bootstrap path.

Priority: P1
Reviewed head: 6176265d0e83e99c68a581afbc75bf1c95f650ed
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The broad role-policy implementation has useful coverage, but two high-impact authorization and setup defects remain unaddressed.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the posted loopback trace proves reconnect-time revocation but not a role downgrade during an awaited hook; show the demoted operator is rejected before an admin Gateway final effect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the posted loopback trace proves reconnect-time revocation but not a role downgrade during an awaited hook; show the demoted operator is rejected before an admin Gateway final effect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Stale authority after an await: Tool invocation awaits the before-tool hook, then installs the pre-await profile and scope snapshot as in-process authority. The dispatcher builds a synthetic client from that snapshot, and method authorization accepts a retained operator.admin scope without a current role-policy lookup.
Disconnect does not revoke retained synthetic authority: users.setRole invalidates and closes matching WebSocket clients, but the production disconnect path only mutates live clients; it cannot clear a previously-created synthetic tool client. The existing test simulates revocation by mutating a local scopes object rather than exercising that path.
Required authority proof remains absent: The in-process-dispatch test proves authority expires after an invocation completes, not that a role change during an awaited hook blocks an admin method before dispatch. The provided PR trace covers reconnect-time revocation, not this race.
Findings 2 actionable findings [P1] Revalidate role scopes before in-process tool dispatch
[P1] Provide a non-escalating role bootstrap path
Security Needs attention Role revocation does not reach retained tool authority: An awaited tool hook can outlive a user’s role downgrade while retaining the old operator.admin scope in a synthetic client; Gateway method routing trusts that stale scope before a privileged side effect.

How this fits together

Gateway converts authenticated identity into operator scopes before routing WebSocket, HTTP, and tool requests. This change stores a role on the user profile and applies its ceiling across session and agent operations, including in-process tool calls.

flowchart LR
  A[Verified user identity] --> B[Gateway authentication]
  B --> C[Profile role and scope ceiling]
  C --> D[WebSocket HTTP and tool requests]
  D --> E[Session and agent authorization]
  E --> F[Gateway side effects]
Loading

Decision needed

Question Recommendation
Which safe bootstrap authority should an identity-only Gateway use to assign its first named role without granting every default guest operator.admin? Require an explicit scoped bootstrap path: Add a narrowly bounded bootstrap authority or setup flow that can assign the first role without making the default role administrative.

Why: The feature’s least-privilege model cannot be made operable by a warning alone; choosing a bootstrap mechanism determines the public configuration and recovery contract.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the posted loopback trace proves reconnect-time revocation but not a role downgrade during an awaited hook; show the demoted operator is rejected before an admin Gateway final effect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Revalidate role scopes before in-process tool dispatch (P1) - A role downgrade during runBeforeToolCallHook leaves the retained AsyncLocal authority with its original scopes. The synthetic client then carries those scopes into method authorization, which accepts operator.admin without consulting the now-downgraded role. Closing the WebSocket only rejects buffered frames and does not revoke this in-process client, so a hook-delayed tool can still make an admin Gateway call after users.setRole. Re-resolve the role ceiling or generation immediately before the routed final effect and add the hook-race test.
  • Provide a non-escalating role bootstrap path (P1) - The documented configuration assigns every unassigned identity to guest, whose ceiling strips the identity’s operator.admin grant, while users.setRole is the only documented assignment path and itself requires that scope. An identity-only deployment using this example therefore cannot promote its first maintainer; putting admin in the default role instead grants it to every guest. Add a scoped bootstrap mechanism or reject activation until one is configured, and cover the trusted-proxy setup end-to-end.
  • Resolve security concern: Role revocation does not reach retained tool authority - An awaited tool hook can outlive a user’s role downgrade while retaining the old operator.admin scope in a synthetic client; Gateway method routing trusts that stale scope before a privileged side effect.
  • Resolve merge risk (P1) - The PR’s acknowledged sessions.patch owner-stamping gap can hide a role-capped user’s newly created session until its canonical repair is linked or landed.
  • Resolve merge risk (P1) - Exact-head CI remains in progress in the supplied context; it does not affect the two source-proven blockers.
  • Complete next step (P2) - Maintainers must choose the bootstrap contract and require the missing revocation-before-I/O proof before this cross-cutting role feature can merge.
  • Improve patch quality - Add a paused-hook role-downgrade test that proves an admin method is rejected before dispatch.
  • Improve patch quality - Choose and prove a safe first-maintainer bootstrap flow for trusted identity authentication.
  • Improve patch quality - Link or land the sessions.patch owner-stamping repair before claiming own-session access coverage.

Findings

  • [P1] Revalidate role scopes before in-process tool dispatch — src/gateway/server-plugin-in-process-dispatch.ts:161-195
  • [P1] Provide a non-escalating role bootstrap path — docs/gateway/configuration-reference.md:715-727
  • [high] Role revocation does not reach retained tool authority — src/gateway/server-plugin-in-process-dispatch.ts:161
Agent review details

Security

Needs attention: The diff permits stale administrator authority to cross a role-revocation boundary into an in-process Gateway side effect.

Review metrics

Metric Value Why it matters
Role policy surface 1 config subtree added; 1 persisted nullable profile field; 1 Gateway role-assignment RPC added This creates configuration, stored-state, and administrative contracts whose bootstrap and upgrade behavior must be safe.
Production and test LOC PR body reports approximately production +2.2k and tests +4.1k The cross-entry-point authorization surface needs final-effect revocation proof beyond the current test coverage.

Stored data model

Persistent data-model change detected: database schema: docs/reference/database-schemas.md, database schema: src/state/user-profiles.test.ts, serialized state: src/gateway/agent-turn/agent-session-persist.test.ts, serialized state: src/gateway/session-create-service.ts, serialized state: src/gateway/session-group-defaults-access.ts, serialized state: src/gateway/session-group-mutation-targets.ts, and 28 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair revocation and bootstrap before merge (recommended)
    Fence each routed in-process effect with current role authority, add the awaited-hook demotion proof, and provide a least-privilege first-maintainer path.
  2. Pause the feature
    Do not land team roles until maintainers choose and validate an operable bootstrap contract.

Technical review

Best possible solution:

Add a non-escalating first-maintainer bootstrap path and revalidate live role authority immediately before each in-process final effect, with trusted-identity end-to-end proof for both.

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

Yes, from source: pause the before-tool hook for an administrator, demote that profile through users.setRole, then resume a tool that dispatches an admin Gateway method; the retained synthetic client still carries the old scope. The bootstrap lockout follows directly from the documented guest ceiling and admin-only assignment method.

Is this the best way to solve the issue?

No. Closing a WebSocket is not a live authorization check for retained in-process clients, and a Doctor warning cannot bootstrap an administrator; use a current-policy fence plus a deliberate scoped bootstrap authority.

Full review comments:

  • [P1] Revalidate role scopes before in-process tool dispatch — src/gateway/server-plugin-in-process-dispatch.ts:161-195
    A role downgrade during runBeforeToolCallHook leaves the retained AsyncLocal authority with its original scopes. The synthetic client then carries those scopes into method authorization, which accepts operator.admin without consulting the now-downgraded role. Closing the WebSocket only rejects buffered frames and does not revoke this in-process client, so a hook-delayed tool can still make an admin Gateway call after users.setRole. Re-resolve the role ceiling or generation immediately before the routed final effect and add the hook-race test.
    Confidence: 0.97
  • [P1] Provide a non-escalating role bootstrap path — docs/gateway/configuration-reference.md:715-727
    The documented configuration assigns every unassigned identity to guest, whose ceiling strips the identity’s operator.admin grant, while users.setRole is the only documented assignment path and itself requires that scope. An identity-only deployment using this example therefore cannot promote its first maintainer; putting admin in the default role instead grants it to every guest. Add a scoped bootstrap mechanism or reject activation until one is configured, and cover the trusted-proxy setup end-to-end.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 23df5799fd01.

Labels

Label changes:

  • add merge-risk: 🚨 auth-provider: The role ceiling changes trusted-proxy and Tailscale identity authentication behavior, including whether their granted scopes survive.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P1: The advertised team-role flow can either retain revoked admin authority or leave an identity-only deployment unable to assign its first maintainer.
  • merge-risk: 🚨 compatibility: Enabling the documented default role can remove an existing identity-granted admin scope with no operable upgrade path.
  • merge-risk: 🚨 security-boundary: A demoted operator can retain operator.admin in an in-process synthetic client after the role change.
  • merge-risk: 🚨 auth-provider: The role ceiling changes trusted-proxy and Tailscale identity authentication behavior, including whether their granted scopes survive.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the posted loopback trace proves reconnect-time revocation but not a role downgrade during an awaited hook; show the demoted operator is rejected before an admin Gateway final effect. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [high] Role revocation does not reach retained tool authority — src/gateway/server-plugin-in-process-dispatch.ts:161
    An awaited tool hook can outlive a user’s role downgrade while retaining the old operator.admin scope in a synthetic client; Gateway method routing trusts that stale scope before a privileged side effect.
    Confidence: 0.97

Acceptance criteria:

  • [P1] Configure identity-only Gateway roles with a default guest and establish the first maintainer without giving guests operator.admin.
  • [P1] Pause a before-tool hook, demote the active profile, then verify an admin Gateway call is denied before its final effect.
  • [P1] Create and re-open a session through sessions.patch as a role-capped profile after the owner-stamping repair.

What I checked:

  • Stale authority after an await: Tool invocation awaits the before-tool hook, then installs the pre-await profile and scope snapshot as in-process authority. The dispatcher builds a synthetic client from that snapshot, and method authorization accepts a retained operator.admin scope without a current role-policy lookup. (src/gateway/tools-invoke-shared.ts:394, 6176265d0e83)
  • Disconnect does not revoke retained synthetic authority: users.setRole invalidates and closes matching WebSocket clients, but the production disconnect path only mutates live clients; it cannot clear a previously-created synthetic tool client. The existing test simulates revocation by mutating a local scopes object rather than exercising that path. (src/gateway/server-request-context.ts:368, 6176265d0e83)
  • Required authority proof remains absent: The in-process-dispatch test proves authority expires after an invocation completes, not that a role change during an awaited hook blocks an admin method before dispatch. The provided PR trace covers reconnect-time revocation, not this race. (src/gateway/server-plugin-in-process-dispatch.authorization.test.ts:210, 6176265d0e83)
  • Documented configuration locks out first role assignment: The example gives the identity an admin grant but then applies a default guest role whose ceiling omits operator.admin; the only documented role-assignment method requires administrator scope. Adding admin to the default would instead grant it to all guests. Public docs: docs/gateway/configuration-reference.md. (docs/gateway/configuration-reference.md:715, 6176265d0e83)
  • Known session-owner gap affects the advertised role flow: The sessions.patch creation path authorizes a missing entry and writes the projected entry without the canonical creation stamp, while catalog visibility treats createdActor as ownership. The PR body identifies this as a separate follow-up; no canonical repair is linked here. (src/gateway/server-methods/sessions-patch-engine.ts:197, 6176265d0e83)
  • Current-main and release status: Current main is 23df579 and does not contain src/gateway/operator-role-policy.ts; no version tag contains the PR head. The feature is therefore neither implemented on current main nor released. (src/gateway/operator-role-policy.ts, 23df5799fd01)

Likely related people:

  • steipete: Grafted-head blame attributes the role-dispatch and role-configuration surface to this contributor. (role: current feature contributor; confidence: medium; commits: 6176265d0e83; files: src/gateway/server-plugin-in-process-dispatch.ts, src/gateway/server-request-context.ts, docs/gateway/configuration-reference.md)

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 (2 earlier review cycles)
  • reviewed 2026-08-24T06:07:12.653Z sha 9b7e1ac :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-24T07:24:23.670Z sha 3ba58e2 :: needs real behavior proof before merge. :: [P1] Revalidate the role immediately before tool execution

@openclaw-barnacle openclaw-barnacle Bot added the app: android App: android label Aug 24, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 24, 2026
Adds gateway.roles: named role bundles over a closed capability set —
sessions.others (none/view/suggest/write), an agents allowlist, and an
operator-scope ceiling. Roles are person-level (additive user_profiles.role
column, SQLite stays at v9); users.setRole (admin-only) assigns them. With
no gateway.roles config, behavior is unchanged for solo deployments.

Enforcement is deny-by-default from a host-minted actor identity
(system vs operator+profileId on server-only client.internal, never
accepted from the wire) and covers every entry point: WS RPCs, OpenAI-compat
and Responses HTTP, tools invocation, cron, questions, usage, task
suggestions, session catalog/sharing/reads. The agents allowlist gates both
session creation and run-start on existing sessions. Subagent completion
announce and descendant wake mint explicit system authority so role
boundaries never silently drop parent notifications.

The enforcement surface is expressed through a narrow policy vocabulary
(operatorSessionCap, hasOperatorBoundary, authorizeSessionSharing) rather
than per-handler policy internals.
- Break import cycles: extract GatewayOperatorRoleActor leaf contract; merge
  session-group-mutation-targets into session-sharing-target-input.
- Split sessions-suggestions.test.ts (max-lines) into a visibility suite.
- Add users.setRole to the 2026.8 train registry test and regenerate the
  Kotlin protocol client.
- Startup UNAVAILABLE gating now precedes session authorization: session
  stores are not loaded during startup, so authorization reads would deny
  with a misleading non-retryable error.
- sessions.assignOwner keeps its documented visibility-authorized contract
  when no operator role caps the caller; view/suggest-capped roles still
  cannot reassign foreign session ownership.
- Test stubs updated for main's socket readyState guard (#128144) and the
  system-authority arg on channel-native resets.
…d session target

chat.send requires a non-empty sessionKey at the protocol level; the mutation
pipeline now rejects targetless frames before profile-dependent dispatch, so
the pending-profile test must send a realistic frame.
@steipete
steipete force-pushed the steipete/openclaw-non-maintainer-access-b93bdf branch from 3ba58e2 to 6176265 Compare August 24, 2026 07:59
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 24, 2026
@steipete
steipete merged commit 53dcaae into main Aug 24, 2026
240 checks passed
@steipete
steipete deleted the steipete/openclaw-non-maintainer-access-b93bdf branch August 24, 2026 08:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 25, 2026
…claw#128548)

* feat(gateway): generic operator roles for non-maintainer access

Adds gateway.roles: named role bundles over a closed capability set —
sessions.others (none/view/suggest/write), an agents allowlist, and an
operator-scope ceiling. Roles are person-level (additive user_profiles.role
column, SQLite stays at v9); users.setRole (admin-only) assigns them. With
no gateway.roles config, behavior is unchanged for solo deployments.

Enforcement is deny-by-default from a host-minted actor identity
(system vs operator+profileId on server-only client.internal, never
accepted from the wire) and covers every entry point: WS RPCs, OpenAI-compat
and Responses HTTP, tools invocation, cron, questions, usage, task
suggestions, session catalog/sharing/reads. The agents allowlist gates both
session creation and run-start on existing sessions. Subagent completion
announce and descendant wake mint explicit system authority so role
boundaries never silently drop parent notifications.

The enforcement surface is expressed through a narrow policy vocabulary
(operatorSessionCap, hasOperatorBoundary, authorizeSessionSharing) rather
than per-handler policy internals.

* fix(gateway): heal PR CI after rebase onto main

- Break import cycles: extract GatewayOperatorRoleActor leaf contract; merge
  session-group-mutation-targets into session-sharing-target-input.
- Split sessions-suggestions.test.ts (max-lines) into a visibility suite.
- Add users.setRole to the 2026.8 train registry test and regenerate the
  Kotlin protocol client.
- Startup UNAVAILABLE gating now precedes session authorization: session
  stores are not loaded during startup, so authorization reads would deny
  with a misleading non-retryable error.
- sessions.assignOwner keeps its documented visibility-authorized contract
  when no operator role caps the caller; view/suggest-capped roles still
  cannot reassign foreign session ownership.
- Test stubs updated for main's socket readyState guard (openclaw#128144) and the
  system-authority arg on channel-native resets.

* test(gateway): chat.send pending-profile dispatch carries its required session target

chat.send requires a non-empty sessionKey at the protocol level; the mutation
pipeline now rejects targetless frames before profile-dependent dispatch, so
the pending-profile test must send a realistic frame.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 25, 2026
…sions (openclaw#128774)

The sessions.patch create path skipped createdVia and createdActor, making the creator own session invisible under createSessionListEntryFilter when gateway.roles sets sessions.others=none.

Thread resolveOperatorSessionCreation through sessions-patch-engine into projectSessionsPatchEntry and stamp only genuinely new rows, mirroring session-create-service. Preserve existing rows and placeholder aliases without restamping their provenance.

Add an owner-boundary regression proving the identified creator can see and update a patch-created session. Follow-up of openclaw#128548.
obviyus added a commit that referenced this pull request Sep 2, 2026
…6420)

Fixes #133955.

Reported by @aoclaw-glitch. Thank you for the clear trust-model and reconnect analysis.

## What Problem This Solves

Fixes an issue where operator clients rejected by configured Gateway role policies would reconnect forever when their auth method did not provide a verified user identity. The rejection also used broad wording and did not tell the Control UI how to recover.

## Why This Change Was Made

The handshake now returns the precise additive `AUTH_VERIFIED_USER_REQUIRED` detail and states which authentication paths work. TypeScript, Android, and Swift clients treat this outcome as terminal without clearing a valid device token. The Control UI shows verified-identity recovery steps instead of network or proxy-header troubleshooting.

The existing `AUTH_IDENTITY_HEADER_REQUIRED` code remains specific to missing trusted-proxy headers.

## User Impact

Clients stop reconnect churn after this configured-role rejection. Operators can reconnect through the trusted proxy or Tailscale, or use the shared Gateway token or password for trusted local access.

## Evidence

- Red on main `e61adf3d2c61cde99f224d590a9f0824e21ccc8e`: the real WebSocket client received the detail-less rejection twice and never paused.
- Green on head `655c283aeedeab4064234640e89b07fe5b976aa7`: the real client received `AUTH_VERIFIED_USER_REQUIRED`, made one attempt after waiting past the first reconnect delay, and retained the exact server-valid device token.
- `node scripts/run-vitest.mjs src/gateway/server/ws-connection/connect-device-pairing.test.ts packages/gateway-client/src/reconnect-policy.test.ts ui/src/components/login-gate.test.ts`
- `pnpm lint:core`
- Control UI localization, formatting, max-lines, assertion-safety, coercion-helper, conflict-marker, and native-state schema guards passed.
- Local native test processes could not start because this Linux host lacks Swift and Java; pull-request CI owns native compilation and tests.

Production LOC: +39/-3 (net +36) | Tests: +127/-12

The production growth is the new cross-client error contract, terminal classifiers, and user recovery card. No configuration, persistence, or protocol version changes are included.

Provenance: PR #128548 introduced the detail-less rejection in `53dcaaedec195fdaf5af06357557c706d3c0caf5` on 2026-08-24. The raw parent is `1f1d0e9d8f2b4b05102aeb0f17ee94d06142dcac`; author and merger were @steipete.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
…nclaw#136420)

Fixes openclaw#133955.

Reported by @aoclaw-glitch. Thank you for the clear trust-model and reconnect analysis.

## What Problem This Solves

Fixes an issue where operator clients rejected by configured Gateway role policies would reconnect forever when their auth method did not provide a verified user identity. The rejection also used broad wording and did not tell the Control UI how to recover.

## Why This Change Was Made

The handshake now returns the precise additive `AUTH_VERIFIED_USER_REQUIRED` detail and states which authentication paths work. TypeScript, Android, and Swift clients treat this outcome as terminal without clearing a valid device token. The Control UI shows verified-identity recovery steps instead of network or proxy-header troubleshooting.

The existing `AUTH_IDENTITY_HEADER_REQUIRED` code remains specific to missing trusted-proxy headers.

## User Impact

Clients stop reconnect churn after this configured-role rejection. Operators can reconnect through the trusted proxy or Tailscale, or use the shared Gateway token or password for trusted local access.

## Evidence

- Red on main `d71a187ceaf0a353b4871a1542e4e0a0f32e5a54`: the real WebSocket client received the detail-less rejection twice and never paused.
- Green on head `655c283aeedeab4064234640e89b07fe5b976aa7`: the real client received `AUTH_VERIFIED_USER_REQUIRED`, made one attempt after waiting past the first reconnect delay, and retained the exact server-valid device token.
- `node scripts/run-vitest.mjs src/gateway/server/ws-connection/connect-device-pairing.test.ts packages/gateway-client/src/reconnect-policy.test.ts ui/src/components/login-gate.test.ts`
- `pnpm lint:core`
- Control UI localization, formatting, max-lines, assertion-safety, coercion-helper, conflict-marker, and native-state schema guards passed.
- Local native test processes could not start because this Linux host lacks Swift and Java; pull-request CI owns native compilation and tests.

Production LOC: +39/-3 (net +36) | Tests: +127/-12

The production growth is the new cross-client error contract, terminal classifiers, and user recovery card. No configuration, persistence, or protocol version changes are included.

Provenance: PR openclaw#128548 introduced the detail-less rejection in `75dfbacbaebb678b43e53606ec9b7c659ffab129` on 2026-08-24. The raw parent is `3f9488a8030427c59dcf4d727eb54a9061775552`; author and merger were @steipete.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: android App: android app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant