Skip to content

Workspaces: add safe workspace distribution#101919

Open
100yenadmin wants to merge 22 commits into
openclaw:mainfrom
100yenadmin:feat/dashboard-distribution
Open

Workspaces: add safe workspace distribution#101919
100yenadmin wants to merge 22 commits into
openclaw:mainfrom
100yenadmin:feat/dashboard-distribution

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Workspace owners need a safe way to move a dashboard layout between installations without exporting private data, preserving authorization by accident, or letting imported custom code become executable. The previous distribution work predated the first-class Teams tenant, principal, and exact-resource grant contracts and could not safely distinguish an owner export from a member's exact shared-tab export.

Why This Change Was Made

This rebuild makes distribution a Workspaces-owned, authorization-aware workflow:

  • canonical workspace owners may export the layout for the full workspace;
  • external members may export only the exact tab granted to their Teams principal;
  • exports are versioned and layout-only: bindings, opaque widget props, credentials, grants, presence, and session data are not included;
  • imports are owner-only and use a bounded preview followed by an explicit commit;
  • preview state is short-lived and bound to the owner, isolation domain, workspace, and source workspace version;
  • imported tabs, widgets, slugs, and custom-widget namespaces receive fresh collision-safe identities;
  • imported custom widgets always return to pending approval and cannot inherit an executable snapshot;
  • an agent-facing WORKSPACE-DESIGN.md documents the review/refine loop and distribution security contract; it is guidance only and cannot grant access or approve custom widgets;
  • the commit preserves tab order, performs bounded capacity eviction only when a reserved slot is needed, and synchronizes the new tab inventory with the canonical Teams resource registry;
  • a post-commit sharing-sync failure is returned as a warning after the durable import succeeds, rather than falsely reporting the import as rolled back;
  • a ?ws= deep link selects presentation state only and is never accepted as authorization input.

The implementation reuses the Teams resource-specific owner signal and exact-tab authorization rather than creating a second distribution permission model.

User Impact

Owners can review and import a shared workspace package without exposing workspace data or silently trusting custom code. Team members can carry away only the tab they were actually granted. Imported layouts remain useful, while every security-sensitive identity and approval is regenerated locally.

Evidence

  • Restacked onto Teams foundation d3ca7fa6ccf9b80eb52b310f956a35112561a0cd, based on upstream main 7da28f370476ef53c025f37339c1b128f6ed3933 captured 2026-07-13T09:16:13Z; both feature commits range-diff identically.
  • Focused Workspaces proof: 25 extension tests and 49 UI tests passed (74 total), including owner/member export boundaries, preview binding, collision handling, capacity eviction, tab-order preservation, pending custom widgets, sharing-sync warnings, and deep-link authorization isolation.
  • pnpm tsgo:extensions, scoped Oxlint, and git diff --check passed.
  • Structured review findings were classified under the scope governor and all accepted distribution correctness/security findings were fixed with regression coverage.
  • No dependency or lockfile change remains in the rebuilt branch.
  • Only the English source locale changes here; generated non-English locale bundles remain owned by the authenticated post-merge locale refresh workflow.

Closes #101155. Addresses #101154. Partially addresses #101156.

@100yenadmin
100yenadmin requested a review from a team as a code owner July 7, 2026 23:59
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh /allow-dependencies-change comment after the guard blocks that new head SHA.

  • Current SHA: c1c4fbee678f9847d3553fb1d20b14b842317651

@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 5:51 AM ET / 09:51 UTC.

Summary
Adds authorization-aware workspace export/import, exact-tab Teams sharing, schema and SQLite migrations, host-bound plugin Teams APIs, delegated agent authorization propagation, and Control UI distribution and Teams portal flows.

Reproducibility: not applicable. This PR adds new distribution and multi-user authorization capabilities rather than repairing a reproducible current-main bug.

Review metrics: 3 noteworthy metrics.

  • Public API surfaces: 1 new api.teams namespace plus resource access policies. The PR publishes a compatibility-sensitive plugin authorization contract rather than only an internal Workspaces implementation.
  • Persisted schema surfaces: 2 changed: shared authorization state and Workspaces schema v1→v2. Both fresh-install and upgrade behavior need proof before merge.
  • Authentication surfaces: 3 added: local accounts, session cookies, and invite redemption. These expand the security boundary and require live end-to-end validation.

