Repository navigation
Description
Part of the VM demo epic (#370). Item B: depends on A (#366, the control plane on
deploy/vm).
Goal
Two distinct users, each on their own laptop, run mocactl login against the demo VM. Each creates and resumes sessions, and neither can see or reach the other's. This is also the first manual acceptance run of the real device-flow login, which is item 4 of #362.
Current state (verified on main @ 73f1bf4)
- Identity: the only provider is
GithubOAuthProvider, using the GitHub device flow (packages/control-plane/src/identity.ts:57-160, wired atmain.ts:144).- The subject is the numeric GitHub user id.
- Generic OIDC is only a comment ("slice 2").
- There is no development identity provider (MU1 follow-ups from #348: VM control plane on Vault, dev identity provider, inference-credential binding #362 item 2: needs its own ADR, loopback-only, never the default, and it must refuse to start under
MOCA_TENANCY=multi, per MI1 §10.3).
- Routes (
packages/control-plane/src/routes.ts:33-132):- no auth:
POST /v1/auth/deviceand/v1/auth/device/token; - api token:
/v1/me,/v1/sessions*and/v1/credentials*.
- no auth:
- Ownership: every session-scoped handler goes through one ownership choke point (
handlers.ts:72-90), which returns 404, not 403, to a non-owner.listSessionsis scoped bydeps.index.listByOwner(p.sub), and?owner=requires the admin role (handlers.ts:265-277). The worker allows a turn only whentoken.sid == body.sessionId(packages/knative-server/src/turn-auth.ts). - mocactl:
mocactl loginpolls the device flow (packages/mocactl/src/core/auth.ts:24-40,api/control-plane.ts:77-131);- it caches a 1-hour api token in
$XDG_CONFIG_HOME/mocactl/auth.json, one identity per config dir, so two users on one machine need separateXDG_CONFIG_HOMEvalues; - onboarding and
doctorrun seven checks.
- Today's test stand-in for login:
deploy/compose/smoke.sh:176-185mints an api token for an arbitrarysubwith the control plane's signing key. Use it for automated two-subject tests, but the demo itself uses real logins. - Session creation needs an inference credential:
createSessionfails if the user has none (handlers.ts:213-261). This issue touches that only enough to create sessions; item C (VM demo C: per-user inference credentials and a curl/git research turn in the P6 container sandbox #368) owns making credentials work for real.
Scope
-
GitHub OAuth app setup on the VM path
- Document it in
deploy/vm/README.md: create the app, enable device flow, setSH_GITHUB_CLIENT_IDincontrol-plane.env. - The VM needs outbound access to
github.com, and so do users' laptops for the verification URL. - Decide whether
setup-vm.shacceptsSH_GITHUB_CLIENT_IDfrom its environment, asdeploy/compose/install.sh:227-232does.
- Document it in
-
Two-user acceptance run on a VM built by item A (VM demo A: run the MU1 control plane on deploy/vm (systemd unit, generated secrets) #366), with two real GitHub accounts (write down the steps as a runbook):
mocactl login, thendoctor(all seven checks), thenrun "hello"for each user;- user 1's
/sessionsnever lists user 2's sessions; GET/DELETE /v1/sessions/<other user's id>returns 404;- a turn posted with user 1's session token to user 2's session id is refused.
-
Automated two-subject test, runnable without GitHub. Extend the control plane's vitest suite, or add a VM smoke, to cover:
- two minted subjects;
- disjoint session lists;
- cross-owner 404s;
- cross-session turn refusal at the harness.
Tests of this kind may already exist in
packages/control-planeandpackages/knative-server. Check first, and add only what's missing. -
Record the fix list for anything the run finds, such as the mocactl UX when the control plane has no kubectl for
/resources, or token expiry during a demo.
Explicitly not claimed (state this in the runbook)
Session ownership is enforced. Sandbox isolation between users is not.
- On the container tier, every user's turns lease the same shared sandbox containers (
harness/src/select-sandbox.ts:376-434has no owner filter), and the container worker ignoresworkspace_key, so all users share/workspace, the Unix user and the process list (remote-worker/internal/exec/runner.go:98). - Fixing this is MI1 S5, owner binding (
docs/specs/2026-09-28-moca-multi-user-isolation-design.md§9). - A cheap mitigation (a per-session working directory on the container worker) is listed as an optional follow-up on the epic.
Watch for: the MI1 S2 tenancy pin
MI1 §6.6 plans a first-subject pin under MOCA_TENANCY=single: the first subject to use a single-tenant deployment owns it, and later subjects get 403 single_tenant_deployment. It isn't implemented yet (MOCA_TENANCY is unset on the VM today). Once S2 lands, a two-user demo will need MOCA_TENANCY=multi, which in turn requires S5's sandbox owner binding. Make sure the demo runbook states which tenancy it runs under.
Optional, only if the owner chooses it: the dev identity provider
If a GitHub-free demo is wanted, #362 item 2 is the path. It needs an ADR before code, and it's loopback-only by design, so it only serves users who tunnel to the VM. Don't start it without the owner's decision.
Acceptance
- Two real GitHub users complete login,
doctorandrunagainst the VM. - Their session lists are disjoint, and cross-owner access fails with 404 (or with the harness's refusal for turns).
- The automated two-subject test passes.
- The runbook is written, with the "not claimed" section.
References
- MU1 spec:
docs/specs/2026-09-08-multi-user-control-plane-design.md - mocactl spec:
docs/specs/2026-09-25-mocactl-control-plane-client-design.md packages/mocactl/README.md,packages/mocactl/QUICKSTART.md- MU1 follow-ups from #348: VM control plane on Vault, dev identity provider, inference-credential binding #362, RedisSessionBackend.list() enumerates every tenant's sessions (via KEYS) #361 (not route-exposed today; don't regress it)
Working conventions (for a fresh session)
- Workspace:
git fetch, then create a worktree fromrossoctl/main(never localmain), under.worktrees/. Populate and buildpi-fork(git submodule update --init --recursive && cd pi-fork && npm ci && npm run build), thenpnpm install. A worktree without the pi-fork build does not typecheck. - Plans: write the plan with
superpowers:writing-plansintodocs/plans/<date>-<slug>.md. Plans are gitignored and never committed. Write it in chunks, one append per task. Usedocs/plans/2026-09-28-mi1-s1-hardening.mdas the model for style and granularity, if you have it locally. - Pre-flight table: list every process entrypoint, systemd unit, env example and shell/Go launcher whose boot contract changes, not only TypeScript call sites.
- Tests: Redis on 6379 must be up. Use each package's own
node_modules/.bin/vitest. vitest can exit non-zero with every test green, so grep the log forErrors. Redirect long output to/tmp/kagenti/....make lintskips untracked files. - Commits:
git commit -swithAssisted-By: Claude (Anthropic AI) <[email protected]>, neverCo-Authored-By. - Shared KVM rig (
[email protected]): the owner runs tutorials on it. Alert the owner before using it, record a manifest of what you install, and verify cleanup. The rig's podman is a static build (Amazon Linux 2023 packages none). - Don't push or open PRs without the owner's go-ahead.
Activity
pdettori commentedon Sep 30, 2026
Automated two-subject test delivered in #371 (scope item 3). It covers: two minted subjects; disjoint session lists over HTTP; cross-owner 404s on GET/DELETE/token re-mint; cross-session turn refusal at the harness (400
session_mismatch, JSON and SSE branches, credential exchange never consulted). The audit that preceded it found no ownership bug — the handler-level properties were already covered byroute-authz-enumeration,handlers-sessionsandexchangetests; #371 adds the end-to-end shape with the smoke.sh minted-token stand-in.The two-user runbook steps and the fix-list candidates (mocactl /resources without kubectl, token expiry during a demo, one identity per XDG_CONFIG_HOME, the MI1 S2 tenancy-pin collision, shared /workspace on the container tier, device_flow_disabled as the likeliest first-run login failure) were drafted in the local plan (
docs/plans/2026-09-30-vm-demo-b-two-subject-test.md, gitignored) and are ready to fold into the demo runbook slice.Remaining on this issue: items 1 and 2 (GitHub OAuth app docs in deploy/vm/, and the live two-account acceptance run).
test: address review notes on the two-subject suites (rossoctl#367 it…
test: two-subject flows over HTTP for VM demo B (#367 item 3)
Merge pull request #371 from pdettori/feat/367-vm-demo-b-two-subject-…
feat(deploy/vm): document the GitHub OAuth app; seed its client id fr…
docs(demos): two-user acceptance runbook for the P6 VM (rossoctl#367 …
docs(microvm): the real mocactl login on the P4 tier, verified (rosso…
Merge pull request #403 from pdettori/feat/367-vm-demo-b-oauth-runbook
pdettori commentedon Oct 1, 2026
Two real GitHub accounts, live, on the shared KVM rig: 2026-10-01, at
main@ 03d2ee8. This was the full VM demo (#370), recorded indocs/demos/vm-multi-user-demo.md(#412), whose Acts 1 and 3 overlap this issue's acceptance run.Setup:
XDG_CONFIG_HOMEdirectories, and user 2's device code approved in a private browser window;vm-two-user-acceptance.md0a describes;deploy/vmships it:MOCA_TENANCYunset,SH_REQUIRE_AUTH=true, operator fallback off.Against this issue's acceptance:
login,doctorandrungithub:6678093andgithub:228572680(a second account), both through the real device flow.doctorpassed all seven checks for both. Each ran research turns and a resume, on their own credential (anthropic,anthropic-dev). The control plane's audit stream shows each turn's own subject and credential name.mocactl run --session <user 1's id>and--session sess-does-not-existboth failed withthat session no longer exists, or is not yours, exit 1. That path is the session-token re-mint (POST /v1/sessions/{id}/token) answeringsession_not_found404. User 1 then resumed the same session normally. Not run live: the API-levelGETandDELETE404s (vm-two-user-acceptance.md2b).session_mismatch(vm-two-user-acceptance.md2c) is covered only by #371's automated test.vm-two-user-acceptance.md(#403), and the demo runbook (#412).Also confirmed on the run:
This account is currently not available., and a Redis forward wasadministratively prohibited.SH_API_TOKEN_TTL_SECONDS=14400) meant nobody had to log in again during the run.Found by the run (filed or in #412's fix list):
setup-vm.shnever pulls the sandbox image.mocactl --profile) as the one-machine caveat.What would close the remaining gap: a pass through
vm-two-user-acceptance.mdAct 2 (2b and 2c) with the same two accounts. That is thecurlchecks only, about 10 minutes, and two people on two laptops if we want that case covered too. I'd leave this issue open until then, unless you consider #371 plus today's live run enough.pdettori commentedon Oct 1, 2026
Closing on the owner's call: the live two-account run on 2026-10-01 plus #371's automated two-subject test cover the acceptance. The API-level GET/DELETE 404s and the harness's session_mismatch were not run live; #371 covers them (see the comment above).