Shared repositories for server users

A repository owner, usually the server administrator, can let other server users start their own sessions in selected repositories. A user does not import, clone or synchronize the repository: the execution host keeps one canonical checkout per repository, and every session receives its own independent clone and branch.

This is a separate capability from shared sessions. Shared sessions grant view or control of somebody else's running session. A repository-use grant lets a user start their own sessions. The two grants never imply each other.

Model

The feature reuses existing pieces instead of introducing a parallel project namespace.

Concern Reused piece
Recipients Server users and server groups (server-team), with dynamic group membership
Scope Project-sharing scopes: one repository, an owned project group, or an exact set
Ownership of user runtime Ordinary user-owned Project, workspace and sessions (server_entity_owners)
Per-session checkout Existing isolated session checkout (devctrl/sessions/<leaf> branch, own clone)
User Git access Existing user Git connections bound to an owned Project
Owner Git access Existing encrypted Git connection bound to the owner's source Project
Project configuration Existing durable Project configuration store on the execution host
Session launch Existing POST /v1/sessions path and its authorization

Repository-use grant

A grant record has a UUID id, an owner, exactly one recipient (recipientUserId or recipientGroupId) and a project-sharing scope. Scope resolution is the same as for project sharing: group scopes are dynamic, exact sets are fixed, Control Room projects are never included, and only repositories the owner still owns are effective. A grant reached through a group is effective only while the recipient belongs to that group. Disabled owners or recipients have no effective grants. Creating the same UUID twice is idempotent. An owner can have at most 256 active repository-use grants.

Grants are stored in the controller database (repository_use_grants). They do not create session shares, approvals, compute administration or access to the owner's accounts.

Per-repository sharing policy

The owner chooses, per source repository:

The policy is stored per source Project with an optimistic revision.

User copy ("seat")

On a user's first start, the controller creates an ordinary Project owned by the user, with the deterministic ID shared-<sha256(user, sourceProject)[0..24]> and a sharedRepository marker (sourceProjectId, ownerUserId, grantId, gitAccess, configuration). It has the source repository's credential-free HTTPS remote and display name. Its single workspace, named shared, is owned by the user and runs in the user's own container. Different users therefore never share a container, account home, checkout or writable cache, preserving the existing invariant that users always run in different containers.

The seat is not an import: no remote clone is performed for the user. The marker is server-controlled; clients cannot set it.

Canonical checkout

Each execution host keeps one canonical checkout per source Project:

<DEVCTL_DATA_DIR>/shared-repositories/<sha256(sourceProjectId)[0..24]>/checkout

The seat workspace's primary checkout is a local copy of the canonical checkout (clone --no-local --no-hardlinks), with origin reset to the credential-free remote. No user process can modify canonical objects through hard links.

Per-session clone and branch

A new seat session uses the canonical checkout as its isolated-checkout source. The existing preparation creates an independent clone in the user's persistent sessions storage, on the branch devctrl/sessions/<leaf>, where leaf is the opaque per-session checkout leaf. The source has no uncommitted context, so every session starts at the current remote default branch. Continuations still use their parent checkout as source, as before.

Credentials

A user can never read the owner's token: it is not part of any API response to users, any snapshot, queued command payload, container mount or environment.

Configuration

Revocation

A grant ends when it is revoked, when the recipient leaves the granting group, when the owner or recipient is disabled or offboarded, or when the repository leaves the scope. From that moment the controller refuses, for that user and repository: new sessions, seat workspace creation and start, owner-credential delivery and brokered pushes. These checks run on each request, so membership changes take effect without a separate reconciliation.

Running sessions follow the policy. With keep-running, they continue with the material they already have; brokered pushes are refused. With stop-sessions, an explicit grant revocation requests a stop of the affected running sessions through the ordinary session stop command. A membership change or a disabled account denies new work immediately but does not stop running sessions; the owner can revoke the grant to apply the stop policy. Seats, workspaces and session checkouts are retained, because they contain the user's work. The user may delete them; deletion is never automatic.

Quotas

Using it

Open Shared sessions / Shift+S, then Shared repositories / u, in the TUI or the browser console.

API

All routes are handler-scoped for server users; the handler derives the authenticated owner or recipient.

Limits