Stored data model
Persistent data-model change detected: database schema: extensions/workspaces/src/default-workspace.ts, database schema: extensions/workspaces/src/schema.test.ts, database schema: extensions/workspaces/src/schema.ts, database schema: extensions/workspaces/src/ui-gateway-integration.test.ts, database schema: src/state/openclaw-state-schema.generated.ts, database schema: src/state/openclaw-state-schema.sql, and 13 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live browser proof for owner export/import, exact-tab member access and denial, revocation, pending custom widgets, and presentation-only ?ws= behavior.
  • [P1] Rebase onto current main and resolve the failing required checks on the exact head.
  • Obtain explicit maintainer sponsorship for the public api.teams contract and combined Teams/Workspaces landing plan.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body reports focused tests and a successful proof check, but the supplied body and comments contain no inspectable after-fix recording, screenshot, terminal output, logs, or linked artifact for the rewritten owner/member flows. Add redacted live browser evidence and update the PR body to trigger re-review; if needed, ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The Workspaces schema and isolation-domain partitioning can affect durable existing layouts, so upgrade fixtures must prove that current local state is preserved or rejected with an actionable recovery path.
  • [P1] The new api.teams namespace and gateway resource-policy contract would become public plugin SDK surface before its permanent API direction has explicit maintainer approval.
  • [P1] The new accounts, cookies, invites, exact-resource grants, delegated-agent authority, and member sockets create security boundaries where a binding or lifetime defect could expose another tab, tenant, or operator capability.
  • [P1] The branch is behind current main and several checks fail on its current head, leaving the exact three-way merge and current-base validation unresolved.
  • [P1] The supplied discussion has no inspectable redacted live browser artifact proving owner import/export, exact-tab member restrictions, pending imported custom widgets, revocation, and deep-link authorization isolation.

Maintainer options:

  1. Split and prove owner distribution (recommended)
    Extract local owner export/import and its schema migration into a focused branch, leaving Teams and public plugin APIs for separate approval.
  2. Accept the combined platform change
    Keep the full stack but require explicit API sponsorship, upgrade fixtures, adversarial authorization review, and live proof before merge.
  3. Pause the oversized stack
    Hold or close this branch if maintainers do not want to adopt the Teams and plugin authorization platform now.

Next step before merge

  • [P1] A maintainer must choose the permanent Teams and plugin API direction and stack split before normal repair or merge validation proceeds.

Maintainer decision needed

  • Question: Should OpenClaw adopt this combined Teams authorization and Workspaces distribution stack, including the new public api.teams plugin SDK contract, as the supported product direction?
  • Rationale: This is not a narrow distribution patch; it establishes identity, authorization, persisted-state, gateway, plugin SDK, and member-portal contracts whose scope and permanence require maintainer intent.
  • Likely owner: 100yenadmin — This is the only evidence-backed person connected to the full feature history in the supplied context; an official decision owner could not be established.
  • Options:
    • Sponsor the full stack: Approve the Teams and Workspaces architecture, API direction, and ordered landing plan, then require compatibility and live-proof gates on a rebased head.
    • Split distribution from Teams (recommended): Keep owner-only local export and import in a focused PR while the Teams and public authorization APIs receive separate design review.
    • Pause the direction: Hold or close the branch until maintainers choose a smaller Workspaces distribution and multi-user sharing architecture.

Security
Needs attention: The design contains substantial defensive work, but the exact current head still needs independent live cross-tenant and imported-code security proof.

Review details

Best possible solution:

Land only an explicitly sponsored and rebased design after stable plugin API approval, fresh-install and upgrade migration proof, adversarial authorization review, and redacted live Control UI and Teams portal evidence for the exact head.

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

Not applicable: this PR adds new distribution and multi-user authorization capabilities rather than repairing a reproducible current-main bug.

Is this the best way to solve the issue?

Unclear: the security design is detailed, but combining owner distribution with a new Teams platform and public plugin API is not yet proven to be the narrowest maintainable solution.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7efdd9d70607.

Label changes

