Skip to content

feat(workspace): add workspace resource model with scoping, membershi…#2243

Draft
derekwaynecarr wants to merge 1 commit into
NVIDIA:mainfrom
derekwaynecarr:decarr/workspace-model
Draft

feat(workspace): add workspace resource model with scoping, membershi…#2243
derekwaynecarr wants to merge 1 commit into
NVIDIA:mainfrom
derekwaynecarr:decarr/workspace-model

Conversation

@derekwaynecarr

@derekwaynecarr derekwaynecarr commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements Phase 1 of RFC 0011 — the workspace and membership model that provides hard isolation boundaries for multi-player OpenShell deployments.

  • Workspace resource: CRUD RPCs (CreateWorkspace, GetWorkspace, ListWorkspaces, DeleteWorkspace) with a default workspace created on gateway startup for backwards compatibility
  • Workspace-scoped resources: workspace field on ObjectMeta — sandboxes, providers, service endpoints, SSH sessions, policies, settings, provider refresh state, and inference routes all inherit workspace
    from context
  • Membership model: AddWorkspaceMember, RemoveWorkspaceMember, ListWorkspaceMembers RPCs with (workspace, principal_subject) → role records; membership records cleaned up on workspace deletion
  • Persistence: Name uniqueness shifts from (object_type, name) to (object_type, workspace, name) via migration 006; existing resources backfilled to default workspace; cross-workspace list_by_type store
    method for infrastructure operations (reconciler, resume, provider refresh)
  • Provider profiles: Two-tier scoping with independent scope listing — workspace custom + built-in, or platform custom + built-in (no merged cross-scope view)
  • Service routing: Endpoint hostnames include workspace prefix ({workspace}--{sandbox}--{service}.{domain}); default workspace preserves current format
  • Inference routes: Rename Cluster* RPCs and messages to Route* (SetInferenceRoute, GetInferenceRoute, InferenceRouteConfig); workspace-scope route storage and lookup; derive workspace from sandbox
    principal for bundle resolution; thread --workspace through CLI inference commands
  • ObjectWorkspace trait: requires_workspace() method with debug_assert! validation in store write helpers to catch empty-workspace bugs in debug builds
  • CLI: --workspace and --all-workspaces flags on all resource commands; WORKSPACE column as first column in list outputs when --all-workspaces (matching kubectl --all-namespaces convention); workspace
    CRUD and membership subcommands; inference help text updated from "gateway-level" to "workspace-level"
  • TUI: Workspace state with [w] key cycling, WORKSPACE column in sandbox/provider tables, workspace indicator in title bar, workspace-scoped gRPC requests

Related Issue

#1977

Changes

  • 50 files changed, +7188 / -886 lines
  • New files: workspace.rs (gRPC handlers + tests), migration 006 (sqlite + postgres), workspace_lifecycle.rs (e2e test), RFC 0011
  • Proto: Workspace, WorkspaceMember messages; workspace CRUD and membership RPCs; workspace field on ObjectMeta; all_workspaces on list requests; inference route rename (Cluster* → Route*) with
    workspace fields on set/get request/response messages

Testing

  • 897 server unit tests passing (11 workspace-specific, 2 inference route workspace isolation)
  • 24 TUI tests passing
  • 7 CLI integration tests passing
  • e2e workspace lifecycle test covering create/list/get/delete and cross-workspace isolation
  • Inference route isolation tests: verify workspace-scoped route resolution (alpha/beta workspaces with different providers/models) and empty bundle for workspace with no route configured

Known remaining work

  • Phase 2: Expanded role model (Platform Admin / Workspace Admin / User) and authorization enforcement — not started, sequential dependency on this PR.

@derekwaynecarr derekwaynecarr requested review from a team, maxamillion and mrunalp as code owners July 13, 2026 12:23
@copy-pr-bot

copy-pr-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@derekwaynecarr derekwaynecarr marked this pull request as draft July 13, 2026 12:26
@derekwaynecarr derekwaynecarr force-pushed the decarr/workspace-model branch from b45cc4a to 2468c04 Compare July 13, 2026 14:54
…p, and CLI/TUI support

Implement Phase 1 of RFC 0011 (multi-player workspace support):

- Add Workspace resource with CRUD RPCs (Create, Get, List, Delete)
- Add workspace field to ObjectMeta; all workspace-scoped resources
  (sandbox, provider, service endpoint, SSH session, policy, settings,
  provider refresh state, inference route) inherit workspace from context
- Add membership store with Add/Remove/List WorkspaceMember RPCs
- Create default workspace on gateway startup for backwards compat
- Shift name uniqueness from (object_type, name) to
  (object_type, workspace, name) with migration backfill
- Add ObjectWorkspace trait with requires_workspace() and debug_assert
  validation in store write helpers
- Add all_workspaces field on list RPCs for cross-workspace visibility
- Add cross-workspace list_by_type store method for infrastructure ops
- Thread workspace through StoredProviderCredentialRefreshState
- Provider profiles use two-tier scoping with independent scope listing
  (workspace custom + built-in, or platform custom + built-in)
- Service endpoint hostnames include workspace prefix for collision avoidance
- Add WORKSPACE column to CLI list outputs (kubectl convention)
- Add TUI workspace awareness: selector, workspace column, title bar
- Clean up membership records on workspace deletion
- Workspace-scope inference routes: rename Cluster* RPCs and messages to
  Route* (SetInferenceRoute, GetInferenceRoute, InferenceRouteConfig),
  thread workspace through set/get/bundle handlers and CLI commands,
  derive workspace from sandbox principal for bundle resolution
- Add workspace isolation tests for inference routes

Signed-off-by: Derek Carr <decarr@redhat.com>
@derekwaynecarr derekwaynecarr force-pushed the decarr/workspace-model branch from 2468c04 to 77ef1fc Compare July 13, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant