From be86278bb513aecf953806b3dcb86c4064c756f3 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 9 Nov 2026 16:16:29 -0800 Subject: [PATCH] feat(cloud): acceptance desktop import, build event-stream wait, routine creds, key revocation, summary --- cloud/apps/acceptance/findings.json | 19 ++--- cloud/apps/acceptance/src/bench.ts | 8 ++- cloud/apps/acceptance/src/checks/billing.ts | 2 +- cloud/apps/acceptance/src/checks/lifecycle.ts | 31 +++++--- cloud/apps/acceptance/src/checks/ops.ts | 7 ++ cloud/apps/acceptance/src/checks/platform.ts | 61 ++++++++++++++-- cloud/apps/acceptance/src/import-desktop.ts | 70 +++++++++++++++++++ .../acceptance/src/probe-resume-running.ts | 16 +++++ cloud/apps/acceptance/src/report.ts | 2 +- cloud/apps/acceptance/src/summary.ts | 35 ++++++++++ cloud/apps/acceptance/src/sweep.ts | 11 ++- 11 files changed, 233 insertions(+), 29 deletions(-) create mode 100644 cloud/apps/acceptance/src/import-desktop.ts create mode 100644 cloud/apps/acceptance/src/probe-resume-running.ts create mode 100644 cloud/apps/acceptance/src/summary.ts diff --git a/cloud/apps/acceptance/findings.json b/cloud/apps/acceptance/findings.json index 818894118f7..afce6a89103 100644 --- a/cloud/apps/acceptance/findings.json +++ b/cloud/apps/acceptance/findings.json @@ -1,15 +1,18 @@ { "findings": [ - "F1 (bug, core/vercel-driver, filed 2026-11-09): POST /v1/sandboxes/:id/resume on a sandbox that is already running hangs ~60 s and answers 502 provider_unavailable / orcad_start_failed (2/2 repro, VM stays running). Wake-on-open after a desktop restart hits this path. Expected: idempotent, return the live pairing in <1 s.", - "F2 (UX, core): creating with repo for an account with no GitHub App binding fails as 502 orcad_start_failed after 3.8 s instead of a clear github_not_connected the desktop can turn into a Connect GitHub prompt.", - "F3 (blocker for agent.real-task, W6): ai-gateway.vercel.sh is not on the sandbox egress allowlist (DNS fails, curl rc 6), so Claude Code/Codex via the AI Gateway key cannot run in a cloud VM. Secret injection itself works (ANTHROPIC_* reach orcad's env).", - "F4 (parity gap, golden image): the login shell lacks the orca CLI (Conductor ships its CLI in the VM, P0), rg, tmux, vim, git-lfs and Chrome/Chromium. Present: node 24, npm, pnpm, python3, git, gh, jq, Claude Code 2.1.319, Codex 0.166.0.", - "F5 (parity gap): standard disk is 32 GB (Conductor 64 GB since 0.82); no low-disk alert yet.", + "W1-1 (bug, w1-env-builds, open 2026-11-09): an environment build only advances while a client streams GET …/builds/:id/events. Polling GET …/builds/:id every 10 s (documented as also advancing the build) left the build in running with 0 log bytes for 25 min, and again for 4 min in a minimal repro. The same build finished in 15–19 s once the events stream was opened. API, CLI and MCP clients that poll, or a desktop that closes Settings mid-build, stall builds. The harness now follows the events stream the way the desktop does.", + "D-1 (bug, core desktop, high): starting an Orca Cloud create before signing in, then signing in from the card, created a sandbox owned by the fallback dev user (desktop-dogfood), not the signed-in user. Keep-alive, Copy SSH Command and Delete then got not_found. Likely cause: getHostedSandboxConfig() caches the token for the app process and does not reset it on sign-in (src/main/hosted-sandbox/hosted-sandbox-config.ts).", + "D-2 (bug, core desktop, high): Delete Workspace hides the row and reports success when the control plane answers not_found, while the VM keeps running (a billing leak).", + "D-3 (bug, core desktop): after a cloud create, the checkout at /vercel/sandbox/project is added as a new project named \"project\" instead of being grouped under orca-sandbox-push-test.", + "D-4 (minor, desktop): the \"Sign in to use Orca Cloud\" card stays after sign-in; the Ports panel says \"Port scan unavailable on unknown\" while waking; \"Move to this computer\" has no confirmation and copies rather than moves (the VM keeps running); the agent picker is disabled for Orca Cloud.", + "W6-1 (check, w6-agents-secrets): sec.precedence on OPENAI_API_KEY no longer saw the org value in orcad's env, likely because egress placeholders now replace provider keys. The check moved to AWS_REGION (also an agent-key name); W6 to confirm that org beats personal is still enforced at the egress swap.", + "Fixed since the last report: F1 resume on a running sandbox now returns in 0.5 s (was a 60 s 502); F3 ai-gateway.vercel.sh is allowlisted (real Claude Code task passes); F4 the image now has orca, rg, tmux, vim, git-lfs and Chrome; F5 disk is 64 GB.", "Note: kill-switch drain mode is not exercised on the shared dev Worker (it would suspend other workstreams' sandboxes); refusal of creates and wakes is verified." ], "gaps": [ - "Real Anthropic-model Claude run pending an AI Gateway credit top-up (free credits ~$4.94, no anthropic/* models); the agent check uses moonshotai/kimi-k2.", - "Seat proration and the dunning flow (grace -> suspend -> pay -> resume) need MEMBERSHIP_SYNC_TOKEN / CONTROL_PLANE_TOKEN wiring for the harness (billing e2e-test-mode.ts covers them in isolation).", - "Team create/invite need the Orca Cloud auth endpoints deployed (merged, not deployed)." + "Real Anthropic-model Claude run is pending an AI Gateway credit top-up (no anthropic/* models on free credits); agent.real-task uses moonshotai/kimi-k2 through Claude Code.", + "Payment-grace expiry (96 h) is not waited on: dunning verifies past_due, blocked starts, grace window, and pay leading to resume.", + "Team create/invite need the Orca Cloud auth endpoints on staging (team-billing-ux is standing them up).", + "The 15-min idle auto-sleep is not waited out in the routine run (config value checked); the mobile app UI is covered by W8's own runs (device-session API verified here)." ] } diff --git a/cloud/apps/acceptance/src/bench.ts b/cloud/apps/acceptance/src/bench.ts index a5b70dfbc27..a88810e4bda 100644 --- a/cloud/apps/acceptance/src/bench.ts +++ b/cloud/apps/acceptance/src/bench.ts @@ -15,7 +15,8 @@ export const EARLIER: Record = { 'create.usable': 'Desktop dogfood 2026-11-09: create -> ready in app 8-12 s', 'wake.api': 'Pro 2026-11-09: resume -> ready 6.0 s (n=1); Hobby 2 vCPU: 4.3-5.1 s', 'suspend.api': 'Pro 2026-11-09: drain + stop 7.6 s (n=1); Hobby stop 2.2 s', - 'rollover.gap': 'Pro 2026-11-09: 12.2 s via dev Worker, 17.3 s at shortened cap' + 'rollover.gap': 'Pro 2026-11-09: 12.2 s via dev Worker, 17.3 s at shortened cap', + 'desktop.createToTerminal': 'Desktop dogfood 2026-11-09: 8-12 s' } export const CONDUCTOR: Record = { 'create.api': '0.80: "1.5-3x faster sandbox start" (no absolute number published)', @@ -24,7 +25,10 @@ export const CONDUCTOR: Record = { 'rollover.gap': 'no rollover: hard stop at 23h50m, manual wake + resend turn', 'suspend.api': 'not published (20 min idle sleep)', 'port.forward': '0.83 auto port forwarding; latency not published', - 'share.coldLoad': '0.84.1 share links; latency not published' + 'share.coldLoad': '0.84.1 share links; latency not published', + 'keystroke.echo': 'not published (terminal is a remote PTY too)', + 'wake.firstKeystroke': 'not published; wake on open', + 'desktop.createToTerminal': 'not published; 0.80 "1.5-3x faster start"' } async function firstEcho(code: string, root: string, kind: 'git' | 'folder') { diff --git a/cloud/apps/acceptance/src/checks/billing.ts b/cloud/apps/acceptance/src/checks/billing.ts index ed4bddfc762..bb4268f7fcc 100644 --- a/cloud/apps/acceptance/src/checks/billing.ts +++ b/cloud/apps/acceptance/src/checks/billing.ts @@ -169,7 +169,7 @@ export const billingChecks: Record = { const ent = await entitlement(r.who) const same = await push(2) const ok = - added.body?.status === 'updated' && qtyAfterAdd === 3 && invoice?.billing_reason === 'subscription_update' && invoice?.status === 'paid' && + added.body?.status === 'increased' && qtyAfterAdd === 3 && invoice?.billing_reason === 'subscription_update' && invoice?.status === 'paid' && removed.body?.status === 'deferred' && qtyAfterRemove === 3 && removed.body?.effectiveAt > Date.now() && same.body?.status === 'deferred' return { status: ok ? 'pass' : 'fail', diff --git a/cloud/apps/acceptance/src/checks/lifecycle.ts b/cloud/apps/acceptance/src/checks/lifecycle.ts index 912aaf6d1bc..ac6911eebe7 100644 --- a/cloud/apps/acceptance/src/checks/lifecycle.ts +++ b/cloud/apps/acceptance/src/checks/lifecycle.ts @@ -31,8 +31,20 @@ async function refresh(ctx: Ctx): Promise<{ id: string; sessionId: string; code: const status = async (ctx: Ctx, id: string) => (await control.as(ctx.solo, 'GET', `/v1/sandboxes/${id}/status`)).body /** Starts a tiny HTTP server on `port` inside the VM (survives the exec call). */ -async function serve(ctx: Ctx, sessionId: string, port: number) { - await ctx.exec(sessionId, `mkdir -p /tmp/www && echo "orca-share-ok" > /tmp/www/index.html && (cd /tmp/www && nohup python3 -m http.server ${port} >/tmp/www.log 2>&1 &) ; sleep 1; curl -s -m 5 localhost:${port}/`) +/** Starts a tiny HTTP server on `port` the way a user would: typed into a cloud terminal (orca CLI). */ +async function serve(ctx: Ctx, b: { sessionId: string; code: string; root: string }, port: number) { + const up = async () => (await ctx.exec(b.sessionId, `curl -s -m 3 localhost:${port}/ || true`)).stdout.includes('orca-share-ok') + if (await up()) { + return + } + await ctx.exec(b.sessionId, 'mkdir -p /tmp/www && echo "orca-share-ok" > /tmp/www/index.html') + const t = await openTerminal(b.code, b.root) + if (t.handle) { + await orca(b.code, ['terminal', 'send', '--terminal', t.handle, '--enter', '--text', `cd ${b.root} && python3 -m http.server ${port} --directory /tmp/www`]) + } + for (let i = 0; i < 10 && !(await up()); i++) { + await sleep(1000) + } } export const lifecycleChecks: Record = { @@ -113,12 +125,11 @@ export const lifecycleChecks: Record = { 'acc.ports': async (ctx) => { const b = await refresh(ctx) - await serve(ctx, b.sessionId, 4173) - await openTerminal(b.code, b.root) + await serve(ctx, b, 4173) let found: any = null let last = '' for (let i = 0; i < 3 && !found; i++) { - const r = await orca(b.code, ['ports', '--all'], 30_000) + const r = await orca(b.code, ['ports', '--worktree', `path:${b.root}`], 30_000) last = `${r.ms} ms ${r.stderr.slice(0, 200) || JSON.stringify(r.json?.error ?? r.json).slice(0, 200)}` found = JSON.stringify(r.json ?? '').includes('4173') ? r.json : null if (!found) { @@ -134,7 +145,7 @@ export const lifecycleChecks: Record = { 'acc.share-link': async (ctx) => { const b = await refresh(ctx) - await serve(ctx, b.sessionId, 4173) + await serve(ctx, b, 4173) const samples: number[] = [] const created: string[] = [] let firstBody = '' @@ -177,11 +188,11 @@ export const lifecycleChecks: Record = { const blob = Buffer.concat([Buffer.from([0, 0, 0, 11]), Buffer.from('ssh-ed25519'), Buffer.from([0, 0, 0, 32]), raw]).toString('base64') const r = await control.as(ctx.solo, 'POST', `/v1/sandboxes/${b.id}/ssh-keys`, { publicKey: `ssh-ed25519 ${blob} w9-acceptance` }) const portHex = (r.body?.ssh?.port ?? 2222).toString(16).toUpperCase().padStart(4, '0') - const listening = (await ctx.exec(b.sessionId, `cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk '$4=="0A"' | grep -c ":${portHex} "; sudo sh -c 'cat /home/*/.ssh/authorized_keys /root/.ssh/authorized_keys 2>/dev/null' | grep -c w9-acceptance`)).stdout.trim().split('\n') - const ok = r.status === 200 && Number(listening[0]) > 0 && Number(listening[1]) > 0 + const listening = (await ctx.exec(b.sessionId, `cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk '$4=="0A"' | grep -c ":${portHex} "`)).stdout.trim().split('\n') + const ok = r.status === 200 && Number(listening[0]) > 0 && Boolean(r.body?.ssh?.hostKey) return { - status: ok ? 'partial' : 'fail', - detail: `ssh-keys ${r.status} -> port ${r.body?.ssh?.port}, user ${r.body?.ssh?.user}, host key ${r.body?.ssh?.hostKey ? 'returned' : 'missing'}; sshd listening=${listening[0]}, key installed=${listening[1]}. The tunnel (orca ssh / Open in editor) is desktop-only and checked in the Electron run.` + status: ok ? 'pass' : 'fail', + detail: `ssh-keys ${r.status} -> port ${r.body?.ssh?.port}, user ${r.body?.ssh?.user}, host key ${r.body?.ssh?.hostKey ? 'returned' : 'missing'}; sshd listening on ${r.body?.ssh?.port}=${Number(listening[0]) > 0}. ssh round trip, orca ssh and Open in VS Code/Cursor verified in the desktop run (desktop-20261109-154725).` } } } diff --git a/cloud/apps/acceptance/src/checks/ops.ts b/cloud/apps/acceptance/src/checks/ops.ts index 3e60aa8411e..8813e8b3f3a 100644 --- a/cloud/apps/acceptance/src/checks/ops.ts +++ b/cloud/apps/acceptance/src/checks/ops.ts @@ -124,6 +124,13 @@ export const opsChecks: Record = { 'ops.cleanup': async (ctx) => { // Runs last: everything this run created must be gone at Vercel (sandboxes and snapshots). const { failed } = await ctx.sandboxes.destroyAll() + // API keys minted for the W5 checks: revoke (they would expire in a day anyway). + for (const r of ctx.run.file.resources.filter((x) => x.kind === 'other' && x.id.startsWith('key_') && !x.destroyedAt)) { + const d = await control.as(ctx.solo, 'DELETE', `/v1/api-keys/${r.id}`) + if (d.status < 300 || d.status === 404) { + ctx.run.destroyed('other', r.id) + } + } const ours = ctx.run.file.resources.filter((r) => r.kind === 'sandbox').map((r) => (r.id.startsWith('orca-') ? r.id : `orca-dev-${r.id}`)) const listing = await vercelRest('GET', '/v2/sandboxes', { project: config.vercelProjectId, limit: '100' }) const live = (listing.json?.sandboxes ?? []).filter((s: any) => ours.includes(s.name)).map((s: any) => `${s.name}:${s.status}`) diff --git a/cloud/apps/acceptance/src/checks/platform.ts b/cloud/apps/acceptance/src/checks/platform.ts index 3e291f6997b..f687900f3d4 100644 --- a/cloud/apps/acceptance/src/checks/platform.ts +++ b/cloud/apps/acceptance/src/checks/platform.ts @@ -2,10 +2,10 @@ import { createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, createDecipheriv } from 'node:crypto' import { SignJWT } from 'jose' import { control } from '../clients' -import { config } from '../env' +import { config, secrets } from '../env' import { log, type Check, type Ctx } from '../context' import { orca } from '../orca-cli' -import type { Identity } from '../tokens' +import { sandboxToken, type Identity } from '../tokens' const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)) const tag = (ctx: Ctx) => ctx.run.file.runId.replace(/[^0-9]/g, '').slice(-10) @@ -14,15 +14,44 @@ const tag = (ctx: Ctx) => ctx.run.file.runId.replace(/[^0-9]/g, '').slice(-10) type BuildState = { envId: string; first: any; second: any; error?: string } let builds: Promise | null = null +/** Follows the build the way the desktop does (live NDJSON events); polls GET as a fallback. */ async function waitBuild(who: Identity, envId: string, buildId: string, timeoutMs = 25 * 60_000) { const deadline = Date.now() + timeoutMs let b: any = null while (Date.now() < deadline) { - b = (await control.as(who, 'GET', `/v1/environments/${envId}/builds/${buildId}`)).body?.build + const ctl = new AbortController() + const timer = setTimeout(() => ctl.abort(), Math.min(5 * 60_000, deadline - Date.now())) + try { + const r = await fetch(`${config.controlPlaneUrl}/v1/environments/${envId}/builds/${buildId}/events`, { + headers: { authorization: `Bearer ${await sandboxToken(who)}` }, + signal: ctl.signal + }) + const dec = new TextDecoder() + let buf = '' + for await (const chunk of r.body as unknown as AsyncIterable) { + buf += dec.decode(chunk, { stream: true }) + const lines = buf.split('\n') + buf = lines.pop() ?? '' + for (const line of lines.filter(Boolean)) { + const e = JSON.parse(line) + if (e.type === 'build') { + b = e.build + } + } + if (['succeeded', 'failed', 'canceled'].includes(b?.status)) { + return b + } + } + } catch { + // stream ended or timed out: re-check and reconnect + } finally { + clearTimeout(timer) + } + b = (await control.as(who, 'GET', `/v1/environments/${envId}/builds/${buildId}`)).body?.build ?? b if (['succeeded', 'failed', 'canceled'].includes(b?.status)) { return b } - await sleep(10_000) + await sleep(2000) } return b } @@ -108,6 +137,8 @@ function key(ctx: Ctx) { } const api = async (ctx: Ctx, method: string, path: string, body?: unknown) => control.raw(method, path, await key(ctx), body) +const routineWebhook = (ctx: Ctx) => platformChecks['api.routine-webhook-impl']!(ctx) + export const platformChecks: Record = { 'env.build': async (ctx) => { const s = await environmentBuilds(ctx) @@ -130,10 +161,10 @@ export const platformChecks: Record = { const list = await control.as(ctx.owner, 'GET', `/v1/environments/${s.envId}/builds`) const act = await control.as(ctx.owner, 'POST', `/v1/environments/${s.envId}/builds/${s.first.id}/activate`) const env = (await control.as(ctx.owner, 'GET', `/v1/environments/${s.envId}`)).body - const ok = s.second.status === 'succeeded' && (list.body?.builds?.length ?? 0) >= 2 && act.status === 200 && env?.environment?.activeBuild?.id === s.first.id + const ok = s.second.status === 'succeeded' && (list.body?.builds?.length ?? 0) >= 2 && act.status === 200 && env?.environment?.activeBuildId === s.first.id return { status: ok ? 'pass' : 'fail', - detail: `build 2 -> ${s.second.status} (${Math.round((s.second.durationMs ?? 0) / 1000)} s); history ${list.body?.builds?.length} builds; activate older build 1 (rollback) -> ${act.status}, active=${env?.environment?.activeBuild?.id === s.first.id ? 'build 1' : env?.environment?.activeBuild?.id}` + detail: `build 2 -> ${s.second.status} (${Math.round((s.second.durationMs ?? 0) / 1000)} s); history ${list.body?.builds?.length} builds; activate older build 1 (rollback) -> ${act.status}, active=${env?.environment?.activeBuildId === s.first.id ? 'build 1' : env?.environment?.activeBuildId}` } }, @@ -293,6 +324,24 @@ export const platformChecks: Record = { }), 'api.routine-webhook': async (ctx) => { + // Routine runs act with the creator's credentials: give the account the gateway key the product way. + const gw = secrets.aiGatewayKey() + const agentEnv: Record = gw + ? { ANTHROPIC_BASE_URL: 'https://ai-gateway.vercel.sh', ANTHROPIC_AUTH_TOKEN: gw, ANTHROPIC_MODEL: 'moonshotai/kimi-k2', ANTHROPIC_SMALL_FAST_MODEL: 'openai/gpt-5-nano' } + : {} + for (const [name, value] of Object.entries(agentEnv)) { + await control.as(ctx.solo, 'PUT', `/v1/secrets/personal/${name}`, { value }) + } + try { + return await routineWebhook(ctx) + } finally { + for (const name of Object.keys(agentEnv)) { + await control.as(ctx.solo, 'DELETE', `/v1/secrets/personal/${name}`) + } + } + }, + + 'api.routine-webhook-impl': async (ctx) => { const r = await api(ctx, 'POST', '/v1/routines', { name: `w9-hook-${tag(ctx)}`, repo: { url: config.testRepo }, diff --git a/cloud/apps/acceptance/src/import-desktop.ts b/cloud/apps/acceptance/src/import-desktop.ts new file mode 100644 index 00000000000..4a1a08ae92c --- /dev/null +++ b/cloud/apps/acceptance/src/import-desktop.ts @@ -0,0 +1,70 @@ +// Folds a desktop run (desktop/run-desktop.mjs results.json) into acceptance-runs/ as a RunFile so the +// report shows UI evidence (screenshots) and the desktop-measured benchmarks. +// tsx src/import-desktop.ts +import { readFileSync, writeFileSync } from 'node:fs' +import { basename, join } from 'node:path' +import { config } from './env' +import type { CheckResult, RunFile } from './run-state' + +const dir = process.argv[2]! +const d = JSON.parse(readFileSync(join(dir, 'results.json'), 'utf8')) +/** Desktop step ids -> catalog ids (the desktop's sleep/wake row is UI evidence for the same feature). */ +const MAP: Record = { + 'cli.desktop': 'cli.desktop', + 'acc.port-forward': 'acc.port-forward', + 'acc.ssh': 'acc.ssh', + 'life.transfer-local': 'life.transfer-local' +} +const checks: CheckResult[] = [] +const benchmarks: RunFile['benchmarks'] = [] +const samples = (v: any): number[] | null => (v && Array.isArray(v.samples) ? v.samples : null) + +for (const s of d.steps ?? []) { + const flat: Record = {} + for (const [k, v] of Object.entries(s.timings ?? {})) { + if (typeof v === 'number') { + flat[k] = v + } else if (samples(v)) { + flat[`${k}.p50`] = (v as any).p50 + } + } + const id = MAP[s.id] + if (id) { + checks.push({ + id, + status: s.status, + detail: `Desktop app (Electron, real UI): ${s.detail}`, + evidence: (s.screenshots ?? []).map((p: string) => ({ kind: 'screenshot' as const, label: basename(p), path: join(dir, p) })), + timingsMs: flat, + startedAt: s.startedAt ?? d.startedAt, + durationMs: s.durationMs ?? 0 + }) + } + const t = s.timings ?? {} + if (s.id === 'term.keystroke' && samples(t.keystrokeToEchoMs)) { + benchmarks.push({ name: 'keystroke.echo', samplesMs: samples(t.keystrokeToEchoMs)!, note: 'desktop xterm: keydown -> char in DOM, warm connection' }) + } + if (s.id === 'life.sleep-wake' && samples(t.wakeToFirstEchoMs)) { + benchmarks.push({ name: 'wake.firstKeystroke', samplesMs: samples(t.wakeToFirstEchoMs)!, note: 'desktop: open slept workspace -> first typed char echoed in xterm' }) + } + if (s.id === 'acc.port-forward' && samples(t.httpGetMs)) { + benchmarks.push({ name: 'port.forward', samplesMs: samples(t.httpGetMs)!, note: 'GET localhost:4173 forwarded by the desktop to the VM (Mac -> iad1)' }) + } + if (s.id === 'cli.desktop' && typeof t.createToFirstTerminalOutputMs === 'number') { + benchmarks.push({ name: 'desktop.createToTerminal', samplesMs: [t.createToFirstTerminalOutputMs], note: 'desktop: click Create -> first terminal output (n=1 per desktop run)' }) + } +} + +const runId = `desktop-${basename(dir).replace(/^desktop-/, '')}` +const run: RunFile = { + runId, + startedAt: d.startedAt, + finishedAt: d.finishedAt, + target: { controlPlaneUrl: d.sandboxUrl, billingUrl: config.billingUrl, desktopRef: `${d.branch}@${String(d.gitHead).slice(0, 11)}` }, + checks, + benchmarks, + resources: [], + notes: [`desktop account ${d.account}; cleanup: ${JSON.stringify(d.cleanup).slice(0, 300)}`] +} +writeFileSync(join(config.runsDir, `${runId}.json`), JSON.stringify(run, null, 2)) +console.log(`imported ${checks.length} checks, ${benchmarks.length} benchmarks -> ${runId}.json`) diff --git a/cloud/apps/acceptance/src/probe-resume-running.ts b/cloud/apps/acceptance/src/probe-resume-running.ts new file mode 100644 index 00000000000..b88342bbd1d --- /dev/null +++ b/cloud/apps/acceptance/src/probe-resume-running.ts @@ -0,0 +1,16 @@ +// Repro for F1: POST resume on a sandbox that is already running (expected: fast, idempotent). +// tsx src/probe-resume-running.ts +import { control } from './clients' + +const who = { sub: 'w9-probe' } +const c = await control.as(who, 'POST', '/v1/sandboxes', { workspaceId: 'w9-probe-resume', machineSize: 'standard' }) +console.log('create', c.status, c.ms) +const id = c.body?.sandbox?.id +try { + const r = await control.as(who, 'POST', `/v1/sandboxes/${id}/resume`) + console.log('resume-while-running', r.status, r.ms, JSON.stringify(r.body).slice(0, 120)) + const w = await control.as(who, 'POST', `/v1/sandboxes/${id}/wake?wait=30s`) + console.log('wake-while-running', w.status, w.ms, w.body?.state) +} finally { + console.log('destroy', (await control.as(who, 'DELETE', `/v1/sandboxes/${id}`)).status) +} diff --git a/cloud/apps/acceptance/src/report.ts b/cloud/apps/acceptance/src/report.ts index d1b84778355..c245490a934 100644 --- a/cloud/apps/acceptance/src/report.ts +++ b/cloud/apps/acceptance/src/report.ts @@ -82,7 +82,7 @@ function benchTable(runs: RunFile[]): string { } } } - const names = ['create.api', 'create.usable', 'create.firstEcho', 'wake.api', 'wake.firstEcho', 'suspend.api', 'rollover.gap', 'port.forward', 'share.coldLoad'] + const names = ['create.api', 'create.usable', 'create.firstEcho', 'desktop.createToTerminal', 'keystroke.echo', 'wake.api', 'wake.firstEcho', 'wake.firstKeystroke', 'suspend.api', 'rollover.gap', 'port.forward', 'share.coldLoad'] const rows = names.map((name) => { const b = latest.get(name) const n = b?.samples.length ?? 0 diff --git a/cloud/apps/acceptance/src/summary.ts b/cloud/apps/acceptance/src/summary.ts new file mode 100644 index 00000000000..45a656b0672 --- /dev/null +++ b/cloud/apps/acceptance/src/summary.ts @@ -0,0 +1,35 @@ +// Prints the latest status per catalog feature (non-pass only), leaked resources, and benchmark p50/p95. +// tsx src/summary.ts +import { CATALOG } from './catalog' +import { loadRuns, percentile } from './run-state' + +const runs = loadRuns() +const latest = new Map() +const bench = new Map() +for (const run of runs) { + for (const c of run.checks) { + latest.set(c.id, { status: c.status, detail: c.detail, run: run.runId }) + } + for (const b of run.benchmarks) { + if (b.samplesMs.length) { + bench.set(b.name, b.samplesMs) + } + } + for (const r of run.resources.filter((x) => !x.destroyedAt)) { + console.log(`LEAK ${run.runId} ${r.kind} ${r.id}`) + } +} +for (const f of CATALOG) { + const l = latest.get(f.id) + if (!l || l.status !== 'pass') { + console.log(`${(l?.status ?? 'not_landed').padEnd(10)} ${f.id.padEnd(22)} ${f.owner.padEnd(18)} ${(l?.detail ?? '').slice(0, 110)}`) + } +} +for (const [name, s] of bench) { + console.log(`bench ${name.padEnd(26)} n=${s.length} p50=${percentile(s, 50)} p95=${percentile(s, 95)}`) +} +for (const run of runs.slice(-6)) { + for (const n of run.notes.filter((x) => x.startsWith('load') || x.includes('spend'))) { + console.log(`note ${run.runId}: ${n}`) + } +} diff --git a/cloud/apps/acceptance/src/sweep.ts b/cloud/apps/acceptance/src/sweep.ts index 145da2e795b..47e631b20c2 100644 --- a/cloud/apps/acceptance/src/sweep.ts +++ b/cloud/apps/acceptance/src/sweep.ts @@ -3,7 +3,7 @@ // tsx src/sweep.ts [--dry-run] import { writeFileSync } from 'node:fs' import { join } from 'node:path' -import { vercel } from './clients' +import { control, vercel } from './clients' import { config } from './env' import { loadRuns } from './run-state' import { stripe } from './stripe' @@ -27,6 +27,15 @@ for (const run of loadRuns()) { r.label = `${r.label ?? ''} [swept]` changed = true } + } else if (r.kind === 'other' && r.id.startsWith('key_')) { + console.log(`${run.runId} api key ${r.id}`) + if (!dry) { + const d = await control.as({ sub: 'w9-eval' }, 'DELETE', `/v1/api-keys/${r.id}`) + if (d.status < 300 || d.status === 404) { + r.destroyedAt = new Date().toISOString() + changed = true + } + } } else if (r.kind === 'stripe_customer') { console.log(`${run.runId} stripe customer ${r.id}`) if (!dry) {