Label justifications:

  • P2: This is a substantial optional feature stack with material review complexity but no demonstrated urgent regression.
  • merge-risk: 🚨 compatibility: The PR changes persisted Workspaces schema and publishes plugin SDK contracts that upgrades and external callers may depend on.
  • merge-risk: 🚨 session-state: The PR migrates and partitions durable workspace state and binds preview, change-request, and session data to domains and principals.
  • merge-risk: 🚨 security-boundary: The PR adds accounts, cookies, invites, member sockets, resource grants, and delegated-agent authorization with cross-tenant exposure risk if incorrect.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and a successful proof check, but the supplied body and comments contain no inspectable after-fix recording, screenshot, terminal output, logs, or linked artifact for the rewritten owner/member flows. Add redacted live browser evidence and update the PR body to trigger re-review; if needed, ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

Security concerns:

  • [high] Require live cross-tenant authorization proof — src/plugins/teams-api.ts:1
    Prove that a member can export only the granted tab, cannot reach another tab or the operator shell, loses access after logout or revocation, and cannot reuse retained request or tool capabilities.
    Confidence: 0.88
  • [high] Prove imported code remains non-executable — extensions/workspaces/src/distribution.ts:1
    Show that imported custom widgets receive fresh identities, inherit no approved file snapshot, remain pending, and cannot be served or executed before separate approval.
    Confidence: 0.86

What I checked:

  • Current-main boundary: The PR is built from a Teams foundation plus two distribution commits that are not present in the supplied current-main revision, so the requested behavior is not implemented on main. (extensions/workspaces/src/distribution.ts:1, c1c4fbee678f)
  • Persisted compatibility surface: The branch changes the canonical Workspaces schema from version 1 to 2, adds immutable workspace and tab identifiers plus revisions, and migrates existing SQLite-backed workspace documents. (extensions/workspaces/src/schema.ts:51, d3ca7fa6ccf9)
  • Public plugin API expansion: The branch adds the host-bound api.teams namespace and resource access policies, creating a compatibility-sensitive public plugin SDK contract. (src/plugins/types.ts:2752, 392c075f6855)
  • Security boundary expansion: The branch adds local Teams accounts, HttpOnly sessions, invites, member gateway access, exact-resource authorization, delegated agent subjects, and a restricted portal. (src/gateway/teams-http.ts:1, e8d5813431e5)
  • Prior review continuity: The previous ClawSweeper cycle required real Control UI evidence and raised persistence, root-carve, and workflow findings. The rewrite appears to address the code findings, but the supplied PR body and comments still contain no inspectable live browser artifact. (ui/src/pages/plugin/workspace-view.ts:1, 5e1611c294d0)

Likely related people:

  • 100yenadmin: The supplied history connects this contributor to the Teams authorization foundation, Workspaces partitioning, exact sharing, restricted portal, and distribution implementation; no separate current-main owner was established from the available evidence. (role: feature author and recent area contributor; confidence: medium; commits: 392c075f6855, 93d2e57780f9, 288fa9ab6395; files: extensions/workspaces/src/distribution.ts, extensions/workspaces/src/store.ts, src/plugins/teams-api.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (3 earlier review cycles)
  • reviewed 2026-07-08T00:13:06.587Z sha c71f97a :: needs real behavior proof before merge. :: [P1] Persist dashboard workspace state in SQLite | [P3] Remove the root carve spec
  • reviewed 2026-07-08T04:35:06.456Z sha c71f97a :: needs real behavior proof before merge. :: [P1] Persist dashboard workspace state in SQLite | [P3] Remove the root carve spec
  • reviewed 2026-07-10T07:11:17.833Z sha 5e1611c :: needs real behavior proof before merge. :: [P1] Persist dashboard state in SQLite | [P3] Remove the root carve spec | [P2] Use a valid binding in the design workflow

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 8, 2026
@100yenadmin
100yenadmin force-pushed the feat/dashboard-distribution branch from 5e1611c to 3528fad Compare July 13, 2026 09:04
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling plugin: workspaces Agent-composable Workspaces plugin labels Jul 13, 2026
@github-actions github-actions Bot removed the dependencies-changed PR changes dependency-related files label Jul 13, 2026
@100yenadmin 100yenadmin changed the title Dashboard: distribution — shareable deep links, export/import, dashboard-design skill Workspaces: add safe workspace distribution Jul 13, 2026
@100yenadmin
100yenadmin force-pushed the feat/dashboard-distribution branch from 3528fad to c1c4fbe Compare July 13, 2026 09:30
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: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime 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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. plugin: workspaces Agent-composable Workspaces plugin rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts 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.

Dashboard: export / import / share a workspace config

1 participant