Skip to content
Python

E2E specs for machines, connectors, teams, settings and the gallery

Rohit C Prasadbd977f5aaa87
diff --git a/surfaces/gui/e2e/artifacts.spec.ts b/surfaces/gui/e2e/artifacts.spec.ts
index 6e7707c9..8081ee85 100644
--- a/surfaces/gui/e2e/artifacts.spec.ts
+++ b/surfaces/gui/e2e/artifacts.spec.ts
@@ -104,3 +104,46 @@ test("viewer breadcrumb goes back and ✕ closes (UX-038)", async ({ page }) =>
await page.getByTestId("artifact-close").click();
await expect(page.getByTestId("rail-toggle-artifacts")).toBeVisible();
});
+
+test("an open artifact widens the rail and the chat and topbar make room for it", async ({
+ page,
+}) => {
+ // Owner catch 2026-09-16: `--artifact-rail-w` was declared only under the "large" text
+ // size, so at the default size the rail shrank to fit, the chat ran underneath it, and the
+ // topbar lost its right edge — collapsing to ~240px and parking the centered title on top
+ // of the nav reveal button. Lock all three geometries to the one variable.
+ await openReport(page);
+ const rail = page.locator(".right-rail.artifact-mode");
+ await expect(rail).toBeVisible();
+ const g = await page.evaluate(() => {
+ const px = (v: string) => parseFloat(v);
+ const rail = document.querySelector(".right-rail.artifact-mode") as HTMLElement;
+ const chat = document.querySelector(".main-chat") as HTMLElement;
+ const top = document.querySelector(".main-topbar") as HTMLElement;
+ const want = Math.min(0.62 * window.innerWidth, 960);
+ return {
+ want,
+ railW: rail.getBoundingClientRect().width,
+ chatMargin: px(getComputedStyle(chat).marginRight),
+ chatRight: chat.getBoundingClientRect().right,
+ railLeft: rail.getBoundingClientRect().left,
+ topRight: px(getComputedStyle(top).right),
+ };
+ });
+ expect(Math.abs(g.railW - g.want)).toBeLessThan(2);
+ expect(Math.abs(g.chatMargin - g.want)).toBeLessThan(2);
+ expect(g.chatRight).toBeLessThanOrEqual(g.railLeft + 1); // the chat never runs under the rail
+ expect(Math.abs(g.topRight - g.want)).toBeLessThan(2);
+
+ // With the nav collapsed the session topbar carries an inline cluster at its left; the
+ // centered title must clear that cluster's last control (the bug parked it on top).
+ // (The e2e shell starts with the nav collapsed — the "Dock sidebar" state.)
+ await expect(page.locator(".app.nav-collapsed")).toBeVisible();
+ const overlap = await page.evaluate(() => {
+ const t = document.querySelector(".main-title")?.getBoundingClientRect();
+ const btns = document.querySelectorAll(".main-topbar-side:not(.main-topbar-actions) button");
+ const last = btns.length ? btns[btns.length - 1].getBoundingClientRect() : null;
+ return t && last ? t.left < last.right && t.right > last.left : false;
+ });
+ expect(overlap).toBe(false);
+});
diff --git a/surfaces/gui/e2e/card-gallery.spec.ts b/surfaces/gui/e2e/card-gallery.spec.ts
new file mode 100644
index 00000000..505d7e95
--- /dev/null
+++ b/surfaces/gui/e2e/card-gallery.spec.ts
@@ -0,0 +1,93 @@
+// The dev-only card gallery (/#/gallery): real cards rendered from the payload files
+// under src/gallery/states, with no server at all — so these tests mock nothing.
+//
+// Element screenshots for review come from here too, in place of throwaway specs:
+// GALLERY_SHOT="team-request/model-fallback,approval/web-fetch?place=inbox" \
+// GALLERY_SHOT_DIR=/tmp/shots GALLERY_THEME=dark npx playwright test card-gallery
+// GALLERY_CLICK="testid,testid" clicks those controls on the card before the shot.
+import { expect, test } from "@playwright/test";
+import path from "node:path";
+
+test("a state link opens that card and state, and the card's answer is printed, not sent", async ({ page }) => {
+ const calls: string[] = [];
+ page.on("request", (r) => {
+ if (r.url().includes("/v1/") || r.url().includes(":8765")) calls.push(r.url());
+ });
+ await page.goto("/#/gallery/team-request/lead-suggested-github");
+ await expect(page.getByTestId("gallery-state-lead-suggested-github")).toHaveAttribute("aria-selected", "true");
+ await expect(page.getByTestId("teamreq-connector-0-github")).toBeChecked();
+
+ await page.getByTestId("teamreq-approve").click();
+ const sent = page.getByTestId("gallery-response");
+ await expect(sent).toContainText('"type": "team_response"');
+ await expect(sent).toContainText('"connectors": [\n "github"');
+ expect(calls).toEqual([]);
+});
+
+test("the same state renders as the parked Inbox item and resolves with the full decision", async ({ page }) => {
+ await page.goto("/#/gallery/team-request/beyond-usual-set?place=inbox");
+ await expect(page.getByTestId("inbox-item-gallery-item")).toBeVisible();
+ await expect(page.getByTestId("teamreq-beyond-0")).toContainText("you asked");
+ await page.getByTestId("teamreq-approve").click();
+ await expect(page.getByTestId("gallery-response")).toContainText("/v1/inbox/gallery-item/resolve");
+ await expect(page.getByTestId("gallery-response")).toContainText('"enable_chat": true');
+});
+
+test("the rail switches cards and lands on the card's first state", async ({ page }) => {
+ await page.goto("/#/gallery");
+ await page.getByTestId("gallery-card-work-items").click();
+ await expect(page).toHaveURL(/#\/gallery\/work-items\/three-items$/);
+ await expect(page.getByTestId("itemsreq-card")).toBeVisible();
+});
+
+test("a scenario opens the real app on a saved moment; answers are printed, not sent", async ({ page }) => {
+ await page.goto("/#/gallery/scenarios");
+ await page.getByTestId("gallery-scenario-lead-staffing-card-waiting").click();
+ // The real session view: the mention that woke the lead, its steps, and the parked
+ // staffing card answered in context — all from one JSON file.
+ // (The mention card swaps names for ids under the mouse, so assert on the message itself.)
+ await expect(page.getByText(/Add a PDF download to every invoice/).first()).toBeVisible();
+ await expect(page.getByTestId("teamreq-card")).toBeVisible();
+ await expect(page.getByTestId("teamreq-connector-0-github")).toBeChecked();
+ await page.getByTestId("teamreq-approve").click();
+ await expect(page.getByTestId("scenario-sent-toggle")).toContainText("sent 1");
+ await page.getByTestId("scenario-sent-toggle").click();
+ await expect(page.getByTestId("scenario-sent")).toContainText("/v1/inbox/scn-gate-team/resolve");
+ await expect(page.getByTestId("scenario-sent")).toContainText('"approved": true');
+});
+
+test("an attended scenario replays its live card and fills the rail", async ({ page }) => {
+ await page.goto("/?scenario=lead-team-running-approval#/s/scn-lead-3b");
+ await expect(page.getByTestId("boardwake-card")).toBeVisible();
+ await expect(page.getByRole("button", { name: "Allow once" })).toBeVisible();
+ await page.getByRole("button", { name: "Allow once" }).click();
+ await page.getByTestId("scenario-sent-toggle").click();
+ await expect(page.getByTestId("scenario-sent")).toContainText('"decision": "once"');
+});
+
+// GALLERY_SCENARIO="id,id" takes a full-window screenshot of each scenario.
+for (const id of (process.env.GALLERY_SCENARIO || "").split(",").map((s) => s.trim()).filter(Boolean)) {
+ test(`screenshot scenario ${id}`, async ({ page }) => {
+ await page.setViewportSize({ width: 1440, height: 900 });
+ await page.goto(`/#/gallery/scenarios`);
+ await page.getByTestId(`gallery-scenario-${id}`).click();
+ await page.waitForTimeout(1500);
+ const dir = process.env.GALLERY_SHOT_DIR || "test-results/gallery";
+ await page.screenshot({ path: path.join(dir, `scenario_${id}.png`) });
+ });
+}
+
+const shots = (process.env.GALLERY_SHOT || "").split(",").map((s) => s.trim()).filter(Boolean);
+for (const shot of shots) {
+ test(`screenshot ${shot}`, async ({ page }) => {
+ await page.setViewportSize({ width: 1280, height: 1000 });
+ await page.goto(`/#/gallery/${shot}`);
+ if (process.env.GALLERY_THEME === "dark") await page.getByTestId("gallery-theme-dark").click();
+ if (process.env.GALLERY_WIDTH === "narrow") await page.getByTestId("gallery-width-narrow").click();
+ const clicks = (process.env.GALLERY_CLICK || "").split(",").map((c) => c.trim()).filter(Boolean);
+ for (const id of clicks) await page.getByTestId(id).click();
+ const dir = process.env.GALLERY_SHOT_DIR || "test-results/gallery";
+ const name = shot.replace(/[/?=]/g, "_") + (process.env.GALLERY_THEME === "dark" ? "_dark" : "") + (clicks.length ? "_clicked" : "") + ".png";
+ await page.getByTestId("gallery-stage").screenshot({ path: path.join(dir, name) });
+ });
+}
diff --git a/surfaces/gui/e2e/chat.spec.ts b/surfaces/gui/e2e/chat.spec.ts
index b40345a8..0393dcf6 100644
--- a/surfaces/gui/e2e/chat.spec.ts
+++ b/surfaces/gui/e2e/chat.spec.ts
@@ -22,9 +22,9 @@ test("send → user bubble → streamed echo reply renders", async ({ page }) =>
// user sees at send time is exactly what serves the turn.
await expect(page.getByText("[model=anthropic:claude-opus-4-8]")).toBeVisible();
// …and the picker STAYS actionable after the first turn (§17 rev 2026-07-22 — mid-session
- // switching shipped); the fact also reads in the topbar's facts subtitle.
+ // switching shipped); the fact also reads in the title's tooltip (UX-048: no subtitle).
await expect(page.locator(".dd").filter({ hasText: "Claude Opus" })).toBeVisible();
- await expect(page.getByTestId("session-subtitle")).toContainText("Claude Opus 4.8");
+ await expect(page.getByTestId("session-title")).toHaveAttribute("title", /Claude Opus 4.8/);
// Composer cleared and re-armed for the next turn.
await expect(box).toHaveValue("");
});
diff --git a/surfaces/gui/e2e/connector-page.spec.ts b/surfaces/gui/e2e/connector-page.spec.ts
index 681bc250..f6ce0f99 100644
--- a/surfaces/gui/e2e/connector-page.spec.ts
+++ b/surfaces/gui/e2e/connector-page.spec.ts
@@ -19,7 +19,7 @@ test("list row status + navigation to the Slack page", async ({ page }) => {
const row = page.getByTestId("connector-slack");
await expect(row).toContainText("2 workspaces · relay");
await row.click();
- await expect(page.getByTestId("slack-workspaces")).toBeVisible();
+ await expect(page.getByTestId("glance-slack")).toBeVisible();
// signed out (fixture default) → the status line leads with the actionable layer
await expect(page.getByTestId("slack-mode-badge")).toContainText("Sign-in needed");
});
diff --git a/surfaces/gui/e2e/connectors-across.spec.ts b/surfaces/gui/e2e/connectors-across.spec.ts
new file mode 100644
index 00000000..030b6b46
--- /dev/null
+++ b/surfaces/gui/e2e/connectors-across.spec.ts
@@ -0,0 +1,262 @@
+import { test, expect, seedMachines } from "./fixtures";
+
+// UX-049 — connectors across machines: a machine's Connectors page shows what
+// other machines hold (Enable / Move here, or the sign-in for a rotating
+// provider), inbound rows link to the glance page, and the glance page under
+// Settings ▸ App shows holders, the default machine, People, and who answers
+// each channel. Cloud views are mocked at the sidecar's /v1/cloud routes.
+
+const SEAL_PUB = "pbEWq+ooNkz0sfoIeaDCE/O+xvH+RD83HTD8rHTxSg4=";
+const base = (id: string, name: string) => ({
+ id,
+ name,
+ origin: "cloud",
+ fingerprint: id,
+ app_version: "0.2.0",
+ created_at: 1_755_000_000,
+ last_seen: 1_755_000_000,
+ connected: true,
+ seal_pubkey: SEAL_PUB,
+ seal_fingerprint: id,
+});
+const CLOUD_VM = base("cloud:mA", "cloud-vm");
+const SANDBOX = { ...base("cloud:mB", "sandbox-1"), provenance: "fly" };
+
+const conn = (name: string, extra: Record<string, unknown>) => ({
+ name,
+ title: name === "outlook" ? "Outlook" : name[0].toUpperCase() + name.slice(1),
+ icon: "•",
+ blurb: `${name} blurb`,
+ auth: "oauth",
+ two_way: name === "slack",
+ channels: name === "slack",
+ available: true,
+ fields: [],
+ instructions: [],
+ connected: false,
+ account: null,
+ enabled: true,
+ brand_color: "#333",
+ logo: name,
+ allowed_users: [],
+ tools: [],
+ managed: true,
+ ...extra,
+});
+
+const CLOUD_CONNECTIONS = [
+ { connection_id: "c-slack", connector: "slack", provider: "slack", status: "connected", provider_account: "acme.slack.com", holders: [{ machine_id: "mB", delegated_at: "2026-09-03T10:00:00Z", events: true }, { machine_id: "mA", delegated_at: "2026-09-03T11:00:00Z", events: true }], default_machine_id: "", copyable: true, routing: {} },
+ { connection_id: "c-notion", connector: "notion", provider: "notion", status: "connected", provider_account: "Rohit's Notion", holders: [{ machine_id: "mB", delegated_at: "2026-09-03T10:00:00Z", events: false }], default_machine_id: "", copyable: true, routing: {} },
+ { connection_id: "c-outlook", connector: "outlook", provider: "microsoft", status: "connected", provider_account: "[email protected]", holders: [{ machine_id: "mB", delegated_at: "2026-09-03T10:00:00Z", events: false }], default_machine_id: "", copyable: false, routing: {} },
+];
+
+async function mockCloud(page: import("@playwright/test").Page) {
+ const calls: { path: string; body: unknown }[] = [];
+ await page.route(/\/v1\/cloud\/connections$/, (r) => r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ connections: CLOUD_CONNECTIONS }) }));
+ await page.route(/\/v1\/cloud\/connections\/[^/]+\/(default-machine|routing)$/, (r) => {
+ calls.push({ path: new URL(r.request().url()).pathname, body: r.request().postDataJSON() });
+ return r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true }) });
+ });
+ await page.route(/\/v1\/cloud\/subscriptions(\?.*)?$/, (r) => r.fulfill({
+ status: 200, contentType: "application/json",
+ body: JSON.stringify({ subscriptions: [
+ { source: "slack:T1/C1", connector: "slack", machine_id: "mA", session_id: "s-1", connection_id: "c-slack", team_id: "T1", title: "Release watcher", state: "active", created_at: "2026-09-03T12:00:00Z" },
+ { source: "slack:T1/C2", connector: "slack", machine_id: "mB", session_id: "s-2", connection_id: "c-slack", team_id: "T1", title: "", state: "orphan", created_at: "2026-09-01T12:00:00Z" },
+ ] }),
+ }));
+ await page.route(/\/v1\/cloud\/subscriptions\/remove$/, (r) => {
+ calls.push({ path: "remove", body: r.request().postDataJSON() });
+ return r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, removed: true }) });
+ });
+ await page.route(/\/v1\/cloud\/people(\?.*)?$/, (r) => r.fulfill({
+ status: 200, contentType: "application/json",
+ body: JSON.stringify({ people: [{ source: "slack:T1/U_BOB", connector: "slack", scope: "T1", member: "U_BOB", name: "Bob", added_at: "" }] }),
+ }));
+ return calls;
+}
+
+test("a machine's Connectors page: Enable for a grant held elsewhere, Configure on inbound rows, sign-in for a rotating provider", async ({ page }) => {
+ await seedMachines(page, [CLOUD_VM, SANDBOX]);
+ await mockCloud(page);
+ await page.route(/\/v1\/cloud\/machines\/mA\/p\/v1\/connectors$/, (r) => r.fulfill({
+ status: 200, contentType: "application/json",
+ body: JSON.stringify({ connectors: [
+ conn("slack", { connected: true, account: "acme.slack.com", mode: "relay" }),
+ conn("notion", {}),
+ conn("outlook", {}),
+ conn("gmail", {}),
+ ] }),
+ }));
+ await page.goto("/#/settings/connectors?m=cloud:mA");
+
+ // Connected here: Slack names its other holder and the default, links Configure.
+ const slack = page.getByTestId("remote-connector-slack");
+ await expect(slack.getByTestId("remote-holders-slack")).toContainText("also on sandbox-1");
+ await expect(slack.getByTestId("remote-holders-slack")).toContainText("sandbox-1 answers by default");
+ await expect(slack.getByTestId("remote-disconnect-slack")).toHaveText("Disconnect here");
+
+ // Held on another machine: Notion offers Enable + Move here; Outlook (rotating) offers the sign-in.
+ const notion = page.getByTestId("remote-held-notion");
+ await expect(notion).toContainText("on sandbox-1");
+ await expect(notion.getByTestId("remote-enable-notion")).toHaveAttribute("title", /already connected on another machine/);
+ await expect(notion.getByTestId("remote-move-notion")).toHaveText("Move here");
+ const outlook = page.getByTestId("remote-held-outlook");
+ await expect(outlook).toContainText("signs in separately on each machine");
+ await expect(outlook.getByTestId("remote-enable-outlook")).toHaveCount(0);
+ // Held nowhere stays in Available with the sign-in.
+ await expect(page.getByTestId("remote-available-gmail")).toBeVisible();
+
+ // Configure → the glance page.
+ await slack.getByTestId("remote-configure-slack").click();
+ await expect(page.getByTestId("glance-slack")).toBeVisible();
+});
+
+test("Settings ▸ Slack: holders, default machine, People, subscribed channels; unsubscribe and default change go to the cloud", async ({ page }) => {
+ await seedMachines(page, [CLOUD_VM, SANDBOX]);
+ const calls = await mockCloud(page);
+ await page.goto("/#/settings/appearance");
+ // The tab appears because Slack is connected somewhere.
+ await page.getByRole("button", { name: "Slack" }).click();
+ const glance = page.getByTestId("glance-slack");
+ await expect(glance.getByTestId("glance-holders")).toContainText("sandbox-1");
+ await expect(glance.getByTestId("glance-holders")).toContainText("cloud-vm");
+ // The T1 scope: the routing line (machine · coworker) and one People list.
+ const scope = page.getByTestId("slack-workspace-T1");
+ await expect(scope.getByTestId("glance-people-T1")).toContainText("Bob");
+ const picker = scope.getByTestId("glance-machine-T1");
+ // This Mac holds Slack too (the fixture's local relay), and held it first: preselected.
+ await expect(glance.getByTestId("glance-holders")).toContainText("This Mac");
+ await expect(picker).toHaveValue("desktop");
+ await picker.selectOption("mA");
+ await expect.poll(() => calls.find((c) => c.path.endsWith("/routing"))?.body).toEqual({ scope: "T1", machine_id: "mA" });
+ await scope.getByTestId("glance-coworker-T1").selectOption("");
+ // Subscribed channels across machines; the orphan offers Remove.
+ await expect(page.getByTestId("glance-sub-slack:T1/C1")).toContainText("#C1");
+ await expect(page.getByTestId("glance-sub-slack:T1/C1")).toContainText("cloud-vm");
+ await expect(page.getByTestId("glance-sub-slack:T1/C2")).toContainText("session gone");
+ await expect(page.getByTestId("glance-unsub-slack:T1/C2")).toHaveText("Remove");
+ await page.getByTestId("glance-unsub-slack:T1/C1").click();
+ await expect.poll(() => calls.find((c) => c.path === "remove")?.body).toEqual({ source: "slack:T1/C1" });
+});
+
+// UX-050 — the GitHub glance page IS its configurations (spec §10): the
+// installation default is the first row; Add opens the dialog (repositories ×
+// event × who × send to); Existing session uses the grouped picker; Delete and
+// a broker conflict round-trip through the cloud proxy.
+const GITHUB_CONN = { connection_id: "c-github", connector: "github", provider: "github", status: "connected", provider_account: "acme", holders: [{ machine_id: "mB", delegated_at: "2026-09-03T10:00:00Z", events: true }], default_machine_id: "", copyable: true, routing: {} };
+const DEFAULT_ROW = {
+ config_id: "cfg0", connector: "github", installation_id: "101", repos: ["acme"], event: "mention", name: "", who: ["nia"],
+ target: { kind: "new", machine_id: "mB", persona: "security", models: [], base_dir: "", worktree: true, skills: [], instructions: "" },
+ state: "active", created_at: "2026-09-03T10:00:00Z", created_by: "default",
+};
+const CFG_ROW = {
+ config_id: "cfg1", connector: "github", installation_id: "101", repos: ["acme/site", "acme/api"], event: "pr_open", name: "", who: ["nia"],
+ target: { kind: "new", machine_id: "mB", persona: "reviewer", models: ["anthropic:claude-sonnet-4-6"], base_dir: "~/work", worktree: true, skills: [], instructions: "" },
+ state: "active", created_at: "2026-09-04T10:00:00Z",
+};
+
+async function mockConfigurations(page: import("@playwright/test").Page, opts: { conflict?: boolean } = {}) {
+ const calls: { method: string; path: string; body: unknown }[] = [];
+ const rows = [DEFAULT_ROW, CFG_ROW];
+ await page.route(/\/v1\/cloud\/connections$/, (r) => r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ connections: [...CLOUD_CONNECTIONS, GITHUB_CONN] }) }));
+ await page.route(/\/v1\/cloud\/configurations(\?.*)?$/, (r) => {
+ const req = r.request();
+ if (req.method() === "POST") {
+ calls.push({ method: "POST", path: "configurations", body: req.postDataJSON() });
+ if (opts.conflict) return r.fulfill({ status: 409, contentType: "application/json", body: JSON.stringify({ detail: { error: "held", held_by: { key: "github:acme/site@pr_open" } } }) });
+ rows.push({ ...CFG_ROW, config_id: "cfg2", repos: (req.postDataJSON() as { repos: string[] }).repos });
+ return r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, configuration: rows[rows.length - 1] }) });
+ }
+ return r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ configurations: rows }) });
+ });
+ await page.route(/\/v1\/cloud\/configurations\/[^/]+$/, (r) => {
+ const req = r.request();
+ if (req.method() === "DELETE") {
+ calls.push({ method: "DELETE", path: new URL(req.url()).pathname, body: null });
+ rows.splice(rows.findIndex((x) => req.url().endsWith(`/${x.config_id}`)), 1);
+ return r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, removed: 2 }) });
+ }
+ return r.continue();
+ });
+ await page.route(/\/v1\/cloud\/people(\?.*)?$/, (r) => r.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ people: [] }) }));
+ return calls;
+}
+
+test("Settings ▸ GitHub: the default row, a configuration row, Add with a new session, Delete", async ({ page }) => {
+ await seedMachines(page, [CLOUD_VM, SANDBOX]);
+ await mockCloud(page);
+ const calls = await mockConfigurations(page);
+ await page.goto("/#/settings/appearance");
+ await page.getByRole("button", { name: "GitHub" }).click();
+ const glance = page.getByTestId("glance-github");
+ await expect(glance.getByTestId("glance-holders")).toContainText("sandbox-1");
+ // The installation default is a row like any other (created at connect).
+ const dflt = page.getByTestId("glance-cfg-cfg0");
+ await expect(dflt).toContainText("All repositories");
+ await expect(dflt).toContainText("default");
+ await expect(dflt).toContainText("security");
+ await expect(dflt.getByTestId("cfg-edit-cfg0")).toBeVisible();
+ // No page-level routing line or People list for GitHub any more.
+ await expect(page.getByTestId("glance-machine-101")).toHaveCount(0);
+ await expect(page.getByTestId("glance-people-101")).toHaveCount(0);
+ // A configuration row from the cloud.
+ const row = page.getByTestId("glance-cfg-cfg1");
+ await expect(row).toContainText("site, api");
+ await expect(row).toContainText("PR opened");
+ await expect(row).toContainText("reviewer");
+ await expect(row).toContainText("you + 1");
+
+ // Add: repositories × event × who × new session.
+ await page.getByTestId("cfg-add").click();
+ const dlg = page.getByTestId("cfg-dialog");
+ await dlg.getByTestId("cfg-repo-input").fill("acme/site");
+ await dlg.getByTestId("cfg-repo-input").press("Enter");
+ await expect(dlg.getByTestId("cfg-repo-acme/site")).toBeVisible();
+ await dlg.getByTestId("cfg-event").selectOption("pr_open");
+ await dlg.getByTestId("cfg-who-input").fill("nia");
+ await dlg.getByTestId("cfg-who-input").press("Enter");
+ await dlg.getByTestId("cfg-machine").selectOption("desktop");
+ await dlg.getByTestId("cfg-coworker").selectOption("security");
+ // The coworker's own models list is offered; the Ollama one is marked not here.
+ await expect(dlg.getByTestId("cfg-model-ollama:qwen3-coder:30b")).toContainText("not here");
+ await dlg.getByTestId("cfg-base-dir").fill("~/work");
+ // Spec §11.5: Approval mode defaults to Auto-approve and approvals go to the Inbox;
+ // both are the user's to change here.
+ await expect(dlg.getByTestId("cfg-approval-mode")).toHaveValue("auto-approve");
+ await expect(dlg.getByTestId("cfg-unattended")).toBeChecked();
+ await dlg.getByTestId("cfg-approval-mode").selectOption("interactive");
+ await dlg.getByTestId("cfg-unattended").uncheck();
+ await dlg.getByTestId("cfg-save").click();
+ await expect.poll(() => calls.find((c) => c.method === "POST")?.body).toMatchObject({
+ repos: ["acme/site"], event: "pr_open", who: ["nia"],
+ target: { kind: "new", machine_id: "desktop", persona: "security", base_dir: "~/work", worktree: true, models: ["anthropic:claude-opus-4-8"], approval_mode: "interactive", unattended: false },
+ });
+ await expect(page.getByTestId("cfg-dialog")).toHaveCount(0);
+ await expect(page.getByTestId("glance-cfg-cfg2")).toBeVisible();
+
+ // Delete goes to the cloud.
+ await page.getByTestId("cfg-delete-cfg1").click();
+ await expect.poll(() => calls.find((c) => c.method === "DELETE")?.path).toContain("/v1/cloud/configurations/cfg1");
+});
+
+test("Settings ▸ GitHub: Existing session uses the grouped picker; a broker conflict shows in the dialog", async ({ page }) => {
+ await seedMachines(page, [CLOUD_VM, SANDBOX]);
+ await mockCloud(page);
+ const calls = await mockConfigurations(page, { conflict: true });
+ await page.goto("/#/settings/appearance");
+ await page.getByRole("button", { name: "GitHub" }).click();
+ await page.getByTestId("cfg-add").click();
+ const dlg = page.getByTestId("cfg-dialog");
+ await dlg.getByTestId("cfg-repo-input").fill("acme/site");
+ await dlg.getByTestId("cfg-repo-input").press("Enter");
+ await dlg.getByTestId("cfg-event").selectOption("pr_merge");
+ await dlg.getByTestId("cfg-target-existing").check();
+ // This Mac's pinned session is listed under its machine group, pinned first.
+ await dlg.getByTestId("cfg-session-search").fill("launch");
+ await dlg.getByTestId("cfg-session-pinned-cowork-1").click();
+ await dlg.getByTestId("cfg-save").click();
+ await expect.poll(() => calls.find((c) => c.method === "POST")?.body).toMatchObject({
+ event: "pr_merge", target: { kind: "existing", machine_id: "desktop", session_id: "pinned-cowork-1" },
+ });
+ await expect(dlg.getByTestId("cfg-error")).toContainText("already covers");
+});
diff --git a/surfaces/gui/e2e/connectors-list.spec.ts b/surfaces/gui/e2e/connectors-list.spec.ts
index 6ebcf5de..816ad3fb 100644
--- a/surfaces/gui/e2e/connectors-list.spec.ts
+++ b/surfaces/gui/e2e/connectors-list.spec.ts
@@ -27,6 +27,7 @@ test("connected connectors come first with status + health chip", async ({ page
test("row navigates to the detail subpage; breadcrumb returns", async ({ page }) => {
await openConnectors(page);
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
await expect(page.getByTestId("slack-workspaces")).toBeVisible();
await page.getByTestId("connectors-breadcrumb").click();
await expect(page.getByTestId("connector-slack")).toContainText("2 workspaces · relay");
diff --git a/surfaces/gui/e2e/family-gate.spec.ts b/surfaces/gui/e2e/family-gate.spec.ts
index 3afe6841..773a1716 100644
--- a/surfaces/gui/e2e/family-gate.spec.ts
+++ b/surfaces/gui/e2e/family-gate.spec.ts
@@ -51,12 +51,13 @@ test("gated coworker: send with no folder asks where to work; temp folder sends
await expect(page.locator(".main-scroll").getByText("fix the tests", { exact: true })).toHaveCount(1);
await expect(page.getByText("Temporary folder created · git initialized")).toBeVisible();
- // The raw temp path never shows: header says "Temporary folder" + Save as project….
- const sub = page.getByTestId("session-subtitle");
- await expect(sub).toContainText("Security Coworker");
- await expect(sub).toContainText("Temporary folder");
- await expect(sub).not.toContainText("ow-temp");
- await expect(page.getByTestId("save-as-project")).toBeVisible();
+ // The raw temp path never shows: the title tooltip says "Temporary folder" (UX-048 moved the
+ // facts there; "Save as project…" was dropped 2026-09-03).
+ const ttl = page.getByTestId("session-title");
+ await expect(ttl).toHaveAttribute("title", /Security Coworker/);
+ await expect(ttl).toHaveAttribute("title", /Temporary folder/);
+ await expect(ttl).not.toHaveAttribute("title", /ow-temp/);
+ await expect(page.getByTestId("save-as-project")).toHaveCount(0);
// One-time pick: the setup row left with the first message.
await expect(page.getByTestId("setup-row")).toHaveCount(0);
@@ -76,8 +77,7 @@ test("gated coworker: Choose a folder… binds the picked project and sends", as
// Native pick is mocked server-side → /tmp/picked-folder.
await page.getByTestId("send-folder-dialog").getByRole("button", { name: "Choose a folder…" }).click();
await expect(page.getByText(/Echo: hello repo/)).toBeVisible();
- await expect(page.getByTestId("session-subtitle")).toContainText("picked-folder");
- await expect(page.getByTestId("save-as-project")).toHaveCount(0);
+ await expect(page.getByTestId("session-title")).toHaveAttribute("title", /picked-folder/);
});
test("escape restores the draft instead of losing it", async ({ page }) => {
diff --git a/surfaces/gui/e2e/fixtures.ts b/surfaces/gui/e2e/fixtures.ts
index 9c2d444b..996c3dc7 100644
--- a/surfaces/gui/e2e/fixtures.ts
+++ b/surfaces/gui/e2e/fixtures.ts
@@ -1,4 +1,7 @@
import { test as base, expect, type Page } from "@playwright/test";
+// Card payloads live in the gallery's state files (one source for the gallery, the unit
+// tests and this fixture) — replay them by id instead of writing the event by hand.
+import { statePayload, type CardId } from "../src/gallery/states";
// The app-wide /ws/events socket each page opened (UX-026 toast et al.) — specs
// push server events through it via sendAppEvent below.
@@ -65,7 +68,9 @@ const PERSONAS = {
personas: [
{ id: "cowork", name: "OpenWorker", icon: "cowork", tagline: "Produce a deliverable — research, analysis, scripts", requires_folder: false, builtin: true, tools: ["files", "search"], enabled: true, surfaced: true, default: true, ships: true, group: "general" },
{ id: "code", name: "Code", icon: "code", tagline: "Work in a codebase — files, git, shell", requires_folder: true, builtin: true, tools: ["code_files", "git"], enabled: false, surfaced: false, default: false, ships: true, group: "general" },
- { id: "security", name: "Security Coworker", icon: "shield", tagline: "Find and fix security issues — scan, triage, PR", requires_folder: true, builtin: true, tools: ["code_files", "git", "shell"], enabled: true, surfaced: true, default: false, ships: true, group: "security" },
+ // Carries a `models:` list (spec §4): the picker shows only these two; the Ollama one
+ // is not runnable on the mocked machine (its /v1/settings list lacks it).
+ { id: "security", name: "Security Coworker", icon: "shield", tagline: "Find and fix security issues — scan, triage, PR", requires_folder: true, builtin: true, tools: ["code_files", "git", "shell"], enabled: true, surfaced: true, default: false, ships: true, group: "security", models: ["anthropic:claude-opus-4-8", "ollama:qwen3-coder:30b"], models_available: ["anthropic:claude-opus-4-8"] },
{ id: "ops", name: "Ops Coworker", icon: "wrench", tagline: "Operate and investigate — runbooks, logs, infrastructure", requires_folder: false, builtin: true, tools: ["files", "shell"], enabled: true, surfaced: true, default: false, ships: false, group: "general" },
// A non-builtin install (disabled pending consent — invisible to picker specs) so the
// Personas page's delete/enable affordances have a target.
@@ -281,6 +286,8 @@ const PERSONA_DETAIL = {
description: "",
enabled: true,
tools: ["files", "search"],
+ models: ["anthropic:claude-opus-4-8"],
+ models_available: ["anthropic:claude-opus-4-8"],
recommended_models: ["anthropic:claude-opus-4-8"],
default_permission_mode: "interactive",
workspace: "deliverable",
@@ -564,6 +571,10 @@ export async function mockApi(page: import("@playwright/test").Page) {
// Sessions — mutable so archive (PATCH), rename (PATCH), and delete round-trip.
// UX-044: mutable binding state for the project-menu mocks.
const projectBindings: Record<string, string> = {};
+ // Remote homes (P1b): mutable machines list + enrollment arming, so specs can
+ // arm, "join" a box (push into the array), rename, and remove.
+ const machines: any[] = [];
+ const enrollment = { armed: false, join_url: "", expires_at: 0 };
const projectNames: Record<string, { name: string; key: string }[]> = {
memory: [
{ name: "openworker", key: "/k/openworker" },
@@ -672,6 +683,7 @@ export async function mockApi(page: import("@playwright/test").Page) {
await page.routeWebSocket(/\/ws\/session\//, (ws) => {
const send = (type: string, data: Record<string, unknown> = {}) =>
ws.send(JSON.stringify({ type, data }));
+ const sendState = (type: string, card: CardId, id: string) => send(type, statePayload(card, id));
// The page's session id, from the socket URL — team approval stamps THIS session
// as the lead (the active conversation IS the lead; workers hang off it).
const sid = ws.url().split("/ws/session/")[1]?.split("?")[0] || "sess-lead";
@@ -683,6 +695,14 @@ export async function mockApi(page: import("@playwright/test").Page) {
const msg = JSON.parse(String(raw));
if (msg.type === "user_message") {
hadTurn = true;
+ // Simulated link loss (machine rollover / sidecar restart): the server side
+ // closes the socket mid-conversation. The client must show a reconnecting
+ // state and come back on its own — Playwright re-runs this handler for the
+ // new connection, which sends `ready` again.
+ if (/drop the socket/i.test(msg.text)) {
+ ws.close();
+ return;
+ }
// Force-run (SKILLS-SPEC §6): like the real server, TURN_START ships the user's
// literal "/name …" line as `display` so the client dedupes on what the user sees.
send("turn_start", {
@@ -706,23 +726,13 @@ export async function mockApi(page: import("@playwright/test").Page) {
// The Auto-Approve reviewer answered `unsure`: the card carries its reason.
pendingTool = "run_shell";
send("tool_proposed", { name: "run_shell", arguments: { command: "python3 helper.py" } });
- send("permission_required", {
- name: "run_shell",
- arguments: { command: "python3 helper.py" },
- reason: "requires approval",
- reviewer_unsure: "This runs a newly created script whose effects cannot be determined from the command.",
- });
+ sendState("permission_required", "approval", "reviewer-unsure");
return; // suspended on the approval
}
if (/run a tool/i.test(msg.text)) {
pendingTool = "run_shell";
send("tool_proposed", { name: "run_shell", arguments: { command: "ls" } });
- send("permission_required", {
- name: "run_shell",
- arguments: { command: "ls" },
- reason: "The coworker wants to run a command.",
- readonly_ok: true, // `ls` classifies read-only server-side
- });
+ sendState("permission_required", "approval", "read-only-command");
return; // suspended on the approval
}
// Agent teams: the decomposition gate — the lead proposes work items and
@@ -730,61 +740,31 @@ export async function mockApi(page: import("@playwright/test").Page) {
// A board wake arriving on this session: the digest rides `source` with
// structured rows — the BoardWakeCard renders collapsed by default.
if (/board wake/i.test(msg.text)) {
- send("turn_start", {
- source: {
- connector: "board",
- kind: "channel",
- channel_id: "/Users/test/OpenWorker/launch-note",
- channel_name: "Team board",
- sender_id: "board",
- sender_name: "Board",
- ts: Date.now() / 1000,
- text: "⏰ Board wake — your team needs decisions:\n- #2 moved to review by webb",
- board: {
- rows: [
- {
- kind: "moved",
- item: 2,
- title: "Statements page",
- actor: "webb",
- to: "review",
- note: "Ready for review on feat/customer-statements, commit 029f9f7. Build verified; final verdict stays with the tester.",
- },
- { kind: "filed", item: 5, title: "Follow-up: rate limit", actor: "nia" },
- ],
- },
- },
- });
+ sendState("turn_start", "board-wake", "review-and-filed");
send("assistant_message", { text: "Reviewing the hand-off now." });
send("turn_done");
return;
}
if (/propose the split/i.test(msg.text)) {
- send("items_proposed", {
- items: [
- { title: "Statement API endpoint", criteria: "returns opening/closing balances over the chosen range; 8 endpoint tests green; malformed, missing, and reversed date ranges return 400; draft invoices are excluded from issued totals; inclusive boundaries verified end to end" },
- { title: "Statements dashboard page", criteria: "renders seeded data for Ada / Northgate; empty + error states covered" },
- { title: "Statement totals reconcile", criteria: "running balance matches invoices minus payments for the range" },
- { title: "Verification pass", criteria: "tester confirms page renders with live API data" },
- ],
- note: "Shared journal case: statements.",
- });
+ sendState("items_proposed", "work-items", "statements-split");
return; // suspended on the items decision
}
// Agent teams (OPE-97): the staffing gate — the lead proposes a roster and
// SUSPENDS until the team_response verdict arrives.
if (/staff the team/i.test(msg.text)) {
- send("team_proposed", {
- members: [
- { persona: "swe-worker", name: "nia", model: "anthropic:claude-opus-4-8", reason: "implementation" },
- { persona: "design-worker", name: "webb", reason: "UI polish" },
- { persona: "test-worker", name: "checks", reason: "verifies against acceptance criteria" },
- ],
- enable_chat: false,
- note: "Three workers cover the plan; checks verifies before anything closes.",
- });
+ sendState("team_proposed", "team-request", "model-fallback");
return; // suspended on the staffing decision
}
+ // Spec §11.6: the lead asks to give a worker a connector after staffing, or a
+ // coworker asks for a service to be connected — both suspend on the verdict.
+ if (/grant nia github/i.test(msg.text)) {
+ sendState("connector_requested", "connector-request", "grant-github");
+ return;
+ }
+ if (/connect linear/i.test(msg.text)) {
+ sendState("connector_requested", "connector-request", "connect-linear");
+ return;
+ }
// Agent teams (OPE-96): a decomposition turn — the plan was approved in
// conversation (plan-approval flow); the agent files the items and the
// board rail appears on the next board fetch.
@@ -808,48 +788,29 @@ export async function mockApi(page: import("@playwright/test").Page) {
// — an older sidecar, or any surface that forgets the field. Must render NOT
// installable, never a guessed Install offer.
if (/request an unpinned tool/i.test(msg.text)) {
- send("tool_requested", {
- name: "somescanner",
- reason: "scan the Terraform for misconfigurations",
- });
+ sendState("tool_requested", "tool-request", "not-installable");
return; // suspended on the tool request
}
// OPE-85: the agent hits a missing scanner and asks instead of skipping the check.
if (/scan for secrets/i.test(msg.text)) {
- send("tool_requested", {
- name: "gitleaks",
- reason: "scan the git history for committed secrets",
- installable: true,
- version: "8.30.1",
- summary: "scans git history and the working tree for committed secrets",
- source: "github.com/gitleaks",
- });
+ sendState("tool_requested", "tool-request", "installable");
return; // suspended on the tool request
}
// §35 compact row: a routine workspace write (content rides in the args).
if (/write a file/i.test(msg.text)) {
pendingTool = "write_file";
- const args = {
- path: "src/fetch_data.py",
- content: "import json\nimport urllib.request\n\ncompanies = [\"NVDA\", \"AMD\"]\nprint(len(companies))\ndone = True",
- };
+ const args = statePayload("approval", "write-file").arguments;
send("tool_proposed", { name: "write_file", arguments: args });
- send("permission_required", { name: "write_file", arguments: args, reason: "" });
+ sendState("permission_required", "approval", "write-file");
return; // suspended on the approval
}
// A one-paragraph digest with NO newlines — the owner-repro shape that once
// ballooned the card to full-transcript height (char clamp, 2026-07-15).
if (/post the long digest/i.test(msg.text)) {
pendingTool = "send_message";
- const args = {
- target: "slack:T1/C1",
- text:
- "aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. ".repeat(
- 6,
- ),
- };
+ const args = statePayload("approval", "long-message").arguments;
send("tool_proposed", { name: "send_message", arguments: args });
- send("permission_required", { name: "send_message", arguments: args, reason: "", category: "messaging" });
+ sendState("permission_required", "approval", "long-message");
return;
}
// Standing scoped approvals (§25): an eligible connector-ish write — the event
@@ -860,13 +821,7 @@ export async function mockApi(page: import("@playwright/test").Page) {
name: "send_message",
arguments: { target: "slack:T1/C1", text: "Weekly digest ready" },
});
- send("permission_required", {
- name: "send_message",
- arguments: { target: "slack:T1/C1", text: "Weekly digest ready" },
- reason: "",
- category: "messaging",
- standing_target: "slack:T1/C1",
- });
+ sendState("permission_required", "approval", "automation-run");
return;
}
// §25 consent card: the agent proposes the automation's permission set on the
@@ -874,20 +829,7 @@ export async function mockApi(page: import("@playwright/test").Page) {
if (/create an automation/i.test(msg.text)) {
pendingTool = "create_scheduled_task";
send("tool_proposed", { name: "create_scheduled_task", arguments: {} });
- send("permission_required", {
- name: "create_scheduled_task",
- arguments: {
- title: "Weekly digest",
- instructions: "Summarize the week and post it.",
- cron: "0 9 * * 1",
- permissions: [
- { tool: "send_message", target: "slack:T1/C1", access: "write" },
- { tool: "github_list_commits", target: "rohit/agent-platform", access: "read" },
- ],
- },
- reason: "",
- category: "automation",
- });
+ sendState("permission_required", "approval", "automation-consent");
return;
}
// A reasoning model's turn: thinking deltas tick in slowly, then the answer —
@@ -1043,15 +985,44 @@ export async function mockApi(page: import("@playwright/test").Page) {
status,
current_item: item,
},
+ // Persisted per-model totals (spec §5) — nia has worked, the others not yet.
+ usage:
+ actor === "nia"
+ ? { "anthropic:claude-opus-4-8": { input: 20_000, output: 4_000, cache_read: 0, cache_write: 0, turns: 3 } }
+ : {},
});
}
send("assistant_message", {
- text: "Team created — nia, webb and checks are standing by. Assigning items now.",
+ // Echo the human's per-worker decisions so the spec can see them arrive.
+ text:
+ "Team created — " +
+ (Array.isArray(msg.members) && msg.members.length
+ ? msg.members
+ .map(
+ (m: any) =>
+ `${m.name} (${(m.connectors || []).join(", ") || "no connectors"})`,
+ )
+ .join(", ")
+ : "nia, webb and checks are standing by") +
+ ". Assigning items now." +
+ // …and the per-worker model picks, when the card sent them.
+ (Array.isArray(msg.members) && msg.members.some((m: any) => m.model)
+ ? " Models — " +
+ msg.members.map((m: any) => `${m.name}: ${m.model || "default"}`).join(", ") +
+ "."
+ : ""),
});
} else {
send("assistant_message", { text: "Understood — tell me how to change the roster." });
}
send("turn_done");
+ } else if (msg.type === "connector_response") {
+ send("assistant_message", {
+ text: msg.approved
+ ? "Granted — nia can push the branch now."
+ : "Understood — I'll route that step through myself.",
+ });
+ send("turn_done");
} else if (msg.type === "tool_response") {
// Either way the turn continues — the point of the contract is that declining
// degrades the report openly instead of dropping the check.
@@ -1114,6 +1085,13 @@ export async function mockApi(page: import("@playwright/test").Page) {
});
});
+ await page.route("**/v1/capabilities", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ mode: "desktop" }),
+ }),
+ );
await page.route("**/v1/**", async (route) => {
const req = route.request();
const p = new URL(req.url()).pathname;
@@ -1133,6 +1111,39 @@ export async function mockApi(page: import("@playwright/test").Page) {
}
return json(connections);
}
+ // Remote homes (P1b): machines list + arming.
+ if (p === "/v1/machines" && m === "GET") {
+ return json({ machines, armed: enrollment.armed });
+ }
+ if (/^\/v1\/machines\/[^/]+$/.test(p) && m === "PATCH") {
+ const id = p.split("/").pop();
+ const b = req.postDataJSON() || {};
+ const row = machines.find((x) => x.id === id);
+ if (!row) return json({ error: "unknown machine" }, 404);
+ if (machines.some((x) => x.id !== id && x.name === b.name))
+ return json({ error: `a machine named '${b.name}' already exists` }, 409);
+ row.name = b.name;
+ return json({ machine: { id: row.id, name: row.name } });
+ }
+ if (/^\/v1\/machines\/[^/]+$/.test(p) && m === "DELETE") {
+ const id = p.split("/").pop();
+ const row = machines.find((x) => x.id === id);
+ if (!row) return json({ error: "unknown machine" }, 404);
+ if (row.connected)
+ return json({ error: "machine is connected; it must leave (or go offline) first" }, 409);
+ machines.splice(machines.indexOf(row), 1);
+ return json({ removed: id });
+ }
+ if (p === "/v1/remote/arm" && m === "POST") {
+ enrollment.armed = true;
+ enrollment.join_url = "http://127.0.0.1:9787/j/e2e-token";
+ enrollment.expires_at = Date.now() / 1000 + 600;
+ return json({ join_url: enrollment.join_url, expires_at: enrollment.expires_at, ttl_seconds: 600 });
+ }
+ if (p === "/v1/remote/arm" && m === "DELETE") {
+ enrollment.armed = false;
+ return json({ armed: false });
+ }
// UX-044 project bindings: stateful per-run so specs can bind/unbind/name.
if (/\/v1\/sessions\/[^/]+\/project-menu$/.test(p)) {
const kind = new URL(req.url()).searchParams.get("kind") || "memory";
@@ -2221,8 +2232,18 @@ export async function mockApi(page: import("@playwright/test").Page) {
});
const link = raw.match(/slack\.com\/archives\/([A-Za-z0-9]+)/);
const channel = link ? `slack:${link[1].toUpperCase()}` : raw;
+ // Cloud-first claim (one session across all machines answers a source): CHELD is
+ // held by another session until the caller moves it.
+ if (channel === "slack:CHELD" && !b.move)
+ return json({
+ ok: false,
+ error: "held",
+ held_by: { session_id: "s-other", title: "Release watcher", machine_id: "m-cloud-vm", source: channel },
+ also: [],
+ move_allowed: true,
+ });
subscriptions.push({ session_id: b.session_id, session_title: "", agent: "", channel, routing_target: null, collision: false });
- return json({ ok: true, channel });
+ return json({ ok: true, channel, registered: channel === "slack:CHELD" });
}
if (p.endsWith("/v1/subscriptions/remove") && m === "POST") {
const b = req.postDataJSON();
@@ -2257,6 +2278,176 @@ export async function seedSessionMessages(
);
}
+/** Seed the machines list for one spec (remote homes, UX-045). Registers LATER
+ * routes (later routes win) with their own closure state, so rename/remove/arm
+ * round-trip against the seeded rows; returns a handle whose `join()` pushes a
+ * newly-"joined" box, the way a real enrollment appears mid-poll. */
+export async function seedMachines(
+ page: Page,
+ rows: Record<string, unknown>[],
+ remoteSessions: Record<string, Record<string, unknown>[]> = {},
+ // Cached transcripts keyed "machineId/sessionId" — served by the controller-
+ // view messages endpoint whether the machine is online (live) or not (cached).
+ remoteTranscripts: Record<string, Record<string, unknown>[]> = {},
+ remoteInboxItems: Record<string, any[]> = {},
+): Promise<{ join: (row: Record<string, unknown>) => void }> {
+ const machines = rows.map((r) => ({ ...r }));
+ await page.route(/\/v1\/machines\/[^/]+\/sessions\/[^/]+\/messages$/, (route) => {
+ const parts = new URL(route.request().url()).pathname.split("/");
+ const mid = parts[3];
+ const sid = parts[5];
+ const row = machines.find((x: any) => x.id === mid);
+ const cached = remoteTranscripts[`${mid}/${sid}`];
+ return route.fulfill({
+ status: row ? 200 : 404,
+ contentType: "application/json",
+ body: JSON.stringify(
+ row
+ ? {
+ messages: cached ?? [],
+ live: !!(row as any).connected,
+ cached: !!cached,
+ }
+ : { error: "unknown machine" },
+ ),
+ });
+ });
+ // Controller-view per-machine session lists (getAllSessions fans out over ALL
+ // machines): live rows for a connected machine, the stored snapshot
+ // (live:false) for an offline one — greyed, never vanished.
+ await page.route(/\/v1\/machines\/[^/]+\/sessions$/, (route) => {
+ const mid = new URL(route.request().url()).pathname.split("/")[3];
+ const row = machines.find((x: any) => x.id === mid);
+ return route.fulfill({
+ status: row ? 200 : 404,
+ contentType: "application/json",
+ body: JSON.stringify(
+ row
+ ? { sessions: remoteSessions[mid] ?? [], live: !!(row as any).connected }
+ : { error: "unknown machine" },
+ ),
+ });
+ });
+ // Proxied transcripts: reopening a remote session starts blank, like the shared mock.
+ await page.route(/\/v1\/machines\/[^/]+\/p\/v1\/sessions\/[^/]+\/messages$/, (route) =>
+ route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ messages: [] }) }),
+ );
+ const enrollment = { armed: false };
+ const json = (route: any, body: unknown, status = 200) =>
+ route.fulfill({ status, contentType: "application/json", body: JSON.stringify(body) });
+ await page.route("**/v1/machines", (route) =>
+ json(route, { machines, armed: enrollment.armed }),
+ );
+ await page.route(/\/v1\/machines\/[^/]+$/, (route) => {
+ const req = route.request();
+ const id = new URL(req.url()).pathname.split("/").pop();
+ const row = machines.find((x: any) => x.id === id);
+ if (!row) return json(route, { error: "unknown machine" }, 404);
+ if (req.method() === "PATCH") {
+ const b = req.postDataJSON() || {};
+ if (machines.some((x: any) => x.id !== id && x.name === b.name))
+ return json(route, { error: `a machine named '${b.name}' already exists` }, 409);
+ (row as any).name = b.name;
+ return json(route, { machine: { id, name: b.name } });
+ }
+ if (req.method() === "DELETE") {
+ if ((row as any).connected)
+ return json(route, { error: "machine is connected; it must leave (or go offline) first" }, 409);
+ machines.splice(machines.indexOf(row), 1);
+ return json(route, { removed: id });
+ }
+ return route.fallback();
+ });
+ await page.route("**/v1/remote/arm", (route) => {
+ if (route.request().method() === "DELETE") {
+ enrollment.armed = false;
+ return json(route, { armed: false });
+ }
+ enrollment.armed = true;
+ return json(route, {
+ join_url: "http://127.0.0.1:9787/j/e2e-token",
+ expires_at: Date.now() / 1000 + 600,
+ ttl_seconds: 600,
+ });
+ });
+ // Keys wallet: names-only listing + per-machine deployed-profiles ledger.
+ await page.route("**/v1/wallet", (route) =>
+ json(route, { profiles: [{ profile: "provider:openai", type: null }] }),
+ );
+ const deployed: Record<string, Set<string>> = {};
+ await page.route(/\/v1\/machines\/[^/]+\/secrets$/, (route) => {
+ const req = route.request();
+ const mid = new URL(req.url()).pathname.split("/")[3];
+ if (!machines.some((x: any) => x.id === mid))
+ return json(route, { error: "unknown machine" }, 404);
+ const set = (deployed[mid] ||= new Set());
+ if (req.method() === "POST") {
+ const names: string[] = req.postDataJSON()?.profiles ?? [];
+ names.forEach((n) => set.add(n));
+ return json(route, { ok: true, deployed: names });
+ }
+ if (req.method() === "DELETE") {
+ const names: string[] = req.postDataJSON()?.profiles ?? [];
+ names.forEach((n) => set.delete(n));
+ return json(route, { ok: true, revoked: names });
+ }
+ return json(route, {
+ secrets: [...set].map((profile) => ({
+ profile,
+ deployed_at: Date.now() / 1000,
+ stale: false,
+ missing_from_wallet: false,
+ })),
+ });
+ });
+ // Aggregated Inbox: each machine's parked items via the proxy, stateful so a
+ // resolve routed to the machine clears it.
+ const remoteInbox: Record<string, any[]> = { ...remoteInboxItems };
+ await page.route(/\/v1\/machines\/[^/]+\/p\/v1\/inbox\?/, (route) => {
+ const mid = new URL(route.request().url()).pathname.split("/")[3];
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ items: (remoteInbox[mid] ?? []).filter((i) => i.state === "pending") }),
+ });
+ });
+ await page.route(/\/v1\/machines\/[^/]+\/p\/v1\/inbox\/[^/]+\/resolve$/, (route) => {
+ const parts = new URL(route.request().url()).pathname.split("/");
+ const mid = parts[3];
+ const itemId = parts[7];
+ const item = (remoteInbox[mid] ?? []).find((i) => i.id === itemId);
+ if (item) item.state = "resolved";
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true }),
+ });
+ });
+ // Remote folder flows: the box's recents, path validation, and temp dirs.
+ await page.route(/\/v1\/machines\/[^/]+\/p\/v1\/workspaces\/recent$/, (route) =>
+ json(route, { workspaces: [] }),
+ );
+ await page.route(/\/v1\/machines\/[^/]+\/p\/v1\/workspaces\/open$/, (route) => {
+ const b = route.request().postDataJSON() || {};
+ return String(b.path).startsWith("/")
+ ? json(route, { ok: true, path: b.path, git_branch: null })
+ : json(route, { ok: false, error: "no such folder on this machine" });
+ });
+ await page.route(/\/v1\/machines\/[^/]+\/p\/v1\/workspaces\/temp$/, (route) =>
+ json(route, { ok: true, path: "/home/ow/OpenWorker/tmp-e2e", git: true }),
+ );
+ // Machine-scoped settings (the proxied /v1/settings the runs-on picker loads).
+ await page.route(/\/v1\/machines\/[^/]+\/p\/v1\/settings$/, (route) =>
+ json(route, {
+ model: "ollama:qwen3-coder:30b",
+ models: ["ollama:qwen3-coder:30b"],
+ model_labels: { "ollama:qwen3-coder:30b": "qwen3-coder:30b · Ollama" },
+ model_ready: true,
+ }),
+ );
+ return { join: (row) => void machines.push({ ...row }) };
+}
+
// A `test` whose page has the API mocked before navigation.
export const test = base.extend({
page: async ({ page }, use) => {
diff --git a/surfaces/gui/e2e/github-page.spec.ts b/surfaces/gui/e2e/github-page.spec.ts
index 6536ce9a..8ef577f8 100644
--- a/surfaces/gui/e2e/github-page.spec.ts
+++ b/surfaces/gui/e2e/github-page.spec.ts
@@ -10,6 +10,7 @@ async function openGithubPage(page) {
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Connectors", exact: true }).click();
await page.getByTestId("connector-github").click();
+ await page.getByTestId("manage-local-github").click();
}
test("lists each installation as its own group with people and waiting rows", async ({
@@ -54,6 +55,7 @@ test("add installation opens the modal; signed in installs a second org", async
await page.getByTestId("account-sign-in").click();
await expect(page.getByTestId("account-row")).toContainText("Rohit", { timeout: 10_000 });
await page.getByTestId("connector-github").click();
+ await page.getByTestId("manage-local-github").click();
await page.getByTestId("add-installation-btn").click();
await page.getByTestId("modal-install-github-app").click();
// the mock completes the browser install instantly; the page's poll shows it
@@ -76,6 +78,7 @@ test("modal has ONE connect button and sends no flow — authorize-first lives i
await page.getByTestId("account-sign-in").click();
await expect(page.getByTestId("account-row")).toContainText("Rohit", { timeout: 10_000 });
await page.getByTestId("connector-github").click();
+ await page.getByTestId("manage-local-github").click();
let flowSent: string | null = null;
await page.route("**/v1/connectors/github/connect-managed", async (route) => {
@@ -96,6 +99,7 @@ test("disconnect removes one installation and keeps the rest", async ({ page })
await page.getByTestId("account-sign-in").click();
await expect(page.getByTestId("account-row")).toContainText("Rohit", { timeout: 10_000 });
await page.getByTestId("connector-github").click();
+ await page.getByTestId("manage-local-github").click();
await page.getByTestId("add-installation-btn").click();
await page.getByTestId("modal-install-github-app").click();
await expect(page.getByTestId("github-install-202")).toBeVisible({ timeout: 10_000 });
diff --git a/surfaces/gui/e2e/machines.spec.ts b/surfaces/gui/e2e/machines.spec.ts
new file mode 100644
index 00000000..3011ca50
--- /dev/null
+++ b/surfaces/gui/e2e/machines.spec.ts
@@ -0,0 +1,708 @@
+import { test, expect, seedMachines } from "./fixtures";
+
+// Remote homes P1b (UX-045 frames C/D): Settings ▸ Machines — rows with
+// presence, rename/remove round trips, and the enrollment card (arming, the
+// join one-liner, and the joined state when a box appears mid-poll).
+
+const HETZNER = {
+ id: "m1",
+ name: "hetzner-box",
+ fingerprint: "8aaaac6fdc97e081",
+ app_version: "0.2.0",
+ created_at: 1_755_000_000,
+ last_seen: 1_755_000_000,
+ connected: true,
+};
+const MACPRO = {
+ id: "m2",
+ name: "old-macpro",
+ fingerprint: "1234567890abcdef",
+ app_version: "0.1.9",
+ created_at: 1_754_000_000,
+ last_seen: 1_754_100_000,
+ connected: false,
+};
+
+async function openMachines(page: import("@playwright/test").Page) {
+ await page.goto("/");
+ await page.getByTestId("account-row").click();
+ await page.getByRole("button", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Machines", exact: true }).click();
+}
+
+test("machine rows: This Mac + presence, offline machines keep their row", async ({ page }) => {
+ await seedMachines(page, [HETZNER, MACPRO]);
+ await openMachines(page);
+
+ await expect(page.getByText("This Mac", { exact: true })).toBeVisible();
+ const hetzner = page.getByTestId("machine-hetzner-box");
+ await expect(hetzner.getByText("hetzner-box")).toBeVisible();
+ await expect(hetzner.getByText(/online/)).toBeVisible();
+ const macpro = page.getByTestId("machine-old-macpro");
+ await expect(macpro.getByText(/last seen/)).toBeVisible();
+ await expect(macpro.getByText(/v0\.1\.9/)).toBeVisible();
+});
+
+test("rename round-trips; removing a connected machine is refused", async ({ page }) => {
+ await seedMachines(page, [HETZNER]);
+ await openMachines(page);
+
+ const row = page.getByTestId("machine-hetzner-box");
+ await row.hover();
+ await row.getByText("Rename").click();
+ await page.locator("input:focus").fill("gpu-rig");
+ await page.keyboard.press("Enter");
+ await expect(page.getByTestId("machine-gpu-rig")).toBeVisible();
+
+ page.on("dialog", (d) => d.accept());
+ const renamed = page.getByTestId("machine-gpu-rig");
+ await renamed.hover();
+ await renamed.getByText("Remove").click();
+ await expect(page.getByText(/must leave \(or go offline\)/)).toBeVisible();
+ await expect(page.getByTestId("machine-gpu-rig")).toBeVisible();
+});
+
+test("enrollment: arming shows the one-liner, a joining box flips the card", async ({ page }) => {
+ const seeded = await seedMachines(page, [MACPRO]);
+ await openMachines(page);
+
+ await page.getByText("Add a machine…").click();
+ await expect(page.getByTestId("join-command")).toContainText(
+ "openworker join http://127.0.0.1:9787/j/e2e-token",
+ );
+ await expect(page.getByText(/Waiting for the machine/)).toBeVisible();
+ await expect(page.getByTestId("token-countdown")).toContainText("token expires in");
+
+ // The reachability toggle only swaps hint text.
+ await expect(page.getByText(/ssh -N -R/)).toBeVisible();
+ await page.getByText("Tailscale / VPN").click();
+ await expect(page.getByText(/tailnet address/)).toBeVisible();
+
+ // Provision-with-defaults rides the join: on by default when the wallet
+ // holds provider keys.
+ await expect(page.getByTestId("provision-defaults")).toBeChecked();
+
+ seeded.join({
+ id: "m9",
+ name: "my-box",
+ fingerprint: "feedfacecafebeef",
+ app_version: "0.2.0",
+ created_at: Date.now() / 1000,
+ last_seen: Date.now() / 1000,
+ connected: true,
+ });
+ await expect(page.getByTestId("join-success")).toContainText("my-box joined");
+ await expect(page.getByTestId("join-success")).toContainText("feedfacecafebeef");
+ await expect(page.getByTestId("provisioned-note")).toContainText("Provisioned with 1 model key");
+ await expect(page.getByText(/pick ⌂ my-box under/)).toBeVisible();
+});
+
+// -- P1c: runs-on chip, ⌂ badge, Machine grouping ------------------------------
+
+const REMOTE_SESSION = {
+ session_id: "remote-nightly-1",
+ title: "Nightly triage watch",
+ workspace: "/home/ow/scratch/nightly",
+ agent: "cowork",
+ model: "anthropic:claude-opus-4-8",
+ mode: "interactive",
+ updated_at: "2026-07-01 08:00:00",
+ messages: 4,
+ pinned: false,
+ archived: false,
+};
+
+test("runs-on chip: appears with a machine enrolled, retargets the draft, hides the folder chip", async ({ page }) => {
+ await seedMachines(page, [HETZNER]);
+ await page.goto("/");
+ await page.getByRole("button", { name: "New session" }).click();
+
+ const chip = page.getByTestId("runson-chip");
+ await expect(chip).toContainText("This Mac");
+ await expect(page.getByTestId("folder-chip")).toBeVisible();
+
+ await chip.click();
+ await page.getByText("⌂ hetzner-box").click();
+ await expect(chip).toContainText("hetzner-box");
+ // A remote draft never carries a local folder.
+ await expect(page.getByTestId("folder-chip")).toHaveCount(0);
+
+ // And back: This Mac restores the folder chip.
+ await chip.click();
+ await page.getByRole("button", { name: "This Mac" }).click();
+ await expect(chip).toContainText("This Mac");
+ await expect(page.getByTestId("folder-chip")).toBeVisible();
+});
+
+test("offline machines are listed but not selectable in the runs-on menu", async ({ page }) => {
+ await seedMachines(page, [HETZNER, MACPRO]);
+ await page.goto("/");
+ await page.getByRole("button", { name: "New session" }).click();
+ await page.getByTestId("runson-chip").click();
+ const offline = page.getByRole("button", { name: /old-macpro/ });
+ await expect(offline).toBeDisabled();
+});
+
+test("remote sessions wear the ⌂ badge and group under their machine", async ({ page }) => {
+ await seedMachines(page, [HETZNER], { m1: [REMOTE_SESSION] });
+ await page.goto("/");
+
+ // Flat list: the remote row is present with its quiet badge.
+ const row = page.getByText("Nightly triage watch").first();
+ await expect(row).toBeVisible();
+
+ // Group by Machine (entry exists only because a machine is enrolled).
+ await page.getByRole("button", { name: "Group and filter conversations" }).click();
+ await page.getByRole("menu").getByText("Machine", { exact: true }).click();
+ // UX-048: group headers are the machine name, sentence case, no glyph.
+ await expect(page.locator("div").filter({ hasText: /^This Mac$/ })).toBeVisible();
+ await expect(page.locator("div").filter({ hasText: /^hetzner-box$/ })).toBeVisible();
+ await page.mouse.click(640, 400); // dismiss the popover (its backdrop covers the page)
+
+ // Selecting the remote session adopts its machine — the proxied (blank) transcript
+ // renders as a draft whose runs-on chip already points at the box.
+ await page.getByText("Nightly triage watch").first().click();
+ await expect(page.getByTestId("runson-chip")).toContainText("hetzner-box");
+});
+
+test("an offline machine's sessions stay listed — greyed, with an explainer on open", async ({ page }) => {
+ await seedMachines(page, [MACPRO], { m2: [{ ...REMOTE_SESSION, session_id: "snap-1", title: "Snapshot watch" }] });
+ await page.goto("/");
+
+ // The snapshot row is present despite the machine being offline (it sorts
+ // oldest, so expand the recents peek first)…
+ await page.getByText(/Show (\d+ )?more/).first().click();
+ const row = page.getByText("Snapshot watch").first();
+ await expect(row).toBeVisible();
+ // …and quiet: the row wrapper carries the offline treatment.
+ await expect(
+ page.locator("div.opacity-45", { hasText: "Snapshot watch" }).first(),
+ ).toBeVisible();
+
+ // No cached transcript → opening explains where the conversation lives.
+ await row.click();
+ await expect(page.getByText(/old-macpro is offline — the conversation lives there/)).toBeVisible();
+});
+
+test("a viewed transcript stays readable offline — read-only with a banner", async ({ page }) => {
+ await seedMachines(
+ page,
+ [MACPRO],
+ { m2: [{ ...REMOTE_SESSION, session_id: "snap-2", title: "Synced watch" }] },
+ {
+ "m2/snap-2": [
+ { role: "user", content: "check the deploy" },
+ { role: "assistant", content: "Deploy looks healthy; two warnings noted." },
+ ],
+ },
+ );
+ await page.goto("/");
+ await page.getByText(/Show (\d+ )?more/).first().click();
+ await page.getByText("Synced watch").first().click();
+
+ // The last synced conversation renders…
+ await expect(page.getByText("check the deploy").first()).toBeVisible();
+ await expect(page.getByText(/Deploy looks healthy/).first()).toBeVisible();
+ // …with the read-only banner…
+ await expect(page.getByText(/showing the last synced view \(read-only\)/)).toBeVisible();
+ // …and the composer can't send (the bridged socket never connects).
+ await expect(page.getByRole("button", { name: "Send" })).toBeDisabled();
+});
+
+// -- Keys wallet W3: chips + machine-scoped model picker -----------------------
+
+test("a remote draft offers the MACHINE's models, not this Mac's", async ({ page }) => {
+ await seedMachines(page, [HETZNER]);
+ await page.goto("/");
+ await page.getByRole("button", { name: "New session" }).click();
+ await page.getByTestId("runson-chip").click();
+ await page.getByText("⌂ hetzner-box").click();
+ // The composer's model chip flips to the box's default (proxied settings).
+ await expect(page.getByRole("button", { name: /qwen3-coder:30b/ })).toBeVisible();
+});
+
+test("wallet chips: deploy and revoke a provider key on a machine", async ({ page }) => {
+ await seedMachines(page, [HETZNER, MACPRO]);
+ await page.goto("/");
+ await page.getByTestId("account-row").click();
+ await page.getByRole("button", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Models & Keys" }).click();
+ await page.getByTestId("set-provider-openai").click(); // configured + keyed in fixtures
+
+ const chips = page.getByTestId("wallet-chips");
+ await expect(chips.getByText("This Mac")).toBeVisible();
+ const offline = page.getByTestId("wallet-chip-old-macpro");
+ await expect(offline).toBeDisabled();
+
+ const chip = page.getByTestId("wallet-chip-hetzner-box");
+ await chip.click();
+ await expect(chip).toContainText("✓");
+ await chip.click();
+ await expect(chip).not.toContainText("✓");
+});
+
+
+// -- Cloud-mode skeleton: same bundle, server-driven flag ----------------------
+
+async function forceCloudMode(page: import("@playwright/test").Page) {
+ // LATER routes win: flip the capabilities answer to cloud for this spec.
+ await page.route("**/v1/capabilities", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ mode: "cloud" }),
+ }),
+ );
+}
+
+test("cloud mode: no This-Mac row, machine-first runs-on, no local folder chip", async ({ page }) => {
+ await seedMachines(page, [HETZNER]);
+ await forceCloudMode(page);
+ await page.goto("/");
+
+ await page.getByRole("button", { name: "New session" }).click();
+ // The runs-on chip prompts for a machine (no local home to default to)…
+ const chip = page.getByTestId("runson-chip");
+ await expect(chip).toContainText("Choose machine");
+ // …and with no machine there is no socket to reconnect — no strip on a
+ // fresh draft (the controller has no engine; owner-hit 2026-09-02).
+ await page.waitForTimeout(1500);
+ await expect(page.getByTestId("session-reconnecting")).toHaveCount(0);
+ await chip.click();
+ // …and the menu offers only machines — This Mac is not a choice.
+ await expect(page.getByText("⌂ hetzner-box")).toBeVisible();
+ await expect(page.getByRole("button", { name: "This Mac" })).toHaveCount(0);
+ await page.getByText("⌂ hetzner-box").click();
+ // No local folder chip in cloud mode.
+ await expect(page.getByTestId("folder-chip")).toHaveCount(0);
+
+ // Settings ▸ Machines: the controller isn't a home — no This-Mac row.
+ await page.getByTestId("account-row").click();
+ await page.getByRole("button", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Machines", exact: true }).click();
+ await expect(page.getByTestId("machine-hetzner-box")).toBeVisible();
+ await expect(page.getByText("This Mac")).toHaveCount(0);
+});
+
+// -- Inbox aggregation across machines -----------------------------------------
+
+test("the Inbox aggregates a connected machine's parked items; resolve routes back", async ({ page }) => {
+ await seedMachines(
+ page,
+ [HETZNER],
+ { m1: [REMOTE_SESSION] },
+ {},
+ {
+ m1: [
+ {
+ id: "remote-appr-1",
+ session_id: "remote-nightly-1",
+ kind: "approval",
+ title: "Approve: run_shell",
+ body: "systemctl restart nginx",
+ state: "pending",
+ resolution: null,
+ inbox: "default",
+ created_at: "2026-07-02 03:00:00",
+ resolved_at: null,
+ session_title: "Nightly triage watch",
+ session_agent: "cowork",
+ session_workspace: "",
+ session_exists: true,
+ },
+ ],
+ },
+ );
+ await page.goto("/");
+ await page.getByRole("button", { name: "Inbox" }).click();
+
+ // The remote approval lists beside local ones, wearing its machine tag.
+ await expect(page.getByText("systemctl restart nginx")).toBeVisible();
+ await expect(page.getByText("⌂ hetzner-box").first()).toBeVisible();
+
+ // Resolving it posts to THAT machine (the stateful mock flips it) and the
+ // item leaves the pending list.
+ await page
+ .getByTestId("inbox-item-remote-appr-1")
+ .getByRole("button", { name: "Approve", exact: true })
+ .click();
+ await expect(page.getByText("systemctl restart nginx")).toHaveCount(0);
+});
+
+// -- Remote folder choice (send-time dialog) -----------------------------------
+
+test("remote send-folder dialog: typed path on the machine, no local picker", async ({ page }) => {
+ await seedMachines(page, [HETZNER]);
+ await page.goto("/");
+ await page.getByRole("button", { name: "New session" }).click();
+
+ // A folder-gated coworker on a machine.
+ await page.getByTestId("coworker-chip").click();
+ await page.getByText("Security Coworker").click();
+ await page.getByTestId("runson-chip").click();
+ await page.getByText("⌂ hetzner-box").click();
+
+ await page.getByPlaceholder(/Ask the coworker/).fill("scan the repo");
+ await page.keyboard.press("Enter");
+
+ const dialog = page.getByTestId("send-folder-dialog");
+ await expect(dialog).toBeVisible();
+ // Remote variant: machine-scoped copy, typed path, NO native picker.
+ await expect(dialog.getByText(/on ⌂ hetzner-box/).first()).toBeVisible();
+ await expect(dialog.getByText("Choose a folder…")).toHaveCount(0);
+ await expect(dialog.getByTestId("start-temp-folder")).toContainText("on hetzner-box");
+
+ // A bad path is rejected BY THE MACHINE with a real error…
+ await page.getByTestId("remote-path-input").fill("not-a-path");
+ await page.getByTestId("remote-path-open").click();
+ await expect(dialog.getByText(/no such folder on this machine/)).toBeVisible();
+
+ // …a good one validates and the stashed message flies.
+ await page.getByTestId("remote-path-input").fill("/home/ow/project");
+ await page.getByTestId("remote-path-open").click();
+ await expect(page.getByTestId("send-folder-dialog")).toHaveCount(0);
+ await expect(page.getByText("scan the repo").first()).toBeVisible();
+});
+
+test("typed-code approval: bad code dead-ends, good code shows fingerprint, approve decides", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ const decisions: string[] = [];
+ await page.route(/\/v1\/remote\/device\/[^/]+\/(approve|deny)$/, (route) => {
+ decisions.push(new URL(route.request().url()).pathname.split("/").pop()!);
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true }),
+ });
+ });
+ await page.route(/\/v1\/remote\/device\/[^/]+$/, (route) => {
+ const code = new URL(route.request().url()).pathname.split("/").pop();
+ if (code === "WXYZ-2345")
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ user_code: "WXYZ-2345",
+ name: "auth-vm",
+ fingerprint: "deadbeef00112233",
+ expires_at: Date.now() / 1000 + 600,
+ }),
+ });
+ return route.fulfill({
+ status: 404,
+ contentType: "application/json",
+ body: JSON.stringify({ error: "unknown or expired code" }),
+ });
+ });
+ await openMachines(page);
+ await page.getByTestId("approve-machine-button").click();
+
+ // Unknown code: a dead end, never a grant.
+ await page.getByTestId("approval-code-input").fill("AAAA-0000");
+ await page.keyboard.press("Enter");
+ await expect(page.getByTestId("approval-unknown")).toBeVisible();
+
+ // Lowercase input is normalized; the claim (name + fingerprint) shows first.
+ await page.getByTestId("approval-code-input").fill("wxyz-2345");
+ await page.keyboard.press("Enter");
+ await expect(page.getByText("auth-vm")).toBeVisible();
+ await expect(page.getByTestId("approval-fingerprint")).toContainText("deadbeef00112233");
+
+ await page.getByTestId("approve-button").click();
+ await expect(page.getByTestId("approval-result")).toContainText("Approved");
+ expect(decisions).toEqual(["approve"]);
+});
+
+test("approval deep link: #/approve/CODE lands on the card with the claim shown", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route(/\/v1\/remote\/device\/[^/]+$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ user_code: "WXYZ-2345",
+ name: "deep-vm",
+ fingerprint: "0123456789abcdef",
+ expires_at: Date.now() / 1000 + 600,
+ }),
+ }),
+ );
+ await page.goto("/#/approve/WXYZ-2345");
+ // No clicks: the deep link opens Settings ▸ Machines with the lookup done.
+ await expect(page.getByTestId("approval-fingerprint")).toContainText("0123456789abcdef", {
+ timeout: 10000,
+ });
+ await expect(page.getByText("deep-vm")).toBeVisible();
+});
+
+test("settings shell (UX-046): scoped rail, machine picker, machine-scoped Models & Keys", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/settings$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ model: "ollama:qwen3-coder:30b",
+ models: ["ollama:qwen3-coder:30b", "anthropic:claude-sonnet-4-6"],
+ model_labels: {},
+ model_context_windows: {},
+ model_ready: true,
+ }),
+ }),
+ );
+ await page.goto("/");
+ await page.getByTestId("account-row").click();
+ await page.getByRole("button", { name: "Settings", exact: true }).click();
+
+ // Grouped rail with the picker on the MACHINE header, defaulting to This Mac.
+ await expect(page.getByText("Inventory", { exact: true })).toBeVisible();
+ const picker = page.getByTestId("machine-scope-picker");
+ await expect(picker).toHaveValue("");
+
+ // Models & Keys on This Mac = the local providers page.
+ await page.getByRole("button", { name: "Models & Keys" }).click();
+ await expect(page.getByText("Keys are stored only on this computer")).toBeVisible();
+
+ // Pick the machine: the panel flips to the machine's own report + ledger.
+ await picker.selectOption("m1");
+ await expect(page.getByTestId("machine-models-panel")).toBeVisible();
+ await expect(page.getByTestId("active-ollama")).toContainText("qwen3-coder:30b");
+ await expect(page.getByTestId("active-anthropic")).toContainText("claude-sonnet-4-6");
+ await expect(page.getByText(/Send a key to this machine/i)).toBeVisible();
+
+ // Skills under the machine scope: the list comes THROUGH THE PROXY — a
+ // remote-only skill proves which backend answered.
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/skills$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ skills: [
+ {
+ name: "remote-only-skill",
+ description: "Lives on the box",
+ instructions: "x",
+ scope: "global",
+ source: "local",
+ enabled: true,
+ path: "/home/ow/.skills/remote-only-skill",
+ },
+ ],
+ }),
+ }),
+ );
+ await page.getByRole("button", { name: "Skills", exact: true }).click();
+ await expect(page.getByText("remote-only-skill")).toBeVisible();
+ await expect(page.getByText(/On ⌂ hetzner-box — reusable instructions/)).toBeVisible();
+
+ // Coworkers under the machine scope: same proxy proof, and the detail page
+ // opens scoped (no local-export affordance for a remote coworker).
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/personas$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ internal: false,
+ personas: [
+ {
+ id: "remote-cw",
+ name: "Remote Coworker",
+ icon: "wrench",
+ tagline: "Only on the box",
+ requires_folder: false,
+ builtin: false,
+ tools: ["files"],
+ enabled: true,
+ surfaced: true,
+ default: false,
+ ships: true,
+ group: "general",
+ },
+ ],
+ }),
+ }),
+ );
+ await page.getByRole("button", { name: "Coworkers", exact: true }).click();
+ await expect(page.getByText("Remote Coworker")).toBeVisible();
+
+ // Context optimization reads THE MACHINE's settings (the same proxied
+ // settings route registered above answers).
+ await page.getByRole("button", { name: "Context optimization" }).click();
+ await expect(page.getByText("On ⌂ hetzner-box — how its sessions spend tokens.")).toBeVisible();
+ await expect(page.getByTestId("token-savings-card")).toBeVisible();
+
+ // Memory is VIEW-ONLY on a machine: entries render, no edit/delete, and the
+ // CTA starts a conversation ON the machine — the edit surface.
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/memory$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ memory: [{ id: 7, content: "Remote fact: deploys happen on Fridays" }] }),
+ }),
+ );
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/memory\/settings$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ enabled: true, user_rules: "Remote rules" }),
+ }),
+ );
+ await page.getByRole("button", { name: "Memory", exact: true }).click();
+ await expect(page.getByTestId("memory-remote-cta")).toBeVisible();
+ await expect(page.getByText("Remote fact: deploys happen on Fridays")).toBeVisible();
+ await expect(page.getByTestId("memory-edit-btn-7")).toHaveCount(0);
+ await expect(page.getByTestId("memory-delete-all")).toHaveCount(0);
+ await page.getByTestId("memory-ask-worker").click();
+ await expect(page.getByPlaceholder(/Ask the coworker/)).toHaveValue(/Update your memory/);
+ await expect(page.getByTestId("runson-chip")).toContainText("hetzner-box");
+});
+
+// -- managed sandboxes (spec §Fly sandboxes, 2026-09-02) -----------------------
+
+test("cloud mode: New sandbox creates, the row walks provisioning → joining → online, at-cap disables", async ({
+ page,
+}) => {
+ await seedMachines(page, []);
+ await forceCloudMode(page);
+ const state: { sandboxes: any[]; cap: number; used: number } = { sandboxes: [], cap: 1, used: 0 };
+ const machines: any[] = [];
+ await page.route("**/v1/sandboxes", async (route) => {
+ if (route.request().method() === "POST") {
+ state.sandboxes = [
+ { id: "sb-1", name: "sandbox-1", owner: "[email protected]", mine: true, state: "provisioning", phase: "provisioning", error: "", machine_id: "", connected: false, created_at: 1, updated_at: 1 },
+ ];
+ state.used = 1;
+ return route.fulfill({ status: 202, contentType: "application/json", body: JSON.stringify({ sandbox: state.sandboxes[0], cap: 1, used: 1 }) });
+ }
+ return route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify(state) });
+ });
+ await page.route("**/v1/machines", (route) =>
+ route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ machines, armed: false }) }),
+ );
+ await openMachines(page);
+
+ const button = page.getByTestId("new-sandbox-button");
+ await expect(button).toHaveText(/New sandbox \(0 of 1\)/);
+ await button.click();
+ await expect(page.getByTestId("sandbox-phase-sandbox-1")).toContainText("creating the machine");
+ await expect(button).toHaveText(/\(1 of 1\)/);
+ await expect(button).toBeDisabled();
+
+ // Fly machine started, box booting.
+ state.sandboxes[0] = { ...state.sandboxes[0], state: "running", phase: "joining" };
+ await expect(page.getByTestId("sandbox-phase-sandbox-1")).toContainText("starting up", { timeout: 10000 });
+
+ // The box joined: the pending row becomes a machine row with the tag.
+ state.sandboxes[0] = { ...state.sandboxes[0], phase: "online", machine_id: "m9", connected: true };
+ machines.push({ id: "m9", name: "sandbox-1", fingerprint: "abcdefabcdef0000", app_version: "0.2.0", created_at: 2, last_seen: 2, connected: true, provenance: "fly", provenance_ref: "sb-1" });
+ await expect(page.getByTestId("machine-sandbox-1")).toBeVisible({ timeout: 10000 });
+ await expect(page.getByTestId("sandbox-tag-sandbox-1")).toBeVisible();
+ await expect(page.getByTestId("sandbox-phase-sandbox-1")).toHaveCount(0);
+ // The Settings rail's machine picker learns about it without a reload.
+ await expect(page.getByRole("combobox")).toContainText("sandbox-1", { timeout: 10000 });
+});
+
+test("a keyless machine shows no active model — its default is not reported as working", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/settings$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ model: "gpt-5.6-sol",
+ models: ["gpt-5.6-sol"], // the box keeps its default selectable…
+ model_labels: {},
+ model_context_windows: {},
+ model_ready: false, // …but nothing can run it yet
+ }),
+ }),
+ );
+ await openMachines(page);
+ await page.getByTestId("machine-scope-picker").selectOption("m1");
+ await page.getByRole("button", { name: "Models & Keys" }).click();
+ await expect(page.getByTestId("machine-models-panel")).toBeVisible();
+ await expect(page.getByText("No working models yet — send a key below.")).toBeVisible();
+ await expect(page.getByTestId("active-openai")).toHaveCount(0);
+});
+
+// -- cloud-dashboard connect-direct (spec, 2026-09-02) --------------------------
+
+test("cloud mode: Connect in browser on a machine's connector seals the broker's result to the machine", async ({
+ page,
+}) => {
+ const SEAL_PUB = Buffer.from(new Uint8Array(32).fill(1)).toString("base64");
+ await seedMachines(page, [{ ...HETZNER, seal_pubkey: SEAL_PUB, seal_fingerprint: "0101010101010101" }]);
+ await page.route("**/v1/capabilities", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ mode: "cloud", machines: true, wallet: false, cloud: { base: "https://broker.test" } }),
+ }),
+ );
+ const notion = {
+ name: "notion", title: "Notion", icon: "notion", blurb: "", auth: "oauth", two_way: false, channels: false,
+ available: true, fields: [], instructions: [], connected: false, account: null, enabled: false,
+ brand_color: "#000", logo: "", allowed_users: [], tools: [], managed: true, managed_profile: false,
+ };
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/connectors$/, (route) =>
+ route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ connectors: [notion] }) }),
+ );
+ const starts: any[] = [];
+ await page.route("https://broker.test/v1/oauth/notion/start", async (route) => {
+ starts.push({ body: route.request().postDataJSON(), auth: route.request().headers()["authorization"] });
+ await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ authorize_url: "https://notion.test/authorize?state=x" }) });
+ });
+ const relays: any[] = [];
+ await page.route(/\/v1\/machines\/m1\/connectors\/notion\/managed-grant-sealed$/, async (route) => {
+ relays.push(route.request().postDataJSON());
+ await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, account: "Acme" }) });
+ });
+ // The popup: a stub that records the URL it was pointed at. The hosted dashboard holds
+ // a session token (the broker call is authorised with it); the test supplies its own
+ // rather than leaning on a dev token file that only exists on a developer's machine.
+ await page.addInitScript(() => {
+ (globalThis as any).__COWORKER_API_TOKEN__ = "e2e-session-token";
+ (window as any).__popup = { location: { href: "" }, close() {} };
+ window.open = () => (window as any).__popup as any;
+ });
+
+ await page.goto("/");
+ await page.getByTestId("account-row").click();
+ await page.getByRole("button", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Connectors", exact: true }).click();
+ await page.getByTestId("machine-scope-picker").selectOption("m1");
+ const button = page.getByTestId("remote-connect-browser-notion");
+ await expect(button).toBeVisible();
+ await button.click();
+ await expect.poll(() => starts.length).toBe(1);
+ expect(starts[0].body).toMatchObject({ connector: "notion", mode: "browser", machine_id: "m1", seal_pubkey: SEAL_PUB });
+ expect(starts[0].body.redirect).toBe(new URL(page.url()).origin);
+ await expect.poll(() => page.evaluate(() => (window as any).__popup.location.href)).toBe("https://notion.test/authorize?state=x");
+ await expect(button).toContainText("Waiting for browser");
+
+ // A message from the WRONG origin is ignored…
+ await page.evaluate(() => {
+ window.dispatchEvent(new MessageEvent("message", { origin: "https://evil.test", data: { type: "openworker-managed-grant", connector: "notion", access_token: "x" } }));
+ });
+ await page.waitForTimeout(300);
+ expect(relays.length).toBe(0);
+ // …the broker's is sealed to the machine and relayed as ciphertext only.
+ await page.evaluate(() => {
+ window.dispatchEvent(new MessageEvent("message", {
+ origin: "https://broker.test",
+ data: { type: "openworker-managed-grant", provider: "notion", connector: "notion", connection_id: "conn_1", access_token: "SECRET-TOKEN", account: "Acme", account_id: "ws_1", machine_credential: "mc_1", broker_user_id: "usr_1", machine_id: "m1" },
+ }));
+ });
+ await expect.poll(() => relays.length).toBe(1);
+ expect(typeof relays[0].sealed_b64).toBe("string");
+ expect(JSON.stringify(relays[0])).not.toContain("SECRET-TOKEN");
+ await expect(button).toContainText("Connect in browser");
+});
diff --git a/surfaces/gui/e2e/persona-models.spec.ts b/surfaces/gui/e2e/persona-models.spec.ts
new file mode 100644
index 00000000..85f0e422
--- /dev/null
+++ b/surfaces/gui/e2e/persona-models.spec.ts
@@ -0,0 +1,30 @@
+import { test, expect } from "./fixtures";
+
+async function newDraftAs(page: import("@playwright/test").Page, coworker: RegExp) {
+ await page.getByText("New session").first().click();
+ await page.getByTestId("coworker-chip").click();
+ await page.locator(".setup-menu").getByRole("button", { name: coworker }).click();
+}
+
+// Models per coworker (connectors-across-machines spec §4): a coworker's `models:` list
+// restricts the composer picker to the list, marks entries this machine cannot run, and
+// binds a fresh draft to the first runnable entry. A coworker without a list keeps the
+// machine's full selectable list.
+test("a coworker's models list restricts the picker and binds the draft", async ({ page }) => {
+ await page.goto("/");
+ await newDraftAs(page, /Security Coworker/);
+
+ // Bound to the first runnable entry of the list.
+ const picker = page.locator(".dd").filter({ hasText: "Claude Opus 4.8" });
+ await expect(picker).toBeVisible();
+ await picker.locator(".pill").click();
+ const items = page.locator(".dd-item");
+ await expect(items).toHaveCount(2);
+ await expect(items.filter({ hasText: "qwen3-coder:30b" })).toContainText(
+ "Not available on this machine",
+ );
+ // The machine's other models (GPT-5.5 is on /v1/settings) are not offered here.
+ await expect(items.filter({ hasText: "GPT-5.5" })).toHaveCount(0);
+ await page.locator(".dd-backdrop").click();
+ // (A coworker without a list keeps the machine's full list — model-switch.spec covers it.)
+});
diff --git a/surfaces/gui/e2e/persona-surfacing.spec.ts b/surfaces/gui/e2e/persona-surfacing.spec.ts
index 1d79475c..c32f7aad 100644
--- a/surfaces/gui/e2e/persona-surfacing.spec.ts
+++ b/surfaces/gui/e2e/persona-surfacing.spec.ts
@@ -31,6 +31,8 @@ test("enabling an installed persona surfaces it in picker + sidebar without relo
await expect(enabled).toBeChecked();
// No reload: the sidebar group and the picker both pick it up via PERSONAS_CHANGED.
+ // (Settings owns the left column while open — leave it to see the session list.)
+ await page.getByTestId("settings-back").click();
await expect(sidebar.getByText("Acme Notes")).toBeVisible();
await page.getByText("New session").first().click();
await page.getByTestId("coworker-chip").click();
@@ -70,6 +72,7 @@ test("disabling a persona with conversations asks first, then archives them", as
await enabled.click();
await page.getByTestId("persona-disable-confirm-ops").click();
await expect(enabled).not.toBeChecked();
+ await page.getByTestId("settings-back").click();
await expect(sidebar.getByText("Ops", { exact: true })).toHaveCount(0);
});
diff --git a/surfaces/gui/e2e/provider-keys.spec.ts b/surfaces/gui/e2e/provider-keys.spec.ts
index 3b8c528e..9dc451aa 100644
--- a/surfaces/gui/e2e/provider-keys.spec.ts
+++ b/surfaces/gui/e2e/provider-keys.spec.ts
@@ -10,7 +10,7 @@ async function openModels(page) {
await page.goto("/");
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Settings", exact: true }).click();
- await page.getByRole("button", { name: "Models", exact: true }).click();
+ await page.getByRole("button", { name: "Models & Keys" }).click();
await expect(page.getByTestId("set-provider-openai")).toBeVisible();
}
diff --git a/surfaces/gui/e2e/remote-connectors.spec.ts b/surfaces/gui/e2e/remote-connectors.spec.ts
new file mode 100644
index 00000000..8645b5f5
--- /dev/null
+++ b/surfaces/gui/e2e/remote-connectors.spec.ts
@@ -0,0 +1,337 @@
+import { test, expect, seedMachines } from "./fixtures";
+
+// Settings ▸ Connectors under a machine scope: the machine's own connector
+// list via the proxy, sealed manual connect (fields encrypted in-tab to the
+// machine's pinned key — the wire carries ciphertext only), and honest tags
+// on connectors that need a browser sign-in.
+
+const SEAL_PUB = "pbEWq+ooNkz0sfoIeaDCE/O+xvH+RD83HTD8rHTxSg4=";
+
+const HETZNER = {
+ id: "m1",
+ name: "hetzner-box",
+ fingerprint: "8aaaac6fdc97e081",
+ app_version: "0.2.0",
+ created_at: 1_755_000_000,
+ last_seen: 1_755_000_000,
+ connected: true,
+ seal_pubkey: SEAL_PUB,
+ seal_fingerprint: "8662e3d8968dca74",
+};
+
+const REMOTE_CONNECTORS = [
+ {
+ name: "linear",
+ title: "Linear",
+ icon: "◆",
+ blurb: "Issues and projects",
+ auth: "api_token",
+ two_way: false,
+ channels: false,
+ available: true,
+ fields: [
+ {
+ key: "api_key",
+ label: "API key",
+ secret: true,
+ required: true,
+ help: "",
+ placeholder: "lin_api_…",
+ },
+ ],
+ instructions: [],
+ connected: false,
+ account: null,
+ enabled: true,
+ brand_color: "#5E6AD2",
+ logo: "linear",
+ allowed_users: [],
+ tools: [],
+ managed: false,
+ },
+ {
+ name: "gmail",
+ title: "Gmail",
+ icon: "✉",
+ blurb: "Email",
+ auth: "oauth",
+ two_way: true,
+ channels: false,
+ available: true,
+ fields: [],
+ instructions: [],
+ connected: false,
+ account: null,
+ enabled: true,
+ brand_color: "#EA4335",
+ logo: "gmail",
+ allowed_users: [],
+ tools: [],
+ managed: true,
+ },
+ {
+ name: "google_calendar",
+ title: "Google Calendar",
+ icon: "▤",
+ blurb: "Events",
+ auth: "oauth",
+ two_way: false,
+ channels: false,
+ available: true,
+ fields: [],
+ instructions: [],
+ connected: false,
+ account: null,
+ enabled: true,
+ brand_color: "#4285F4",
+ logo: "google_calendar",
+ allowed_users: [],
+ tools: [],
+ managed: true,
+ managed_paused: true,
+ },
+ {
+ name: "slack",
+ title: "Slack",
+ icon: "▣",
+ blurb: "Messages",
+ auth: "api_token",
+ two_way: true,
+ channels: true,
+ available: true,
+ fields: [],
+ instructions: [],
+ connected: true,
+ account: "quillvoice.slack.com",
+ enabled: true,
+ brand_color: "#611f69",
+ logo: "slack",
+ allowed_users: [],
+ tools: [
+ {
+ name: "slack_send",
+ label: "Send messages",
+ kind: "write",
+ description: "Post to channels",
+ enabled: true,
+ requires_approval: true,
+ },
+ ],
+ managed: false,
+ },
+];
+
+test("machine scope: the machine's own connectors, sealed connect, honest OAuth tag", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/connectors$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ connectors: REMOTE_CONNECTORS }),
+ }),
+ );
+ let sealedBody = "";
+ await page.route("**/v1/machines/m1/connectors/linear/connect-sealed", (route) => {
+ sealedBody = route.request().postData() ?? "";
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true, account: "[email protected]" }),
+ });
+ });
+ await page.goto("/#/settings/connectors?m=m1");
+
+ // The machine's list: connected Slack with its account, available Linear.
+ const slack = page.getByTestId("remote-connector-slack");
+ await expect(slack).toContainText("quillvoice.slack.com");
+ await expect(page.getByTestId("remote-available-linear")).toBeVisible();
+
+ // Managed Gmail: connect-direct-to-machine — OAuth runs in this browser,
+ // the grant lands on the machine (machines spec §Remote OAuth).
+ const gmail = page.getByTestId("remote-available-gmail");
+ await expect(gmail.getByTestId("remote-connect-browser-gmail")).toBeVisible();
+ // A paused managed connector still gets the honest tag, not a dead button.
+ const gcal = page.getByTestId("remote-available-google_calendar");
+ await expect(gcal).toContainText("browser sign-in");
+ await expect(gcal.getByRole("button", { name: /Connect/ })).toHaveCount(0);
+
+ // Manual connect: the field seals in-tab; the wire never sees the token.
+ await page.getByTestId("remote-connect-linear").click();
+ await page.locator('input[type="password"]').fill("lin_api_SECRETVALUE");
+ await page.getByTestId("remote-connect-submit-linear").click();
+ await expect.poll(() => sealedBody).toContain("sealed_b64");
+ expect(sealedBody).not.toContain("lin_api_SECRETVALUE");
+});
+
+test("This-Mac scope keeps the full Connectors page; account menu lands here", async ({
+ page,
+}) => {
+ await page.goto("/");
+ await page.getByTestId("account-row").click();
+ await page.getByRole("button", { name: "Connectors" }).click();
+ // Settings shell, Connectors page selected, the familiar full list.
+ await expect(page).toHaveURL(/#\/settings\/connectors$/);
+ await expect(
+ page.getByRole("heading", { name: "Connectors", exact: true }),
+ ).toBeVisible();
+});
+
+test("grant handoff: Move from This Mac deploys sealed names, then This Mac forgets", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ // The machine doesn't have Notion; This Mac does (fixture's default local
+ // list is overridden so notion shows connected locally).
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/connectors$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ connectors: [
+ {
+ ...REMOTE_CONNECTORS[1],
+ name: "notion",
+ title: "Notion",
+ managed: true,
+ },
+ ],
+ }),
+ }),
+ );
+ await page.route(/^https?:\/\/[^/]+\/v1\/connectors$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ connectors: [
+ { ...REMOTE_CONNECTORS[1], name: "notion", title: "Notion", connected: true },
+ ],
+ }),
+ }),
+ );
+ await page.route("**/v1/connectors/notion/handoff-info", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ ok: true,
+ portable: true,
+ profiles: ["notion:account:42", "notion:default"],
+ needs_delegation: true,
+ }),
+ }),
+ );
+ let delegated = false;
+ let delegateBody = "";
+ await page.route("**/v1/connectors/notion/delegate", (route) => {
+ delegated = true;
+ delegateBody = route.request().postData() ?? "";
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true, delegated: ["notion:account:42"] }),
+ });
+ });
+ let deployed = "";
+ await page.route("**/v1/machines/m1/secrets", (route) => {
+ deployed = route.request().postData() ?? "";
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true, deployed: ["notion:account:42", "notion:default"] }),
+ });
+ });
+ let forgot = false;
+ await page.route("**/v1/connectors/notion/forget-local", (route) => {
+ forgot = true;
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true }),
+ });
+ });
+ page.on("dialog", (d) => d.accept());
+ await page.goto("/#/settings/connectors?m=m1");
+
+ await page.getByTestId("remote-move-notion").click();
+ await expect.poll(() => delegated).toBe(true); // broker delegation precedes the move
+ // The machine's seal key rides the delegation — the broker mints the
+ // machine credential against it (managed events).
+ expect(delegateBody).toContain(SEAL_PUB);
+ await expect.poll(() => deployed).toContain("notion:account:42");
+ await expect.poll(() => forgot).toBe(true); // local-only forget — never broker disconnect
+
+});
+
+test("grant handoff: a managed grant explains the refresh gate instead of moving", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/connectors$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ connectors: [{ ...REMOTE_CONNECTORS[1], name: "gmail", title: "Gmail" }],
+ }),
+ }),
+ );
+ await page.route(/^https?:\/\/[^/]+\/v1\/connectors$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ connectors: [
+ { ...REMOTE_CONNECTORS[1], name: "gmail", title: "Gmail", connected: true },
+ ],
+ }),
+ }),
+ );
+ await page.route("**/v1/connectors/gmail/handoff-info", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true, portable: false, reason: "refresh_binding", profiles: [] }),
+ }),
+ );
+ await page.goto("/#/settings/connectors?m=m1");
+
+ await page.getByTestId("remote-move-gmail").click();
+ await expect(
+ page.getByText(/renews its sign-in through OpenWorker Cloud/),
+ ).toBeVisible();
+});
+
+test("connect-direct: the browser flow starts with the machine as target", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route(/\/v1\/machines\/m1\/p\/v1\/connectors$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ connectors: REMOTE_CONNECTORS }),
+ }),
+ );
+ let startBody = "";
+ await page.route("**/v1/connectors/gmail/connect-managed", (route) => {
+ startBody = route.request().postData() ?? "";
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true, authorize_url: "https://example.test/consent" }),
+ });
+ });
+ await page.goto("/#/settings/connectors?m=m1");
+
+ await page.getByTestId("remote-connect-browser-gmail").click();
+ // The sidecar is told WHICH machine the grant is for — the callback ships
+ // it there and stores nothing locally.
+ await expect.poll(() => startBody).toContain('"machine_id":"m1"');
+ expect(startBody).toContain('"machine_name":"hetzner-box"');
+ await expect(page.getByTestId("remote-available-gmail")).toContainText(
+ "land on ⌂ hetzner-box",
+ );
+});
diff --git a/surfaces/gui/e2e/session-reconnect.spec.ts b/surfaces/gui/e2e/session-reconnect.spec.ts
new file mode 100644
index 00000000..36ff50ea
--- /dev/null
+++ b/surfaces/gui/e2e/session-reconnect.spec.ts
@@ -0,0 +1,30 @@
+// Machines hardening (c), 2026-09-02: a dropped session socket shows a reconnecting
+// state and the client re-opens the socket by itself (ledger 2026-09-01: the v14 ECS
+// rollover blanked the bridged view until the user navigated away).
+import { expect } from "@playwright/test";
+import { test } from "./fixtures";
+
+test("a dropped session socket shows Reconnecting and recovers without navigation", async ({
+ page,
+}) => {
+ await page.goto("/");
+ await page.getByText("Draft the launch note").first().click();
+ const box = page.getByPlaceholder(/Ask the coworker/);
+ await expect(box).toBeVisible();
+
+ await box.fill("drop the socket");
+ await box.press("Enter");
+
+ // The link is gone: the strip appears and the send path is disabled…
+ const strip = page.getByTestId("session-reconnecting");
+ await expect(strip).toBeVisible({ timeout: 10_000 });
+ await expect(strip).toContainText(/Reconnecting/);
+
+ // …then the client reconnects on its own (1s first retry) and the strip clears.
+ await expect(strip).toHaveCount(0, { timeout: 10_000 });
+
+ // And the session still works on the new socket.
+ await box.fill("hello again");
+ await box.press("Enter");
+ await expect(page.getByText("Echo: hello again").first()).toBeVisible({ timeout: 10_000 });
+});
diff --git a/surfaces/gui/e2e/session-shell.spec.ts b/surfaces/gui/e2e/session-shell.spec.ts
index 0e918f06..a508893b 100644
--- a/surfaces/gui/e2e/session-shell.spec.ts
+++ b/surfaces/gui/e2e/session-shell.spec.ts
@@ -33,14 +33,16 @@ test("top-left cluster renders only while the sidebar is collapsed", async ({ pa
await expect(page.getByTestId("topbar-cluster")).toHaveCount(0);
});
-test("facts subtitle: absent on a fresh session, coworker + model after the first turn, inert", async ({
+test("session facts: none on a fresh session, coworker + model in the title tooltip after the first turn", async ({
page,
}) => {
await page.goto("/");
- // Fresh-ish (boot-resumed, no rendered history): no subtitle, no old About-persona button —
+ // Fresh-ish (boot-resumed, no rendered history): no facts line (UX-048: the header is the
+ // title alone; facts ride its tooltip once there is history), no old About-persona button —
// and the model is a live PICKER in the composer (fresh sessions choose; nothing is locked yet).
await expect(page.getByTestId("session-subtitle")).toHaveCount(0);
+ await expect(page.getByTestId("session-title")).not.toHaveAttribute("title", /·/);
await expect(page.getByRole("button", { name: "About this persona" })).toHaveCount(0);
await expect(page.locator(".dd").filter({ hasText: "Claude Opus 4.8" })).toBeVisible();
@@ -51,12 +53,13 @@ test("facts subtitle: absent on a fresh session, coworker + model after the firs
await page.getByRole("button", { name: "Send" }).click();
await expect(page.getByText(/Echo: hello/)).toBeVisible();
- // Coworker + model (UX-029 restored the coworker name — the picker shipped), and the
- // subtitle is a plain fact line, not a button to the persona page.
- const sub = page.getByTestId("session-subtitle");
- await expect(sub).toHaveText("Coworker · Claude Opus 4.8");
+ // Coworker + model in the tooltip (UX-029 restored the coworker name — the picker shipped);
+ // the title is a plain fact, not a button to the persona page.
+ const ttl = page.getByTestId("session-title");
+ await expect(ttl).toHaveAttribute("title", /Coworker · Claude Opus 4.8/);
+ await expect(page.getByTestId("session-subtitle")).toHaveCount(0);
await expect(page.locator(".dd").filter({ hasText: "Claude Opus 4.8" })).toBeVisible();
- await sub.click();
+ await ttl.click();
await expect(page.getByRole("button", { name: "Back", exact: true })).toHaveCount(0);
});
diff --git a/surfaces/gui/e2e/settings-routes.spec.ts b/surfaces/gui/e2e/settings-routes.spec.ts
new file mode 100644
index 00000000..09bcf26c
--- /dev/null
+++ b/surfaces/gui/e2e/settings-routes.spec.ts
@@ -0,0 +1,133 @@
+import { test, expect, seedMachines } from "./fixtures";
+
+// Settings URL routes + the Account page (UX-046 tail, 2026-08-30):
+// #/settings/{page} deep links open Settings on that page, tab browsing keeps
+// the URL current (replaceState — no history pileup), and ?m= carries the
+// machine scope for machine-scoped pages. The Account page is the APP-group
+// home for identity: OpenWorker Cloud sign-in on desktop, the Auth0 identity
+// + org switcher on the hosted dashboard (moved off the Machines page).
+
+const HETZNER = {
+ id: "m1",
+ name: "hetzner-box",
+ fingerprint: "8aaaac6fdc97e081",
+ app_version: "0.2.0",
+ created_at: 1_755_000_000,
+ last_seen: 1_755_000_000,
+ connected: true,
+};
+
+test("deep link #/settings/skills opens that page; tab clicks ride the URL", async ({
+ page,
+}) => {
+ await page.goto("/#/settings/skills");
+ await expect(page.getByRole("heading", { name: "Skills" })).toBeVisible();
+ await expect(page).toHaveURL(/#\/settings\/skills$/);
+
+ // Browsing to another page rewrites the hash — bookmarks always name the open page.
+ await page.getByRole("button", { name: "General", exact: true }).click();
+ await expect(page.getByRole("heading", { name: "General" })).toBeVisible();
+ await expect(page).toHaveURL(/#\/settings\/general$/);
+});
+
+test("?m= deep-links a machine scope; the picker adopts it and the URL keeps it", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.goto("/#/settings/models?m=m1");
+ await expect(page.getByTestId("machine-models-panel")).toBeVisible();
+ await expect(page.getByTestId("machine-scope-picker")).toHaveValue("m1");
+ await expect(page).toHaveURL(/#\/settings\/models\?m=m1$/);
+
+ // App-scope pages carry no machine scope — the param drops off.
+ await page.getByRole("button", { name: "General", exact: true }).click();
+ await expect(page).toHaveURL(/#\/settings\/general$/);
+});
+
+test("leaving Settings hands the URL back to the session route", async ({ page }) => {
+ await page.goto("/#/settings/general");
+ await expect(page.getByRole("heading", { name: "General" })).toBeVisible();
+ // Settings owns the left column while open (the session sidebar is not mounted);
+ // "Back to app" on the rail is the way out.
+ await expect(page.getByTestId("settings-rail")).toBeVisible();
+ await expect(page.getByRole("button", { name: "New session" })).toHaveCount(0);
+ await page.getByTestId("settings-back").click();
+ await expect(page).toHaveURL(/#\/s\/[\w-]+$/);
+ await expect(page.getByRole("button", { name: "New session" })).toBeVisible();
+});
+
+test("Account page (desktop): sign in lands the identity; sign out returns the button", async ({
+ page,
+}) => {
+ await page.goto("/#/settings/account");
+ const card = page.getByTestId("cloud-signin-card");
+ await expect(card).toBeVisible();
+
+ // The fixture's /v1/cloud/login flips state instantly; the page polls it in.
+ await card.getByTestId("account-page-sign-in").click();
+ await expect(card.getByText("[email protected]")).toBeVisible({ timeout: 10000 });
+
+ await card.getByRole("button", { name: "Sign out" }).click();
+ await expect(card.getByTestId("account-page-sign-in")).toBeVisible();
+});
+
+test("Account page (cloud): identity and org name (display only), no desktop sign-in card", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route("**/v1/capabilities", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ mode: "cloud" }),
+ }),
+ );
+ // One login, one org: /v1/me offers exactly the resolved org — the page
+ // shows its name and offers no way to switch.
+ await page.route("**/v1/me", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ actor: "[email protected]",
+ email: "[email protected]",
+ org_id: "org:deeplearning-ai",
+ admin: false,
+ orgs: [{ id: "org:deeplearning-ai", name: "DeepLearning AI", role: "admin" }],
+ policies: { key_push: true },
+ }),
+ }),
+ );
+ await page.goto("/#/settings/account");
+
+ const account = page.getByTestId("cloud-account-card");
+ await expect(account.getByText("[email protected]")).toBeVisible();
+ await expect(account.getByTestId("org-name")).toHaveText("DeepLearning AI");
+ await expect(account.locator("select")).toHaveCount(0);
+ await expect(page.getByTestId("cloud-signin-card")).toHaveCount(0);
+});
+
+test("a spent approval deep link leaves the URL on Settings ▸ Machines", async ({
+ page,
+}) => {
+ await seedMachines(page, [HETZNER]);
+ await page.route(/\/v1\/remote\/device\/[^/]+$/, (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ user_code: "WXYZ-2345",
+ name: "deep-vm",
+ fingerprint: "0123456789abcdef",
+ expires_at: Date.now() / 1000 + 600,
+ }),
+ }),
+ );
+ await page.goto("/#/approve/WXYZ-2345");
+ await expect(page.getByTestId("approval-fingerprint")).toContainText("0123456789abcdef", {
+ timeout: 10000,
+ });
+ // The code was consumed on landing — a refresh must not replay a decided
+ // approval, so the URL has already moved to the page itself.
+ await expect(page).toHaveURL(/#\/settings\/machines$/);
+});
diff --git a/surfaces/gui/e2e/settings.spec.ts b/surfaces/gui/e2e/settings.spec.ts
index 2c77c59f..c5d060cd 100644
--- a/surfaces/gui/e2e/settings.spec.ts
+++ b/surfaces/gui/e2e/settings.spec.ts
@@ -12,7 +12,7 @@ test("Settings opens as a full page and navigates sections", async ({ page }) =>
// Full-page: left sub-nav + the General section (no modal backdrop).
await expect(page.getByRole("heading", { name: "General" })).toBeVisible();
await expect(page.locator(".modal-backdrop")).toHaveCount(0);
- for (const label of ["General", "Models", "Voice input"]) {
+ for (const label of ["General", "Models & Keys", "Voice input"]) {
await expect(page.getByRole("button", { name: label, exact: true })).toBeVisible();
}
// Folded tabs: Files is a General card now; Coworkers ships as its own tab (UX-029).
@@ -22,7 +22,7 @@ test("Settings opens as a full page and navigates sections", async ({ page }) =>
// The Files card lives inside General.
await expect(page.getByText("Each conversation gets its own folder")).toBeVisible();
- await page.getByRole("button", { name: "Models", exact: true }).click();
+ await page.getByRole("button", { name: "Models & Keys" }).click();
await expect(page.getByTestId("set-provider-openai")).toBeVisible();
});
@@ -51,7 +51,7 @@ test("Models: provider gallery states; vendor form previews models", async ({ pa
await page.goto("/");
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Settings", exact: true }).click();
- await page.getByRole("button", { name: "Models", exact: true }).click();
+ await page.getByRole("button", { name: "Models & Keys" }).click();
// Card states from the fixtures: openai configured+used, anthropic configured, zai not.
await expect(page.getByTestId("set-provider-openai")).toContainText("✓ Connected · used 2h ago");
@@ -83,7 +83,7 @@ test("Models: BytePlus and Volcengine Ark stay visually and operationally separa
await page.goto("/");
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Settings", exact: true }).click();
- await page.getByRole("button", { name: "Models", exact: true }).click();
+ await page.getByRole("button", { name: "Models & Keys" }).click();
const byteplusCard = page.getByTestId("set-provider-ark");
const volcengineCard = page.getByTestId("set-provider-ark-agent-plan-cn");
@@ -124,7 +124,7 @@ test("Models: Remove key reverts a configured provider", async ({ page }) => {
page.on("dialog", (d) => d.accept());
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Settings", exact: true }).click();
- await page.getByRole("button", { name: "Models", exact: true }).click();
+ await page.getByRole("button", { name: "Models & Keys" }).click();
await page.getByTestId("set-provider-anthropic").click();
await expect(page.getByTestId("set-saved-pill")).toContainText("Tested & saved");
diff --git a/surfaces/gui/e2e/skills-session.spec.ts b/surfaces/gui/e2e/skills-session.spec.ts
index 7ee928d4..aac4adea 100644
--- a/surfaces/gui/e2e/skills-session.spec.ts
+++ b/surfaces/gui/e2e/skills-session.spec.ts
@@ -30,6 +30,7 @@ test("skills-session: new skill offered in '/', disabled one absent", async ({ p
await expect(page.getByRole("status")).toContainText("turned off everywhere");
// Back in the session: the popup reflects the new state — created offered, disabled gone.
+ await page.getByTestId("settings-back").click(); // Settings owns the left column while open
await page.getByText("Draft the launch note").first().click();
await box.fill("/");
await expect(page.getByTestId("skill-popup")).toBeVisible();
diff --git a/surfaces/gui/e2e/slack-directory.spec.ts b/surfaces/gui/e2e/slack-directory.spec.ts
index 55d8295e..9ba2955c 100644
--- a/surfaces/gui/e2e/slack-directory.spec.ts
+++ b/surfaces/gui/e2e/slack-directory.spec.ts
@@ -9,6 +9,7 @@ async function openSlackPage(page) {
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Connectors", exact: true }).click();
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
}
test("people picker: type a name, pick it, chip lands with the display name", async ({
diff --git a/surfaces/gui/e2e/slack-health.spec.ts b/surfaces/gui/e2e/slack-health.spec.ts
index b86d0394..e19af13e 100644
--- a/surfaces/gui/e2e/slack-health.spec.ts
+++ b/surfaces/gui/e2e/slack-health.spec.ts
@@ -37,6 +37,7 @@ test("signed out: chip and status line say Sign-in needed", async ({ page }) =>
await openConnectors(page);
await expect(page.getByTestId("connector-slack")).toContainText("Sign-in needed");
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
await expect(page.getByTestId("slack-mode-badge")).toContainText(
"Sign-in needed — relaying is paused",
);
@@ -47,6 +48,7 @@ test("signed in + live socket: Live everywhere", async ({ page }) => {
await openConnectors(page);
await expect(page.getByTestId("connector-slack")).toContainText("Ready");
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
await expect(page.getByTestId("slack-mode-badge")).toContainText("Live · managed relay");
});
@@ -57,6 +59,7 @@ test("relay socket reconnecting: warn chip + status line", async ({ page }) => {
await openConnectors(page);
await expect(page.getByTestId("connector-slack")).toContainText("Reconnecting");
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
await expect(page.getByTestId("slack-mode-badge")).toContainText("Reconnecting to the relay");
});
@@ -67,6 +70,7 @@ test("relay unreachable: Offline, not a Slack-outage claim", async ({ page }) =>
await openConnectors(page);
await expect(page.getByTestId("connector-slack")).toContainText("Offline");
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
await expect(page.getByTestId("slack-mode-badge")).toContainText("can't reach the relay");
});
@@ -77,6 +81,7 @@ test("one dead bot token: ⚠ chip + a warning on THAT workspace only", async ({
await openConnectors(page);
await expect(page.getByTestId("connector-slack")).toContainText("Token");
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
await expect(page.getByTestId("token-warn-T2AC")).toContainText("Token revoked");
await expect(page.getByTestId("token-warn-T1DL")).toHaveCount(0);
});
diff --git a/surfaces/gui/e2e/slack-howitworks.spec.ts b/surfaces/gui/e2e/slack-howitworks.spec.ts
index 403aea2a..556adb63 100644
--- a/surfaces/gui/e2e/slack-howitworks.spec.ts
+++ b/surfaces/gui/e2e/slack-howitworks.spec.ts
@@ -9,6 +9,7 @@ async function openSlackPage(page) {
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Connectors", exact: true }).click();
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
}
test("post-connect card: personalized status line + the installer's 'you' chip", async ({
diff --git a/surfaces/gui/e2e/slack-workspaces.spec.ts b/surfaces/gui/e2e/slack-workspaces.spec.ts
index e06707dc..3b73c94e 100644
--- a/surfaces/gui/e2e/slack-workspaces.spec.ts
+++ b/surfaces/gui/e2e/slack-workspaces.spec.ts
@@ -10,6 +10,7 @@ async function openSlackPage(page) {
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Connectors", exact: true }).click();
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
}
test("lists every connected workspace as its own group", async ({ page }) => {
@@ -42,6 +43,7 @@ test("Add workspace opens the modal; signed out shows the sign-in hint, signed i
await page.getByTestId("account-sign-in").click();
await expect(page.getByTestId("account-row")).toContainText("Rohit", { timeout: 10_000 });
await page.getByTestId("connector-slack").click();
+ await page.getByTestId("manage-local-slack").click();
await page.getByTestId("add-workspace-btn").click();
await page.getByTestId("modal-add-to-slack").click();
// the mock completes the browser install instantly; the page's poll shows it
diff --git a/surfaces/gui/e2e/sources-channels.spec.ts b/surfaces/gui/e2e/sources-channels.spec.ts
index 1668913d..9892edce 100644
--- a/surfaces/gui/e2e/sources-channels.spec.ts
+++ b/surfaces/gui/e2e/sources-channels.spec.ts
@@ -98,3 +98,26 @@ test("channel add: link URLs resolve, bare #names are rejected with a hint", asy
await expect(page.getByText("slack:C0123ABC")).toBeVisible();
await expect(page.getByText(/Subscribed channels · 1/)).toBeVisible();
});
+
+// One session across all of the user's machines answers a source (connectors-across-machines
+// spec §3): a held channel names the holder and offers the move; nothing is stored until then.
+test("channel add: a held channel names its holder and moves on request", async ({ page }) => {
+ await page.goto("/");
+ await page.getByText("Draft the launch note").first().click();
+ await page.getByTestId("access-toggle").click();
+ await page.getByRole("button", { name: /Channels · 0/ }).click();
+
+ const input = page.getByPlaceholder("slack:C0123 or channel link");
+ await input.fill("slack:CHELD");
+ await page.getByRole("button", { name: "Add", exact: true }).click();
+ const held = page.getByTestId("channel-held");
+ await expect(held).toContainText("Release watcher");
+ await expect(held).toContainText("another machine");
+ await expect(page.getByTestId("channel-add-error")).toHaveCount(0);
+ await expect(page.getByText(/Subscribed channels · 1/)).toHaveCount(0);
+
+ await page.getByTestId("channel-move").click();
+ await expect(page.getByTestId("channel-held")).toHaveCount(0);
+ await expect(page.getByText("slack:CHELD", { exact: true })).toBeVisible();
+ await expect(page.getByText(/Subscribed channels · 1/)).toBeVisible();
+});
diff --git a/surfaces/gui/e2e/team.spec.ts b/surfaces/gui/e2e/team.spec.ts
index 2c6d406a..31cc8526 100644
--- a/surfaces/gui/e2e/team.spec.ts
+++ b/surfaces/gui/e2e/team.spec.ts
@@ -61,7 +61,7 @@ test("typing while a gate is pending sends the reply as feedback to the lead", a
await expect(page.getByTestId("teamreq-card")).toHaveCount(0);
});
-test("a board wake renders collapsed; expanding reveals rows, hand-offs stay one more click away", async ({
+test("a team update renders collapsed; expanded it groups by work item with note previews", async ({
page,
}) => {
await page.goto("/");
@@ -69,20 +69,22 @@ test("a board wake renders collapsed; expanding reveals rows, hand-offs stay one
await page.getByRole("button", { name: "Send" }).click();
const card = page.getByTestId("boardwake-card");
await expect(card).toBeVisible();
- await expect(card).toContainText("Board wake");
- await expect(card).toContainText("1 review, 1 filing");
+ await expect(card).toContainText("Team update");
+ // The summary says what needs action, in words — not a count per event type.
+ await expect(page.getByTestId("boardwake-summary")).toHaveText("#2 is ready for review · 1 more");
// collapsed by default: ambient awareness, not reading assignment
await expect(page.getByTestId("boardwake-body")).toHaveCount(0);
await expect(card).not.toContainText("029f9f7");
await page.getByTestId("boardwake-toggle").click();
const body = page.getByTestId("boardwake-body");
await expect(body).toBeVisible();
- await expect(body).toContainText("#2 Statements page → review by webb");
- await expect(body).toContainText("nia filed #5 Follow-up: rate limit");
- // the hand-off comment sits behind its own per-row toggle
- await expect(body).not.toContainText("029f9f7");
- await body.getByRole("button", { name: "show hand-off" }).click();
- await expect(body).toContainText("029f9f7");
+ const review = page.getByTestId("boardwake-group-2");
+ await expect(review).toContainText("#2 Statements page");
+ await expect(review).toContainText("Ready for review");
+ await expect(review).toContainText("webb handed it off for review");
+ // the hand-off note is previewed in place — no click per row
+ await expect(review).toContainText("029f9f7");
+ await expect(page.getByTestId("boardwake-group-5")).toContainText("nia filed it");
});
test("declining the split returns feedback to the lead", async ({ page }) => {
@@ -94,12 +96,12 @@ test("declining the split returns feedback to the lead", async ({ page }) => {
await expect(page.getByText(/reworking the split/)).toBeVisible();
});
-test("the staffing gate shows named workers, the chat toggle, and the grant sentence", async ({
+test("the staffing gate shows named workers, the chat toggle, and one-line buttons", async ({
page,
}) => {
await proposeTeam(page);
const card = page.getByTestId("teamreq-card");
- await expect(card).toContainText("Proposed team — 3 workers");
+ await expect(card).toContainText("Creating a team of agents — 3 workers");
// callnames lead the rows; persona + reason follow
await expect(card).toContainText("nia");
await expect(card).toContainText("swe-worker");
@@ -107,9 +109,15 @@ test("the staffing gate shows named workers, the chat toggle, and the grant sent
await expect(card).toContainText("checks");
// the chat checkbox defaults OFF — the user's call, not the lead's
await expect(card.getByTestId("teamreq-chat-toggle")).not.toBeChecked();
- await expect(card).toContainText(
- "Approving grants the lead create, assign & steer — this team only, revocable.",
+ // the grant sentence lives in the primary button's title, not in the card's text
+ await expect(card).not.toContainText("Approving grants the lead");
+ const approve = card.getByTestId("teamreq-approve");
+ await expect(approve).toHaveText("Create team");
+ await expect(approve).toHaveAttribute(
+ "title",
+ /Approving grants the lead create, assign & steer — this team only, revocable\./,
);
+ await expect(card.getByRole("button", { name: "Not now" })).toBeVisible();
});
test("enabling chat at the gate adds the # team chat row; posting works with mentions", async ({
@@ -210,3 +218,119 @@ test("approval creates the team; members live in the drawer, RECENT keeps one en
await expect(page.getByTestId("rail-toggle-progress")).toBeVisible();
await expect(page.getByTestId("rail-toggle-team")).toHaveCount(0);
});
+
+// Token counting (connectors-across-machines §5): the lead's Team panel rolls the tree
+// up by model — the lead's live turns plus each worker's persisted totals. Counts only.
+test("the Team panel shows tokens by model for the lead and its workers", async ({ page }) => {
+ await proposeTeam(page);
+ await page.getByTestId("teamreq-approve").click();
+ await expect(page.getByText(/Team created/)).toBeVisible();
+ await expect(page.getByTestId("rail-toggle-team")).toBeVisible({ timeout: 12_000 });
+ await page.getByTestId("rail-toggle-team").click();
+
+ const usage = page.getByTestId("team-usage");
+ await expect(usage).toBeVisible();
+ // nia's persisted 24k plus the lead's own turns so far (the fixture's 10k per turn).
+ await expect(usage).toContainText("Tokens");
+ await expect(usage).toContainText("claude-opus-4-8");
+ await expect(usage).not.toContainText("$");
+});
+
+// Worker-connector-grants spec §2, §6: workers start with no connectors; the card offers
+// each worker's default set — the lead's suggestion arrives TICKED with its reason, the
+// rest unticked — and everything else connected on the machine behind "+ Add another
+// connector". Approvals follow the lead: the card states the lead's CURRENT mode, live from the composer,
+// and has no control of its own. The human's connector decisions ride the approval.
+test("the staffing card carries connector checkboxes and states that approvals follow the lead", async ({
+ page,
+}) => {
+ await proposeTeam(page);
+ const card = page.getByTestId("teamreq-card");
+ // the lead suggested github for nia → ticked, with the lead's reason beside it
+ const nia = card.getByTestId("teamreq-connector-0-github");
+ await expect(nia).toBeChecked();
+ await expect(card.getByTestId("teamreq-row-0")).toContainText("pushes the branch and opens the PR");
+ // no suggestion for checks → its default set is offered unticked, with no reason
+ await expect(card.getByTestId("teamreq-connector-2-github")).not.toBeChecked();
+ // webb declares nothing: no default group, but the machine's other connectors can be added
+ await expect(card.getByTestId("teamreq-row-1")).not.toContainText("none available");
+ await expect(card.getByTestId("teamreq-beyond-1")).toHaveCount(0);
+ await card.getByTestId("teamreq-add-1").click();
+ await card.getByTestId("teamreq-connector-1-linear").check();
+ await expect(card.getByTestId("teamreq-beyond-1")).toContainText("Beyond this worker's usual set");
+ await expect(card.getByTestId("teamreq-connector-1-linear")).toBeChecked();
+ await expect(card.getByTestId("teamreq-approve")).toHaveAttribute(
+ "title",
+ /Workers get only the connectors you tick\./,
+ );
+ // the approvals line reads the composer's mode…
+ await expect(card.getByTestId("teamreq-approvals")).toContainText("Approvals follow the lead's mode: Ask for approval");
+ // …and follows it live when the mode changes in the composer
+ await page.getByRole("button", { name: "Mode" }).click();
+ await page.getByTestId("mode-menu").getByText("Bypass approvals").click();
+ await expect(card.getByTestId("teamreq-approvals")).toContainText("Approvals follow the lead's mode: Bypass approvals");
+ // approve as ticked — the final ticks ride the response, beyond-default ones included
+ await page.getByTestId("teamreq-approve").click();
+ await expect(
+ page.getByText("Team created — nia (github), webb (linear), checks (no connectors)"),
+ ).toBeVisible();
+});
+
+// Worker models: each worker's model is picked on the card. A worker whose persona
+// recommends nothing runnable arrives on the lead's model with a warning glyph; picking
+// another model clears it, and the final pick per worker rides the approval.
+test("the staffing card picks each worker's model and warns on a fallback", async ({ page }) => {
+ await proposeTeam(page);
+ const card = page.getByTestId("teamreq-card");
+ await expect(card.getByTestId("teamreq-model-0")).toHaveValue("anthropic:claude-opus-4-8");
+ await expect(card.getByTestId("teamreq-model-warn-0")).toHaveCount(0);
+ const warn = card.getByTestId("teamreq-model-warn-2");
+ await expect(warn).toBeVisible();
+ await expect(warn).toHaveAttribute("title", /recommended models can run on this machine/);
+ // the picker sits on line one without making the row wrap
+ const who = card.getByTestId("teamreq-row-2").locator(".teamreq-who");
+ const code = await who.locator("code").boundingBox();
+ const pick = await card.getByTestId("teamreq-model-2").boundingBox();
+ expect(Math.abs((code!.y + code!.height / 2) - (pick!.y + pick!.height / 2))).toBeLessThan(6);
+ await card.getByTestId("teamreq-model-2").selectOption("anthropic:claude-haiku-4-8");
+ await expect(card.getByTestId("teamreq-model-warn-2")).toHaveCount(0);
+ // a pick outside the worker's recommended models is noted, quietly
+ await card.getByTestId("teamreq-model-1").selectOption("anthropic:claude-opus-4-8");
+ await expect(card.getByTestId("teamreq-model-note-1")).toHaveText(
+ "Not one of this worker's recommended models.",
+ );
+ await page.getByTestId("teamreq-approve").click();
+ await expect(
+ page.getByText(
+ "Models — nia: anthropic:claude-opus-4-8, webb: anthropic:claude-opus-4-8, checks: anthropic:claude-haiku-4-8.",
+ ),
+ ).toBeVisible();
+});
+
+test("a lead may ask for a worker's connector later; the human grants or declines", async ({
+ page,
+}) => {
+ await page.goto("/");
+ await page.getByPlaceholder(/Ask the coworker/).fill("grant nia github");
+ await page.getByRole("button", { name: "Send" }).click();
+ const card = page.getByTestId("connreq-card");
+ await expect(card).toContainText("give nia access to GitHub");
+ await expect(card).toContainText("push the branch for #1");
+ await page.getByTestId("connreq-grant").click();
+ await expect(page.getByText("Granted — nia can push the branch now.")).toBeVisible();
+ await expect(page.getByTestId("connreq-card")).toHaveCount(0);
+});
+
+test("a coworker may ask for a service to be connected; not now is a plain outcome", async ({
+ page,
+}) => {
+ await page.goto("/");
+ await page.getByPlaceholder(/Ask the coworker/).fill("connect linear");
+ await page.getByRole("button", { name: "Send" }).click();
+ const card = page.getByTestId("connreq-card");
+ await expect(card).toContainText("would like Linear connected");
+ await expect(card.getByTestId("connreq-open")).toBeVisible();
+ await page.getByTestId("connreq-decline").click();
+ await expect(page.getByText("route that step through myself")).toBeVisible();
+});
+
diff --git a/surfaces/gui/e2e/text-size.spec.ts b/surfaces/gui/e2e/text-size.spec.ts
new file mode 100644
index 00000000..d6f7eecb
--- /dev/null
+++ b/surfaces/gui/e2e/text-size.spec.ts
@@ -0,0 +1,29 @@
+// Text size (UX-048 follow-up): a three-step control in Settings ▸ General sets
+// data-text-size on <html>, persists per device, and the token scale follows.
+import { expect } from "@playwright/test";
+import { test } from "./fixtures";
+
+test("Text size: Large sets the root attribute, survives reload, Default clears it", async ({ page }) => {
+ await page.goto("/");
+ const html = page.locator("html");
+ await expect(html).not.toHaveAttribute("data-text-size", /.+/);
+ const body = () => page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue("--fs-body").trim());
+ expect(await body()).toBe("14px");
+
+ await page.getByTestId("account-row").click();
+ await page.getByRole("button", { name: "Settings", exact: true }).click();
+ await page.getByTestId("text-size-large").click();
+ await expect(html).toHaveAttribute("data-text-size", "large");
+ expect(await body()).toBe("15px");
+
+ await page.reload();
+ await expect(html).toHaveAttribute("data-text-size", "large");
+
+ // Settings keeps the left column while open — the reload lands back on the settings
+ // route, so the control is still on screen.
+ await page.getByTestId("text-size-small").click();
+ expect(await body()).toBe("13px");
+ await page.getByTestId("text-size-default").click();
+ await expect(html).not.toHaveAttribute("data-text-size", /.+/);
+ expect(await body()).toBe("14px");
+});
diff --git a/surfaces/gui/e2e/unauthorized-gate.spec.ts b/surfaces/gui/e2e/unauthorized-gate.spec.ts
new file mode 100644
index 00000000..afd7eb5b
--- /dev/null
+++ b/surfaces/gui/e2e/unauthorized-gate.spec.ts
@@ -0,0 +1,21 @@
+// Machines hardening (d), 2026-09-02: when the sidecar rejects this window's launch
+// token, the app shows a plain signed-out state instead of crashing on the error body
+// (ledger 2026-09-01: dev GUI 401 wall + `undefined.includes` in App.tsx).
+import { expect } from "@playwright/test";
+import { test } from "./fixtures";
+
+test("a 401 from the local backend renders the signed-out gate, not a crash", async ({ page }) => {
+ // Registered after the fixtures' mocks, so it wins for these routes.
+ await page.route(/\/v1\/(health|settings|sessions)(\?.*)?$/, (route) =>
+ route.fulfill({
+ status: 401,
+ contentType: "application/json",
+ body: JSON.stringify({ detail: "Unauthorized" }),
+ }),
+ );
+ await page.goto("/");
+ const gate = page.getByTestId("unauthorized-gate");
+ await expect(gate).toBeVisible({ timeout: 10_000 });
+ await expect(gate).toContainText("Signed out of the coworker service");
+ await expect(gate.getByRole("button", { name: "Reload" })).toBeVisible();
+});
diff --git a/surfaces/gui/e2e/union-v15.spec.ts b/surfaces/gui/e2e/union-v15.spec.ts
new file mode 100644
index 00000000..f168209b
--- /dev/null
+++ b/surfaces/gui/e2e/union-v15.spec.ts
@@ -0,0 +1,198 @@
+import { test, expect, seedMachines } from "./fixtures";
+
+// Union v1.5: cloud machines join the two cross-machine aggregations —
+// sidebar session groups and the Inbox. Motivated live: a cloud box's parked
+// approval was invisible (a silent stall) until this.
+
+const CLOUD_ROW = {
+ id: "c1",
+ name: "cloud-vm",
+ fingerprint: "8e74c8c42ec58dfa",
+ app_version: "0.2.0",
+ created_at: 1_755_100_000,
+ last_seen: 1_755_100_000,
+ connected: true,
+};
+
+const CLOUD_SESSION = {
+ session_id: "cloud-triage-1",
+ title: "github mention triage",
+ workspace: null,
+ agent: "cowork",
+ model: "anthropic:claude-sonnet-4-6",
+ mode: "interactive",
+ updated_at: "2026-09-01 20:00:00",
+ messages: 5,
+ pinned: false,
+ archived: false,
+};
+
+async function seedCloud(page: import("@playwright/test").Page) {
+ await page.route("**/v1/cloud/machines", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ session: "ok",
+ org: { id: "org:deeplearning-ai", name: "DeepLearning AI" },
+ machines: [CLOUD_ROW],
+ }),
+ }),
+ );
+ await page.route("**/v1/cloud/machines/c1/sessions", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ live: true, sessions: [CLOUD_SESSION] }),
+ }),
+ );
+}
+
+test("sidebar lists a cloud machine's sessions; Machine grouping shows its group", async ({
+ page,
+}) => {
+ await seedMachines(page, []);
+ await seedCloud(page);
+ await page.route("**/v1/cloud/machines/c1/p/v1/inbox*", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ items: [] }),
+ }),
+ );
+ await page.goto("/");
+
+ const row = page.getByText("github mention triage").first();
+ await expect(row).toBeVisible();
+
+ await page.getByRole("button", { name: "Group and filter conversations" }).click();
+ await page.getByRole("menu").getByText("Machine", { exact: true }).click();
+ // UX-048: group headers are the machine name, sentence case, no glyph.
+ await expect(page.locator("div").filter({ hasText: /^cloud-vm$/ })).toBeVisible();
+});
+
+test("Inbox aggregates a cloud box's parked approval; resolve routes via the proxy", async ({
+ page,
+}) => {
+ await seedMachines(page, []);
+ await seedCloud(page);
+ await page.route("**/v1/cloud/machines/c1/p/v1/inbox*", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ items: [
+ {
+ id: "cloud-appr-1",
+ session_id: "cloud-triage-1",
+ kind: "approval",
+ title: "Run `send_message`?",
+ body: "requires approval\ntarget: github:o/r#2",
+ state: "pending",
+ resolution: null,
+ inbox: "default",
+ created_at: "2026-09-01 20:00:00",
+ resolved_at: null,
+ session_title: "github mention triage",
+ session_agent: "cowork",
+ session_workspace: "",
+ session_exists: true,
+ },
+ ],
+ }),
+ }),
+ );
+ let resolved = "";
+ await page.route("**/v1/cloud/machines/c1/p/v1/inbox/cloud-appr-1/resolve", (route) => {
+ resolved = route.request().postDataJSON()?.resolution ?? "";
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true }),
+ });
+ });
+ await page.goto("/");
+ await page.getByRole("button", { name: "Inbox" }).click();
+
+ // The cloud approval lists beside local ones, wearing its machine tag —
+ // the drill's invisible approval, now with a face.
+ await expect(page.getByText("target: github:o/r#2")).toBeVisible();
+ await expect(page.getByText("⌂ cloud-vm").first()).toBeVisible();
+
+ await page
+ .getByTestId("inbox-item-cloud-appr-1")
+ .getByRole("button", { name: "Approve", exact: true })
+ .click();
+ await expect.poll(() => resolved).toBe("allow");
+});
+
+// Connectors-across-machines §6: team calls ride the machine of the session they
+// belong to. A lead session on a cloud box opens its chat and journal through the
+// same proxy its transcript uses — never the local sidecar.
+test("team chat and journal of a cloud lead session route via the proxy", async ({ page }) => {
+ await seedMachines(page, []);
+ await page.route("**/v1/cloud/machines", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ session: "ok",
+ org: { id: "org:deeplearning-ai", name: "DeepLearning AI" },
+ machines: [CLOUD_ROW],
+ }),
+ }),
+ );
+ const lead = {
+ ...CLOUD_SESSION,
+ session_id: "cloud-lead-1",
+ title: "SWE team on the box",
+ agent: "swe-lead",
+ team: { role: "lead", team_id: "t-cloud", lead_session: "cloud-lead-1", chat_enabled: true },
+ };
+ // The Team panel renders for a lead WITH workers — one worker on the same box.
+ const worker = {
+ ...CLOUD_SESSION,
+ session_id: "cloud-worker-1",
+ title: "nia",
+ agent: "swe-worker",
+ team: { role: "worker", team_id: "t-cloud", lead_session: "cloud-lead-1", actor: "nia", status: "idle" },
+ };
+ await page.route("**/v1/cloud/machines/c1/sessions", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ live: true, sessions: [lead, worker] }),
+ }),
+ );
+ await page.route("**/v1/cloud/machines/c1/p/v1/inbox*", (route) =>
+ route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ items: [] }) }),
+ );
+ await page.route("**/v1/cloud/machines/c1/p/v1/sessions/cloud-lead-1/board", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ space: "box-space", name: "Board", items: [] }),
+ }),
+ );
+ const hits: string[] = [];
+ page.on("request", (r) => {
+ const u = r.url();
+ if (u.includes("/v1/teams/")) hits.push(u);
+ });
+ await page.goto("/");
+ await page.getByText("SWE team on the box").first().click();
+
+ await expect(page.getByTestId("rail-toggle-team")).toBeVisible({ timeout: 12_000 });
+ await page.getByTestId("rail-toggle-team").click();
+ await page.getByTestId("team-chat-row").click();
+ await expect(page.getByTestId("teamchat-view")).toBeVisible();
+
+ await expect
+ .poll(() => hits.filter((u) => u.includes("/v1/cloud/machines/c1/p/v1/teams/t-cloud/chat")).length)
+ .toBeGreaterThan(0);
+ await expect
+ .poll(() => hits.filter((u) => u.includes("/v1/cloud/machines/c1/p/v1/teams/journal")).length)
+ .toBeGreaterThan(0);
+ // Nothing about this team asked the local sidecar.
+ expect(hits.filter((u) => !u.includes("/p/v1/teams/"))).toEqual([]);
+});
diff --git a/surfaces/gui/e2e/union-view.spec.ts b/surfaces/gui/e2e/union-view.spec.ts
new file mode 100644
index 00000000..092666fa
--- /dev/null
+++ b/surfaces/gui/e2e/union-view.spec.ts
@@ -0,0 +1,144 @@
+import { test, expect, seedMachines } from "./fixtures";
+
+// Union view (spec §"Union view on the signed-in desktop"): the desktop shows
+// its local registry plus the hosted cloud's machines, proxied by the sidecar
+// under /v1/cloud/machines. Cloud rows wear a `cloud:` id prefix in the GUI —
+// one seam routes every consumer (rows, picker, scoped pages, sessions).
+
+const LOCAL = {
+ id: "m1",
+ name: "hetzner-box",
+ fingerprint: "8aaaac6fdc97e081",
+ app_version: "0.2.0",
+ created_at: 1_755_000_000,
+ last_seen: 1_755_000_000,
+ connected: true,
+};
+
+const CLOUD_ROW = {
+ id: "c1",
+ name: "cloud-vm",
+ fingerprint: "8e74c8c42ec58dfa",
+ app_version: "0.2.0",
+ created_at: 1_755_100_000,
+ last_seen: 1_755_100_000,
+ connected: true,
+};
+
+async function seedCloud(
+ page: import("@playwright/test").Page,
+ body: Record<string, unknown> = {
+ session: "ok",
+ org: { id: "org:deeplearning-ai", name: "DeepLearning AI" },
+ machines: [CLOUD_ROW],
+ },
+) {
+ await page.route("**/v1/cloud/machines", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify(body),
+ }),
+ );
+}
+
+test("Machines page: cloud section lists the org's machines beside the local registry", async ({
+ page,
+}) => {
+ await seedMachines(page, [LOCAL]);
+ await seedCloud(page);
+ await page.goto("/#/settings/machines");
+
+ await expect(page.getByTestId("machine-hetzner-box")).toBeVisible();
+ const section = page.getByTestId("cloud-machines-section");
+ await expect(section).toContainText("OpenWorker Cloud · DeepLearning AI");
+ await expect(section.getByTestId("machine-cloud-vm")).toBeVisible();
+});
+
+test("cloud rename routes through the sidecar's cloud proxy", async ({ page }) => {
+ await seedMachines(page, [LOCAL]);
+ await seedCloud(page);
+ let renamed = "";
+ await page.route("**/v1/cloud/machines/c1", (route) => {
+ renamed = route.request().postDataJSON()?.name ?? "";
+ return route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ machine: { id: "c1", name: renamed } }),
+ });
+ });
+ await page.goto("/#/settings/machines");
+
+ const row = page.getByTestId("machine-cloud-vm");
+ await row.hover();
+ await row.getByText("Rename").click();
+ await page.locator("input:focus").fill("prod-vm");
+ await page.keyboard.press("Enter");
+ await expect.poll(() => renamed).toBe("prod-vm");
+});
+
+test("expired cloud session degrades the section; the local list is untouched", async ({
+ page,
+}) => {
+ await seedMachines(page, [LOCAL]);
+ await seedCloud(page, { session: "expired", machines: [] });
+ await page.goto("/#/settings/machines");
+
+ await expect(page.getByTestId("machine-hetzner-box")).toBeVisible();
+ await expect(page.getByTestId("cloud-session-expired")).toContainText(
+ "session expired",
+ );
+});
+
+test("signed out: the cloud section does not exist at all", async ({ page }) => {
+ await seedMachines(page, [LOCAL]);
+ await seedCloud(page, { session: "signed_out", machines: [] });
+ await page.goto("/#/settings/machines");
+
+ await expect(page.getByTestId("machine-hetzner-box")).toBeVisible();
+ await expect(page.getByTestId("cloud-machines-section")).toHaveCount(0);
+});
+
+test("Settings picker offers cloud machines; scoped pages ride the cloud proxy", async ({
+ page,
+}) => {
+ await seedMachines(page, [LOCAL]);
+ await seedCloud(page);
+ await page.route("**/v1/cloud/machines/c1/p/v1/skills*", (route) =>
+ route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({
+ skills: [
+ {
+ name: "cloud-only-skill",
+ description: "Lives on the cloud VM",
+ source: "workspace",
+ enabled: true,
+ },
+ ],
+ }),
+ }),
+ );
+ await page.goto("/#/settings/skills");
+
+ const picker = page.getByTestId("machine-scope-picker");
+ await picker.selectOption("cloud:c1");
+ await expect(page.getByText("cloud-only-skill")).toBeVisible();
+ await expect(page).toHaveURL(/#\/settings\/skills\?m=cloud:c1$/);
+});
+
+test("runs-on menu groups cloud machines under their own header", async ({
+ page,
+}) => {
+ await seedMachines(page, [LOCAL]);
+ await seedCloud(page);
+ await page.goto("/");
+
+ await page.getByRole("button", { name: "New session" }).click();
+ const chip = page.getByTestId("runson-chip");
+ await chip.click();
+ await expect(page.getByText("OpenWorker Cloud", { exact: true })).toBeVisible();
+ await expect(page.getByText("⌂ cloud-vm")).toBeVisible();
+ await expect(page.getByText("⌂ hetzner-box")).toBeVisible();
+});
diff --git a/surfaces/gui/e2e/usage-chip.spec.ts b/surfaces/gui/e2e/usage-chip.spec.ts
index bc98e0a5..b079ccaa 100644
--- a/surfaces/gui/e2e/usage-chip.spec.ts
+++ b/surfaces/gui/e2e/usage-chip.spec.ts
@@ -1,18 +1,36 @@
-// Token-usage chip (OPE-42): after a turn reports usage, a quiet meter+count chip appears
-// in the composer's bottom row; clicking it opens the per-model breakdown popover with the
-// context-window fill. The fake agent attaches fixed usage to every echo turn
-// (input 1k / output 200 / cache_read 8k / cache_write 800 — 10k per turn), and the
-// settings fixture maps the default model to a 200k context window.
+// Context meter (OPE-42, UX-048 placement): the composer's model pill shows the model NAME;
+// hovering it opens a card (model, provider, context ring + line, "Click to change model").
+// The Settings switch adds the ring to the pill itself. The fake agent attaches fixed usage to
+// every echo turn (input 1k / output 200 / cache_read 8k / cache_write 800), and the settings
+// fixture maps the default model to a 200k context window.
import { expect } from "@playwright/test";
import { test } from "./fixtures";
-test("usage chip appears after a turn and opens the breakdown popover", async ({ page }) => {
+const modelPill = (page: import("@playwright/test").Page) =>
+ page.locator(".dd button").filter({ hasText: "Claude Opus 4.8" });
+
+test("model pill: name only; hover card carries provider, context line and the click hint", async ({ page }) => {
await page.goto("/");
await page.getByText("Draft the launch note").first().click();
- // Fresh session: no usage yet — the chip is hidden entirely.
+ const pill = modelPill(page);
+ await expect(pill).toBeVisible();
+ await expect(pill).toHaveText(/Claude Opus 4.8/);
+ await expect(pill).not.toHaveText(/Anthropic/);
+ await expect(pill).not.toHaveAttribute("title", /.+/); // the card replaces the native title
await expect(page.getByTestId("usage-chip")).toHaveCount(0);
+ // Fresh session: no usage yet.
+ await pill.hover();
+ const tip = page.getByTestId("dd-tip");
+ await expect(tip).toBeVisible();
+ await expect(tip).toContainText("Claude Opus 4.8");
+ await expect(tip).toContainText("Anthropic");
+ await expect(tip).toContainText("No usage yet");
+ await expect(tip).toContainText("Click to change model");
+ await page.mouse.move(10, 10);
+ await expect(tip).toHaveCount(0);
+
const box = page.getByPlaceholder(/Ask the coworker/);
await box.fill("hello");
await box.press("Enter");
@@ -20,32 +38,26 @@ test("usage chip appears after a turn and opens the breakdown popover", async ({
timeout: 10_000,
});
- // Default: no bar — the chip states the in-context size (prompt side of the last
- // turn: 1k + 8k + 800 = 9.8k). Session totals are on release hold (owner call
- // 2026-08-24): context-window figures only, everywhere.
- const chip = page.getByTestId("usage-chip");
- await expect(chip).toContainText("9.8k");
-
- // Popover: context fill only (9.8k prompt-side of 200k = 5%) — no totals breakdown.
- await chip.click();
- const pop = page.getByTestId("usage-popover");
- await expect(pop).toBeVisible();
- await expect(pop).toContainText("Context window");
- await expect(pop).toContainText("9.8k of 200k · 5%");
- await expect(pop).not.toContainText("Session totals");
- await expect(pop).not.toContainText("Uncached input");
- await expect(pop).not.toContainText("tokens");
+ // In-context size = prompt side of the last turn: 1k + 8k + 800 = 9.8k of 200k = 5%.
+ // Session totals stay on release hold (owner call 2026-08-24): context figures only.
+ await pill.hover();
+ await expect(tip).toContainText("Context 5% · 9.8k of 200k");
+ await expect(tip).not.toContainText(/tokens|Uncached/);
+ await expect(page.getByTestId("usage-chip")).toHaveCount(0); // ring in the pill is opt-in
+ await page.mouse.move(10, 10);
- // Context is a level, not a sum — a second identical turn leaves the chip unchanged.
- // The scrim click closes the popover.
- await page.mouse.click(10, 10);
- await expect(pop).toHaveCount(0);
+ // Context is a level, not a sum — a second identical turn leaves the line unchanged.
await box.fill("again");
await box.press("Enter");
await expect(page.getByText("Echo: again", { exact: false }).first()).toBeVisible({
timeout: 10_000,
});
- await expect(chip).toContainText("9.8k");
+ await pill.hover();
+ await expect(tip).toContainText("Context 5% · 9.8k of 200k");
+
+ // Opening the menu hides the card.
+ await pill.click();
+ await expect(tip).toHaveCount(0);
});
test("usage resets on a new session", async ({ page }) => {
@@ -54,23 +66,27 @@ test("usage resets on a new session", async ({ page }) => {
const box = page.getByPlaceholder(/Ask the coworker/);
await box.fill("hello");
await box.press("Enter");
- await expect(page.getByTestId("usage-chip")).toBeVisible({ timeout: 10_000 });
+ await expect(page.getByText("Echo: hello", { exact: false }).first()).toBeVisible({ timeout: 10_000 });
+ await modelPill(page).hover();
+ await expect(page.getByTestId("dd-tip")).toContainText("Context 5%");
+ await page.mouse.move(10, 10);
// "+ New session" wipes the transcript — and the usage accumulation with it.
await page.getByRole("button", { name: /New session/ }).first().click();
- await expect(page.getByTestId("usage-chip")).toHaveCount(0);
+ await modelPill(page).hover();
+ await expect(page.getByTestId("dd-tip")).toContainText("No usage yet");
});
-test("Settings toggle turns the context bar on; default is the in-context number", async ({ page }) => {
+test("Settings switch puts the context ring in the pill", async ({ page }) => {
await page.goto("/");
await page.getByText("Draft the launch note").first().click();
const box = page.getByPlaceholder(/Ask the coworker/);
await box.fill("hello");
await box.press("Enter");
- const chip = page.getByTestId("usage-chip");
- await expect(chip).toContainText("9.8k", { timeout: 10_000 }); // default: in-context size, no bar
+ await expect(page.getByText("Echo: hello", { exact: false }).first()).toBeVisible({ timeout: 10_000 });
+ await expect(page.getByTestId("usage-chip")).toHaveCount(0); // default: no ring
- // Turn the bar ON in Settings -> General.
+ // Turn the ring ON in Settings -> General.
await page.getByTestId("account-row").click();
await page.getByRole("button", { name: "Settings", exact: true }).click();
await expect(page.getByTestId("context-bar-toggle")).not.toBeChecked();
@@ -82,13 +98,12 @@ test("Settings toggle turns the context bar on; default is the in-context number
]);
expect(req.postDataJSON()).toEqual({ context_bar: true });
- // Reload so the app re-reads settings: the chip is now the fill bar, not a number.
+ // Reload so the app re-reads settings: the ring sits in the pill with the context label.
await page.goto("/");
await page.getByText("Draft the launch note").first().click();
await page.getByPlaceholder(/Ask the coworker/).fill("hello");
await page.getByPlaceholder(/Ask the coworker/).press("Enter");
- const bar = page.getByTestId("usage-chip");
- await expect(bar).toBeVisible({ timeout: 10_000 });
- await expect(bar).not.toContainText("9.8k");
- await expect(bar).toHaveAttribute("title", /Context window 5% full/);
+ const ring = page.getByTestId("usage-chip");
+ await expect(ring).toBeVisible({ timeout: 10_000 });
+ await expect(ring).toHaveAttribute("aria-label", /Context 5% · 9.8k of 200k/);
});