Repository navigation
feat: let admins share specific projects with restricted roles - #203470
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: needs maintainer review before merge. What this changesAdds role-specific project sharing, isolated worktrees for grant-only access, and an administrator-only project rename method. Example: An administrator grants the guest role projects: ["private-handbook"].
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds a useful capability absent from current main, with no introduced correctness or security defect identified; the CI gate remains red. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway project admission combines authenticated scopes, current role grants, and repository visibility to return discoverable projects or authorize checkout creation. flowchart TD
A[Authenticated requester] --> B[Current role and scopes]
B --> C[Project access policy]
D[Project registry] --> C
E[GitHub visibility] --> C
C --> F[Project listing and metadata]
C --> G[Session and child worktrees]
Technical reviewBest possible solution: Retain the existing project-access owner for explicit role grants and land the core capability with its companion administration UI after the CI gate is resolved. Do we have a high-confidence way to reproduce the issue? This is a feature request implemented by the PR; current-main source confirms the missing selective-sharing capability, and supplied Gateway traces exercise the new behavior without running target code during review. Is this the best way to solve the issue? The approach fits the existing owners: role configuration supplies grants, project-access.ts decides visibility and admission, and the registry worker handles rename without adding another store or manager. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e2973f933f10. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +277, Tests +427, Docs +47, Generated 0, Other +2. Total +753 across 45 files. Added test files: 0. 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:
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 HistoryReview history (1 earlier review cycle)
Reviewed November 23, 2026, 2:59 PM ET / 19:59 UTC (Revision 2). |
1855a93 to
2ee9ad1
Compare
Real-Gateway upgrade and behavior proofReal Gateways ran on this host with an isolated
Stable 2026.11.7 seeds the state (01-stable-2026.11.7-seed.txt)Branch upgrades the same state in place (02-branch-upgrade-load.txt)Grant, isolated worktree, revoke (03-branch-grant-isolated-worktree-revoke.txt)Rename persists across restart (04-rename-persists-across-restart.txt)Fresh install (05-fresh-install.txt) |
Add an optional `projects` field ("*" or registry project IDs) to Gateway
role definitions. Restricted operators (no operator.write) keep the
public-GitHub fallback and additionally reach the granted projects in
projects.list, checkout options, project skills, sessions.create,
background spawns, inherited child checkouts, icon reads and publication
paths. Requesters carry the grant from their current role policy; runs use
the admitted authority's prepared role policy or the creator's live role.
A project reached only through a grant always opens in an isolated managed
worktree. Grants never widen cwd, folder browsing, projectGitUrl or remote
search; unknown IDs are ignored.
Add the admin-scoped projects.rename RPC for registry projects.
Project grant edits no longer count as a role source-policy change, so they do not reconnect clients or stop runs. Background runs and spawns resolve the driving operator's (or creator's) current grant live instead of a prepared snapshot, keeping revocation immediate for new uses and out of run-recovery snapshots.
Retained connections and admitted-run synthetic clients carried the admission-time role into project access, so a revoked grant kept working and a new one was missed. Project grants now always come from the caller's canonical profile and current role after the ordinary role boundary (OpenClaw ID owner, member and node principals included), for clients, run authorities, spawns and publication paths.
A merge redirects an admitted profile to another person's role. Live grant resolution now requires the current canonical profile to equal the admitted one, so retained runs, spawns and publication paths grant nothing after such a merge, while prepared aliases still resolve their canonical profile's grant.
…child test #203488 made sessions.create check requester authority once at admission and removed the mid-request hasCurrentClientAuthority re-checks. The repository child test still flipped that callback before and during the parent copy and expected "Gateway requester authority changed"; the request now proceeds to the label check instead. Remove those four rows, as #203488 did for the other mid-request refusal tests, and keep the parent-source data fence row.
6b490a1 to
a2e74e6
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* fix(tlon): gate group DMs by club approval * fix(tlon): persist configured club grants * docs(config): record Tlon club policy surface * test(tlon): keep sender role cases under lint limit * fix(tlon): preserve direct settings events * fix(tlon): narrow settings event records without assertions (cherry picked from commit 6eb70d4) Release adaptation: regenerate stable config docs counts/hashes and bundled channel metadata; no source conflicts. Channel count +6, core/plugin unchanged. The assertion ratchet generator confirms the same Tlon-only shrink; unrelated pre-existing UI ratchet entries are excluded. Companion disposition: #204126 is a missing optional user-facing warning about later club invitees; existing prompts already disclose unverified participant input and future messages. #203928 is not applicable to approval/routing, only image download lifetime. #204219, #203470, #203901 and #203063 overlap only generated/ratchet files, not applicable; regenerate from stable inputs. No later PR or commit-SHA mentions. Co-authored-by: RomneyDa <[email protected]>
…law#203470) * feat(gateway): grant named roles access to registered projects Add an optional `projects` field ("*" or registry project IDs) to Gateway role definitions. Restricted operators (no operator.write) keep the public-GitHub fallback and additionally reach the granted projects in projects.list, checkout options, project skills, sessions.create, background spawns, inherited child checkouts, icon reads and publication paths. Requesters carry the grant from their current role policy; runs use the admitted authority's prepared role policy or the creator's live role. A project reached only through a grant always opens in an isolated managed worktree. Grants never widen cwd, folder browsing, projectGitUrl or remote search; unknown IDs are ignored. Add the admin-scoped projects.rename RPC for registry projects. * fix(gateway): read project grants live without retiring role work Project grant edits no longer count as a role source-policy change, so they do not reconnect clients or stop runs. Background runs and spawns resolve the driving operator's (or creator's) current grant live instead of a prepared snapshot, keeping revocation immediate for new uses and out of run-recovery snapshots. * fix(gateway): read retained run project grants from current config Retained connections and admitted-run synthetic clients carried the admission-time role into project access, so a revoked grant kept working and a new one was missed. Project grants now always come from the caller's canonical profile and current role after the ordinary role boundary (OpenClaw ID owner, member and node principals included), for clients, run authorities, spawns and publication paths. * fix(gateway): keep live project grants on the admitted profile A merge redirects an admitted profile to another person's role. Live grant resolution now requires the current canonical profile to equal the admitted one, so retained runs, spawns and publication paths grant nothing after such a merge, while prepared aliases still resolve their canonical profile's grant. * chore: allocate test lines for role project grant regressions * test(gateway): drop stale mid-request authority rows from repository child test openclaw#203488 made sessions.create check requester authority once at admission and removed the mid-request hasCurrentClientAuthority re-checks. The repository child test still flipped that callback before and during the parent copy and expected "Gateway requester authority changed"; the request now proceeds to the label check instead. Remove those four rows, as openclaw#203488 did for the other mid-request refusal tests, and keep the parent-source data fence row.
Remove unused exports left by openclaw#204094, openclaw#204178, and openclaw#203470. Preserve focused coverage through the existing Windows supervisor and completion-settlement entry points.
What Problem This Solves
On a multi-user Gateway, people with restricted roles (for example
guestorcollaborator) can only see agent workspaces and projects whose origin is a public GitHub repository. An admin has no way to share a specific private repository with them short of grantingoperator.write, which also unlocks folder browsing, arbitrary working directories and cloning by URL. In practice, a collaborator opening New Session sees no projects at all.User Impact
User impact: admins can share chosen registered projects with a named role by adding
projectsto its definition ("*"for every registered project, or a list of project IDs). People in that role then see and can start sessions in those projects. Roles without the field behave exactly as before. Sharing or unsharing takes effect on the next request without disconnecting anyone or stopping their runs.Admins can also rename a registered project with the new
projects.renamemethod (admin only).Why This Change Was Made
Project access is decided in one place (
project-access.ts), and roles already carry similar allow lists (agents,workerProfiles). This adds a matchingprojectslist and passes the caller's current grant to every project-access check: project listing, checkout options, project skills, session creation, subagent spawns, inherited worktrees, GitHub publication and PR workspace prep, and project icons.cwd, cloning by URL, remote search). Hidden projects still look like unknown IDs.Known gap, deliberately unchanged for backward compatibility: a restricted caller can still open a public-GitHub project as a direct checkout without a worktree, as on
maintoday.This is the core half of a two-PR stack; the Control UI Projects tab that edits these grants follows on top of this branch.
Evidence
"*", a listed private project, an unlisted private project staying hidden, full access being unchanged, a forced worktree for grant-only access (and none for public access), andprojects.rename(authorization, validation, kept ID).sessions.create,projects.listandcheckoutOptionsintegration tests share and unshare a private project. They show revocation denying it again, a retained restricted run following grant edits without a restart, and a merged profile not picking up another profile's grant.projects. Sharing a private project lists it and opens it in a managed worktree, revoking it denies the next request, rename survives a restart, and a fresh install works.6ff7a062e54e) stopped re-checking requester authority after a request is admitted, but left four stale mid-request rows inserver.sessions.create.projects.test.ts. That test fails identically onmain, and this PR's diff makes CI select it. Commit6b490a1dremoves those rows the same way refactor(gateway): check session mutation authority once at admission #203488 handled its other tests, and keeps the parent-source-change row. Bisect: passes ate0c7c74ae20d, fails at6ff7a062e54e.main, not caused by this PR: CI tests this branch merged with currentmain, and this diff makes it select these files. Each fails identically onmain515a93c6725bwithout our commits, and the first three pass on this branch without refactor(agents): drop mid-run operator authority re-reads (R6c part 4c) #204155:operator-run-authority.worker.test.ts(readCurrentRoleFactsno longer throws),ui-command.test.ts("Alice's access changed"), andlocal-request-context.session-tools.test.ts(revocation now returns a tool error): stale expectations after refactor(agents): drop mid-run operator authority re-reads (R6c part 4c) #204155 dropped mid-run authority re-reads.users-personal-file.test.ts(3 rows): fails on412df9062d6ctoo and is already listed as failing onmainin refactor(agents): drop mid-run operator re-checks in agent tools, sandbox and command #204093.session-run.session-model-strictness.integration.test.ts(scheduled preflight compaction): fails onmainalone.Commands
pnpm tsgo:core,pnpm tsgo:test:src(22 shards): passsincecheck,format:docs:check: passmain1601f86def0c.pnpm check:baseline-ratchets --base origin/main(12/12),protocol:check,gateway:validators:check: pass🦞 Made with OpenClaw