From 73ae50acd07ba971a90916618d33540a23991872 Mon Sep 17 00:00:00 2001 From: tangzhixiong613-jpg <340458552+tangzhixiong613-jpg@users.noreply.github.com> Date: Sun, 15 Nov 2026 09:50:17 +0000 Subject: [PATCH 1/2] =?UTF-8?q?T-1246=20InstaBox=20=E4=BA=91=E7=94=B5?= =?UTF-8?q?=E8=84=91=E6=8E=A5=E7=BA=BF=EF=BC=9A=E9=85=8D=E7=BD=AE=E3=80=81?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E3=80=81=E5=B7=A5=E5=85=B7=E3=80=81=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=80=81=E5=BF=AB=E7=85=A7=E6=8E=A5=E8=BF=9B=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../T-1200/T-1246-instabox-wiring/brief.md | 106 + .../tasks/T-1200/T-1246-instabox-wiring/r2.md | 30 + .../T-1200/T-1246-instabox-wiring/report.md | 76 + .../T-1246-instabox-wiring/verification.txt | 2066 +++++++++++++++++ server/index.ts | 23 +- server/instabox/client.ts | 5 +- server/instabox/power.test.ts | 4 +- server/instabox/power.ts | 13 +- server/instabox/snapshot-wiring.e2e.test.ts | 101 + server/instabox/snapshot-wiring.ts | 64 + server/instabox/wiring-backends-fixture.ts | 72 + server/instabox/wiring.e2e.test.ts | 186 ++ server/instabox/wiring.test.ts | 22 + server/instabox/wiring.ts | 62 + server/routes/config-instabox.test.ts | 2 +- server/routes/instabox-snapshots.e2e.test.ts | 11 +- server/routes/instabox-snapshots.ts | 43 +- server/testing/fake-instabox-core.ts | 47 +- server/testing/fake-instabox-snapshots.ts | 6 +- shared/place-view.ts | 2 +- src/components/CloudBackendPicker.test.ts | 8 +- src/components/CloudBackendPicker.tsx | 6 +- src/components/ComputerPanel.instabox.test.ts | 65 + src/components/ComputerPanel.tsx | 24 +- src/components/InstaboxSnapshots.test.tsx | 4 +- src/components/InstaboxSnapshots.tsx | 2 +- src/components/instabox-panel.test.ts | 29 + src/components/instabox-panel.ts | 12 + src/lib/place-view.ts | 12 +- src/locales/pt-br.json | 2 +- 30 files changed, 3032 insertions(+), 73 deletions(-) create mode 100644 docs/tasks/T-1200/T-1246-instabox-wiring/brief.md create mode 100644 docs/tasks/T-1200/T-1246-instabox-wiring/r2.md create mode 100644 docs/tasks/T-1200/T-1246-instabox-wiring/report.md create mode 100644 docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt create mode 100644 server/instabox/snapshot-wiring.e2e.test.ts create mode 100644 server/instabox/snapshot-wiring.ts create mode 100644 server/instabox/wiring-backends-fixture.ts create mode 100644 server/instabox/wiring.e2e.test.ts create mode 100644 server/instabox/wiring.test.ts create mode 100644 server/instabox/wiring.ts create mode 100644 src/components/ComputerPanel.instabox.test.ts create mode 100644 src/components/instabox-panel.test.ts create mode 100644 src/components/instabox-panel.ts diff --git a/docs/tasks/T-1200/T-1246-instabox-wiring/brief.md b/docs/tasks/T-1200/T-1246-instabox-wiring/brief.md new file mode 100644 index 00000000..82952c63 --- /dev/null +++ b/docs/tasks/T-1200/T-1246-instabox-wiring/brief.md @@ -0,0 +1,106 @@ +## 运行环境(云沙箱,必读) +- 开工先在 worktree 根目录运行 依赖准备脚本(镜像自带,把预装依赖链进 node_modules),之后 `pnpm exec vitest` / `pnpm exec tsc` 才可用。 +- 这里**没有** systemd、Docker,说明里出现的 `systemd-run --scope ... --` 前缀一律去掉直接运行;机器 8G/4 核,一次只跑一个测试文件。 +- 若本轮沙箱已放开(能联网、能监听端口),交回前必须把改动相关的测试全部跑过,包括需要端口的 e2e;涉及的 e2e 连跑 3 次都要过。跑不了的写明原因。 +- 报告只写三样:改了什么(文件列表与 git status 一致)、为什么、测试命令与结果摘要。不要写长篇分析;完整输出放 verification 文本文件即可。 +- 不提交 git。 + +# T-1246 T-1239⑤ 云电脑:把核心、工具、画面、设置/快照接进服务端,端到端可用 + +## 背景 +父任务 T-1239:新增云电脑后端 `instabox`。①–④ 已分别合并进 main,但为避免互相冲突,都没有接进服务端入口,现在处于「代码在、没接线」状态: +- ① T-1242 核心:`server/instabox/` 下机器生命周期(ensureRunning/suspend/remove/exec/readFile/writeFile/vncUpstream)、回合接入、策略与删除。报告:`docs/tasks/T-1200/T-1242-instabox-core/report.md`。 +- ② T-1243 工具:`server/instabox/computer-tools.ts`(智能体操作电脑的工具、复制上限、lease)。报告:`docs/tasks/T-1200/T-1243-instabox-tools/report.md`。 +- ③ T-1244 画面:`server/instabox/vnc.ts` 远程桌面中继。报告里「供⑤接线的现有确切签名」一节:`docs/tasks/T-1200/T-1244-instabox-vnc/report.md`。 +- ④ T-1245 设置/快照:钥匙设置项、三后端选择 `CloudBackendPicker`、快照面板 `InstaboxSnapshots`、快照路由与假服务。报告里「⑤ 接线的确切签名」和「尚未独立闭环」两节:`docs/tasks/T-1200/T-1245-instabox-settings/report.md`。 + +先完整读这四份报告和下面的共同约定,再动手。 + +## 要做的事(必改) +1. 配置:`instabox.apiKey` 接进配置 schema、saveConfig 的 section 合并列表、加载、`INSTABOX_API_KEY` 环境变量覆盖、全局 configStatus 和 config 广播。`/api/config` 和广播里只给「已配置/末四位/来源」,绝不回显钥匙原文(④第 4 轮已有的约束保持)。 +2. 路由:注册④的快照路由;注册③的画面中继:浏览器 target id 沿用 `vps/`,服务端按智能体实际后端选 provider,instabox 时调 `machines.ensureRunning(botId)` + `machines.vncUpstream(id)`,服务端 key 用 `instabox//`,换机后旧连接失效。 +3. 工具:智能体后端为 instabox 时,回合里的电脑工具走②的 `computer-tools`,不再落到 Boat/VPS;box/vps 行为不变。 +4. 前端:电脑面板里④的后端选择和快照面板在接好后正常可用;没配钥匙时 instabox 选项置灰并提示去设置页填钥匙(用④已加的文案键,缺的键补进 zh/en/pt-br)。 +5. 共用电脑(team computer / 部门桌面)、本地 VM 私有桌面、多屏一律不动。 + +## 一起改(来自④第 2 轮复审的建议) +6. 快照接口同步等待每段实际约 205 秒(180 + 一次 25 秒长轮询):前端请求超时和服务端反代/路由超时按此留余量,或把剩余时间截成 `wait` 参数,不能让前端先超时而后台还在跑。 +7. 假服务快照对象改成真实 OpenAPI 形状:status 为 `pending|ready|failed`,带 `sourceMachineId`;操作单判别只认 `type/phase`,不认 `machineId`。 +8. 快照 e2e 在 restore 前断言创建时已调过 operations 和 `GET /v1/snapshots`。 +9. pt-br 里「智能体」译法统一,照文件里已有的多数译法。 + +## 端到端测试(必须新增,进仓库) +新增 `server/instabox/wiring.e2e.test.ts`(名字可调整),用真实服务端入口 + 本地假 (不连真实服务)走完一条链: +设置钥匙(含环境变量覆盖)→ `/api/config` 不含钥匙原文 → 新建智能体选 instabox → 回合里调一次电脑工具(exec + 截图/读文件)落到假 → 画面中继以 `vps/` 连上并收到 RFB 握手 → 建快照、列快照、restore → 删智能体时机器被删除。 +另加一条:box/vps 智能体的同一路径不碰假 。 +e2e 连跑 3 次都要过。 + +## 约束 +- 行数门禁(`scripts/testing/file-size-ratchet.test.ts`):`server/index.ts`、`ComputerPanel.tsx`、`config.ts`、`store.ts` 余量很少,先查余量;接线逻辑放 `server/instabox/wiring.ts` 等新文件,大文件里只加挂载调用。 +- 公开仓库:代码、测试、文档、verification.txt 不得出现内部域名、IP、邮箱、人名、真实钥匙、uuid;假钥匙用 `instabox-e2e-fixture` 这类明显的假值。 +- 钥匙只在服务端,不进机器、前端、日志、智能体上下文。 + +## 验收 +改动相关测试逐文件跑过(含①–④已有的 instabox 测试、`server/index.test.ts`、`server/bot-box/env.test.ts`、file-size-ratchet);`pnpm exec tsc -p tsconfig.server.json`、前端 tsc;改动文件 `oxlint --deny-warnings`。report.md 写短:改了哪些文件、怎么接的、测试结果;列出还需要协调者用真实钥匙核对的点(例如真实快照耗时、真实画面)。 + +## 顺手修(main 上已有) +10. `server/routes/config-instabox.test.ts` 第 20 行 `configForAccess: (status, auth) =>` 两个参数隐式 any,`tsc -p tsconfig.server.json` 报 TS7006;补上类型,让服务端 tsc 全绿。 +# T-1239 云电脑后端:共同约定(4 个并行子任务都必须遵守) + +## 目标与范围(用户已定) +- 新增云电脑后端 `instabox`,与 Boat(box)、VPS(vps)并列,供单个智能体使用自己的云电脑。范围:Linux 桌面 + Android 模板,不含苹果。 +- 共用电脑(team computer / 部门桌面)、本地 VM 私有桌面、多屏都**不改**,仍走原来的路。 +- 所有机器用同一把 钥匙:配置 `instabox.apiKey`,环境变量 `INSTABOX_API_KEY` 覆盖;钥匙只在服务端,绝不进入机器、前端、日志或智能体上下文。 +- 本仓库是**公开仓库**:代码、测试、文档里不得出现内部域名、IP、邮箱、人名、真实钥匙。公共接口域名 `api.instabox.sh`、`connect.instabox.sh` 可以出现。 + +## 接口要点(实测) +- 基址 `https://api.instabox.sh`,请求头 `X-API-Key: `。 +- 生命周期调用(POST /v1/machines、PATCH、start/stop/suspend/resume/restore、POST snapshots、DELETE)**必须**带 `Idempotency-Key`;删机器另带 `X-Confirm-Delete: `。都返回 202 + 操作单 `{id,machineId,type,state,phase,error}`,用 `GET /v1/operations/{id}?wait=25s` 长轮询到 succeeded/failed。 +- 机器 state:creating、starting、running、stopping、stopped、suspending、suspended、resuming、deleting、deleted、error。 +- 创建:`{"name","templateId":"agent-browser"|"android","spec":{"vcpus":4,"memoryGiB":8},"autoSuspendAfterSeconds":600,"metadata":{...}}`。按名字找回机器:`GET /v1/machines`(按 name 过滤)。 +- 新建、冷启动、restore、从快照新建之后桌面不运行:必须 `POST /v1/machines/{id}/desktop {"action":"start","width":1280,"height":800}`。 +- exec:`POST /v1/machines/{id}/exec {"cmd"|"argv","envs","cwd","stdin","timeoutSeconds":1..600}` → `{stdout,stderr,exitCode,timedOut,truncated,...}`;非流式输出各 1 MiB 截断。默认没有 DISPLAY,桌面在 `:1`(Boat 是 :0)。后台任务用 `nohup setsid ... >log 2>&1 `,metadata 带 `{"app":"crybot","botId":...}`。 + +## 共享文件(各任务需要时原样创建,内容必须一字不差;已存在就不要改) +`server/instabox/machine.ts`: +```ts +/** cloud computer: the contract the four backend pieces share. */ +export type InstaboxTemplate = "linux" | "android"; +export type InstaboxMachineState = "creating" | "starting" | "running" | "stopping" | "stopped" | "suspending" | "suspended" | "resuming" | "deleting" | "deleted" | "error"; + +export interface InstaboxMachine { id: string; name: string; state: InstaboxMachineState; template: InstaboxTemplate } + +export interface InstaboxExecRequest { cmd?: string; argv?: string[]; envs?: Record; cwd?: string; stdin?: string; timeoutSeconds?: number } +export interface InstaboxExecResult { stdout: string; stderr: string; exitCode: number | null; timedOut: boolean; truncated: boolean } + +/** One authenticated API call. `idempotent: true` adds an Idempotency-Key; lifecycle calls need it. */ +export type InstaboxRequest = (method: string, path: string, opts?: { body?: unknown; raw?: Uint8Array; idempotent?: boolean; headers?: Record; query?: Record }) => Promise; + +export interface InstaboxMachines { + find(botId: string): Promise; + /** Create, resume or start the bot's machine as needed, then make sure its desktop runs. */ + ensureRunning(botId: string, opts?: { template?: InstaboxTemplate }): Promise; + suspend(botId: string): Promise; + remove(botId: string): Promise; + exec(machineId: string, req: InstaboxExecRequest): Promise; + readFile(machineId: string, path: string): Promise; + writeFile(machineId: string, path: string, data: Uint8Array, opts?: { mode?: string }): Promise; + /** Where the server connects for this machine's VNC (RFB, no password); headers carry the key and never leave the server. */ + vncUpstream(machineId: string): Promise<{ url: string; headers: Record }>; +} +``` +`shared/wire.ts:62` 改成(原行上改,不增行;文件正好 1000 行,多一行会挂行数门禁): +`export type CloudBackend = "box" | "vps" | "instabox";` + +## 行数门禁 +`scripts/testing/file-size-ratchet.test.ts`:登记文件不许变长,未登记文件不许超过 1000 行。`server/index.ts` 四个任务合计只剩约 110 行余量(由任务①统一占用),`ComputerPanel.tsx` 余量 25、`config.ts` 10、`store.ts` 17、`boat.ts` 1。新逻辑一律放 `server/instabox/` 下的新文件。 + +## 测试 +- 不连真实 。写 `server/testing/fake-instabox.ts` 风格的假服务(`createServer` 起本地 HTTP/WS,`vi.stubEnv` 或依赖注入指过去);各任务若都需要假服务,各自放在自己命名的文件里(如 `fake-instabox-power.ts`),避免同名冲突。 +- 本轮沙箱已放开,可监听端口:改动相关的测试全部跑过,涉及的 e2e 连跑 3 次。另跑 `pnpm exec tsc -p tsconfig.server.json`、前端有改动时跑前端 tsc,对改动文件跑 `oxlint --deny-warnings`。 +- 文案只加 `src/locales/zh.json` 和 `en.json`(且只有任务④加;其他任务需要文案时在报告里列出键名和中英文,由④统一加,代码里先用这些键)。 diff --git a/docs/tasks/T-1200/T-1246-instabox-wiring/r2.md b/docs/tasks/T-1200/T-1246-instabox-wiring/r2.md new file mode 100644 index 00000000..32acbb0c --- /dev/null +++ b/docs/tasks/T-1200/T-1246-instabox-wiring/r2.md @@ -0,0 +1,30 @@ +## 运行环境(云沙箱,必读) +- 开工先在 worktree 根目录运行 依赖准备脚本(镜像自带,把预装依赖链进 node_modules),之后 `pnpm exec vitest` / `pnpm exec tsc` 才可用。 +- 这里**没有** systemd、Docker,说明里出现的 `systemd-run --scope ... --` 前缀一律去掉直接运行;机器 8G/4 核,一次只跑一个测试文件。 +- 若本轮沙箱已放开(能联网、能监听端口),交回前必须把改动相关的测试全部跑过,包括需要端口的 e2e;涉及的 e2e 连跑 3 次都要过。跑不了的写明原因。 +- 报告只写三样:改了什么(文件列表与 git status 一致)、为什么、测试命令与结果摘要。不要写长篇分析;完整输出放 verification 文本文件即可。 +- 不提交 git。 + +# T-1246 第 2 轮:审核 3 条必改(生命周期互斥、快照总截止时间)+ 1 条建议 + +原任务见本文件夹 brief.md,工作区里已有改动保留,在此基础上改。下面是第 1 轮 Codex 只读审核的原文意见,必改 3 条全部修,建议 1 条一起做。 + +必改 + +1. [server/instabox/wiring.ts:56](/root/workspace/crybot/.worktrees/T-1246-instabox-wiring/server/instabox/wiring.ts:56) — 快照路由没有接入电脑生命周期锁,也不检查活跃回合。路由内部的 `busy` 只能排斥其他快照操作;智能体执行命令期间仍可恢复磁盘,恢复期间也能开始新回合或删除智能体。可能中断工作、覆盖正在写入的数据。应接入统一生命周期互斥,恢复前检查普通回合、群聊和控制占用,并补双向并发测试。 + +2. [server/instabox/wiring.ts:50](/root/workspace/crybot/.worktrees/T-1246-instabox-wiring/server/instabox/wiring.ts:50) — VNC 解析直接调用 `ensureRunning`,绕过删机流程持有的生命周期锁。删除机器完成、智能体记录尚未删除时,打开画面会重新创建机器;随后智能体删除成功,留下无人管理的机器。应让 VNC 启动与删除互斥,并在取得锁后重新检查智能体是否有效。补充删除过程中打开画面的回归测试。 + +3. [server/instabox/wiring.ts:28](/root/workspace/crybot/.worktrees/T-1246-instabox-wiring/server/instabox/wiring.ts:28) — 快照的 30 秒请求限制没有覆盖 `machineIdFor → machines.find` 和恢复后的 `machines.ensureRunning`,两者仍使用单请求 650 秒的客户端。例如查机耗时 600 秒、操作轮询再耗时 180 秒,已超过服务端 700 秒和前端 720 秒预算;连接结束也不会取消后台流程。应给完整快照流程统一截止时间,并约束查机、分页、轮询和开桌面的剩余预算,补充慢响应测试。 + +建议 + +1. [server/instabox/wiring.e2e.test.ts:96](/root/workspace/crybot/.worktrees/T-1246-instabox-wiring/server/instabox/wiring.e2e.test.ts:96) — box/vps 用例没有写入电脑工具执行计划,也没有断言消息请求成功;目前只能证明这段流程未访问假 。建议让两个后端实际执行电脑工具,并断言请求落到各自假后端。 + + +## 补充要求 +- 生命周期互斥复用服务端现有 Boat/VPS 用的那把锁和活跃回合检查,不另造一套;新逻辑仍放 `server/instabox/` 下,大文件只加挂载调用,注意行数门禁。 +- 每条必改都要有对应回归测试(快照与回合双向并发、删除过程中打开画面、慢响应超过总截止时间),e2e 连跑 3 次。 + +## 验收 +改动相关测试逐文件跑过(含 `server/instabox/` 全部、`server/index.test.ts`、file-size-ratchet);`pnpm exec tsc -p tsconfig.server.json`、前端 tsc;改动文件 `oxlint --deny-warnings`。report.md 追加第 2 轮一节(短);verification.txt 不写 IP、地址、域名、uuid、Object 相等判定写法。 diff --git a/docs/tasks/T-1200/T-1246-instabox-wiring/report.md b/docs/tasks/T-1200/T-1246-instabox-wiring/report.md new file mode 100644 index 00000000..a35229b5 --- /dev/null +++ b/docs/tasks/T-1200/T-1246-instabox-wiring/report.md @@ -0,0 +1,76 @@ +改了什么 + +接通服务端回合工具、VNC、快照路由与电脑面板;补齐缺钥匙禁选、设置保存后刷新、截图预览、快照等待预算、真实快照对象形状和 pt-br 的 bot 译法;修复配置测试隐式 any。文件清单与 `git status --short --untracked-files=all` 一致,未提交 git: + +```text + M server/index.ts + M server/instabox/client.ts + M server/instabox/power.test.ts + M server/instabox/power.ts + M server/routes/config-instabox.test.ts + M server/routes/instabox-snapshots.e2e.test.ts + M server/routes/instabox-snapshots.ts + M server/testing/fake-instabox-core.ts + M server/testing/fake-instabox-snapshots.ts + M shared/place-view.ts + M src/components/CloudBackendPicker.test.ts + M src/components/CloudBackendPicker.tsx + M src/components/ComputerPanel.tsx + M src/components/InstaboxSnapshots.test.tsx + M src/components/InstaboxSnapshots.tsx + M src/lib/place-view.ts + M src/locales/pt-br.json +?? docs/tasks/T-1200/T-1246-instabox-wiring/report.md +?? docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt +?? server/instabox/wiring.e2e.test.ts +?? server/instabox/wiring.ts +?? src/components/ComputerPanel.instabox.test.ts +?? src/components/instabox-panel.test.ts +?? src/components/instabox-panel.ts +``` + +为什么 + +已有配置 schema、section 合并、加载及环境覆盖继续复用,并由真实入口验证保存、读回、广播和末四位脱敏。新增 `wiring.ts` 统一机器缓存与凭据;单个智能体的普通/群聊回合绑定 工具,画面沿用 `vps/`,服务端按机器编号区分连接,换机后旧连接失效。共用电脑、本地 VM、多屏保持原路径。 + +快照 API 单次请求上限 30 秒,轮询按剩余时间缩短 wait;服务端路由留 700 秒、前端留 720 秒。创建快照的 operations/list 断言移至 restore 之前。入口为 15463/15515 行,电脑面板为 1774/1782 行。 + +测试命令与结果摘要 + +- 开工运行 依赖准备脚本。验证 README 缺失;服务验证均使用临时数据目录、隔离入口和本地假服务。 +- `pnpm exec vitest run <文件> --maxWorkers=1`:48 个相关文件最终全部通过,包含①–④全部 测试、`server/index.test.ts`(338)、`server/config.test.ts`(257)、`server/bot-box/env.test.ts`(11)、行数门禁及前端回归。完整逐文件命令见日志。 +- 8 个 e2e 文件均连续 3 次通过:core(15)、computer-tools(29)、vnc(32)、wiring(3)、snapshots(12)、request-auth(2)、key-readback(2)、place-view(7)。VNC 设置 `CRYBOT_CDP_CHROME=/usr/bin/chromium`,无浏览器用例跳过;桌面代理 HTTP 测试另连续 3 次通过(38)。 +- `pnpm exec tsc -p tsconfig.server.json`、`pnpm exec tsc -p tsconfig.json`:最终均通过。 +- 改动 TS/TSX/JSON 的 `pnpm exec oxlint --deny-warnings`、`node scripts/generate-locale.mjs --check`、`git diff --check`:通过。 +- 协调者仍需用真实钥匙核对真实快照耗时和部署反代的等待预算、真实 VNC 画面/输入、Android 冷启动,以及后台 activity lease 字段与续租行为。 + +完整输出(含修正前的 fixture/type-check 失败)见 [verification.txt](verification.txt)。 + + +## 第 2 轮 + +改了什么(本轮文件清单,与 `git status --short --untracked-files=all` 一致;未提交): + +```text + M docs/tasks/T-1200/T-1246-instabox-wiring/report.md + M docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt + M server/index.ts + M server/instabox/client.ts + M server/instabox/wiring.e2e.test.ts + M server/instabox/wiring.ts + M server/routes/instabox-snapshots.e2e.test.ts + M server/routes/instabox-snapshots.ts + M server/testing/fake-instabox-core.ts +?? server/instabox/snapshot-wiring.e2e.test.ts +?? server/instabox/snapshot-wiring.ts +?? server/instabox/wiring-backends-fixture.ts +?? server/instabox/wiring.test.ts +``` + +为什么:快照变更与 VNC 启动复用 Boat/VPS 生命周期锁;快照复用普通回合、群聊、例行任务和控制占用检查,VNC 取锁后复查智能体及凭据。快照全流程共用 600 秒截止时间,单请求仍限 30 秒,覆盖查机、分页、轮询、正文读取与恢复后的桌面启动,并在断连时取消。回归覆盖双向并发、删机窗口及慢响应;box/vps 用例执行电脑工具并断言各自假后端收到命令。入口仍为 15463 行。 + +测试命令与结果摘要: + +- `pnpm exec vitest run <文件> --maxWorkers=1`:22 个文件逐个通过,含 `server/instabox/` 全部、`server/index.test.ts`、快照路由、Boat/env 与行数门禁;7 个 e2e 文件及桌面代理 HTTP 测试均连续 3 次通过,VNC 设置 `CRYBOT_CDP_CHROME=/usr/bin/chromium`,浏览器用例实际执行。 +- `pnpm exec tsc -p tsconfig.server.json`、`pnpm exec tsc -p tsconfig.json`、改动文件 `pnpm exec oxlint --deny-warnings`、`git diff --check`:全部通过。 +- 验证 README 缺失;全部服务验证使用隔离 fixture。完整脱敏输出(含假后端修正前失败)见 [verification.txt](verification.txt)。 diff --git a/docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt b/docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt new file mode 100644 index 00000000..f50e7d77 --- /dev/null +++ b/docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt @@ -0,0 +1,2066 @@ +All application mutations used isolated fixtures. No real InstaBox service was used. +docs/verification/README.md is absent. Paths and runtime identifiers below are redacted. + +Dependency setup +crybot-link-deps: linked 73 entries; EXIT 0 + + +Initial wiring attempt 1: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + ❯ server/instabox/wiring.e2e.test.ts (3 tests | 1 failed) 17810ms + × wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry 8388ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL server/instabox/wiring.e2e.test.ts > wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry +AssertionError: expected 'box' to be 'instabox' + +Expected: "instabox" +Received: "box" + + ❯ server/instabox/wiring.e2e.test.ts:39:69 + 37| const bot = created.body.bot; + 38| const path = `/api/bots/${bot.id}`; + 39| expect((await request("GET", path + "/computer")).body.backend).to… + | ^ + 40| writeFileSync(app.planPath, JSON.stringify({ [bot.id]: { steps: [ + 41| { server: "computer", name: "exec", input: { command: "printf wi… + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed | 2 passed (3) + Start at 08:43:08 + Duration 22.04s (transform 2.01s, setup 2.15s, import 1.61s, tests 17.81s, environment 0ms) + + + +Initial wiring attempt 2: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + ❯ server/instabox/wiring.e2e.test.ts (3 tests | 1 failed) 57030ms + × wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry 52254ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL server/instabox/wiring.e2e.test.ts > wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry +AssertionError: expected false to be true + +- Expected ++ Received + +- true ++ false + + ❯ server/instabox/wiring.e2e.test.ts:46:113 + 44| ], reply: "Wiring complete." } })); + 45| expect((await request("POST", path + "/messages", { text: "Use the… + 46| await expect.poll(() => fake.calls.some(call => call.path.endsWith… + | ^ + 47| await expect.poll(async () => (await request("GET", "/api/bots")).… + 48| expect(fake.calls.some(call => call.path.endsWith("/exec") && call… + +Caused by: Error: Matcher did not succeed in time. + ❯ server/instabox/wiring.e2e.test.ts:46:5 + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed | 2 passed (3) + Start at 08:44:43 + Duration 60.40s (transform 2.25s, setup 1.65s, import 1.46s, tests 57.03s, environment 0ms) + + + +Initial wiring attempt 3: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 08:46:10 + Duration 19.43s (transform 1.78s, setup 973ms, import 1.33s, tests 16.98s, environment 0ms) + + + +Initial server type check: pnpm exec tsc -p tsconfig.server.json +server/instabox/wiring.e2e.test.ts(28,12): error TS2571: Object is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(32,12): error TS2571: Object is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(37,17): error TS18046: 'created.body' is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(40,12): error TS2571: Object is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(47,35): error TS2571: Object is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(52,12): error TS2571: Object is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(64,12): error TS2571: Object is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(64,71): error TS18046: 'saved.body' is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(66,51): error TS18046: 'saved.body' is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(85,17): error TS2571: Object is of type 'unknown'. +server/instabox/wiring.e2e.test.ts(90,35): error TS2571: Object is of type 'unknown'. + + +Sequential regression checks; CRYBOT_CDP_CHROME=/usr/bin/chromium + +$ pnpm exec vitest run server/instabox/client.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 08:47:35 + Duration 1.38s (transform 874ms, setup 1.10s, import 33ms, tests 89ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 08:47:37 + Duration 11.52s (transform 1.16s, setup 1.14s, import 355ms, tests 9.86s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 08:47:49 + Duration 11.70s (transform 1.24s, setup 1.18s, import 396ms, tests 9.96s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 08:48:02 + Duration 11.72s (transform 1.33s, setup 1.28s, import 406ms, tests 9.86s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 15 passed (15) + Start at 08:48:14 + Duration 62.23s (transform 1.84s, setup 1.03s, import 1.40s, tests 59.66s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 15 passed (15) + Start at 08:49:17 + Duration 60.66s (transform 1.72s, setup 979ms, import 1.28s, tests 58.25s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 15 passed (15) + Start at 08:50:18 + Duration 58.16s (transform 1.66s, setup 956ms, import 1.24s, tests 55.82s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/key.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 4 passed (4) + Start at 08:51:17 + Duration 1.22s (transform 804ms, setup 1.04s, import 10ms, tests 17ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/machines.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 24 passed (24) + Start at 08:51:19 + Duration 1.95s (transform 816ms, setup 997ms, import 56ms, tests 752ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/persistence.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 1 passed (1) + Start at 08:51:21 + Duration 1.53s (transform 1.05s, setup 964ms, import 410ms, tests 27ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/power.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 08:51:23 + Duration 2.13s (transform 1.54s, setup 951ms, import 1.03s, tests 9ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 32 passed (32) + Start at 08:51:26 + Duration 9.05s (transform 1.48s, setup 896ms, import 984ms, tests 7.02s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 32 passed (32) + Start at 08:51:35 + Duration 3.99s (transform 1.41s, setup 971ms, import 840ms, tests 2.04s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 32 passed (32) + Start at 08:51:40 + Duration 3.83s (transform 1.33s, setup 951ms, import 758ms, tests 1.99s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/vnc.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:51:44 + Duration 1.07s (transform 708ms, setup 921ms, import 10ms, tests 4ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 08:51:46 + Duration 16.38s (transform 1.22s, setup 833ms, import 812ms, tests 14.60s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 08:52:03 + Duration 16.26s (transform 1.24s, setup 868ms, import 798ms, tests 14.45s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 08:52:20 + Duration 16.57s (transform 1.22s, setup 848ms, import 801ms, tests 14.79s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 08:52:37 + Duration 3.60s (transform 2.26s, setup 925ms, import 1.92s, tests 614ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 08:52:41 + Duration 3.44s (transform 2.10s, setup 935ms, import 1.74s, tests 624ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 08:52:45 + Duration 3.56s (transform 2.22s, setup 1000ms, import 1.81s, tests 609ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/config-instabox.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 08:52:49 + Duration 3.14s (transform 2.30s, setup 1.05s, import 1.85s, tests 72ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/index.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 338 passed (338) + Start at 08:52:53 + Duration 148.86s (transform 1.31s, setup 866ms, import 870ms, tests 146.99s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/bot-box/env.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 11 passed (11) + Start at 08:55:22 + Duration 1.43s (transform 939ms, setup 1.19s, import 20ms, tests 60ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run scripts/testing/file-size-ratchet.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 1 passed (1) + Start at 08:55:25 + Duration 1.35s (transform 867ms, setup 1.09s, import 10ms, tests 92ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/config.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 257 passed (257) + Start at 08:55:26 + Duration 2.63s (transform 1.09s, setup 1.26s, import 146ms, tests 1.06s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/cloud-backend.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 08:55:30 + Duration 1.32s (transform 901ms, setup 1.13s, import 16ms, tests 5ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/cloud-computer-tools.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 33 passed (33) + Start at 08:55:32 + Duration 2.27s (transform 984ms, setup 1.03s, import 16ms, tests 1.08s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/cloud-computer-background.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 60 passed (60) + Start at 08:55:34 + Duration 24.43s (transform 932ms, setup 967ms, import 24ms, tests 23.31s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/cloud-computer-files.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + +(node:60862) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [ServerResponse]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit +(Use `node --trace-warnings ...` to show where the warning was created) + + Test Files 1 passed (1) + Tests 27 passed (27) + Start at 08:56:00 + Duration 2.65s (transform 1.01s, setup 1.04s, import 25ms, tests 1.44s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 38 passed (38) + Start at 08:56:03 + Duration 32.71s (transform 1.61s, setup 988ms, import 1.05s, tests 30.54s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/desktop-viewer-targets.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 08:56:36 + Duration 1.91s (transform 1.38s, setup 860ms, import 903ms, tests 7ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run shared/place-view.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 19 passed (19) + Start at 08:56:39 + Duration 1.37s (transform 915ms, setup 1.09s, import 122ms, tests 22ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/CloudBackendPicker.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 8 passed (8) + Start at 08:56:40 + Duration 2.08s (transform 1.46s, setup 996ms, import 929ms, tests 26ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/InstaboxSnapshots.test.tsx --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 08:56:43 + Duration 2.71s (transform 810ms, setup 908ms, import 351ms, tests 56ms, environment 1.25s) + +EXIT 0 + +$ pnpm exec vitest run src/components/instabox-panel.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 5 passed (5) + Start at 08:56:46 + Duration 1.80s (transform 1.26s, setup 915ms, import 739ms, tests 4ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.android.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 08:56:49 + Duration 3.58s (transform 2.07s, setup 985ms, import 1.76s, tests 524ms, environment 160ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.browser.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 08:56:53 + Duration 2.69s (transform 1.94s, setup 866ms, import 1.66s, tests 42ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.engine.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 18 passed (18) + Start at 08:56:56 + Duration 2.68s (transform 1.55s, setup 719ms, import 1.31s, tests 372ms, environment 141ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.focus.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 08:56:59 + Duration 2.99s (transform 1.62s, setup 775ms, import 1.36s, tests 600ms, environment 134ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.i18n.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 08:57:03 + Duration 1.25s (transform 734ms, setup 898ms, import 128ms, tests 77ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.lazy.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 9 passed (9) + Start at 08:57:05 + Duration 2.93s (transform 1.62s, setup 853ms, import 1.27s, tests 499ms, environment 164ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.live.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + +AggregateError: + at internalConnectMultiple (node:net:1492:18) + at afterConnectMultiple (node:net:2161:7) { + code: 'ECONNREFUSED', + [errors]: [ + Error: connect ECONNREFUSED [loopback]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[loopback]', + port: 3000 + }, + Error: connect ECONNREFUSED [address]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[address]', + port: 3000 + } + ] +} +AggregateError: + at internalConnectMultiple (node:net:1492:18) + at afterConnectMultiple (node:net:2161:7) { + code: 'ECONNREFUSED', + [errors]: [ + Error: connect ECONNREFUSED [loopback]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[loopback]', + port: 3000 + }, + Error: connect ECONNREFUSED [address]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[address]', + port: 3000 + } + ] +} +AggregateError: + at internalConnectMultiple (node:net:1492:18) + at afterConnectMultiple (node:net:2161:7) { + code: 'ECONNREFUSED', + [errors]: [ + Error: connect ECONNREFUSED [loopback]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[loopback]', + port: 3000 + }, + Error: connect ECONNREFUSED [address]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[address]', + port: 3000 + } + ] +} + + Test Files 1 passed (1) + Tests 5 passed (5) + Start at 08:57:08 + Duration 2.36s (transform 1.53s, setup 728ms, import 1.28s, tests 86ms, environment 140ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.simple.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 45 passed (45) + Start at 08:57:11 + Duration 2.20s (transform 1.43s, setup 721ms, import 1.17s, tests 191ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.tabs.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 11 passed (11) + Start at 08:57:14 + Duration 3.55s (transform 1.49s, setup 743ms, import 1.20s, tests 1.35s, environment 139ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.takeover.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 08:57:18 + Duration 26.25s (transform 1.61s, setup 733ms, import 1.37s, tests 23.88s, environment 139ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 5 passed (5) + Start at 08:57:45 + Duration 990ms (transform 648ms, setup 827ms, import 23ms, tests 6ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/lib/desktop-connection.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 08:57:46 + Duration 1.05s (transform 604ms, setup 757ms, import 23ms, tests 10ms, environment 139ms) + +EXIT 0 + +$ pnpm exec vitest run src/lib/local-computer.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 19 passed (19) + Start at 08:57:48 + Duration 948ms (transform 621ms, setup 713ms, import 105ms, tests 12ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/lib/i18n.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 39 passed (39) + Start at 08:57:49 + Duration 6.16s (transform 2.70s, setup 766ms, import 39ms, tests 5.24s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/locales/sent-keys.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:57:56 + Duration 1.02s (transform 627ms, setup 758ms, import 67ms, tests 83ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/keys/key-catalog.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 16 passed (16) + Start at 08:57:57 + Duration 1.02s (transform 631ms, setup 776ms, import 108ms, tests 17ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/keys/KeysPage.dom.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 24 passed (24) + Start at 08:57:59 + Duration 3.15s (transform 999ms, setup 738ms, import 602ms, tests 1.53s, environment 141ms) + +EXIT 0 + +$ pnpm exec vitest run src/state/store.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 243 passed (243) + Start at 08:58:02 + Duration 2.00s (transform 881ms, setup 669ms, import 515ms, tests 559ms, environment 129ms) + +EXIT 0 + +$ pnpm exec tsc -p tsconfig.server.json +EXIT 0 + +$ pnpm exec tsc -p tsconfig.json +src/components/instabox-panel.test.ts(22,94): error TS2322: Type '{ configured: false; }' is not assignable to type 'SavedKey & { fromEnv: boolean; }'. + Property 'fromEnv' is missing in type '{ configured: false; }' but required in type '{ fromEnv: boolean; }'. +src/components/instabox-panel.test.ts(25,81): error TS2322: Type '{ configured: true; }' is not assignable to type 'SavedKey & { fromEnv: boolean; }'. + Property 'fromEnv' is missing in type '{ configured: true; }' but required in type '{ fromEnv: boolean; }'. +EXIT 1 + +$ node scripts/generate-locale.mjs --check +de.json: 37% (3965/10636) +es.json: 61% (6481/10636) +fr.json: 36% (3794/10636) +hi.json: 34% (3648/10636) +it.json: 67% (7100/10636) +ja.json: 76% (8069/10636) +ko.json: 73% (7754/10636) +pl.json: 68% (7242/10636) +pt-br.json: 100% (10627/10636) +ru.json: 69% (7294/10636) +tr.json: 56% (5985/10636) +uk.json: 38% (4069/10636) +vi.json: 56% (5985/10636) +zh-tw.json: 96% (10246/10636) +zh.json: 76% (8043/10636) +locale catalogs valid (16 languages, 10636 English strings) +EXIT 0 + + +Additional sequential checks; CRYBOT_CDP_CHROME=/usr/bin/chromium + +$ pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:58:38 + Duration 6.09s (transform 1.21s, setup 833ms, import 787ms, tests 4.34s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:58:45 + Duration 7.66s (transform 1.92s, setup 1.32s, import 1.22s, tests 4.94s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:58:54 + Duration 9.96s (transform 2.81s, setup 1.89s, import 1.77s, tests 6.02s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run scripts/testing/key-readback.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:59:04 + Duration 9.92s (transform 2.65s, setup 1.35s, import 2.14s, tests 6.25s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run scripts/testing/key-readback.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:59:15 + Duration 9.19s (transform 2.35s, setup 1.18s, import 1.96s, tests 5.90s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run scripts/testing/key-readback.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 08:59:24 + Duration 9.07s (transform 2.36s, setup 1.17s, import 1.98s, tests 5.79s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/place-view.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 08:59:34 + Duration 23.06s (transform 831ms, setup 969ms, import 93ms, tests 21.85s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/place-view.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 08:59:58 + Duration 23.22s (transform 931ms, setup 1.11s, import 89ms, tests 21.85s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/place-view.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 09:00:22 + Duration 23.00s (transform 885ms, setup 1.04s, import 88ms, tests 21.71s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 38 passed (38) + Start at 09:00:45 + Duration 32.95s (transform 1.68s, setup 1.05s, import 1.09s, tests 30.66s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 38 passed (38) + Start at 09:01:19 + Duration 32.78s (transform 1.60s, setup 934ms, import 1.09s, tests 30.62s, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 38 passed (38) + Start at 09:01:52 + Duration 33.10s (transform 1.86s, setup 1.15s, import 1.19s, tests 30.61s, environment 0ms) + +EXIT 0 + + +UI verification after key-status refresh change + +$ pnpm exec vitest run src/components/ComputerPanel.instabox.test.ts --maxWorkers=1 + + RUN v4.1.11 . + +stderr | src/components/ComputerPanel.instabox.test.ts > refreshes the selected InstaBox panel when its key is saved in Settings +TypeError: Cannot read properties of undefined (reading 'configured') + at ComputerPanel (./src/components/ComputerPanel.tsx:355:50) + at Object.react_stack_bottom_frame (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) + at renderWithHooks (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) + at updateFunctionComponent (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) + at beginWork (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:11778:18) + at runWithFiberInDEV (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) + at performUnitOfWork (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) + at workLoopSync (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) + at renderRootSync (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) + at performWorkOnRoot (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) +An error occurred in the component. + +Consider adding an error boundary to your tree to customize error handling behavior. +Visit [fixture-url] to learn more about error boundaries. + + + ❯ src/components/ComputerPanel.instabox.test.ts (1 test | 1 failed) 1027ms + × refreshes the selected InstaBox panel when its key is saved in Settings 1025ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL src/components/ComputerPanel.instabox.test.ts > refreshes the selected InstaBox panel when its key is saved in Settings +AssertionError: expected 0 to be greater than 0 + ❯ src/components/ComputerPanel.instabox.test.ts:55:50 + 53| try { + 54| render(); + 55| await vi.waitFor(() => expect(fixture.reads).toBeGreaterThan(0)); + | ^ + 56| await vi.waitFor(() => expect(host.textContent).toContain("Add you… + 57| const reads = fixture.reads; + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed (1) + Start at 09:02:33 + Duration 4.06s (transform 2.07s, setup 1.04s, import 1.64s, tests 1.03s, environment 183ms) + +EXIT 1 + +$ pnpm exec vitest run src/components/instabox-panel.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 5 passed (5) + Start at 09:02:38 + Duration 1.85s (transform 1.30s, setup 903ms, import 804ms, tests 4ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.android.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 09:02:40 + Duration 3.55s (transform 2.06s, setup 930ms, import 1.75s, tests 561ms, environment 157ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.browser.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 09:02:44 + Duration 3.94s (transform 2.90s, setup 1.12s, import 2.62s, tests 44ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.engine.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 18 passed (18) + Start at 09:02:49 + Duration 2.92s (transform 1.70s, setup 842ms, import 1.36s, tests 413ms, environment 159ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.focus.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 09:02:52 + Duration 3.30s (transform 1.84s, setup 907ms, import 1.51s, tests 609ms, environment 154ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.i18n.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 09:02:56 + Duration 1.24s (transform 729ms, setup 887ms, import 147ms, tests 72ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.lazy.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 9 passed (9) + Start at 09:02:58 + Duration 3.44s (transform 1.99s, setup 974ms, import 1.63s, tests 535ms, environment 148ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.live.test.ts --maxWorkers=1 + + RUN v4.1.11 . + +AggregateError: + at internalConnectMultiple (node:net:1492:18) + at afterConnectMultiple (node:net:2161:7) { + code: 'ECONNREFUSED', + [errors]: [ + Error: connect ECONNREFUSED [loopback]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[loopback]', + port: 3000 + }, + Error: connect ECONNREFUSED [address]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[address]', + port: 3000 + } + ] +} +AggregateError: + at internalConnectMultiple (node:net:1492:18) + at afterConnectMultiple (node:net:2161:7) { + code: 'ECONNREFUSED', + [errors]: [ + Error: connect ECONNREFUSED [loopback]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[loopback]', + port: 3000 + }, + Error: connect ECONNREFUSED [address]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[address]', + port: 3000 + } + ] +} +AggregateError: + at internalConnectMultiple (node:net:1492:18) + at afterConnectMultiple (node:net:2161:7) { + code: 'ECONNREFUSED', + [errors]: [ + Error: connect ECONNREFUSED [loopback]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[loopback]', + port: 3000 + }, + Error: connect ECONNREFUSED [address]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[address]', + port: 3000 + } + ] +} + + Test Files 1 passed (1) + Tests 5 passed (5) + Start at 09:03:02 + Duration 3.03s (transform 2.01s, setup 1.05s, import 1.57s, tests 104ms, environment 165ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.simple.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 45 passed (45) + Start at 09:03:06 + Duration 3.00s (transform 2.02s, setup 961ms, import 1.66s, tests 236ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.tabs.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 11 passed (11) + Start at 09:03:09 + Duration 4.15s (transform 1.84s, setup 944ms, import 1.48s, tests 1.45s, environment 150ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.takeover.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 09:03:14 + Duration 26.92s (transform 1.93s, setup 940ms, import 1.58s, tests 24.12s, environment 145ms) + +EXIT 0 + +$ pnpm exec vitest run src/components/ComputerPanel.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 5 passed (5) + Start at 09:03:41 + Duration 1.35s (transform 930ms, setup 1.16s, import 26ms, tests 7ms, environment 0ms) + +EXIT 0 + +$ pnpm exec vitest run scripts/testing/file-size-ratchet.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 1 passed (1) + Start at 09:03:43 + Duration 1.42s (transform 889ms, setup 1.16s, import 10ms, tests 92ms, environment 0ms) + +EXIT 0 + + +DOM fixture follow-up: pnpm exec vitest run src/components/ComputerPanel.instabox.test.ts --maxWorkers=1 + + RUN v4.1.11 . + +AggregateError: + at internalConnectMultiple (node:net:1492:18) + at afterConnectMultiple (node:net:2161:7) { + code: 'ECONNREFUSED', + [errors]: [ + Error: connect ECONNREFUSED [loopback]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[loopback]', + port: 3000 + }, + Error: connect ECONNREFUSED [address]:3000 + at createConnectionError (node:net:2124:14) + at afterConnectMultiple (node:net:2154:16) { + errno: -111, + code: 'ECONNREFUSED', + syscall: 'connect', + address: '[address]', + port: 3000 + } + ] +} + + Test Files 1 passed (1) + Tests 1 passed (1) + Start at 09:04:10 + Duration 3.45s (transform 2.35s, setup 1.05s, import 1.99s, tests 111ms, environment 163ms) + + + +Final isolated DOM fixture: pnpm exec vitest run src/components/ComputerPanel.instabox.test.ts --maxWorkers=1; EXIT 0 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 1 passed (1) + Start at 09:05:00 + Duration 3.34s (transform 2.25s, setup 1.04s, import 1.88s, tests 105ms, environment 162ms) + + + +Final frontend type check: pnpm exec tsc -p tsconfig.json; EXIT 0 + + +Final changed-file lint +$ pnpm exec oxlint --deny-warnings server/index.ts server/instabox/client.ts server/instabox/power.test.ts server/instabox/power.ts server/routes/config-instabox.test.ts server/routes/instabox-snapshots.e2e.test.ts server/routes/instabox-snapshots.ts server/testing/fake-instabox-core.ts server/testing/fake-instabox-snapshots.ts shared/place-view.ts src/components/CloudBackendPicker.test.ts src/components/CloudBackendPicker.tsx src/components/ComputerPanel.tsx src/components/InstaboxSnapshots.test.tsx src/components/InstaboxSnapshots.tsx src/lib/place-view.ts src/locales/pt-br.json server/instabox/wiring.e2e.test.ts server/instabox/wiring.ts src/components/ComputerPanel.instabox.test.ts src/components/instabox-panel.test.ts src/components/instabox-panel.ts +EXIT 0 + + +Final whitespace check +git diff --check +EXIT 0 + + + +Round 2 +All mutations used isolated fixtures and temporary data. The verification README is absent. +Dependency setup: crybot-link-deps linked 73 entries; EXIT 0. +Chromium was explicitly enabled for the final VNC runs. + +Initial lifecycle regression run: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:14:58 + Duration 33.36s (transform 2.13s, setup 1.49s, import 1.68s, tests 29.96s, environment 0ms) + + +Initial deadline fixture: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + ❯ server/instabox/snapshot-wiring.e2e.test.ts (6 tests | 1 failed) 4552ms + × bounds the whole snapshot flow including slow desktop responses 1690ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL server/instabox/snapshot-wiring.e2e.test.ts > bounds the whole snapshot flow including slow desktop responses +AssertionError: expected false to be true + +- Expected ++ Received + +- true ++ false + + ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:57 + 75| expect(Date.now() - start).toBeLessThan(700); + 76| expect(f.locked()).toBe(false); + 77| if (stage !== "pages") await expect.poll(f.cancelled).toBe(true); + | ^ + 78| if (stage === "pages") expect(f.calls.length).toBeLessThanOrEqual(3); + 79| if (stage === "poll" || stage === "desktop") { + +Caused by: Error: Matcher did not succeed in time. + ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:26 + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed | 5 passed (6) + Start at 09:16:09 + Duration 7.83s (transform 2.49s, setup 1.19s, import 1.94s, tests 4.55s, environment 0ms) + + +Initial backend fixture: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + ❯ server/instabox/wiring.e2e.test.ts (6 tests | 1 failed) 59751ms + × keeps box computer and snapshot/viewer paths away from InstaBox 32832ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL server/instabox/wiring.e2e.test.ts > keeps box computer and snapshot/viewer paths away from InstaBox +AssertionError: expected false to be true + +- Expected ++ Received + +- true ++ false + + ❯ server/instabox/wiring.e2e.test.ts:106:119 + 104| await expect.poll(() => backends.calls.some(call => backend === "b… + 105| ? call.path.endsWith("/commands") && call.body.command?.includes… + 106| : call.path === "/vps/exec" && call.body.arguments?.command === … + | ^ + 107| await expect.poll(async () => (await f.request("GET", "/api/bots")… + 108| expect((await f.request("GET", path + "/instabox/snapshots")).stat… + +Caused by: Error: Matcher did not succeed in time. + ❯ server/instabox/wiring.e2e.test.ts:104:5 + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed | 5 passed (6) + Start at 09:17:17 + Duration 62.61s (transform 2.05s, setup 1.29s, import 1.39s, tests 59.75s, environment 0ms) + + +Boat fixture diagnosis: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 -t 'keeps box' + + RUN v4.1.11 . + +stdout | server/instabox/wiring.e2e.test.ts > keeps box computer and snapshot/viewer paths away from InstaBox +[{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{"ttlSeconds":28800,"noEnv":true}},{"path":"/sandboxes/bx_23456789","body":{"name":"cry-d68864c9d3e4-e86175f8-30a9ff"}},{"path":"/sandboxes/bx_23456789","body":{}},{"path":"/sandboxes/bx_23456789/desktop","body":{}},{"path":"/sandboxes/bx_23456789/desktop","body":{}},{"path":"/sandboxes/bx_23456789","body":{}},{"path":"/sandboxes/bx_23456789","body":{}},{"path":"/sandboxes/bx_23456789","body":{}}] +Feishu device session revalidation: revoked 0. +bot box: off (not-cloud) +crybot webhook receiver on [endpoint] +Cry Bot open-source edition +local requests: owner trust (self-hosted default) +local requests: CRYBOT_DEV_TRUST_LOCAL_BROWSER=1: browsers on this machine act as the owner (development only) +brand: Cry Bot +crybot server on [endpoint] +Local VM startup recovery complete +[cry-turn] bot=[identifier] text="Use the computer." images=0 depth=0 card=false +[cry-turn] bot=[identifier] text="[From Cry Bot · incident report · information only — not from the pers" images=0 depth=0 card=false +browser engine: unavailable (agent-browser is not installed on this machine yet); bots get no browser tools until it is installed + + + ❯ server/instabox/wiring.e2e.test.ts (6 tests | 1 failed | 5 skipped) 32873ms + × keeps box computer and snapshot/viewer paths away from InstaBox 32871ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL server/instabox/wiring.e2e.test.ts > keeps box computer and snapshot/viewer paths away from InstaBox +AssertionError: expected false to be true + +- Expected ++ Received + +- true ++ false + + ❯ server/instabox/wiring.e2e.test.ts:106:119 + 104| await expect.poll(() => backends.calls.some(call => backend === "b… + 105| ? call.path.endsWith("/commands") && call.body.command?.includes… + 106| : call.path === "/vps/exec" && call.body.arguments?.command === … + | ^ + 107| await expect.poll(async () => (await f.request("GET", "/api/bots")… + 108| expect((await f.request("GET", path + "/instabox/snapshots")).stat… + +Caused by: Error: Matcher did not succeed in time. + ❯ server/instabox/wiring.e2e.test.ts:104:5 + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed | 5 skipped (6) + Start at 09:18:55 + Duration 35.73s (transform 2.04s, setup 1.37s, import 1.31s, tests 32.87s, environment 0ms) + + +Backend fixture corrected: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:19:54 + Duration 31.98s (transform 1.97s, setup 1.32s, import 1.27s, tests 29.21s, environment 0ms) + + +Deadline fixture before correcting operation routing + +COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + ❯ server/instabox/snapshot-wiring.e2e.test.ts (6 tests | 1 failed) 5817ms + × bounds the whole snapshot flow including slow desktop responses 1632ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL server/instabox/snapshot-wiring.e2e.test.ts > bounds the whole snapshot flow including slow desktop responses +AssertionError: expected false to be true + +- Expected ++ Received + +- true ++ false + + ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:57 + 75| expect(Date.now() - start).toBeLessThan(1_200); + 76| expect(f.locked()).toBe(false); + 77| if (stage !== "pages") await expect.poll(f.cancelled).toBe(true); + | ^ + 78| if (stage === "pages") expect(f.calls.length).toBeLessThanOrEqual(3); + 79| if (stage === "poll" || stage === "desktop") { + +Caused by: Error: Matcher did not succeed in time. + ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:26 + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed | 5 passed (6) + Start at 09:21:24 + Duration 8.54s (transform 2.02s, setup 1.14s, import 1.41s, tests 5.82s, environment 0ms) + +EXIT 1 + +Deadline fixture diagnosis: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 -t 'slow desktop' + + RUN v4.1.11 . + + ❯ server/instabox/snapshot-wiring.e2e.test.ts (6 tests | 1 failed | 5 skipped) 629ms + × bounds the whole snapshot flow including slow desktop responses 627ms + +⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ + + FAIL server/instabox/snapshot-wiring.e2e.test.ts > bounds the whole snapshot flow including slow desktop responses +AssertionError: expected [ '/v1/snapshots/saved', …(3) ] to include '/v1/machines/machine/desktop' + ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:67 + 75| expect(Date.now() - start).toBeLessThan(1_200); + 76| expect(f.locked()).toBe(false); + 77| if (stage === "desktop") expect(f.calls.map(call => call.path)).toCo… + | ^ + 78| if (stage !== "pages") await expect.poll(f.cancelled).toBe(true); + 79| if (stage === "pages") expect(f.calls.length).toBeLessThanOrEqual(3); + +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ + + + Test Files 1 failed (1) + Tests 1 failed | 5 skipped (6) + Start at 09:22:12 + Duration 3.24s (transform 1.90s, setup 1.14s, import 1.29s, tests 629ms, environment 0ms) + + +Final serial acceptance; each related e2e ran three consecutive times + +COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:22:29 + Duration 7.94s (transform 2.07s, setup 1.26s, import 1.37s, tests 5.14s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:22:37 + Duration 7.99s (transform 2.11s, setup 1.27s, import 1.42s, tests 5.13s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:22:46 + Duration 7.61s (transform 1.82s, setup 1.03s, import 1.30s, tests 5.13s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:22:54 + Duration 30.67s (transform 1.51s, setup 1.03s, import 987ms, tests 28.52s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:23:25 + Duration 29.68s (transform 1.43s, setup 989ms, import 944ms, tests 27.62s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:23:55 + Duration 29.56s (transform 1.40s, setup 1.03s, import 847ms, tests 27.56s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 15 passed (15) + Start at 09:24:26 + Duration 66.34s (transform 1.92s, setup 1.14s, import 1.40s, tests 63.63s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 15 passed (15) + Start at 09:25:33 + Duration 66.25s (transform 2.23s, setup 1.18s, import 1.71s, tests 63.19s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 15 passed (15) + Start at 09:26:40 + Duration 68.34s (transform 2.26s, setup 1.32s, import 1.64s, tests 65.21s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 09:27:49 + Duration 11.88s (transform 1.34s, setup 1.26s, import 451ms, tests 10.00s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 09:28:01 + Duration 11.92s (transform 1.37s, setup 1.37s, import 399ms, tests 9.98s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 29 passed (29) + Start at 09:28:14 + Duration 11.74s (transform 1.24s, setup 1.25s, import 362ms, tests 9.99s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 32 passed (32) + Start at 09:28:26 + Duration 8.67s (transform 2.05s, setup 1.33s, import 1.27s, tests 5.87s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 32 passed (32) + Start at 09:28:36 + Duration 5.33s (transform 2.22s, setup 1.54s, import 1.26s, tests 2.33s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 32 passed (32) + Start at 09:28:42 + Duration 5.02s (transform 2.02s, setup 1.37s, import 1.15s, tests 2.32s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 09:28:47 + Duration 4.37s (transform 2.80s, setup 1.21s, import 2.33s, tests 654ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 09:28:53 + Duration 4.39s (transform 2.87s, setup 1.32s, import 2.27s, tests 626ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 12 passed (12) + Start at 09:28:58 + Duration 4.45s (transform 2.91s, setup 1.31s, import 2.33s, tests 642ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 38 passed (38) + Start at 09:29:03 + Duration 32.79s (transform 1.66s, setup 1.01s, import 1.10s, tests 30.54s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 38 passed (38) + Start at 09:29:36 + Duration 32.97s (transform 1.78s, setup 1.09s, import 1.16s, tests 30.57s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 38 passed (38) + Start at 09:30:10 + Duration 33.20s (transform 1.86s, setup 1.12s, import 1.25s, tests 30.65s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 1/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 09:30:44 + Duration 6.81s (transform 1.63s, setup 1.05s, import 1.11s, tests 4.50s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 2/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 09:30:51 + Duration 6.13s (transform 1.32s, setup 1.01s, import 795ms, tests 4.19s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 3/3) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 09:30:58 + Duration 6.17s (transform 1.24s, setup 897ms, import 785ms, tests 4.36s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/client.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:31:05 + Duration 1.17s (transform 735ms, setup 930ms, import 43ms, tests 68ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/key.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 4 passed (4) + Start at 09:31:06 + Duration 1.09s (transform 724ms, setup 935ms, import 10ms, tests 19ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/machines.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 24 passed (24) + Start at 09:31:08 + Duration 1.82s (transform 720ms, setup 886ms, import 52ms, tests 738ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/persistence.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 1 passed (1) + Start at 09:31:10 + Duration 1.72s (transform 1.21s, setup 1.11s, import 432ms, tests 22ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/power.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 7 passed (7) + Start at 09:31:13 + Duration 2.28s (transform 1.66s, setup 997ms, import 1.15s, tests 9ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/vnc.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 09:31:16 + Duration 1.20s (transform 806ms, setup 1.03s, import 11ms, tests 4ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/instabox/wiring.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 09:31:17 + Duration 2.14s (transform 1.55s, setup 971ms, import 1.02s, tests 11ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/index.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 338 passed (338) + Start at 09:31:20 + Duration 175.86s (transform 1.48s, setup 980ms, import 922ms, tests 173.81s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/bot-box/env.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 11 passed (11) + Start at 09:34:17 + Duration 1.66s (transform 1.05s, setup 1.30s, import 22ms, tests 142ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/boat-lifecycle.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 09:34:19 + Duration 1.75s (transform 1.16s, setup 1.24s, import 14ms, tests 304ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/cloud-computer-tools.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 33 passed (33) + Start at 09:34:21 + Duration 2.95s (transform 1.45s, setup 1.42s, import 24ms, tests 1.31s, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run server/routes/config-instabox.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:34:25 + Duration 4.46s (transform 3.36s, setup 1.26s, import 2.87s, tests 138ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run src/components/InstaboxSnapshots.test.tsx --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 6 passed (6) + Start at 09:34:30 + Duration 3.15s (transform 1.56s, setup 1.63s, import 438ms, tests 115ms, environment 765ms) + +EXIT 0 + +COMMAND: pnpm exec vitest run scripts/testing/file-size-ratchet.test.ts --maxWorkers=1 (run 1/1) + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 1 passed (1) + Start at 09:34:34 + Duration 2.16s (transform 1.23s, setup 1.56s, import 18ms, tests 391ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec tsc -p tsconfig.server.json +EXIT 0 + +COMMAND: pnpm exec tsc -p tsconfig.json +EXIT 0 + +Changed-file lint +COMMAND: pnpm exec oxlint --deny-warnings server/index.ts server/instabox/client.ts server/instabox/wiring.e2e.test.ts server/instabox/wiring.ts server/routes/instabox-snapshots.e2e.test.ts server/routes/instabox-snapshots.ts server/testing/fake-instabox-core.ts server/instabox/snapshot-wiring.e2e.test.ts server/instabox/snapshot-wiring.ts server/instabox/wiring-backends-fixture.ts server/instabox/wiring.test.ts +EXIT 0 + +Final retained-target regression and lint after sealing its machine stub + +COMMAND: pnpm exec vitest run server/instabox/wiring.test.ts --maxWorkers=1 + + RUN v4.1.11 . + + + Test Files 1 passed (1) + Tests 3 passed (3) + Start at 09:35:10 + Duration 3.78s (transform 2.89s, setup 1.59s, import 2.01s, tests 14ms, environment 0ms) + +EXIT 0 + +COMMAND: pnpm exec oxlint --deny-warnings server/instabox/wiring.test.ts +EXIT 0 + +COMMAND: git diff --check +EXIT 0 diff --git a/server/index.ts b/server/index.ts index 54f3a7e2..d1988280 100644 --- a/server/index.ts +++ b/server/index.ts @@ -132,10 +132,10 @@ import { boatCreateRecoverySnapshot } from "./boat-create-idempotency.ts"; import { boatDeletionSnapshot } from "./boat-delete-journal.ts"; import { liveDecisionRefusal } from "../shared/live-approval.ts"; import type { PersonWaitKind } from "../shared/person-wait.ts"; import { cloudKindOf, cloudPolicyKindOf, vpsLeftBehindNotice } from "./cloud-backend.ts"; -import { createInstaboxRequest } from "./instabox/client.ts"; +import { createInstaboxWiring } from "./instabox/wiring.ts"; import { instaboxConfigured } from "./instabox/key.ts"; import type { InstaboxMachines } from "./instabox/machine.ts"; -import { createInstaboxMachineCache, instaboxComputerAction, instaboxFailureResponse, instaboxStatus, requireInstabox, withInstaboxBackendPower } from "./instabox/power.ts"; +import { instaboxComputerAction, instaboxFailureResponse, instaboxStatus, requireInstabox, withInstaboxBackendPower } from "./instabox/power.ts"; import * as composio from "./composio.ts"; import { appSandboxRule, connectorCallFromFrame, connectorRefusalText, connectorScopeRefusalText, connectorUnrecognizedText, evaluateConnectorTools } from "./connector-verdict.ts"; import { signInCardText } from "./connector-card-text.ts"; @@ -4621,11 +4621,14 @@ function audienceChanged(): void { // Before any revocation callback: Cloud boot can revoke sessions before routes are registered. const upgrades = createUpgrades(); const phoneScreen = createPhoneScreenRoutes({ upgrades, hold: phoneHold, enabled: usbPhoneTakeoverOn, live: (auth) => auth.kind === "loopback" || sessions.isLive(auth.session.id), dataDir: DATA_DIR }); +const instaboxWiring = createInstaboxWiring({ cfg: () => cfg, claim: claimBotComputerLifecycle, inUse: id => managedBoatOwners().some(owner => owner.botId === id && owner.inUse), eligible: id => { const bot = store.bot(id); return !!bot && !inheritedTeamComputer(bot) && cloudKindOf(bot) === "instabox"; } }); const desktopViewer = createDesktopViewer({ + allowInsecureLoopbackUpstream: instaboxWiring.allowInsecureLoopbackUpstream, upgrades, target: (id) => { if (id.startsWith("vps/")) { const botId = id.slice(4); + const instabox = instaboxWiring.target(botId); if (instabox) return instabox; if (store.bot(botId)?.cloudBackend !== "vps") return; return { key: id, resolve: async () => { const connection = vps.vpsDesktopConnection(botId); @@ -5627,9 +5630,7 @@ const computerPreviews = createComputerPreviews(); const vpsJoinRequests = new Map>(); const orphanBoatLifecycleBusyIds = new Set(); const boatInventoryRequestsBusyIds = new Set(); -const cachedInstaboxMachines = createInstaboxMachineCache(key => createInstaboxRequest(key, - /^http:\/\/127\.0\.0\.1:[1-9]\d{0,4}$/.test(process.env.CRYBOT_TEST_INSTABOX_API ?? "") ? process.env.CRYBOT_TEST_INSTABOX_API : undefined)); -function instaboxMachinesFor(cfg: AppConfig): InstaboxMachines | null { return cachedInstaboxMachines(cfg); } +function instaboxMachinesFor(_cfg: AppConfig): InstaboxMachines | null { return instaboxWiring.machines(); } type RemoteComputerProvider = "box" | "vps"; const computerProviderConfigTransitions = new Set(); const localVmIdleMs = () => localVmIdleTimeoutMinutes(cfg) * 60_000; @@ -8210,7 +8211,9 @@ async function beginTurn( computerKind = "box"; } if (!teamComputer && cloudBackend === "instabox" && wants === "cloud") { - await requireInstabox(instaboxMachinesFor(cfg)).ensureRunning(bot.id); + await bindTurnComputer(resourceOwner, `computer:box-bot:${bot.id}`, true); + const machine = await requireInstabox(instaboxMachinesFor(cfg)).ensureRunning(bot.id); + integrations.localComputer = cloudComputerTools(bot.id, resourceOwner, `instabox/${machine.id}`); computerKind = "box"; } if (!teamComputer && cloudBackend === "box" && boat.boatOffered(cfg) && wants === "cloud") { integrations.localComputer = mountBotBoat(bot, resourceOwner, { @@ -10071,7 +10074,9 @@ async function runClaimedGroupMemberTurn( } if (!roomTeamComputer && roomPlan.computer === "cloud") { if (turnProvider(readyBot) === "instabox") { - await requireInstabox(instaboxMachinesFor(cfg)).ensureRunning(readyBot.id); + await bindTurnComputer(resourceOwner, `computer:box-bot:${readyBot.id}`, true); + const machine = await requireInstabox(instaboxMachinesFor(cfg)).ensureRunning(readyBot.id); + integrations.localComputer = cloudComputerTools(readyBot.id, resourceOwner, `instabox/${machine.id}`); roomComputerKind = "box"; } else if (turnProvider(readyBot) === "vps") { vpsThreadStarted(readyBot.id, threadId); roomVpsBotId = readyBot.id; @@ -12451,7 +12456,7 @@ ROUTES.push(createStatusRoutes({ browserEngineInstallError: { set: (error) => { browserEngineInstallError = error; } }, })); -ROUTES.push(desktopViewer.route, phoneScreen.route); +ROUTES.push(instaboxWiring.routes, desktopViewer.route, phoneScreen.route); ROUTES.push(createBrowserViewerRoutes({ upgrades, viewers: browserLive, dataDir: DATA_DIR, person: (auth) => (auth.kind === "session" ? actorKey(auth) : "local-owner"), audience: (auth, threadId) => teamHost.viewerBrowserAudience({ threadId, sees: (id) => visibleTo(viewerFor(auth)).thread(id), person: auth.kind === "session" ? actorKey(auth) : null }), @@ -13183,7 +13188,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => { const abort = new AbortController(); res.once("close", () => { if (!res.writableEnded) abort.abort(); }); return json(res, 200, { result: await cloudComputerRpc(body, { - cfg, signal: abort.signal, folder: () => messageFileRootsForThread(internalCapability.botId, internalCapability.threadId)[0], + cfg, instabox: instaboxWiring.tools(internalCapability.boxId), signal: abort.signal, folder: () => messageFileRootsForThread(internalCapability.botId, internalCapability.threadId)[0], boxId: () => internalCapability.boxId ?? claimedBoatId(internalCapability), gate: () => computerCallGate(internalCapability, abort.signal), assertActive: requireActiveInternalCapability, recovery: boatRecovery, diff --git a/server/instabox/client.ts b/server/instabox/client.ts index 2108ecdd..671b09ab 100644 --- a/server/instabox/client.ts +++ b/server/instabox/client.ts @@ -19,10 +19,11 @@ function errorCode(value: unknown, apiKey?: string): string { ? value : "request_failed"; } -export function createInstaboxRequest(apiKey: string, baseUrl = "https://api.instabox.sh"): InstaboxRequest { +export function createInstaboxRequest(apiKey: string, baseUrl = "https://api.instabox.sh", requestTimeoutMs = 650_000, signal?: AbortSignal): InstaboxRequest { if (!apiKey || /[^\x21-\x7e]/.test(apiKey)) throw new Error("Invalid InstaBox API key"); const origin = new URL(baseUrl); const request: InstaboxRequest = async (method, path, opts = {}) => { + signal?.throwIfAborted(); const url = new URL(path, origin); if (url.origin !== origin.origin || url.username || url.password) throw new Error("Invalid InstaBox API path"); for (const [name, value] of Object.entries(opts.query ?? {})) url.searchParams.set(name, value); @@ -39,7 +40,7 @@ export function createInstaboxRequest(apiKey: string, baseUrl = "https://api.ins } let response: Response; try { - response = await fetch(url, { method: method.toUpperCase(), headers, ...(body === undefined ? {} : { body }), redirect: "error", signal: AbortSignal.timeout(650_000) }); + response = await fetch(url, { method: method.toUpperCase(), headers, ...(body === undefined ? {} : { body }), redirect: "error", signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(requestTimeoutMs)]) : AbortSignal.timeout(requestTimeoutMs) }); } catch { throw new InstaboxError(0, "network_error"); } diff --git a/server/instabox/power.test.ts b/server/instabox/power.test.ts index 3052b559..2ba491a2 100644 --- a/server/instabox/power.test.ts +++ b/server/instabox/power.test.ts @@ -61,7 +61,7 @@ it("sends translation keys for user errors while preserving provider failures", } const service = {} as InstaboxMachines; await expect(instaboxComputerAction(service, "bot", "provision", { template: "apple" })).rejects.toMatchObject({ status: 400, message: "Choose a Linux or Android computer.", errorKey: "serverError.instabox.template" }); - await expect(instaboxComputerAction(service, "bot", "join", {})).rejects.toMatchObject({ status: 501, message: "This InstaBox computer is unavailable.", errorKey: "serverError.instabox.unavailable" }); + await expect(instaboxComputerAction(service, "bot", "unsupported", {})).rejects.toMatchObject({ status: 501, message: "This InstaBox computer is unavailable.", errorKey: "serverError.instabox.unavailable" }); const providerFailure = new Error("provider failed"); expect(() => instaboxFailureResponse(providerFailure)).toThrow(providerFailure); }); @@ -69,7 +69,7 @@ it("sends translation keys for user errors while preserving provider failures", it("leaves the template unspecified when provisioning an existing machine", async () => { const ensureRunning = vi.fn().mockResolvedValue({ id: "machine", template: "android", state: "running" }); await expect(instaboxComputerAction({ ensureRunning } as unknown as InstaboxMachines, "bot", "provision", {})).resolves.toEqual({ - machine: { id: "machine", template: "android", state: "running" }, + ready: true, machine: { id: "machine", template: "android", state: "running" }, }); expect(ensureRunning).toHaveBeenCalledWith("bot", undefined); }); diff --git a/server/instabox/power.ts b/server/instabox/power.ts index 38f48a8a..567a28bc 100644 --- a/server/instabox/power.ts +++ b/server/instabox/power.ts @@ -1,3 +1,5 @@ +import { runInstaboxComputerTool } from "./computer-tools.ts"; +import { desktopViewerUrl } from "../routes/desktop-viewer.ts"; import type { AppConfig } from "../config.ts"; import type { RouteHandler } from "../routes/table.ts"; import type { BotRecord } from "../store.ts"; @@ -58,8 +60,17 @@ export async function instaboxComputerAction(machines: InstaboxMachines | null, if (template !== undefined && template !== "linux" && template !== "android") { throw new InstaboxUserError(400, "serverError.instabox.template"); } - return { machine: await service.ensureRunning(botId, template === undefined ? undefined : { template }) }; + return { ready: true, machine: await service.ensureRunning(botId, template === undefined ? undefined : { template }) }; } + if (action === "screenshot") { + const machine = await service.find(botId); + if (machine?.state !== "running") throw new InstaboxUserError(409, "serverError.instabox.unavailable"); + const result = await runInstaboxComputerTool(service, machine.id, "screenshot", {}, AbortSignal.timeout(90_000)); + const image = result.content.find(part => part.type === "image"); + if (!image || image.type !== "image") throw new InstaboxUserError(502, "serverError.instabox.unavailable"); + return { png: image.data, format: "jpeg" }; + } + if (action === "join") { await service.ensureRunning(botId); return { joinUrl: desktopViewerUrl(`vps/${botId}`) }; } if (action === "sleep") { await service.suspend(botId); return { ok: true }; } if (action === "remove") { await service.remove(botId); return { ok: true }; } throw new InstaboxUserError(501, "serverError.instabox.unavailable"); diff --git a/server/instabox/snapshot-wiring.e2e.test.ts b/server/instabox/snapshot-wiring.e2e.test.ts new file mode 100644 index 00000000..ba437f6b --- /dev/null +++ b/server/instabox/snapshot-wiring.e2e.test.ts @@ -0,0 +1,101 @@ +import { createServer, type Server } from "node:http"; +import { setTimeout as delay } from "node:timers/promises"; +import { afterEach, expect, it, vi } from "vitest"; +import { json, readBody } from "../harness/http.ts"; +import { createInstaboxWiring } from "./wiring.ts"; + +const botId = "snapshot-budget-bot"; +const snapshot = { id: "saved", name: "backup", status: "ready", metadata: { app: "crybot", botId } }; +const machine = { id: "machine", name: `crybot-${botId.slice(0, 12)}`, metadata: { botId }, state: "running" }; +const basePath = `/api/bots/${botId}/instabox/snapshots`; +const servers: Server[] = []; +afterEach(async () => { + for (const server of servers.splice(0)) await new Promise(resolve => { server.close(() => resolve()); server.closeAllConnections(); }); + vi.unstubAllEnvs(); +}); +async function listen(server: Server) { + servers.push(server); + await new Promise(resolve => server.listen(0, "127.0.0.1", resolve)); + const address = server.address(); + if (!address || typeof address === "string") throw new Error("Fixture did not listen"); + return `http://127.0.0.1:${address.port}`; +} + +async function fixture(stall: "lookup" | "pages" | "poll" | "desktop" | "body", timeoutMs = 600) { + const calls: Array<{ path: string; wait: string | null }> = []; + let cancelled = false; + let locked = false; + let reached!: () => void; + const stalled = new Promise(resolve => { reached = resolve; }); + const upstream = await listen(createServer(async (req, res) => { + for await (const chunk of req) void chunk; + const url = new URL(req.url!, "http://fixture"); + const path = url.pathname; + calls.push({ path, wait: url.searchParams.get("wait") }); + const hanging = stall === "lookup" && path === "/v1/machines" || stall === "poll" && path.startsWith("/v1/operations/") || stall === "desktop" && path.endsWith("/desktop") || stall === "body"; + if (hanging) { + res.on("close", () => { cancelled = !res.writableEnded; }); + if (stall === "body") { res.writeHead(200, { "content-type": "application/json" }); res.write('{"snapshots":['); } + reached(); + return; + } + if (stall === "pages") { + await delay(220); + return json(res, 200, { snapshots: [], nextCursor: `page-${calls.length}` }); + } + if (path === "/v1/machines") { await delay(120); return json(res, 200, { machines: [machine] }); } + if (path === "/v1/snapshots/saved") { await delay(120); return json(res, 200, snapshot); } + if (req.method === "POST" && path.endsWith("/restore")) return json(res, 202, { id: "restore", state: "pending" }); + if (path.startsWith("/v1/operations/")) return json(res, 200, { id: "restore", state: "succeeded" }); + json(res, 500, { error: "unexpected_fixture_request" }); + })); + vi.stubEnv("CRYBOT_TEST_INSTABOX_API", upstream); + vi.stubEnv("INSTABOX_API_KEY", "instabox-e2e-fixture"); + const wiring = createInstaboxWiring({ cfg: () => ({}), eligible: id => id === botId, + inUse: () => false, snapshotTimeoutMs: timeoutMs, + claim: () => { if (locked) throw Object.assign(new Error("busy"), { status: 409 }); locked = true; return () => { locked = false; }; }, + }); + const app = await listen(createServer(async (req, res) => { + const url = new URL(req.url!, "http://fixture"); + await wiring.routes({ req, res, url, path: url.pathname, method: req.method!, json, readBody, auth: { kind: "loopback", scopes: ["admin", "client"] } }); + })); + const send = (signal?: AbortSignal) => fetch(app + basePath + (["poll", "desktop"].includes(stall) ? "/saved/restore" : ""), { + method: ["pages", "body"].includes(stall) ? "GET" : "POST", headers: { origin: app, "content-type": "application/json" }, + ...(["pages", "body"].includes(stall) ? {} : { body: "{}" }), signal, + }); + return { send, calls, stalled, cancelled: () => cancelled, locked: () => locked }; +} + +it.each(["lookup", "pages", "poll", "desktop", "body"] as const)("bounds the whole snapshot flow including slow %s responses", async stage => { + const f = await fixture(stage); + const start = Date.now(); + const response = await f.send(); + expect(response.status).toBe(504); + expect(await response.json()).toMatchObject({ code: "instabox_snapshot_timeout" }); + expect(Date.now() - start).toBeLessThan(1_200); + expect(f.locked()).toBe(false); + if (stage === "desktop") expect(f.calls.map(call => call.path)).toContain("/v1/machines/machine/desktop"); + if (stage !== "pages") await expect.poll(f.cancelled).toBe(true); + if (stage === "pages") expect(f.calls.length).toBeLessThanOrEqual(3); + if (stage === "poll" || stage === "desktop") { + const wait = f.calls.find(call => call.path.startsWith("/v1/operations/"))!.wait!; + expect(parseFloat(wait)).toBeLessThan(0.45); + } + const count = f.calls.length; + await delay(300); + expect(f.calls).toHaveLength(count); +}); + +it("cancels the upstream flow and releases the lifecycle lock when the caller disconnects", async () => { + const f = await fixture("lookup", 10_000); + const controller = new AbortController(); + const response = f.send(controller.signal).catch(() => null); + await f.stalled; + expect(f.locked()).toBe(true); + controller.abort(); + expect(await response).toBeNull(); + await expect.poll(f.cancelled).toBe(true); + await expect.poll(f.locked).toBe(false); + await delay(300); + expect(f.calls).toHaveLength(1); +}); diff --git a/server/instabox/snapshot-wiring.ts b/server/instabox/snapshot-wiring.ts new file mode 100644 index 00000000..2f02c1c5 --- /dev/null +++ b/server/instabox/snapshot-wiring.ts @@ -0,0 +1,64 @@ +import type { AppConfig } from "../config.ts"; +import { createInstaboxSnapshotRoutes } from "../routes/instabox-snapshots.ts"; +import { PASS, type RouteHandler } from "../routes/table.ts"; +import { createInstaboxRequest } from "./client.ts"; +import { instaboxApiKey } from "./key.ts"; +import type { InstaboxRequest } from "./machine.ts"; +import { createInstaboxMachines } from "./machines.ts"; + +export function createSnapshotWiring(deps: { + cfg(): AppConfig; + eligible(botId: string): boolean; + claim(botId: string): () => void; + inUse(botId: string): boolean; + baseUrl?: string; + snapshotTimeoutMs?: number; +}): RouteHandler { + return async ctx => { + if (!/^\/api\/bots\/[\w-]+\/instabox\/snapshots(?:\/|$)/.test(ctx.path)) return PASS; + const controller = new AbortController(); + const deadline = Date.now() + (deps.snapshotTimeoutMs ?? 600_000); + const cancel = () => controller.abort(); + const timer = setTimeout(cancel, deadline - Date.now()); + ctx.req.once("aborted", cancel); + ctx.res.once("close", cancel); + try { + const key = instaboxApiKey(deps.cfg()); + const upstream = key ? createInstaboxRequest(key, deps.baseUrl, 30_000, controller.signal) : null; + const request: InstaboxRequest | null = upstream && ((method, path, opts) => { + if (Date.now() >= deadline) cancel(); + controller.signal.throwIfAborted(); + const query = opts?.query?.wait ? { ...opts.query, wait: `${Math.min(parseFloat(opts.query.wait), 25, (deadline - Date.now()) / 1000)}s` } : opts?.query; + return upstream(method, path, { ...opts, query }); + }); + const machines = request ? createInstaboxMachines(request) : null; + return await createInstaboxSnapshotRoutes({ + request: () => request, machines: () => machines, + machineIdFor: async botId => (await machines?.find(botId))?.id ?? null, + botExists: deps.eligible, signal: controller.signal, + claim: botId => { + const release = deps.claim(botId); + if (deps.inUse(botId)) { + release(); + throw Object.assign(new Error("Computer is in use"), { status: 409 }); + } + return release; + }, + })({ ...ctx, readBody: async req => { + controller.signal.throwIfAborted(); + let abort!: () => void; + const aborted = new Promise((_resolve, reject) => { + abort = () => reject(controller.signal.reason); + controller.signal.addEventListener("abort", abort, { once: true }); + }); + try { return await Promise.race([ctx.readBody(req), aborted]); } + finally { controller.signal.removeEventListener("abort", abort); } + } }); + } finally { + clearTimeout(timer); + ctx.req.off("aborted", cancel); + ctx.res.off("close", cancel); + cancel(); + } + }; +} diff --git a/server/instabox/wiring-backends-fixture.ts b/server/instabox/wiring-backends-fixture.ts new file mode 100644 index 00000000..7ef01212 --- /dev/null +++ b/server/instabox/wiring-backends-fixture.ts @@ -0,0 +1,72 @@ +import { createServer } from "node:http"; +import { mkdtempSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { pathToFileURL } from "node:url"; +import { removeTempDir } from "../testing/cleanup.ts"; + +export async function wiringBackendsFixture() { + const root = mkdtempSync(join(tmpdir(), "cry-wiring-backends-")); + const calls: Array<{ path: string; body: any }> = []; + const rows: Array<{ id: string; name: string; state: string }> = []; + const server = createServer(async (req, res) => { + let raw = ""; + for await (const chunk of req) raw += chunk; + const body = raw ? JSON.parse(raw) : {}; + const path = new URL(req.url!, "http://fixture").pathname; + calls.push({ path, body }); + const reply = (value: unknown) => { res.setHeader("content-type", "application/json"); res.end(JSON.stringify(value)); }; + if (path === "/vps/exec") return reply({ content: [{ type: "text", text: "VPS fixture completed" }] }); + if (path === "/sandboxes" && req.method === "POST") { + const sandbox = { id: "bx_23456789", name: body.name, state: "ready" }; rows.push(sandbox); return reply({ sandbox }); + } + if (path === "/sandboxes") return reply({ sandboxes: rows }); + if (path.endsWith("/desktop")) return reply({ desktopUrl: "https://desktop.fixture.invalid" }); + if (path.endsWith("/commands")) return reply({ exitCode: 0, stdout: "Boat fixture completed", stderr: "" }); + const row = rows.find(row => path === `/sandboxes/${row.id}`); + if (row) { if (body.name) row.name = body.name; return reply({ sandbox: row }); } + reply({}); + }); + await new Promise(resolve => server.listen(0, "127.0.0.1", resolve)); + const address = server.address(); + if (!address || typeof address === "string") throw new Error("Fixture did not listen"); + const base = `http://127.0.0.1:${address.port}`; + const mcp = join(root, "vps-mcp.mjs"); + writeFileSync(mcp, ` +import { createInterface } from 'node:readline'; +for await (const line of createInterface({ input: process.stdin })) { + const request = JSON.parse(line); + if (request.id === undefined) continue; + let result = {}; + if (request.method === 'initialize') result = { protocolVersion: '2024-11-05', capabilities: { tools: {} }, serverInfo: { name: 'fixture-vps', version: '1' } }; + if (request.method === 'tools/list') result = { tools: [{ name: 'exec', description: 'Fixture command', inputSchema: { type: 'object', properties: { command: { type: 'string' } } } }] }; + if (request.method === 'tools/call') result = await (await fetch(${JSON.stringify(base + "/vps/exec")}, { method: 'POST', body: JSON.stringify(request.params) })).json(); + process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: request.id, result }) + '\\n'); +} +`); + const actual = new URL("../vps-computer.ts?actual", import.meta.url).href; + const hook = join(root, "vps-hooks.mjs"); + const mock = ` +export * from ${JSON.stringify(actual)}; +const status = { ready: true, daemonUp: true, configured: true, sshAlias: 'fixture-vps', container_id: 'fixture-container', container: 'running' }; +export async function vpsComputerStatus() { return status; } +export async function inspectVpsForAuto() { return status; } +export async function vpsComputerAction() { return status; } +export function vpsComputerMcp() { return { command: process.execPath, args: [${JSON.stringify(mcp)}], env: {} }; } +`; + writeFileSync(hook, ` +import { registerHooks } from 'node:module'; +registerHooks({ + load(url, context, next) { + if (url.endsWith('/vps-computer.ts')) return { format: 'module', shortCircuit: true, source: ${JSON.stringify(mock)} }; + return next(url, context); + } +}); +`); + return { calls, env: { CRYBOT_BOAT_API: base, NODE_OPTIONS: `--import=${pathToFileURL(hook).href}` }, + close: async () => { + await new Promise(resolve => { server.close(() => resolve()); server.closeAllConnections(); }); + await removeTempDir(root); + }, + }; +} diff --git a/server/instabox/wiring.e2e.test.ts b/server/instabox/wiring.e2e.test.ts new file mode 100644 index 00000000..422b17fb --- /dev/null +++ b/server/instabox/wiring.e2e.test.ts @@ -0,0 +1,186 @@ +import { readFileSync, writeFileSync } from "node:fs"; +import { join } from "node:path"; +import { WebSocket } from "ws"; +import { expect, it } from "vitest"; +import { launchRestartableServer } from "../testing/restartable-server.ts"; +import { fakeInstaboxCore } from "../testing/fake-instabox-core.ts"; + +import { wiringBackendsFixture } from "./wiring-backends-fixture.ts"; + +async function fixture(extraEnv: NodeJS.ProcessEnv = {}) { + const fake = await fakeInstaboxCore(); + const env = { ...extraEnv, INSTABOX_API_KEY: "", CRYBOT_TEST_INSTABOX_API: fake.url }; + const app = await launchRestartableServer({ scripted: true, env }); + const request = async (method: string, path: string, body?: unknown) => { + const response = await fetch(app.url + path, { method, headers: { origin: app.url, "content-type": "application/json" }, + ...(body === undefined ? {} : { body: JSON.stringify(body) }), signal: AbortSignal.timeout(30_000) }); + const data = await response.json() as any; + expect(JSON.stringify(data)).not.toContain("instabox-e2e-fixture"); + return { status: response.status, body: data }; + }; + return { fake, env, app, request, close: async () => { await app.close(); await fake.close(); } }; +} + +it("wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry", async () => { + const f = await fixture(); + const { request, fake, app, env } = f; + let socket: WebSocket | undefined; + try { + const stream = await fetch(app.url + "/api/events", { headers: { origin: app.url }, signal: AbortSignal.timeout(10_000) }); + const reader = stream.body!.getReader(); + let frames = ""; + const readFrames = (async () => { for (;;) { const chunk = await reader.read(); if (chunk.done) break; frames += new TextDecoder().decode(chunk.value); } })(); + expect((await request("PUT", "/api/config", { instabox: { apiKey: "instabox-e2e-fixture-file" } })).status).toBe(200); + expect((await request("GET", "/api/config")).body.instabox).toEqual({ configured: true, last4: "file", fromEnv: false }); + await expect.poll(() => frames.includes('"last4":"file"'), { timeout: 5_000 }).toBe(true); + expect(frames).not.toContain("instabox-e2e-fixture"); + await reader.cancel(); await readFrames; + await app.stop(); + env.INSTABOX_API_KEY = "instabox-e2e-fixture-env"; + await app.start(); + expect((await request("GET", "/api/config")).body.instabox).toEqual({ configured: true, last4: "-env", fromEnv: true }); + expect((await request("PATCH", "/api/config", { instabox: { apiKey: "" } })).status).toBe(409); + expect(JSON.parse(readFileSync(join(app.dataDir, "config.json"), "utf8")).instabox.apiKey).toBe("instabox-e2e-fixture-file"); + const created = await request("POST", "/api/bots", { name: "Wiring fixture", computer: "cloud", cloudBackend: "instabox", modelSelection: { instanceId: "claude", model: "claude-sonnet-5" } }); + expect(created.status).toBe(201); + const bot = created.body.bot; + const path = `/api/bots/${bot.id}`; + expect((await request("PATCH", path, { computer: "cloud", cloudBackend: "instabox" })).status).toBe(200); + expect((await request("GET", path + "/computer")).body.backend).toBe("instabox"); + writeFileSync(app.planPath, JSON.stringify({ [bot.id]: { steps: [ + { server: "computer", tool: "exec", arguments: { command: "printf wiring-fixture" } }, + { server: "computer", tool: "screenshot", arguments: {} }, + ], reply: "Wiring complete." } })); + expect((await request("POST", path + "/messages", { text: "Use the computer.", threadId: bot.threadId })).status).toBe(202); + await expect.poll(() => fake.calls.some(call => call.path.endsWith("/files/content")), { timeout: 30_000 }).toBe(true); + await expect.poll(async () => (await request("GET", "/api/bots")).body.bots.find((entry: { id: string }) => entry.id === bot.id)?.busy, { timeout: 30_000 }).toBe(false); + expect(fake.calls.some(call => call.path.endsWith("/exec") && call.body.cmd?.includes("printf wiring-fixture"))).toBe(true); + expect(fake.calls.filter(call => call.path.endsWith("/exec")).every(call => call.body.envs.DISPLAY === ":1")).toBe(true); + expect(fake.calls.every(call => call.headers["x-api-key"] === env.INSTABOX_API_KEY)).toBe(true); + expect(JSON.stringify(fake.calls.map(call => call.body))).not.toContain("instabox-e2e-fixture"); + expect((await request("POST", path + "/computer/screenshot", {})).body).toMatchObject({ format: "jpeg", png: expect.any(String) }); + expect((await request("POST", path + "/computer/join", {})).body.joinUrl).toContain("vps%2F" + bot.id); + expect((await request("GET", `/api/desktop-viewer/vps/${bot.id}`)).body).toEqual({ password: null }); + socket = new WebSocket(app.url.replace("http:", "ws:") + `/api/desktop-viewer/vps/${bot.id}/websockify`, { origin: app.url }); + const handshake = await new Promise((resolve, reject) => { socket!.once("message", bytes => resolve(bytes.toString())); socket!.once("error", reject); }); + expect(handshake).toBe("RFB 003.008\n"); + expect(fake.vncRequests[0]["x-api-key"]).toBe(env.INSTABOX_API_KEY); + const snapshots = path + "/instabox/snapshots"; + const start = fake.calls.length; + const saved = await request("POST", snapshots, {}); + expect(saved.status).toBe(201); + expect(fake.calls.slice(start).some(call => call.path.startsWith("/v1/operations/"))).toBe(true); + expect(fake.calls.slice(start).some(call => call.method === "GET" && call.path === "/v1/snapshots")).toBe(true); + expect((await request("GET", snapshots)).body.snapshots).toEqual([saved.body.snapshot]); + const beforeRestore = fake.calls.length; + expect((await request("POST", `${snapshots}/${saved.body.snapshot.id}/restore`, {})).status).toBe(200); + expect(fake.calls.slice(beforeRestore).some(call => call.path.endsWith("/desktop"))).toBe(true); + const closed = new Promise(resolve => socket!.once("close", () => resolve())); + expect((await request("POST", path + "/computer/remove", {})).status).toBe(200); + expect((await request("POST", path + "/computer/provision", {})).status).toBe(200); + await closed; + expect(fake.machines.size).toBe(2); + expect((await request("DELETE", path)).status).toBe(200); + expect([...fake.machines.values()].every(machine => machine.state === "deleted")).toBe(true); + for (const file of [app.logPath, join(app.dataDir, "fake-claude-dump.json"), app.planPath + ".evidence.jsonl"]) { + expect(readFileSync(file, "utf8")).not.toContain("instabox-e2e-fixture"); + } + } finally { socket?.terminate(); await f.close(); } +}, 120_000); + +it.each(["box", "vps"])("keeps %s computer and snapshot/viewer paths away from InstaBox", async backend => { + const backends = await wiringBackendsFixture(); + const f = await fixture(backends.env); + try { + expect((await f.request("PUT", "/api/config", { instabox: { apiKey: "instabox-e2e-fixture-file" }, box: { token: "boat-e2e-fixture" }, vps: { sshAlias: "fixture-vps" } })).status).toBe(200); + const bot = (await f.request("POST", "/api/bots", { computer: "cloud", cloudBackend: backend, modelSelection: { instanceId: "claude", model: "claude-sonnet-5" } })).body.bot; + const path = `/api/bots/${bot.id}`; + expect((await f.request("PATCH", path, { computer: "cloud", cloudBackend: backend })).status).toBe(200); + await f.request("GET", path + "/computer"); + writeFileSync(f.app.planPath, JSON.stringify({ [bot.id]: { steps: [ + { server: "computer", tool: "exec", arguments: { command: "printf backend-fixture" } }, + ], reply: "Backend complete." } })); + expect((await f.request("POST", path + "/messages", { text: "Use the computer.", threadId: bot.threadId })).status).toBe(202); + await expect.poll(() => backends.calls.some(call => backend === "box" + ? call.path.endsWith("/commands") && call.body.command?.includes("printf backend-fixture") + : call.path === "/vps/exec" && call.body.arguments?.command === "printf backend-fixture"), { timeout: 30_000 }).toBe(true); + await expect.poll(async () => (await f.request("GET", "/api/bots")).body.bots.find((entry: { id: string }) => entry.id === bot.id)?.busy, { timeout: 20_000 }).toBe(false); + expect((await f.request("GET", path + "/instabox/snapshots")).status).toBe(404); + await f.request("GET", `/api/desktop-viewer/vps/${bot.id}`); + expect(f.fake.calls).toEqual([]); + expect(f.fake.vncRequests).toEqual([]); + } finally { await f.close(); await backends.close(); } +}, 60_000); + +it.each(["direct", "group"])("excludes snapshot restore and %s turns in both directions", async kind => { + const f = await fixture(); + const holds: Array<{ release(): void }> = []; + try { + await f.request("PUT", "/api/config", { instabox: { apiKey: "instabox-e2e-fixture" } }); + const bot = (await f.request("POST", "/api/bots", { name: "Lifecycle fixture", modelSelection: { instanceId: "claude", model: "claude-sonnet-5" } })).body.bot; + const path = `/api/bots/${bot.id}`; + expect((await f.request("PATCH", path, { computer: "cloud", cloudBackend: "instabox" })).status).toBe(200); + expect((await f.request("POST", path + "/computer/provision", {})).status).toBe(200); + const saved = await f.request("POST", path + "/instabox/snapshots", {}); + expect(saved.status).toBe(201); + const restore = `${path}/instabox/snapshots/${saved.body.snapshot.id}/restore`; + const room = kind === "group" ? (await f.request("POST", "/api/groups", { name: "Lifecycle room", botIds: [bot.id] })).body.group : null; + const messages = room ? `/api/groups/${room.id}/messages` : path + "/messages"; + writeFileSync(f.app.planPath, JSON.stringify({ [bot.id]: { steps: [ + { server: "computer", tool: "exec", arguments: { command: "printf lifecycle-fixture" } }, + ], reply: "Lifecycle complete." } })); + const exec = f.fake.holdNext("POST", "/v1/machines/machine-1/exec"); holds.push(exec); + expect((await f.request("POST", messages, { text: "Use the computer.", threadId: room?.threadId ?? bot.threadId })).status).toBe(202); + await exec.reached; + const before = f.fake.calls.length; + expect((await f.request("POST", restore, {})).status).toBe(409); + expect(f.fake.calls.slice(before).some(call => call.path.endsWith("/restore"))).toBe(false); + exec.release(); + await expect.poll(async () => { + const state = (await f.request("GET", "/api/bots")).body; + return room ? state.groups.find((entry: { id: string }) => entry.id === room.id)?.working : state.bots.find((entry: { id: string }) => entry.id === bot.id)?.busy; + }, { timeout: 30_000 }).toBe(false); + const heldRestore = f.fake.holdNext("POST", "/v1/machines/machine-1/restore"); holds.push(heldRestore); + const restoring = f.request("POST", restore, {}); + await heldRestore.reached; + const execCount = f.fake.calls.filter(call => call.path.endsWith("/exec")).length; + expect((await f.request("POST", messages, { text: "Try during restore.", threadId: room?.threadId ?? bot.threadId })).status).toBe(409); + expect((await f.request("DELETE", path)).status).toBe(409); + expect((await f.request("POST", path + "/computer/control", { action: "take" })).status).toBe(409); + expect(f.fake.calls.filter(call => call.path.endsWith("/exec"))).toHaveLength(execCount); + heldRestore.release(); + expect((await restoring).status).toBe(200); + expect((await f.request("POST", path + "/computer/control", { action: "take" })).status).toBe(200); + expect((await f.request("POST", restore, {})).status).toBe(409); + expect((await f.request("POST", path + "/computer/control", { action: "release" })).status).toBe(200); + expect((await f.request("POST", restore, {})).status).toBe(200); + } finally { for (const hold of holds) hold.release(); await f.close(); } +}, 90_000); + +it("does not recreate a deleted machine when the viewer opens before bot deletion finishes", async () => { + const f = await fixture(); + const holds: Array<{ release(): void }> = []; + try { + await f.request("PUT", "/api/config", { instabox: { apiKey: "instabox-e2e-fixture" } }); + const bot = (await f.request("POST", "/api/bots", { name: "Deletion fixture" })).body.bot; + const path = `/api/bots/${bot.id}`; + expect((await f.request("PATCH", path, { computer: "cloud", cloudBackend: "instabox" })).status).toBe(200); + expect((await f.request("POST", path + "/computer/provision", {})).status).toBe(200); + const deleting = f.fake.holdNext("DELETE", "/v1/machines/machine-1", true); holds.push(deleting); + const deletion = f.request("DELETE", path); + await deleting.reached; + const operation = [...f.fake.operations.values()].find(op => op.finalState === "deleted")!; + operation.polls = 1; + const deleted = f.fake.holdNext("GET", `/v1/operations/${operation.id}`, true); holds.push(deleted); + deleting.release(); + await deleted.reached; + expect(f.fake.machines.get("machine-1")?.state).toBe("deleted"); + expect((await f.request("GET", "/api/bots")).body.bots.some((entry: { id: string }) => entry.id === bot.id)).toBe(true); + expect((await f.request("GET", `/api/desktop-viewer/vps/${bot.id}`)).status).toBe(409); + expect(f.fake.machines.size).toBe(1); + deleted.release(); + expect((await deletion).status).toBe(200); + expect((await f.request("GET", `/api/desktop-viewer/vps/${bot.id}`)).status).toBe(404); + expect([...f.fake.machines.values()].every(machine => machine.state === "deleted")).toBe(true); + } finally { for (const hold of holds) hold.release(); await f.close(); } +}, 60_000); diff --git a/server/instabox/wiring.test.ts b/server/instabox/wiring.test.ts new file mode 100644 index 00000000..97e6719b --- /dev/null +++ b/server/instabox/wiring.test.ts @@ -0,0 +1,22 @@ +import { afterEach, expect, it, vi } from "vitest"; +import { createInstaboxWiring } from "./wiring.ts"; + +afterEach(() => vi.unstubAllEnvs()); + +it.each(["deleted", "backend changed", "key changed"])("revalidates a retained viewer target after the lifecycle claim when %s", async reason => { + vi.stubEnv("INSTABOX_API_KEY", "instabox-e2e-fixture"); + let eligible = true; + const release = vi.fn(); + const claim = vi.fn(() => { + if (reason === "key changed") vi.stubEnv("INSTABOX_API_KEY", "instabox-e2e-replacement"); + else eligible = false; + return release; + }); + const wiring = createInstaboxWiring({ cfg: () => ({}), eligible: () => eligible, claim, inUse: () => false }); + const ensure = vi.spyOn(wiring.machines()!, "ensureRunning").mockRejectedValue(new Error("Unexpected machine startup")); + const target = wiring.target("fixture-bot")!; + await expect(target.resolve()).rejects.toThrow("unavailable"); + expect(claim).toHaveBeenCalledWith("fixture-bot", true); + expect(release).toHaveBeenCalledOnce(); + expect(ensure).not.toHaveBeenCalled(); +}); diff --git a/server/instabox/wiring.ts b/server/instabox/wiring.ts new file mode 100644 index 00000000..787550fe --- /dev/null +++ b/server/instabox/wiring.ts @@ -0,0 +1,62 @@ +import type { AppConfig } from "../config.ts"; +import type { DesktopTarget } from "../routes/desktop-viewer.ts"; +import { createSnapshotWiring } from "./snapshot-wiring.ts"; +import { createInstaboxRequest } from "./client.ts"; +import { instaboxApiKey } from "./key.ts"; +import type { InstaboxMachine, InstaboxMachines, InstaboxRequest } from "./machine.ts"; +import { createInstaboxMachines } from "./machines.ts"; +import { requireInstabox } from "./power.ts"; +import { instaboxDesktopTarget } from "./vnc.ts"; + +export function createInstaboxWiring(deps: { cfg(): AppConfig; eligible(botId: string): boolean; claim(botId: string, allowPreview?: boolean): () => void; inUse(botId: string): boolean; snapshotTimeoutMs?: number }) { + const fixtureApi = process.env.CRYBOT_TEST_INSTABOX_API; + const fixture = /^http:\/\/127\.0\.0\.1:[1-9]\d{0,4}$/.test(fixtureApi ?? ""); + let cached: { key: string; machines: InstaboxMachines; request: InstaboxRequest } | undefined; + const current = new Map(); + function service() { + const key = instaboxApiKey(deps.cfg()); + if (!key) { cached = undefined; current.clear(); return null; } + if (cached?.key !== key) { + current.clear(); + const request = createInstaboxRequest(key, fixture ? fixtureApi : undefined); + const machines = createInstaboxMachines(request); + const remember = (botId: string, machine: InstaboxMachine | null) => { + if (machine && machine.state !== "deleted") current.set(botId, machine.id); + else current.delete(botId); + return machine; + }; + cached = { key, request, machines: { ...machines, + find: async botId => remember(botId, await machines.find(botId)), + ensureRunning: async (botId, opts) => remember(botId, await machines.ensureRunning(botId, opts))!, + remove: async botId => { await machines.remove(botId); current.delete(botId); }, + } }; + } + return cached; + } + const machines = () => service()?.machines ?? null; + return { + machines, + allowInsecureLoopbackUpstream: fixture, + tools(boxId: string | null | undefined) { + if (!boxId?.startsWith("instabox/")) return undefined; + const active = service(); + return { machines: requireInstabox(active?.machines ?? null), request: active!.request, machineId: () => boxId.slice(9) }; + }, + target(botId: string): DesktopTarget | undefined { + if (!deps.eligible(botId)) return; + const active = service(); + if (!active) return; + const target = instaboxDesktopTarget(`instabox/${botId}/${current.get(botId) ?? "pending"}`, async () => { + const release = deps.claim(botId, true); + try { + if (!deps.eligible(botId) || service() !== active) throw new Error("InstaBox computer is unavailable"); + const machine = await active.machines.ensureRunning(botId); + target.key = `instabox/${botId}/${machine.id}`; + return await active.machines.vncUpstream(machine.id); + } finally { release(); } + }, { live: () => deps.eligible(botId) && service() === active }); + return target; + }, + routes: createSnapshotWiring({ ...deps, baseUrl: fixture ? fixtureApi : undefined }), + }; +} diff --git a/server/routes/config-instabox.test.ts b/server/routes/config-instabox.test.ts index 57af0576..ce67d1bb 100644 --- a/server/routes/config-instabox.test.ts +++ b/server/routes/config-instabox.test.ts @@ -17,7 +17,7 @@ function fixture(reported?: unknown) { providerConfigs: () => ({}), registry: { forgetSnapshots: vi.fn() }, lendingEnabled: () => true, revokeEngineCapabilities: vi.fn(), broadcast, configStatus: () => ({ instabox: reported ?? { ...keyStatus(cfg.instabox?.apiKey), fromEnv: false } }), - configForAccess: (status, auth) => auth.scopes.includes("admin") ? status : withoutKeyHints(status), + configForAccess: (status: Parameters[0], auth: Parameters[1]) => auth.scopes.includes("admin") ? status : withoutKeyHints(status), } as unknown as ConfigRouteDeps); return { cfg, broadcast, request: async (method = "GET", body?: unknown, admin = true) => { let response!: { status: number; body: Record }; diff --git a/server/routes/instabox-snapshots.e2e.test.ts b/server/routes/instabox-snapshots.e2e.test.ts index fcbba34f..162c2780 100644 --- a/server/routes/instabox-snapshots.e2e.test.ts +++ b/server/routes/instabox-snapshots.e2e.test.ts @@ -27,6 +27,7 @@ beforeEach(async () => { machines: () => configured ? { ensureRunning } as unknown as InstaboxMachines : null, machineIdFor: async () => machineId, botExists: (id) => id === botId, + claim: () => () => {}, }); const configRoute = createConfigRoutes({ cfg: { instabox: { apiKey: "fixture-only-key" } }, configStatus: () => ({ instabox: { apiKey: "never-return-this", last4: "this" } }), configForAccess: (status: unknown) => status } as unknown as ConfigRouteDeps); server = createServer(async (req, res) => { @@ -50,13 +51,13 @@ const send = (path = basePath, method = "GET", body?: unknown, headers?: Record< method, headers: { origin: base, "content-type": "application/json", ...headers }, ...(body === undefined ? {} : { body: JSON.stringify(body) }), }); -const ownSnapshot = () => fake.snapshots.set("own", { id: "own", name: "crybot-bot-snapshot-backup", state: "ready" }); +const ownSnapshot = () => fake.snapshots.set("own", { id: "own", name: "crybot-bot-snapshot-backup", status: "ready", sourceMachineId: "machine-one" }); describe("isolated InstaBox snapshot HTTP routes", () => { it("lists only owned snapshots by metadata or prefix and never relays metadata", async () => { ownSnapshot(); - fake.snapshots.set("meta", { id: "meta", name: "backup", state: "ready", metadata: { app: "crybot", botId } }); - fake.snapshots.set("other", { id: "other", name: "crybot-bot-snapshot-spoof", state: "ready", metadata: { botId: "other-bot" } }); + fake.snapshots.set("meta", { id: "meta", name: "backup", status: "ready", sourceMachineId: "machine-one", metadata: { app: "crybot", botId } }); + fake.snapshots.set("other", { id: "other", name: "crybot-bot-snapshot-spoof", status: "ready", sourceMachineId: "machine-one", metadata: { botId: "other-bot" } }); const response = await send(); expect(response.status).toBe(200); const body = await response.json() as { snapshots: Array<{ id: string }> }; @@ -78,6 +79,8 @@ describe("isolated InstaBox snapshot HTTP routes", () => { expect(snapshot.name.startsWith("crybot-bot-snapshot-")).toBe(true); } expect(names[0]).not.toBe(names[1]); + expect(fake.calls.some(call => call.path.startsWith("/v1/operations/"))).toBe(true); + expect(fake.calls.some(call => call.method === "GET" && call.path === "/v1/snapshots")).toBe(true); expect((await send(`${basePath}/${ids[0]}/restore`, "POST")).status).toBe(200); expect(ensureRunning).toHaveBeenCalledWith(botId); const restore = fake.calls.find((call) => call.path.endsWith("/restore")); @@ -99,7 +102,7 @@ describe("isolated InstaBox snapshot HTTP routes", () => { }); it.each(["DELETE", "POST"])("refuses another bot's snapshot before %s", async (method) => { - fake.snapshots.set("other", { id: "other", name: "crybot-other-bot-backup", state: "ready", metadata: { botId: "other-bot" } }); + fake.snapshots.set("other", { id: "other", name: "crybot-other-bot-backup", status: "ready", sourceMachineId: "machine-one", metadata: { botId: "other-bot" } }); const response = await send(`${basePath}/other${method === "POST" ? "/restore" : ""}`, method); expect(response.status).toBe(403); expect(fake.calls).toHaveLength(1); diff --git a/server/routes/instabox-snapshots.ts b/server/routes/instabox-snapshots.ts index 70f7c184..10d48307 100644 --- a/server/routes/instabox-snapshots.ts +++ b/server/routes/instabox-snapshots.ts @@ -41,13 +41,13 @@ async function call(request: InstaboxRequest, method: string, path: string, body return response; } -async function readySnapshot(request: InstaboxRequest, id: string): Promise { +async function readySnapshot(request: InstaboxRequest, id: string, signal?: AbortSignal): Promise { const deadline = Date.now() + 180_000; while (Date.now() < deadline) { const snapshot = snapshotSchema.parse(await (await call(request, "GET", `/v1/snapshots/${encodeURIComponent(id)}`)).json()); if (snapshot.state === "ready") return snapshot; if (["failed", "error", "deleted"].includes(snapshot.state)) throw new SnapshotError(502, "failed"); - await delay(500); + await delay(500, undefined, { signal }); } throw new SnapshotError(504, "timeout"); } @@ -67,35 +67,34 @@ async function listSnapshots(request: InstaboxRequest): Promise { return snapshots; } -async function findSnapshotByName(request: InstaboxRequest, name: string): Promise { +async function findSnapshotByName(request: InstaboxRequest, name: string, signal?: AbortSignal): Promise { const deadline = Date.now() + 180_000; while (Date.now() < deadline) { const snapshot = (await listSnapshots(request)).find((candidate) => candidate.name === name); if (snapshot) return snapshot; - await delay(500); + await delay(500, undefined, { signal }); } throw new SnapshotError(504, "timeout"); } -async function finishOperation(request: InstaboxRequest, response: Response): Promise { +async function finishOperation(request: InstaboxRequest, response: Response, signal?: AbortSignal): Promise { if (response.status === 204) return; - await waitOperation(request, await response.json()); + await waitOperation(request, await response.json(), signal); } -async function waitOperation(request: InstaboxRequest, initial: unknown): Promise { +async function waitOperation(request: InstaboxRequest, initial: unknown, signal?: AbortSignal): Promise { let operation = operationSchema.parse(initial); const deadline = Date.now() + 180_000; while (operation.state !== "succeeded") { if (["failed", "cancelled", "canceled"].includes(operation.state)) throw new SnapshotError(502, "failed"); if (Date.now() >= deadline) throw new SnapshotError(504, "timeout"); - const next = await call(request, "GET", `/v1/operations/${encodeURIComponent(operation.id)}`, undefined, { wait: "25s" }); + const next = await call(request, "GET", `/v1/operations/${encodeURIComponent(operation.id)}`, undefined, { wait: `${Math.max(1, Math.min(25, Math.ceil((deadline - Date.now()) / 1000)))}s` }); operation = operationSchema.parse(await next.json()); - if (operation.state !== "succeeded") await delay(500); + if (operation.state !== "succeeded") await delay(500, undefined, { signal }); } } -export function createInstaboxSnapshotRoutes(deps: { machines(): InstaboxMachines | null; request(): InstaboxRequest | null; machineIdFor(botId: string): Promise; botExists(botId: string): boolean }): RouteHandler { - const busy = new Set(); +export function createInstaboxSnapshotRoutes(deps: { machines(): InstaboxMachines | null; request(): InstaboxRequest | null; machineIdFor(botId: string): Promise; botExists(botId: string): boolean; claim(botId: string): () => void; signal?: AbortSignal }): RouteHandler { return async ({ req, res, path, method, auth, json, readBody }) => { const match = /^\/api\/bots\/([\w-]+)\/instabox\/snapshots(?:\/([\w-]+)(\/restore)?)?$/.exec(path); if (!match) return PASS; @@ -109,10 +108,12 @@ export function createInstaboxSnapshotRoutes(deps: { machines(): InstaboxMachine if (!deps.botExists(botId)) return json(res, 404, { error: "Bot not found", code: "bot_missing" }); const request = deps.request(), machines = deps.machines(); if (!request || !machines) return json(res, 503, { error: "InstaBox key is not set", code: "instabox_key_missing" }); - if (!listing && busy.has(botId)) return json(res, 409, { error: "Snapshot operation in progress", code: "instabox_snapshot_busy" }); + res.setTimeout(700_000); res.setHeader("cache-control", "private, no-store"); - if (!listing) busy.add(botId); + let release: (() => void) | undefined; try { + if (!listing) release = deps.claim(botId); + if (!deps.botExists(botId)) throw new SnapshotError(404, "bot_missing"); if (listing) { const snapshots = await listSnapshots(request); return json(res, 200, { snapshots: snapshots.filter((snapshot) => belongsTo(snapshot, botId)).map(({ id, name, state }) => ({ id, name, state })) }); @@ -128,15 +129,15 @@ export function createInstaboxSnapshotRoutes(deps: { machines(): InstaboxMachine name, description: `Cry Bot snapshot for ${botId}`, }); const createdPayload: unknown = await response.json(); - const isOperation = typeof createdPayload === "object" && createdPayload !== null && ("type" in createdPayload || "phase" in createdPayload || "machineId" in createdPayload); + const isOperation = typeof createdPayload === "object" && createdPayload !== null && ("type" in createdPayload || "phase" in createdPayload); let created: Snapshot; if (isOperation) { - await waitOperation(request, createdPayload); - created = await findSnapshotByName(request, name); + await waitOperation(request, createdPayload, deps.signal); + created = await findSnapshotByName(request, name, deps.signal); } else { created = snapshotSchema.parse(createdPayload); } - const { id, name: readyName, state } = await readySnapshot(request, created.id); + const { id, name: readyName, state } = await readySnapshot(request, created.id, deps.signal); return json(res, 201, { snapshot: { id, name: readyName, state } }); } const response = await call(request, "GET", `/v1/snapshots/${encodeURIComponent(snapshotId!)}`); @@ -146,17 +147,19 @@ export function createInstaboxSnapshotRoutes(deps: { machines(): InstaboxMachine if (snapshot.state !== "ready") throw new SnapshotError(409, "not_ready"); const machineId = await deps.machineIdFor(botId); if (!machineId) throw new SnapshotError(409, "machine_missing"); - await finishOperation(request, await call(request, "POST", `/v1/machines/${encodeURIComponent(machineId)}/restore`, { snapshotId, desiredState: "running" })); + await finishOperation(request, await call(request, "POST", `/v1/machines/${encodeURIComponent(machineId)}/restore`, { snapshotId, desiredState: "running" }), deps.signal); await machines.ensureRunning(botId); } else { - await finishOperation(request, await call(request, "DELETE", `/v1/snapshots/${encodeURIComponent(snapshotId!)}`)); + await finishOperation(request, await call(request, "DELETE", `/v1/snapshots/${encodeURIComponent(snapshotId!)}`), deps.signal); } return json(res, 200, { ok: true }); } catch (error) { + if (deps.signal?.aborted) return json(res, 504, { error: "InstaBox snapshot request timed out or disconnected", code: "instabox_snapshot_timeout" }); + if (!(error instanceof SnapshotError) && error instanceof Error && "status" in error && error.status === 409) return json(res, 409, { error: "Computer is in use", code: "instabox_snapshot_busy" }); const known = error instanceof SnapshotError; return json(res, known ? error.status : 502, { error: "InstaBox snapshot request failed", code: `instabox_snapshot_${known ? error.code : "upstream"}` }); } finally { - if (!listing) busy.delete(botId); + release?.(); } }; } diff --git a/server/testing/fake-instabox-core.ts b/server/testing/fake-instabox-core.ts index 4546584d..6fa8a2c0 100644 --- a/server/testing/fake-instabox-core.ts +++ b/server/testing/fake-instabox-core.ts @@ -1,7 +1,11 @@ import { createServer, type IncomingHttpHeaders } from "node:http"; +import { WebSocketServer } from "ws"; import type { InstaboxMachineState } from "../instabox/machine.ts"; export async function fakeInstaboxCore() { + const snapshots = new Map(); + const vncRequests: IncomingHttpHeaders[] = []; + const sockets = new WebSocketServer({ noServer: true }); const machines = new Map }>(); const operations = new Map(); const files = new Map(); @@ -13,6 +17,7 @@ export async function fakeInstaboxCore() { const calls: Array<{ method: string; path: string; query: URLSearchParams; headers: IncomingHttpHeaders; body: any }> = []; let failure: { status: number; code: string; message?: string } | undefined; let operationFailure = false; + const holds: Array<{ method: string; path: string; response: boolean; entered(): void; wait: Promise; release(): void; cancelled: boolean }> = []; const server = createServer(async (req, res) => { const url = new URL(req.url!, "http://localhost"); const chunks: Buffer[] = []; @@ -20,11 +25,24 @@ export async function fakeInstaboxCore() { const raw = Buffer.concat(chunks); const body = req.headers["content-type"] === "application/json" && raw.length ? JSON.parse(raw.toString()) : raw; calls.push({ method: req.method!, path: url.pathname, query: url.searchParams, headers: req.headers, body }); + const hold = holds.find(entry => entry.method === req.method && entry.path === url.pathname); + if (hold) holds.splice(holds.indexOf(hold), 1); + if (hold) res.on("close", () => { hold.cancelled = !res.writableEnded; }); + if (hold && !hold.response) { hold.entered(); await hold.wait; } const send = (status: number, value: unknown) => { - res.writeHead(status, { "Content-Type": "application/json" }); res.end(JSON.stringify(value)); + const finish = () => { res.writeHead(status, { "Content-Type": "application/json" }); res.end(JSON.stringify(value)); }; + if (hold?.response) { hold.entered(); void hold.wait.then(finish); } + else finish(); }; if (failure) { const next = failure; failure = undefined; return send(next.status, { error: next }); } if (!req.headers["x-api-key"]) return send(401, { error: { code: "unauthorized" } }); + if (url.pathname === "/v1/snapshots") return send(200, { snapshots: [...snapshots.values()] }); + if (url.pathname.startsWith("/v1/snapshots/")) { + const snapshot = snapshots.get(url.pathname.split("/").at(-1)!); + if (!snapshot) return send(404, { error: { code: "not_found" } }); + snapshot.status = "ready"; + return send(200, snapshot); + } const op = url.pathname.match(/^\/v1\/operations\/(.+)$/); if (op) { const operation = operations.get(op[1]); @@ -37,7 +55,7 @@ export async function fakeInstaboxCore() { } const finish = (machineId: string, finalState: InstaboxMachineState) => { if (!req.headers["idempotency-key"]) return send(400, { error: { code: "idempotency_required" } }); - const operation = { id: `op-${operations.size + 1}`, machineId, state: "pending", finalState, polls: 0 }; + const operation = { id: `op-${operations.size + 1}`, machineId, type: "fixture", phase: "pending", state: "pending", finalState, polls: 0 }; operations.set(operation.id, operation); send(202, operation); }; @@ -66,6 +84,12 @@ export async function fakeInstaboxCore() { if (desktop.has(machine.id)) return send(409, { error: { code: "desktop_already_running" } }); desktop.add(machine.id); return send(200, { running: true }); } + if (action === "snapshots") { + const snapshot = { id: `snapshot-${snapshots.size + 1}`, name: body.name, status: "pending" as const, sourceMachineId: machine.id }; + snapshots.set(snapshot.id, snapshot); + return finish(machine.id, "running"); + } + if (action === "restore") { desktop.delete(machine.id); return finish(machine.id, "running"); } if (action === "exec") return send(200, { stdout: "fixture output", stderr: "", exitCode: 0, timedOut: false, truncated: false }); const fileKey = `${machine.id}:${url.searchParams.get("path")}`; if (action === "files" && req.method === "PUT") { files.set(fileKey, raw); res.writeHead(204); return res.end(); } @@ -86,14 +110,27 @@ export async function fakeInstaboxCore() { res.on("close", () => { clearInterval(timer); stream.cancelled = !stream.completed; }); return; } - res.writeHead(200); return res.end(files.get(fileKey) ?? Buffer.alloc(0)); + res.writeHead(200); return res.end(files.get(fileKey) ?? (url.searchParams.get("path")?.startsWith("/tmp/cry-instabox-") ? Buffer.from("/9j/4AAQSkZJRgABAQAAAQABAAD/2Q==", "base64") : Buffer.alloc(0))); } send(404, { error: { code: "not_found" } }); }); + server.on("upgrade", (req, socket, head) => { + vncRequests.push(req.headers); + sockets.handleUpgrade(req, socket, head, peer => { peer.on("error", () => {}); peer.send(Buffer.from("RFB 003.008\n")); }); + }); await new Promise(resolve => server.listen(0, "127.0.0.1", resolve)); const address = server.address(); if (!address || typeof address === "string") throw new Error("Fake InstaBox failed to listen"); - return { url: `http://127.0.0.1:${address.port}`, calls, machines, operations, desktop, + return { url: `http://127.0.0.1:${address.port}`, calls, machines, operations, desktop, snapshots, vncRequests, + holdNext: (method: string, path: string, response = false) => { + let release!: () => void; + let entered!: () => void; + const wait = new Promise(resolve => { release = resolve; }); + const reached = new Promise(resolve => { entered = resolve; }); + const hold = { method, path, response, wait, entered, release, cancelled: false }; + holds.push(hold); + return { reached, release, cancelled: () => hold.cancelled }; + }, streamFile: (machineId: string, path: string, options: { chunk: Buffer; chunkCount: number; contentLength?: number }) => { const stream = { ...options, chunksSent: 0, cancelled: false, completed: false }; fileStreams.set(`${machineId}:${path}`, stream); @@ -101,6 +138,6 @@ export async function fakeInstaboxCore() { }, failNext: (next: NonNullable) => { failure = next; }, failOperations: () => { operationFailure = true; }, - close: () => new Promise((resolve, reject) => { server.close(error => error ? reject(error) : resolve()); server.closeAllConnections(); }), + close: () => new Promise((resolve, reject) => { for (const peer of sockets.clients) peer.terminate(); sockets.close(); server.close(error => error ? reject(error) : resolve()); server.closeAllConnections(); }), }; } diff --git a/server/testing/fake-instabox-snapshots.ts b/server/testing/fake-instabox-snapshots.ts index 3fa1efa9..c47ec43f 100644 --- a/server/testing/fake-instabox-snapshots.ts +++ b/server/testing/fake-instabox-snapshots.ts @@ -3,7 +3,7 @@ import { randomUUID } from "node:crypto"; import { json, readBody } from "../harness/http.ts"; import type { InstaboxRequest } from "../instabox/machine.ts"; -export interface FakeSnapshot { id: string; name: string; state: string; metadata?: { app?: string; botId?: string } } +export interface FakeSnapshot { id: string; name: string; status: "pending" | "ready" | "failed"; sourceMachineId: string; metadata?: { app?: string; botId?: string } } type CreateResponseShape = "operation" | "snapshot"; export async function fakeInstaboxSnapshots(options: { createResponse?: CreateResponseShape } = {}) { @@ -25,7 +25,7 @@ export async function fakeInstaboxSnapshots(options: { createResponse?: CreateRe if (url.pathname === "/v1/snapshots") return json(res, 200, { snapshots: [...snapshots.values()] }); const id = url.pathname.split("/").at(-1)!; if (method === "POST" && url.pathname.endsWith("/snapshots")) { - const snapshot = { id: randomUUID(), name: body.name, state: "creating" }; + const snapshot = { id: randomUUID(), name: body.name, status: "pending" as const, sourceMachineId: "machine-one" }; snapshots.set(snapshot.id, snapshot); if (createResponse === "snapshot") return json(res, 202, snapshot); const operation = { id: randomUUID(), machineId: "machine-one", type: "create", state: "pending", phase: "snapshotting", error: null }; @@ -35,7 +35,7 @@ export async function fakeInstaboxSnapshots(options: { createResponse?: CreateRe if (method === "GET" && url.pathname.startsWith("/v1/snapshots/")) { const snapshot = snapshots.get(id); if (!snapshot) return json(res, 404, { error: "not found" }); - if (snapshot.state === "creating") snapshot.state = snapshotFails ? "failed" : "ready"; + if (snapshot.status === "pending") snapshot.status = snapshotFails ? "failed" : "ready"; return json(res, 200, snapshot); } if (method === "DELETE" || (method === "POST" && url.pathname.endsWith("/restore"))) { diff --git a/shared/place-view.ts b/shared/place-view.ts index 1584f759..3ee5d5a6 100644 --- a/shared/place-view.ts +++ b/shared/place-view.ts @@ -88,7 +88,7 @@ export interface PlaceFacts { /** Boat desktops are unavailable in provider-locked installations. */ providerLock?: boolean; /** The cloud computer's provider: Boat, or the person's own server. */ - backend?: "box" | "vps"; + backend?: "box" | "vps" | "instabox"; engine: { name: string; model?: string; diff --git a/src/components/CloudBackendPicker.test.ts b/src/components/CloudBackendPicker.test.ts index b9ffeb7d..30b388ec 100644 --- a/src/components/CloudBackendPicker.test.ts +++ b/src/components/CloudBackendPicker.test.ts @@ -32,11 +32,12 @@ describe("CloudBackendPicker", () => { }); it.each(["box", "vps", "instabox"] as const)("offers all three backends whichever is chosen (%s)", (value) => { + fixture.config = { instabox: { configured: true } }; const markup = picker(value); expect(markup).toContain("Boat"); expect(markup).toContain("InstaBox"); expect(markup).toContain("Self-hosted VPS"); - expect(markup).not.toContain("disabled"); + expect(markup).not.toContain('disabled=""'); expect(markup).not.toMatch(/ACP model provider/); }); @@ -46,8 +47,9 @@ describe("CloudBackendPicker", () => { }); }); -it("prompts for an InstaBox key without disabling selection", () => { - expect(picker("instabox")).toContain("Add your InstaBox key in Settings first"); +it("disables InstaBox and prompts for a key even when another backend is selected", () => { + expect(picker("box")).toContain("Add your InstaBox key in Settings first"); + expect(picker("box")).toContain('disabled=""'); fixture.config = { instabox: { configured: true } }; expect(picker("instabox")).not.toContain("Add your InstaBox key in Settings first"); }); diff --git a/src/components/CloudBackendPicker.tsx b/src/components/CloudBackendPicker.tsx index cae784a1..abc909fe 100644 --- a/src/components/CloudBackendPicker.tsx +++ b/src/components/CloudBackendPicker.tsx @@ -30,10 +30,12 @@ export function CloudBackendPicker({ ))} - {value === "instabox" && !instaboxKeyStatus(state.config).configured &&

{t("botAccess.cloud.instaboxKeyHint")}

} + {!instaboxKeyStatus(state.config).configured &&

{t("botAccess.cloud.instaboxKeyHint")}

} ); } diff --git a/src/components/ComputerPanel.instabox.test.ts b/src/components/ComputerPanel.instabox.test.ts new file mode 100644 index 00000000..472b2bfb --- /dev/null +++ b/src/components/ComputerPanel.instabox.test.ts @@ -0,0 +1,65 @@ +// @vitest-environment happy-dom +import { createElement } from "react"; +import { flushSync } from "react-dom"; +import { createRoot } from "react-dom/client"; +import { expect, it, vi } from "vitest"; +import type { AppState, Bot, InstanceInfo } from "@/state/store"; + +const fixture = vi.hoisted(() => ({ configured: false, reads: 0 })); +vi.mock("./DesktopCapabilities", async original => ({ + ...await original(), + useCaptionChrome: () => ({ padClass: undefined }), + useDesktopCapabilities: () => ({ ready: true, capabilities: { + host: { platform: "linux", label: "Fixture", session: "unknown", packaged: false, homeDir: "/tmp" }, + windowChrome: "native", screenPreview: { available: false, interaction: "none" }, + dictation: { available: false, engine: "none", onDevice: false }, + localComputer: { available: false, support: "unsupported", enabled: false, status: "unavailable" }, + } }), +})); +vi.mock("@/lib/interface-mode", () => ({ useAdvancedMode: () => true, setAdvancedMode: () => {} })); +vi.mock("./AndroidDevicePanel", () => ({ AndroidDevicePanel: () => null, useAndroidUsbDevices: () => ({ devices: [] }) })); +vi.mock("./BrowserPanel", () => ({ BrowserPanel: () => null })); +vi.mock("./InstaboxSnapshots", () => ({ InstaboxSnapshots: () => null })); +vi.mock("./bot-settings/RoutinesSection", () => ({ RoutinesSection: () => null })); +vi.mock("@/state/store", async original => ({ + ...await original(), + api: async (path: string) => { + if (path.startsWith("/api/bots/fixture-bot/computer?")) { + fixture.reads++; + return { backend: "instabox", configured: fixture.configured, ready: false, machine: null }; + } + if (path.includes("computer/control")) return { held: false, helpReason: null }; + return {}; + }, +})); +const { ComputerPanel } = await import("./ComputerPanel"); +const { BotEditorStore, initialState } = await import("@/state/store"); + +it("refreshes the selected InstaBox panel when its key is saved in Settings", async () => { + const bot = { id: "fixture-bot", threadId: "fixture-thread", name: "Fixture", title: "", description: "", color: "green", + computer: "cloud", cloudBackend: "instabox", modelSelection: { instanceId: "fixture", model: "fixture" }, + messages: [], tasks: [], busy: false } as unknown as Bot; + const instance = { instanceId: "fixture", driverKind: "claudeAgent", displayName: "Fixture", access: "subscription", + snapshot: { state: "available", authenticated: true }, capabilities: { computerMcp: true, browserMcp: true }, + models: { default: "fixture", options: [{ id: "fixture", label: "Fixture" }] } } as InstanceInfo; + vi.stubGlobal("fetch", vi.fn(async () => new Response("{}", { headers: { "content-type": "application/json" } }))); + const host = document.createElement("div"); document.body.append(host); + const root = createRoot(host); + const render = () => { + const state = { ...initialState, bots: [bot], selectedId: bot.id, instances: [instance], + config: { box: { configured: false }, vps: { configured: false }, instabox: { configured: fixture.configured, fromEnv: false } } } as AppState; + flushSync(() => root.render(createElement(BotEditorStore, { value: { state, dispatch: vi.fn(), flushBotPatches: async () => null, + refreshInstances: async () => {}, refreshModels: async () => {} }, children: createElement(ComputerPanel, { bot }) }))); + }; + try { + render(); + await vi.waitFor(() => expect(fixture.reads).toBeGreaterThan(0)); + await vi.waitFor(() => expect(host.textContent).toContain("Add your InstaBox key in Settings first")); + const reads = fixture.reads; + fixture.configured = true; + render(); + await vi.waitFor(() => expect(fixture.reads).toBeGreaterThan(reads)); + await vi.waitFor(() => expect(host.textContent).not.toContain("Add your InstaBox key in Settings first")); + expect(host.textContent).not.toContain("Connect Boat"); + } finally { root.unmount(); host.remove(); vi.unstubAllGlobals(); } +}); diff --git a/src/components/ComputerPanel.tsx b/src/components/ComputerPanel.tsx index 0cfe0052..8de30b5e 100644 --- a/src/components/ComputerPanel.tsx +++ b/src/components/ComputerPanel.tsx @@ -1,3 +1,4 @@ +import { cloudPanelStatus } from "./instabox-panel"; import { InstaboxSnapshots } from "./InstaboxSnapshots"; import { boatCapableEngine, cloudEngineOf } from "@/lib/remote-desktop"; import { canWorkOnCloud } from "../../shared/cloud-computer"; @@ -537,8 +538,9 @@ export function ComputerPanel({ } // Opening the panel only looks: it never creates or wakes a Boat. api(threadPath("computer")) - .then((status) => { + .then((rawStatus) => { if (!alive) return; + const status = cloudPanelStatus(rawStatus); const action = resolveBoatPanelAction({ computer: livePlace === "cloud" ? "cloud" : undefined, configured: Boolean(status.configured), @@ -600,7 +602,7 @@ export function ComputerPanel({ engineReason, cloudSupported, providerLock, - state.config?.vps?.sshAlias, + state.config?.vps?.sshAlias, state.config?.instabox?.configured, panelView, computerSelectionPersisted, surfaceReady, @@ -619,7 +621,7 @@ export function ComputerPanel({ api(threadPath("computer"), { background: true }) .then((status) => { if (!alive) return; - const state = typeof status.box?.state === "string" ? status.box.state : null; + const state = cloudPanelStatus(status).box?.state ?? null; setBoatState(state); if (isReadyBoatState(state)) setPhase("ready"); }) @@ -634,7 +636,7 @@ export function ComputerPanel({ const control = state.computerControl[bot.id] ?? { held: false, helpReason: null }; const liveTarget = bot.computer === "vm" ? localVmTakeoverTarget(phase, vmStatus, computerStatusCurrent) - : cloudPreviewReady && cloudBackend === "vps" ? `vps/${bot.id}` : null; + : cloudPreviewReady && (cloudBackend === "vps" || cloudBackend === "instabox") ? `vps/${bot.id}` : null; const requestControl = useCallback(async (action: ComputerControlAction, controlLeaseId?: string) => { const snap = computerControlSnapshotSchema.parse(await api(threadPath("computer/control"), { method: "POST", @@ -654,9 +656,9 @@ export function ComputerPanel({ session: localVmTakeoverSession(viewerConnectionKey, panelView, bot.computer === "vm" ? lastVmScreenTarget.current.target : null), held: control.held, request: requestControl, - viewerClose: bot.computer === "cloud" && cloudBackend === "vps" ? threadPath("computer/viewer-close") : null, + viewerClose: bot.computer === "cloud" && (cloudBackend === "vps" || cloudBackend === "instabox") ? threadPath("computer/viewer-close") : null, }); - const vpsTakeoverTarget = bot.computer === "cloud" && cloudBackend === "vps" ? `vps/${bot.id}` : null; + const vpsTakeoverTarget = bot.computer === "cloud" && (cloudBackend === "vps" || cloudBackend === "instabox") ? `vps/${bot.id}` : null; const liveDesktopTarget = liveTarget ?? (takeover.here ? vpsTakeoverTarget : null); const liveHere = takeover.here && Boolean(liveDesktopTarget); useEffect(() => { if (liveTarget) void loadLiveDesktop(); }, [liveTarget]); @@ -950,7 +952,7 @@ export function ComputerPanel({ setPhase("starting"); api(`/api/bots/${bot.id}/computer/provision`, { method: "POST" }) .then((result) => { - setBoatState(result.state ?? null); + setBoatState(result.machine?.state ?? result.state ?? null); setResolvedComputerSelection({ botId: bot.id, threadId: bot.threadId, computer: bot.computer, cloudBackend }); setPhase("ready"); }) @@ -1091,7 +1093,7 @@ export function ComputerPanel({ const managedPolicy = state.config?.managedPolicy; const busyBoat = busyBoatView(boatState, profileBot.busy === true); - const cloudComputer: PlaceFacts["computer"] = !computerStatusCurrent || livePlace !== "cloud" || cloudBackend !== "box" ? undefined + const cloudComputer: PlaceFacts["computer"] = !computerStatusCurrent || livePlace !== "cloud" || cloudBackend === "vps" ? undefined : phase === "starting" ? "starting" : phase === "busy-boat" ? (busyBoat.spinner ? "starting" : busyBoat.line === "computer.cloud.asleep" ? "asleep" : "none") : phase === "ready" ? "on" @@ -1502,9 +1504,9 @@ export function ComputerPanel({ {errorText} )} - {!providerLock && (boatKeyShown || (phase === "unconfigured" && cloudView.action?.id === "add-boat-key")) && ( + {!providerLock && (boatKeyShown || (phase === "unconfigured" && (cloudView.action?.id === "add-boat-key" || cloudBackend === "instabox"))) && (
- { setBoatKeyShown(true); if (configured) setRetry((n) => n + 1); }} />
@@ -1650,7 +1652,7 @@ export function ComputerPanel({ )} )} - {!providerLock && canManageCloud && cloudBackend !== "vps" && phase !== "unconfigured" && phase !== "team-boat" && teamComputer?.botId !== bot.id && } + {!providerLock && canManageCloud && cloudBackend === "box" && phase !== "unconfigured" && phase !== "team-boat" && teamComputer?.botId !== bot.id && } {phase !== "team-boat" && (bot.computer !== undefined || computerStatusCurrent) && <> diff --git a/src/components/InstaboxSnapshots.test.tsx b/src/components/InstaboxSnapshots.test.tsx index ffcb9a9a..f2583097 100644 --- a/src/components/InstaboxSnapshots.test.tsx +++ b/src/components/InstaboxSnapshots.test.tsx @@ -34,7 +34,7 @@ describe("InstaBox snapshots", () => { expect(host.textContent).toContain("No snapshots yet"); fixture.api.mockResolvedValueOnce({ snapshot }).mockResolvedValueOnce({ snapshots: [snapshot] }); await click("Save a snapshot"); - expect(fixture.api).toHaveBeenCalledWith("/api/bots/bot-one/instabox/snapshots", { method: "POST", body: "{}" }); + expect(fixture.api).toHaveBeenCalledWith("/api/bots/bot-one/instabox/snapshots", { timeoutMs: 720_000, method: "POST", body: "{}" }); expect(host.textContent).toContain(snapshot.name); expect(host.textContent).not.toContain("No snapshots yet"); }); @@ -50,7 +50,7 @@ describe("InstaBox snapshots", () => { expect(fixture.api).toHaveBeenCalledTimes(1); await click(label); await click(label, document.querySelector('[role="alertdialog"]')!); - expect(fixture.api).toHaveBeenCalledWith(`/api/bots/bot-one/instabox/snapshots/snapshot-one${label === "Delete" ? "" : "/restore"}`, { method: label === "Delete" ? "DELETE" : "POST" }); + expect(fixture.api).toHaveBeenCalledWith(`/api/bots/bot-one/instabox/snapshots/snapshot-one${label === "Delete" ? "" : "/restore"}`, { timeoutMs: 720_000, method: label === "Delete" ? "DELETE" : "POST" }); expect(document.querySelector('[role="alertdialog"]')).toBeNull(); expect(fixture.api).toHaveBeenCalledTimes(3); }); diff --git a/src/components/InstaboxSnapshots.tsx b/src/components/InstaboxSnapshots.tsx index 7ec19892..5e551436 100644 --- a/src/components/InstaboxSnapshots.tsx +++ b/src/components/InstaboxSnapshots.tsx @@ -48,7 +48,7 @@ function SnapshotPanel({ botId }: { botId: string }) { setError(null); try { const path = chosen ? `${base}/${encodeURIComponent(chosen.snapshot.id)}${chosen.kind === "restore" ? "/restore" : ""}` : base; - await api(path, { method: chosen?.kind === "delete" ? "DELETE" : "POST", ...(!chosen ? { body: "{}" } : {}) }); + await api(path, { timeoutMs: 720_000, method: chosen?.kind === "delete" ? "DELETE" : "POST", ...(!chosen ? { body: "{}" } : {}) }); const data = await api<{ snapshots: Snapshot[] }>(base); if (mounted.current) { setSnapshots(data.snapshots); setAction(null); } } catch (cause) { diff --git a/src/components/instabox-panel.test.ts b/src/components/instabox-panel.test.ts new file mode 100644 index 00000000..b3e98391 --- /dev/null +++ b/src/components/instabox-panel.test.ts @@ -0,0 +1,29 @@ +import { describe, expect, it } from "vitest"; +import { cloudPanelStatus } from "./instabox-panel"; +import { resolveBoatPanelAction } from "@/lib/local-computer"; +import { placeFacts, placeViewFor } from "@/lib/place-view"; +import type { Bot, InstanceInfo } from "@/state/store"; + +describe("InstaBox computer panel", () => { + it.each([ + ["running", true, "attach-ready-boat"], + ["suspended", false, "cloud-asleep"], + ["stopped", false, "cloud-asleep"], + [undefined, false, "cloud-new"], + ] as const)("maps %s to the existing cloud controls", (state, ready, expected) => { + const status = cloudPanelStatus({ backend: "instabox", configured: true, ready, machine: state ? { state } : null }); + expect(resolveBoatPanelAction({ computer: "cloud", configured: true, boatState: status.box!.state, canUseCloud: true, autoLocal: false, teamComputer: false, busy: false })).toBe(expected); + }); + + it("uses the InstaBox key and a settings hint independently of Boat or the Cloud plan", () => { + const bot = { name: "Fixture", cloudBackend: "instabox", modelSelection: { instanceId: "fixture", model: "fixture" } } as Bot; + const instances = [{ instanceId: "fixture", capabilities: { computerMcp: true }, snapshot: { authenticated: true, state: "available" } }] as InstanceInfo[]; + const input = { bot, instances, place: "cloud" as const, seat: { server: "linux" as const, plan: true, role: "admin" as const, mode: "simple" as const } }; + const missing = placeViewFor(placeFacts({ ...input, config: { box: { configured: true }, instabox: { configured: false, fromEnv: false } } })); + expect(missing.line).toContain("Add your InstaBox key in Settings first"); + expect(missing.action).toBeNull(); + const ready = placeViewFor(placeFacts({ ...input, computer: "on", config: { instabox: { configured: true, fromEnv: false }, box: { configured: false } } })); + expect(ready.state).toBe("cc-on"); + expect(ready.line).not.toContain("Boat"); + }); +}); diff --git a/src/components/instabox-panel.ts b/src/components/instabox-panel.ts new file mode 100644 index 00000000..90faf718 --- /dev/null +++ b/src/components/instabox-panel.ts @@ -0,0 +1,12 @@ +interface InstaboxPanelStatus { + backend?: string; + machine?: { state: string } | null; + configured?: boolean; + ready?: boolean; +} + +export function cloudPanelStatus(status: T): T & { box?: { state: string | null } } { + if (status.backend !== "instabox") return status; + const state = status.machine?.state; + return { ...status, box: { state: status.ready ? "ready" : state === "suspended" || state === "stopped" ? "archived" : state ?? null } }; +} diff --git a/src/lib/place-view.ts b/src/lib/place-view.ts index f764fa67..7a1a9fc3 100644 --- a/src/lib/place-view.ts +++ b/src/lib/place-view.ts @@ -57,7 +57,7 @@ export function placeFacts(input: { bot: Pick; place: PlaceFacts["place"]; seat: PlaceSeat; - config: (FeatureFlagConfig & Pick) | null | undefined; + config: (FeatureFlagConfig & Pick) | null | undefined; instances: InstanceInfo[]; local?: PlaceFacts["local"]; computer?: PlaceFacts["computer"]; @@ -70,9 +70,9 @@ export function placeFacts(input: { providerLock: config?.providerLock, server: seat.server, bot: bot.name, - plan: seat.plan, - boat: config?.box?.configured ? (config.box.included ? "included" : "own-key") : "none", - backend: bot.cloudBackend === "vps" ? "vps" : "box", + plan: bot.cloudBackend === "instabox" ? false : seat.plan, + boat: bot.cloudBackend === "instabox" ? (config?.instabox?.configured ? "own-key" : "none") : config?.box?.configured ? (config.box.included ? "included" : "own-key") : "none", + backend: bot.cloudBackend ?? "box", engine: engineFacts(instance, bot.modelSelection.model), toolsAllowComputer: canUseMcpServer(bot.toolScope, "computer"), browserOn: builtInBrowserEnabled(config) && browserAvailable(config), @@ -85,7 +85,9 @@ export function placeFacts(input: { } export function placeViewFor(facts: PlaceFacts): PlaceView { - return placeView(facts, { translate: placeTranslate, locale: activeLocale() }); + const view = placeView(facts, { translate: placeTranslate, locale: activeLocale() }); + return facts.backend === "instabox" && view.state === "cc-needs-key" + ? { ...view, short: t("computer.instabox.keyMissing"), line: t("botAccess.cloud.instaboxKeyHint"), action: null } : view; } export function placeRowViewFor(row: PlaceRow, seat: PlaceSeat, worksOnLabel?: string): PlaceView { diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json index ba9a76cb..02ee441d 100644 --- a/src/locales/pt-br.json +++ b/src/locales/pt-br.json @@ -10625,5 +10625,5 @@ "computer.instabox.snapshots.deleteConfirm": "Este instantâneo não poderá ser recuperado depois da exclusão. Excluir?", "computer.instabox.snapshots.busy": "Processando instantâneos, aguarde", "computer.instabox.snapshots.error": "Não foi possível processar o instantâneo. Tente novamente.", - "computer.instabox.snapshots.machineMissing": "Inicie primeiro o computador em nuvem InstaBox deste agente" + "computer.instabox.snapshots.machineMissing": "Inicie primeiro o computador em nuvem InstaBox deste bot" } From 2fd8905f2d81950ee09d3963801f7db4fb3687e2 Mon Sep 17 00:00:00 2001 From: tangzhixiong613-jpg <340458552+tangzhixiong613-jpg@users.noreply.github.com> Date: Sun, 15 Nov 2026 10:20:29 +0000 Subject: [PATCH 2/2] =?UTF-8?q?T-1246=20=E7=AC=AC3=E8=BD=AE=EF=BC=9A?= =?UTF-8?q?=E5=A4=B9=E5=85=B7=E5=8E=BB=E6=8E=89=20Boat=20=E7=94=A8?= =?UTF-8?q?=E8=AF=8D=EF=BC=8C=E6=B5=8B=E8=AF=95=E5=9F=BA=E5=9D=80=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=8F=AA=E5=9C=A8=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../tasks/T-1200/T-1246-instabox-wiring/r3.md | 20 + .../T-1200/T-1246-instabox-wiring/report.md | 22 +- .../T-1246-instabox-wiring/verification.txt | 2112 ++--------------- server/instabox/wiring-backends-fixture.ts | 2 +- server/instabox/wiring.test.ts | 10 + server/instabox/wiring.ts | 4 +- 6 files changed, 212 insertions(+), 1958 deletions(-) create mode 100644 docs/tasks/T-1200/T-1246-instabox-wiring/r3.md diff --git a/docs/tasks/T-1200/T-1246-instabox-wiring/r3.md b/docs/tasks/T-1200/T-1246-instabox-wiring/r3.md new file mode 100644 index 00000000..4e082177 --- /dev/null +++ b/docs/tasks/T-1200/T-1246-instabox-wiring/r3.md @@ -0,0 +1,20 @@ +## 运行环境(云沙箱,必读) +- 开工先在 worktree 根目录运行 依赖准备脚本(镜像自带,把预装依赖链进 node_modules),之后 `pnpm exec vitest` / `pnpm exec tsc` 才可用。 +- 这里**没有** systemd、Docker,说明里出现的 `systemd-run --scope ... --` 前缀一律去掉直接运行;机器 8G/4 核,一次只跑一个测试文件。 +- 若本轮沙箱已放开(能联网、能监听端口),交回前必须把改动相关的测试全部跑过,包括需要端口的 e2e;涉及的 e2e 连跑 3 次都要过。跑不了的写明原因。 +- 报告只写三样:改了什么(文件列表与 git status 一致)、为什么、测试命令与结果摘要。不要写长篇分析;完整输出放 verification 文本文件即可。 +- 不提交 git。 + +# T-1246 第 3 轮:CI 一条分支独有失败 + 一条安全审查低级项 + +原任务见本文件夹 brief.md、r2.md,工作区已提交的改动保留。第 2 轮审核已通过,只改下面两条。 + +## 必改 +1. GitHub Actions 分支独有失败 `src/locales/vocabulary.test.ts`「hard-coded strings in src, server, electron and shared use the same words」: + `server/instabox/wiring-backends-fixture.ts:25` 的字符串 `"Boat fixture completed"` 违反用词约定(Boat 只用来称呼个人自己的钥匙,云桌面要说 cloud desktop)。改成不含 Boat 的说法(如 `"box fixture completed"`),同步改引用它的断言;不要往 ALLOWED 白名单里加条目。 + +## 一起改(安全审查低级) +2. `server/instabox/wiring.ts` 读取 `CRYBOT_TEST_INSTABOX_API`(把 基址改到本机并允许不安全的本机画面上游)在生产进程里也生效。改为只在测试环境生效(沿用仓库已有的测试环境判定方式,如 `NODE_ENV === "test"` 或现有的测试开关),生产进程忽略该变量;补一条单测。 + +## 验收 +`src/locales/vocabulary.test.ts`、`server/instabox/` 下全部测试逐文件跑过,wiring e2e 连跑 3 次;`pnpm exec tsc -p tsconfig.server.json`;改动文件 `oxlint --deny-warnings`。report.md 追加第 3 轮一节(短);verification 不写 IP、地址、域名、uuid、Object 相等判定写法。 diff --git a/docs/tasks/T-1200/T-1246-instabox-wiring/report.md b/docs/tasks/T-1200/T-1246-instabox-wiring/report.md index a35229b5..7b34b556 100644 --- a/docs/tasks/T-1200/T-1246-instabox-wiring/report.md +++ b/docs/tasks/T-1200/T-1246-instabox-wiring/report.md @@ -73,4 +73,24 @@ - `pnpm exec vitest run <文件> --maxWorkers=1`:22 个文件逐个通过,含 `server/instabox/` 全部、`server/index.test.ts`、快照路由、Boat/env 与行数门禁;7 个 e2e 文件及桌面代理 HTTP 测试均连续 3 次通过,VNC 设置 `CRYBOT_CDP_CHROME=/usr/bin/chromium`,浏览器用例实际执行。 - `pnpm exec tsc -p tsconfig.server.json`、`pnpm exec tsc -p tsconfig.json`、改动文件 `pnpm exec oxlint --deny-warnings`、`git diff --check`:全部通过。 -- 验证 README 缺失;全部服务验证使用隔离 fixture。完整脱敏输出(含假后端修正前失败)见 [verification.txt](verification.txt)。 +- 验证 README 缺失;全部服务验证使用隔离 fixture。完整脱敏输出见 [verification.txt](verification.txt)。 + +## 第 3 轮 + +改了什么(未提交): + +```text + M docs/tasks/T-1200/T-1246-instabox-wiring/report.md + M docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt + M server/instabox/wiring-backends-fixture.ts + M server/instabox/wiring.test.ts + M server/instabox/wiring.ts +``` + +为什么:假后端输出改用 cloud desktop 的统一词汇;`CRYBOT_TEST_INSTABOX_API` 现在仅在测试环境开关启用时生效,生产进程忽略它,并新增了回归单测。 + +测试命令与结果摘要: + +- `src/locales/vocabulary.test.ts` 通过 6 项;`server/instabox/` 下全部测试逐文件执行,147 项通过、1 项既有跳过;wiring e2e 连续 3 次通过(每次 6 项)。 +- `pnpm exec tsc -p tsconfig.server.json`、改动文件 `pnpm exec oxlint --deny-warnings`、`git diff --check`:通过。 +- 验证使用隔离 fixture;仓库未提供 `docs/verification/README.md`。完整输出见 [verification.txt](verification.txt)。 diff --git a/docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt b/docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt index f50e7d77..63800139 100644 --- a/docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt +++ b/docs/tasks/T-1200/T-1246-instabox-wiring/verification.txt @@ -1,2066 +1,268 @@ -All application mutations used isolated fixtures. No real InstaBox service was used. -docs/verification/README.md is absent. Paths and runtime identifiers below are redacted. - -Dependency setup -crybot-link-deps: linked 73 entries; EXIT 0 - - -Initial wiring attempt 1: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - ❯ server/instabox/wiring.e2e.test.ts (3 tests | 1 failed) 17810ms - × wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry 8388ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL server/instabox/wiring.e2e.test.ts > wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry -AssertionError: expected 'box' to be 'instabox' - -Expected: "instabox" -Received: "box" - - ❯ server/instabox/wiring.e2e.test.ts:39:69 - 37| const bot = created.body.bot; - 38| const path = `/api/bots/${bot.id}`; - 39| expect((await request("GET", path + "/computer")).body.backend).to… - | ^ - 40| writeFileSync(app.planPath, JSON.stringify({ [bot.id]: { steps: [ - 41| { server: "computer", name: "exec", input: { command: "printf wi… - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed | 2 passed (3) - Start at 08:43:08 - Duration 22.04s (transform 2.01s, setup 2.15s, import 1.61s, tests 17.81s, environment 0ms) - - - -Initial wiring attempt 2: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - ❯ server/instabox/wiring.e2e.test.ts (3 tests | 1 failed) 57030ms - × wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry 52254ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL server/instabox/wiring.e2e.test.ts > wires saved and environment keys, turn tools, VNC, snapshots, replacement and deletion through the real entry -AssertionError: expected false to be true - -- Expected -+ Received - -- true -+ false - - ❯ server/instabox/wiring.e2e.test.ts:46:113 - 44| ], reply: "Wiring complete." } })); - 45| expect((await request("POST", path + "/messages", { text: "Use the… - 46| await expect.poll(() => fake.calls.some(call => call.path.endsWith… - | ^ - 47| await expect.poll(async () => (await request("GET", "/api/bots")).… - 48| expect(fake.calls.some(call => call.path.endsWith("/exec") && call… - -Caused by: Error: Matcher did not succeed in time. - ❯ server/instabox/wiring.e2e.test.ts:46:5 - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed | 2 passed (3) - Start at 08:44:43 - Duration 60.40s (transform 2.25s, setup 1.65s, import 1.46s, tests 57.03s, environment 0ms) - - - -Initial wiring attempt 3: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 08:46:10 - Duration 19.43s (transform 1.78s, setup 973ms, import 1.33s, tests 16.98s, environment 0ms) - - - -Initial server type check: pnpm exec tsc -p tsconfig.server.json -server/instabox/wiring.e2e.test.ts(28,12): error TS2571: Object is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(32,12): error TS2571: Object is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(37,17): error TS18046: 'created.body' is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(40,12): error TS2571: Object is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(47,35): error TS2571: Object is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(52,12): error TS2571: Object is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(64,12): error TS2571: Object is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(64,71): error TS18046: 'saved.body' is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(66,51): error TS18046: 'saved.body' is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(85,17): error TS2571: Object is of type 'unknown'. -server/instabox/wiring.e2e.test.ts(90,35): error TS2571: Object is of type 'unknown'. - - -Sequential regression checks; CRYBOT_CDP_CHROME=/usr/bin/chromium - -$ pnpm exec vitest run server/instabox/client.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 08:47:35 - Duration 1.38s (transform 874ms, setup 1.10s, import 33ms, tests 89ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 29 passed (29) - Start at 08:47:37 - Duration 11.52s (transform 1.16s, setup 1.14s, import 355ms, tests 9.86s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 29 passed (29) - Start at 08:47:49 - Duration 11.70s (transform 1.24s, setup 1.18s, import 396ms, tests 9.96s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 29 passed (29) - Start at 08:48:02 - Duration 11.72s (transform 1.33s, setup 1.28s, import 406ms, tests 9.86s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 15 passed (15) - Start at 08:48:14 - Duration 62.23s (transform 1.84s, setup 1.03s, import 1.40s, tests 59.66s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 15 passed (15) - Start at 08:49:17 - Duration 60.66s (transform 1.72s, setup 979ms, import 1.28s, tests 58.25s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 15 passed (15) - Start at 08:50:18 - Duration 58.16s (transform 1.66s, setup 956ms, import 1.24s, tests 55.82s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/key.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 4 passed (4) - Start at 08:51:17 - Duration 1.22s (transform 804ms, setup 1.04s, import 10ms, tests 17ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/machines.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 24 passed (24) - Start at 08:51:19 - Duration 1.95s (transform 816ms, setup 997ms, import 56ms, tests 752ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/persistence.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 08:51:21 - Duration 1.53s (transform 1.05s, setup 964ms, import 410ms, tests 27ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/power.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 08:51:23 - Duration 2.13s (transform 1.54s, setup 951ms, import 1.03s, tests 9ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 32 passed (32) - Start at 08:51:26 - Duration 9.05s (transform 1.48s, setup 896ms, import 984ms, tests 7.02s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 32 passed (32) - Start at 08:51:35 - Duration 3.99s (transform 1.41s, setup 971ms, import 840ms, tests 2.04s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 32 passed (32) - Start at 08:51:40 - Duration 3.83s (transform 1.33s, setup 951ms, import 758ms, tests 1.99s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/vnc.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:51:44 - Duration 1.07s (transform 708ms, setup 921ms, import 10ms, tests 4ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 08:51:46 - Duration 16.38s (transform 1.22s, setup 833ms, import 812ms, tests 14.60s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 08:52:03 - Duration 16.26s (transform 1.24s, setup 868ms, import 798ms, tests 14.45s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 08:52:20 - Duration 16.57s (transform 1.22s, setup 848ms, import 801ms, tests 14.79s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 08:52:37 - Duration 3.60s (transform 2.26s, setup 925ms, import 1.92s, tests 614ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 08:52:41 - Duration 3.44s (transform 2.10s, setup 935ms, import 1.74s, tests 624ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 08:52:45 - Duration 3.56s (transform 2.22s, setup 1000ms, import 1.81s, tests 609ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/config-instabox.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 08:52:49 - Duration 3.14s (transform 2.30s, setup 1.05s, import 1.85s, tests 72ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/index.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 338 passed (338) - Start at 08:52:53 - Duration 148.86s (transform 1.31s, setup 866ms, import 870ms, tests 146.99s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/bot-box/env.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 11 passed (11) - Start at 08:55:22 - Duration 1.43s (transform 939ms, setup 1.19s, import 20ms, tests 60ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run scripts/testing/file-size-ratchet.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 08:55:25 - Duration 1.35s (transform 867ms, setup 1.09s, import 10ms, tests 92ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/config.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 257 passed (257) - Start at 08:55:26 - Duration 2.63s (transform 1.09s, setup 1.26s, import 146ms, tests 1.06s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/cloud-backend.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 08:55:30 - Duration 1.32s (transform 901ms, setup 1.13s, import 16ms, tests 5ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/cloud-computer-tools.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 33 passed (33) - Start at 08:55:32 - Duration 2.27s (transform 984ms, setup 1.03s, import 16ms, tests 1.08s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/cloud-computer-background.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 60 passed (60) - Start at 08:55:34 - Duration 24.43s (transform 932ms, setup 967ms, import 24ms, tests 23.31s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/cloud-computer-files.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - -(node:60862) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [ServerResponse]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit -(Use `node --trace-warnings ...` to show where the warning was created) - - Test Files 1 passed (1) - Tests 27 passed (27) - Start at 08:56:00 - Duration 2.65s (transform 1.01s, setup 1.04s, import 25ms, tests 1.44s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 38 passed (38) - Start at 08:56:03 - Duration 32.71s (transform 1.61s, setup 988ms, import 1.05s, tests 30.54s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/desktop-viewer-targets.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 08:56:36 - Duration 1.91s (transform 1.38s, setup 860ms, import 903ms, tests 7ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run shared/place-view.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 19 passed (19) - Start at 08:56:39 - Duration 1.37s (transform 915ms, setup 1.09s, import 122ms, tests 22ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/CloudBackendPicker.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 8 passed (8) - Start at 08:56:40 - Duration 2.08s (transform 1.46s, setup 996ms, import 929ms, tests 26ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/InstaboxSnapshots.test.tsx --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 08:56:43 - Duration 2.71s (transform 810ms, setup 908ms, import 351ms, tests 56ms, environment 1.25s) - -EXIT 0 - -$ pnpm exec vitest run src/components/instabox-panel.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 5 passed (5) - Start at 08:56:46 - Duration 1.80s (transform 1.26s, setup 915ms, import 739ms, tests 4ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.android.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 08:56:49 - Duration 3.58s (transform 2.07s, setup 985ms, import 1.76s, tests 524ms, environment 160ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.browser.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 08:56:53 - Duration 2.69s (transform 1.94s, setup 866ms, import 1.66s, tests 42ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.engine.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 18 passed (18) - Start at 08:56:56 - Duration 2.68s (transform 1.55s, setup 719ms, import 1.31s, tests 372ms, environment 141ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.focus.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 08:56:59 - Duration 2.99s (transform 1.62s, setup 775ms, import 1.36s, tests 600ms, environment 134ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.i18n.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 08:57:03 - Duration 1.25s (transform 734ms, setup 898ms, import 128ms, tests 77ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.lazy.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 9 passed (9) - Start at 08:57:05 - Duration 2.93s (transform 1.62s, setup 853ms, import 1.27s, tests 499ms, environment 164ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.live.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - -AggregateError: - at internalConnectMultiple (node:net:1492:18) - at afterConnectMultiple (node:net:2161:7) { - code: 'ECONNREFUSED', - [errors]: [ - Error: connect ECONNREFUSED [loopback]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[loopback]', - port: 3000 - }, - Error: connect ECONNREFUSED [address]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[address]', - port: 3000 - } - ] -} -AggregateError: - at internalConnectMultiple (node:net:1492:18) - at afterConnectMultiple (node:net:2161:7) { - code: 'ECONNREFUSED', - [errors]: [ - Error: connect ECONNREFUSED [loopback]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[loopback]', - port: 3000 - }, - Error: connect ECONNREFUSED [address]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[address]', - port: 3000 - } - ] -} -AggregateError: - at internalConnectMultiple (node:net:1492:18) - at afterConnectMultiple (node:net:2161:7) { - code: 'ECONNREFUSED', - [errors]: [ - Error: connect ECONNREFUSED [loopback]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[loopback]', - port: 3000 - }, - Error: connect ECONNREFUSED [address]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[address]', - port: 3000 - } - ] -} - - Test Files 1 passed (1) - Tests 5 passed (5) - Start at 08:57:08 - Duration 2.36s (transform 1.53s, setup 728ms, import 1.28s, tests 86ms, environment 140ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.simple.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 45 passed (45) - Start at 08:57:11 - Duration 2.20s (transform 1.43s, setup 721ms, import 1.17s, tests 191ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.tabs.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 11 passed (11) - Start at 08:57:14 - Duration 3.55s (transform 1.49s, setup 743ms, import 1.20s, tests 1.35s, environment 139ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.takeover.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 29 passed (29) - Start at 08:57:18 - Duration 26.25s (transform 1.61s, setup 733ms, import 1.37s, tests 23.88s, environment 139ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 5 passed (5) - Start at 08:57:45 - Duration 990ms (transform 648ms, setup 827ms, import 23ms, tests 6ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/lib/desktop-connection.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 08:57:46 - Duration 1.05s (transform 604ms, setup 757ms, import 23ms, tests 10ms, environment 139ms) - -EXIT 0 - -$ pnpm exec vitest run src/lib/local-computer.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 19 passed (19) - Start at 08:57:48 - Duration 948ms (transform 621ms, setup 713ms, import 105ms, tests 12ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/lib/i18n.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 39 passed (39) - Start at 08:57:49 - Duration 6.16s (transform 2.70s, setup 766ms, import 39ms, tests 5.24s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/locales/sent-keys.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:57:56 - Duration 1.02s (transform 627ms, setup 758ms, import 67ms, tests 83ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/keys/key-catalog.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 16 passed (16) - Start at 08:57:57 - Duration 1.02s (transform 631ms, setup 776ms, import 108ms, tests 17ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/keys/KeysPage.dom.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 24 passed (24) - Start at 08:57:59 - Duration 3.15s (transform 999ms, setup 738ms, import 602ms, tests 1.53s, environment 141ms) - -EXIT 0 - -$ pnpm exec vitest run src/state/store.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 243 passed (243) - Start at 08:58:02 - Duration 2.00s (transform 881ms, setup 669ms, import 515ms, tests 559ms, environment 129ms) - -EXIT 0 - -$ pnpm exec tsc -p tsconfig.server.json -EXIT 0 - -$ pnpm exec tsc -p tsconfig.json -src/components/instabox-panel.test.ts(22,94): error TS2322: Type '{ configured: false; }' is not assignable to type 'SavedKey & { fromEnv: boolean; }'. - Property 'fromEnv' is missing in type '{ configured: false; }' but required in type '{ fromEnv: boolean; }'. -src/components/instabox-panel.test.ts(25,81): error TS2322: Type '{ configured: true; }' is not assignable to type 'SavedKey & { fromEnv: boolean; }'. - Property 'fromEnv' is missing in type '{ configured: true; }' but required in type '{ fromEnv: boolean; }'. -EXIT 1 - -$ node scripts/generate-locale.mjs --check -de.json: 37% (3965/10636) -es.json: 61% (6481/10636) -fr.json: 36% (3794/10636) -hi.json: 34% (3648/10636) -it.json: 67% (7100/10636) -ja.json: 76% (8069/10636) -ko.json: 73% (7754/10636) -pl.json: 68% (7242/10636) -pt-br.json: 100% (10627/10636) -ru.json: 69% (7294/10636) -tr.json: 56% (5985/10636) -uk.json: 38% (4069/10636) -vi.json: 56% (5985/10636) -zh-tw.json: 96% (10246/10636) -zh.json: 76% (8043/10636) -locale catalogs valid (16 languages, 10636 English strings) -EXIT 0 - - -Additional sequential checks; CRYBOT_CDP_CHROME=/usr/bin/chromium - -$ pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:58:38 - Duration 6.09s (transform 1.21s, setup 833ms, import 787ms, tests 4.34s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:58:45 - Duration 7.66s (transform 1.92s, setup 1.32s, import 1.22s, tests 4.94s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:58:54 - Duration 9.96s (transform 2.81s, setup 1.89s, import 1.77s, tests 6.02s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run scripts/testing/key-readback.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:59:04 - Duration 9.92s (transform 2.65s, setup 1.35s, import 2.14s, tests 6.25s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run scripts/testing/key-readback.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:59:15 - Duration 9.19s (transform 2.35s, setup 1.18s, import 1.96s, tests 5.90s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run scripts/testing/key-readback.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 08:59:24 - Duration 9.07s (transform 2.36s, setup 1.17s, import 1.98s, tests 5.79s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/place-view.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 08:59:34 - Duration 23.06s (transform 831ms, setup 969ms, import 93ms, tests 21.85s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/place-view.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 08:59:58 - Duration 23.22s (transform 931ms, setup 1.11s, import 89ms, tests 21.85s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/place-view.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 09:00:22 - Duration 23.00s (transform 885ms, setup 1.04s, import 88ms, tests 21.71s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 38 passed (38) - Start at 09:00:45 - Duration 32.95s (transform 1.68s, setup 1.05s, import 1.09s, tests 30.66s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 38 passed (38) - Start at 09:01:19 - Duration 32.78s (transform 1.60s, setup 934ms, import 1.09s, tests 30.62s, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 38 passed (38) - Start at 09:01:52 - Duration 33.10s (transform 1.86s, setup 1.15s, import 1.19s, tests 30.61s, environment 0ms) - -EXIT 0 - - -UI verification after key-status refresh change - -$ pnpm exec vitest run src/components/ComputerPanel.instabox.test.ts --maxWorkers=1 - - RUN v4.1.11 . - -stderr | src/components/ComputerPanel.instabox.test.ts > refreshes the selected InstaBox panel when its key is saved in Settings -TypeError: Cannot read properties of undefined (reading 'configured') - at ComputerPanel (./src/components/ComputerPanel.tsx:355:50) - at Object.react_stack_bottom_frame (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) - at renderWithHooks (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) - at updateFunctionComponent (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) - at beginWork (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:11778:18) - at runWithFiberInDEV (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) - at performUnitOfWork (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) - at workLoopSync (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) - at renderRootSync (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) - at performWorkOnRoot (node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) -An error occurred in the component. - -Consider adding an error boundary to your tree to customize error handling behavior. -Visit [fixture-url] to learn more about error boundaries. - - - ❯ src/components/ComputerPanel.instabox.test.ts (1 test | 1 failed) 1027ms - × refreshes the selected InstaBox panel when its key is saved in Settings 1025ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL src/components/ComputerPanel.instabox.test.ts > refreshes the selected InstaBox panel when its key is saved in Settings -AssertionError: expected 0 to be greater than 0 - ❯ src/components/ComputerPanel.instabox.test.ts:55:50 - 53| try { - 54| render(); - 55| await vi.waitFor(() => expect(fixture.reads).toBeGreaterThan(0)); - | ^ - 56| await vi.waitFor(() => expect(host.textContent).toContain("Add you… - 57| const reads = fixture.reads; - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed (1) - Start at 09:02:33 - Duration 4.06s (transform 2.07s, setup 1.04s, import 1.64s, tests 1.03s, environment 183ms) - -EXIT 1 - -$ pnpm exec vitest run src/components/instabox-panel.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 5 passed (5) - Start at 09:02:38 - Duration 1.85s (transform 1.30s, setup 903ms, import 804ms, tests 4ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.android.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 09:02:40 - Duration 3.55s (transform 2.06s, setup 930ms, import 1.75s, tests 561ms, environment 157ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.browser.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 09:02:44 - Duration 3.94s (transform 2.90s, setup 1.12s, import 2.62s, tests 44ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.engine.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 18 passed (18) - Start at 09:02:49 - Duration 2.92s (transform 1.70s, setup 842ms, import 1.36s, tests 413ms, environment 159ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.focus.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 09:02:52 - Duration 3.30s (transform 1.84s, setup 907ms, import 1.51s, tests 609ms, environment 154ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.i18n.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 09:02:56 - Duration 1.24s (transform 729ms, setup 887ms, import 147ms, tests 72ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.lazy.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 9 passed (9) - Start at 09:02:58 - Duration 3.44s (transform 1.99s, setup 974ms, import 1.63s, tests 535ms, environment 148ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.live.test.ts --maxWorkers=1 - - RUN v4.1.11 . - -AggregateError: - at internalConnectMultiple (node:net:1492:18) - at afterConnectMultiple (node:net:2161:7) { - code: 'ECONNREFUSED', - [errors]: [ - Error: connect ECONNREFUSED [loopback]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[loopback]', - port: 3000 - }, - Error: connect ECONNREFUSED [address]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[address]', - port: 3000 - } - ] -} -AggregateError: - at internalConnectMultiple (node:net:1492:18) - at afterConnectMultiple (node:net:2161:7) { - code: 'ECONNREFUSED', - [errors]: [ - Error: connect ECONNREFUSED [loopback]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[loopback]', - port: 3000 - }, - Error: connect ECONNREFUSED [address]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[address]', - port: 3000 - } - ] -} -AggregateError: - at internalConnectMultiple (node:net:1492:18) - at afterConnectMultiple (node:net:2161:7) { - code: 'ECONNREFUSED', - [errors]: [ - Error: connect ECONNREFUSED [loopback]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[loopback]', - port: 3000 - }, - Error: connect ECONNREFUSED [address]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[address]', - port: 3000 - } - ] -} - - Test Files 1 passed (1) - Tests 5 passed (5) - Start at 09:03:02 - Duration 3.03s (transform 2.01s, setup 1.05s, import 1.57s, tests 104ms, environment 165ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.simple.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 45 passed (45) - Start at 09:03:06 - Duration 3.00s (transform 2.02s, setup 961ms, import 1.66s, tests 236ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.tabs.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 11 passed (11) - Start at 09:03:09 - Duration 4.15s (transform 1.84s, setup 944ms, import 1.48s, tests 1.45s, environment 150ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.takeover.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 29 passed (29) - Start at 09:03:14 - Duration 26.92s (transform 1.93s, setup 940ms, import 1.58s, tests 24.12s, environment 145ms) - -EXIT 0 - -$ pnpm exec vitest run src/components/ComputerPanel.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 5 passed (5) - Start at 09:03:41 - Duration 1.35s (transform 930ms, setup 1.16s, import 26ms, tests 7ms, environment 0ms) - -EXIT 0 - -$ pnpm exec vitest run scripts/testing/file-size-ratchet.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 09:03:43 - Duration 1.42s (transform 889ms, setup 1.16s, import 10ms, tests 92ms, environment 0ms) - -EXIT 0 - - -DOM fixture follow-up: pnpm exec vitest run src/components/ComputerPanel.instabox.test.ts --maxWorkers=1 - - RUN v4.1.11 . - -AggregateError: - at internalConnectMultiple (node:net:1492:18) - at afterConnectMultiple (node:net:2161:7) { - code: 'ECONNREFUSED', - [errors]: [ - Error: connect ECONNREFUSED [loopback]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[loopback]', - port: 3000 - }, - Error: connect ECONNREFUSED [address]:3000 - at createConnectionError (node:net:2124:14) - at afterConnectMultiple (node:net:2154:16) { - errno: -111, - code: 'ECONNREFUSED', - syscall: 'connect', - address: '[address]', - port: 3000 - } - ] -} - - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 09:04:10 - Duration 3.45s (transform 2.35s, setup 1.05s, import 1.99s, tests 111ms, environment 163ms) - - - -Final isolated DOM fixture: pnpm exec vitest run src/components/ComputerPanel.instabox.test.ts --maxWorkers=1; EXIT 0 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 09:05:00 - Duration 3.34s (transform 2.25s, setup 1.04s, import 1.88s, tests 105ms, environment 162ms) - - - -Final frontend type check: pnpm exec tsc -p tsconfig.json; EXIT 0 - - -Final changed-file lint -$ pnpm exec oxlint --deny-warnings server/index.ts server/instabox/client.ts server/instabox/power.test.ts server/instabox/power.ts server/routes/config-instabox.test.ts server/routes/instabox-snapshots.e2e.test.ts server/routes/instabox-snapshots.ts server/testing/fake-instabox-core.ts server/testing/fake-instabox-snapshots.ts shared/place-view.ts src/components/CloudBackendPicker.test.ts src/components/CloudBackendPicker.tsx src/components/ComputerPanel.tsx src/components/InstaboxSnapshots.test.tsx src/components/InstaboxSnapshots.tsx src/lib/place-view.ts src/locales/pt-br.json server/instabox/wiring.e2e.test.ts server/instabox/wiring.ts src/components/ComputerPanel.instabox.test.ts src/components/instabox-panel.test.ts src/components/instabox-panel.ts -EXIT 0 - - -Final whitespace check -git diff --check -EXIT 0 - - - -Round 2 -All mutations used isolated fixtures and temporary data. The verification README is absent. -Dependency setup: crybot-link-deps linked 73 entries; EXIT 0. -Chromium was explicitly enabled for the final VNC runs. - -Initial lifecycle regression run: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:14:58 - Duration 33.36s (transform 2.13s, setup 1.49s, import 1.68s, tests 29.96s, environment 0ms) - - -Initial deadline fixture: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - ❯ server/instabox/snapshot-wiring.e2e.test.ts (6 tests | 1 failed) 4552ms - × bounds the whole snapshot flow including slow desktop responses 1690ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL server/instabox/snapshot-wiring.e2e.test.ts > bounds the whole snapshot flow including slow desktop responses -AssertionError: expected false to be true - -- Expected -+ Received - -- true -+ false - - ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:57 - 75| expect(Date.now() - start).toBeLessThan(700); - 76| expect(f.locked()).toBe(false); - 77| if (stage !== "pages") await expect.poll(f.cancelled).toBe(true); - | ^ - 78| if (stage === "pages") expect(f.calls.length).toBeLessThanOrEqual(3); - 79| if (stage === "poll" || stage === "desktop") { - -Caused by: Error: Matcher did not succeed in time. - ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:26 - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed | 5 passed (6) - Start at 09:16:09 - Duration 7.83s (transform 2.49s, setup 1.19s, import 1.94s, tests 4.55s, environment 0ms) - - -Initial backend fixture: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - ❯ server/instabox/wiring.e2e.test.ts (6 tests | 1 failed) 59751ms - × keeps box computer and snapshot/viewer paths away from InstaBox 32832ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL server/instabox/wiring.e2e.test.ts > keeps box computer and snapshot/viewer paths away from InstaBox -AssertionError: expected false to be true - -- Expected -+ Received - -- true -+ false - - ❯ server/instabox/wiring.e2e.test.ts:106:119 - 104| await expect.poll(() => backends.calls.some(call => backend === "b… - 105| ? call.path.endsWith("/commands") && call.body.command?.includes… - 106| : call.path === "/vps/exec" && call.body.arguments?.command === … - | ^ - 107| await expect.poll(async () => (await f.request("GET", "/api/bots")… - 108| expect((await f.request("GET", path + "/instabox/snapshots")).stat… - -Caused by: Error: Matcher did not succeed in time. - ❯ server/instabox/wiring.e2e.test.ts:104:5 - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed | 5 passed (6) - Start at 09:17:17 - Duration 62.61s (transform 2.05s, setup 1.29s, import 1.39s, tests 59.75s, environment 0ms) - - -Boat fixture diagnosis: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 -t 'keeps box' - - RUN v4.1.11 . - -stdout | server/instabox/wiring.e2e.test.ts > keeps box computer and snapshot/viewer paths away from InstaBox -[{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{}},{"path":"/sandboxes","body":{"ttlSeconds":28800,"noEnv":true}},{"path":"/sandboxes/bx_23456789","body":{"name":"cry-d68864c9d3e4-e86175f8-30a9ff"}},{"path":"/sandboxes/bx_23456789","body":{}},{"path":"/sandboxes/bx_23456789/desktop","body":{}},{"path":"/sandboxes/bx_23456789/desktop","body":{}},{"path":"/sandboxes/bx_23456789","body":{}},{"path":"/sandboxes/bx_23456789","body":{}},{"path":"/sandboxes/bx_23456789","body":{}}] -Feishu device session revalidation: revoked 0. -bot box: off (not-cloud) -crybot webhook receiver on [endpoint] -Cry Bot open-source edition -local requests: owner trust (self-hosted default) -local requests: CRYBOT_DEV_TRUST_LOCAL_BROWSER=1: browsers on this machine act as the owner (development only) -brand: Cry Bot -crybot server on [endpoint] -Local VM startup recovery complete -[cry-turn] bot=[identifier] text="Use the computer." images=0 depth=0 card=false -[cry-turn] bot=[identifier] text="[From Cry Bot · incident report · information only — not from the pers" images=0 depth=0 card=false -browser engine: unavailable (agent-browser is not installed on this machine yet); bots get no browser tools until it is installed - - - ❯ server/instabox/wiring.e2e.test.ts (6 tests | 1 failed | 5 skipped) 32873ms - × keeps box computer and snapshot/viewer paths away from InstaBox 32871ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL server/instabox/wiring.e2e.test.ts > keeps box computer and snapshot/viewer paths away from InstaBox -AssertionError: expected false to be true - -- Expected -+ Received - -- true -+ false - - ❯ server/instabox/wiring.e2e.test.ts:106:119 - 104| await expect.poll(() => backends.calls.some(call => backend === "b… - 105| ? call.path.endsWith("/commands") && call.body.command?.includes… - 106| : call.path === "/vps/exec" && call.body.arguments?.command === … - | ^ - 107| await expect.poll(async () => (await f.request("GET", "/api/bots")… - 108| expect((await f.request("GET", path + "/instabox/snapshots")).stat… - -Caused by: Error: Matcher did not succeed in time. - ❯ server/instabox/wiring.e2e.test.ts:104:5 - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed | 5 skipped (6) - Start at 09:18:55 - Duration 35.73s (transform 2.04s, setup 1.37s, import 1.31s, tests 32.87s, environment 0ms) - - -Backend fixture corrected: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:19:54 - Duration 31.98s (transform 1.97s, setup 1.32s, import 1.27s, tests 29.21s, environment 0ms) - - -Deadline fixture before correcting operation routing - -COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - ❯ server/instabox/snapshot-wiring.e2e.test.ts (6 tests | 1 failed) 5817ms - × bounds the whole snapshot flow including slow desktop responses 1632ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL server/instabox/snapshot-wiring.e2e.test.ts > bounds the whole snapshot flow including slow desktop responses -AssertionError: expected false to be true - -- Expected -+ Received - -- true -+ false - - ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:57 - 75| expect(Date.now() - start).toBeLessThan(1_200); - 76| expect(f.locked()).toBe(false); - 77| if (stage !== "pages") await expect.poll(f.cancelled).toBe(true); - | ^ - 78| if (stage === "pages") expect(f.calls.length).toBeLessThanOrEqual(3); - 79| if (stage === "poll" || stage === "desktop") { - -Caused by: Error: Matcher did not succeed in time. - ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:26 - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed | 5 passed (6) - Start at 09:21:24 - Duration 8.54s (transform 2.02s, setup 1.14s, import 1.41s, tests 5.82s, environment 0ms) - -EXIT 1 - -Deadline fixture diagnosis: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 -t 'slow desktop' - - RUN v4.1.11 . - - ❯ server/instabox/snapshot-wiring.e2e.test.ts (6 tests | 1 failed | 5 skipped) 629ms - × bounds the whole snapshot flow including slow desktop responses 627ms - -⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ - - FAIL server/instabox/snapshot-wiring.e2e.test.ts > bounds the whole snapshot flow including slow desktop responses -AssertionError: expected [ '/v1/snapshots/saved', …(3) ] to include '/v1/machines/machine/desktop' - ❯ server/instabox/snapshot-wiring.e2e.test.ts:77:67 - 75| expect(Date.now() - start).toBeLessThan(1_200); - 76| expect(f.locked()).toBe(false); - 77| if (stage === "desktop") expect(f.calls.map(call => call.path)).toCo… - | ^ - 78| if (stage !== "pages") await expect.poll(f.cancelled).toBe(true); - 79| if (stage === "pages") expect(f.calls.length).toBeLessThanOrEqual(3); - -⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ - - - Test Files 1 failed (1) - Tests 1 failed | 5 skipped (6) - Start at 09:22:12 - Duration 3.24s (transform 1.90s, setup 1.14s, import 1.29s, tests 629ms, environment 0ms) - - -Final serial acceptance; each related e2e ran three consecutive times - -COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:22:29 - Duration 7.94s (transform 2.07s, setup 1.26s, import 1.37s, tests 5.14s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:22:37 - Duration 7.99s (transform 2.11s, setup 1.27s, import 1.42s, tests 5.13s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:22:46 - Duration 7.61s (transform 1.82s, setup 1.03s, import 1.30s, tests 5.13s, environment 0ms) - -EXIT 0 - +T-1246 第 3 轮验证记录 + +环境准备 +COMMAND: crybot-link-deps +RESULT: linked 73 entries + +词汇回归 +COMMAND: pnpm exec vitest run src/locales/vocabulary.test.ts --maxWorkers=1 +RESULT: 1 file passed, 6 tests passed + +server/instabox 逐文件回归 +COMMAND: pnpm exec vitest run server/instabox/client.test.ts --maxWorkers=1 +RESULT: 1 file passed, 6 tests passed +COMMAND: pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 +RESULT: 1 file passed, 29 tests passed +COMMAND: pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 +RESULT: 1 file passed, 15 tests passed +COMMAND: pnpm exec vitest run server/instabox/key.test.ts --maxWorkers=1 +RESULT: 1 file passed, 4 tests passed +COMMAND: pnpm exec vitest run server/instabox/machines.test.ts --maxWorkers=1 +RESULT: 1 file passed, 24 tests passed +COMMAND: pnpm exec vitest run server/instabox/persistence.test.ts --maxWorkers=1 +RESULT: 1 file passed, 1 test passed +COMMAND: pnpm exec vitest run server/instabox/power.test.ts --maxWorkers=1 +RESULT: 1 file passed, 7 tests passed +COMMAND: pnpm exec vitest run server/instabox/snapshot-wiring.e2e.test.ts --maxWorkers=1 +RESULT: 1 file passed, 6 tests passed +COMMAND: pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 +RESULT: 1 file passed, 31 tests passed, 1 existing test skipped +COMMAND: pnpm exec vitest run server/instabox/vnc.test.ts --maxWorkers=1 +RESULT: 1 file passed, 2 tests passed COMMAND: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:22:54 - Duration 30.67s (transform 1.51s, setup 1.03s, import 987ms, tests 28.52s, environment 0ms) - -EXIT 0 - +RESULT: 1 file passed, 6 tests passed COMMAND: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:23:25 - Duration 29.68s (transform 1.43s, setup 989ms, import 944ms, tests 27.62s, environment 0ms) - -EXIT 0 - +RESULT: 1 file passed, 6 tests passed COMMAND: pnpm exec vitest run server/instabox/wiring.e2e.test.ts --maxWorkers=1 (run 3/3) +RESULT: 1 file passed, 6 tests passed +COMMAND: pnpm exec vitest run server/instabox/wiring.test.ts --maxWorkers=1 +RESULT: 1 file passed, 4 tests passed - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:23:55 - Duration 29.56s (transform 1.40s, setup 1.03s, import 847ms, tests 27.56s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 15 passed (15) - Start at 09:24:26 - Duration 66.34s (transform 1.92s, setup 1.14s, import 1.40s, tests 63.63s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 15 passed (15) - Start at 09:25:33 - Duration 66.25s (transform 2.23s, setup 1.18s, import 1.71s, tests 63.19s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/core.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . +类型与 lint +COMMAND: pnpm exec tsc -p tsconfig.server.json +RESULT: exit 0 +COMMAND: pnpm exec oxlint --deny-warnings server/instabox/wiring-backends-fixture.ts server/instabox/wiring.test.ts server/instabox/wiring.ts +RESULT: exit 0 +COMMAND: git diff --check +RESULT: exit 0 +验证均使用隔离 fixture;未连接用户应用或用户数据。仓库未提供 docs/verification/README.md。 - Test Files 1 passed (1) - Tests 15 passed (15) - Start at 09:26:40 - Duration 68.34s (transform 2.26s, setup 1.32s, import 1.64s, tests 65.21s, environment 0ms) +逐文件运行输出(原始摘要) -EXIT 0 +>>> server/instabox/client.test.ts -COMMAND: pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 1/3) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +······ Test Files 1 passed (1) - Tests 29 passed (29) - Start at 09:27:49 - Duration 11.88s (transform 1.34s, setup 1.26s, import 451ms, tests 10.00s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - + Tests 6 passed (6) + Start at 10:07:41 + Duration 1.09s (transform 671ms, setup 855ms, import 34ms, tests 73ms, environment 0ms) - Test Files 1 passed (1) - Tests 29 passed (29) - Start at 09:28:01 - Duration 11.92s (transform 1.37s, setup 1.37s, import 399ms, tests 9.98s, environment 0ms) -EXIT 0 +>>> server/instabox/computer-tools.e2e.test.ts -COMMAND: pnpm exec vitest run server/instabox/computer-tools.e2e.test.ts --maxWorkers=1 (run 3/3) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +····························· Test Files 1 passed (1) Tests 29 passed (29) - Start at 09:28:14 - Duration 11.74s (transform 1.24s, setup 1.25s, import 362ms, tests 9.99s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 32 passed (32) - Start at 09:28:26 - Duration 8.67s (transform 2.05s, setup 1.33s, import 1.27s, tests 5.87s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . + Start at 10:07:42 + Duration 10.73s (transform 892ms, setup 842ms, import 310ms, tests 9.44s, environment 0ms) - Test Files 1 passed (1) - Tests 32 passed (32) - Start at 09:28:36 - Duration 5.33s (transform 2.22s, setup 1.54s, import 1.26s, tests 2.33s, environment 0ms) - -EXIT 0 +>>> server/instabox/core.e2e.test.ts -COMMAND: pnpm exec vitest run server/instabox/vnc.e2e.test.ts --maxWorkers=1 (run 3/3) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +··············· Test Files 1 passed (1) - Tests 32 passed (32) - Start at 09:28:42 - Duration 5.02s (transform 2.02s, setup 1.37s, import 1.15s, tests 2.32s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . - + Tests 15 passed (15) + Start at 10:07:53 + Duration 59.48s (transform 1.61s, setup 947ms, import 1.23s, tests 57.17s, environment 0ms) - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 09:28:47 - Duration 4.37s (transform 2.80s, setup 1.21s, import 2.33s, tests 654ms, environment 0ms) -EXIT 0 +>>> server/instabox/key.test.ts -COMMAND: pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 2/3) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +···· Test Files 1 passed (1) - Tests 12 passed (12) - Start at 09:28:53 - Duration 4.39s (transform 2.87s, setup 1.32s, import 2.27s, tests 626ms, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/routes/instabox-snapshots.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - + Tests 4 passed (4) + Start at 10:08:54 + Duration 1.03s (transform 666ms, setup 862ms, import 8ms, tests 20ms, environment 0ms) - Test Files 1 passed (1) - Tests 12 passed (12) - Start at 09:28:58 - Duration 4.45s (transform 2.91s, setup 1.31s, import 2.33s, tests 642ms, environment 0ms) -EXIT 0 +>>> server/instabox/machines.test.ts -COMMAND: pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 1/3) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +························ Test Files 1 passed (1) - Tests 38 passed (38) - Start at 09:29:03 - Duration 32.79s (transform 1.66s, setup 1.01s, import 1.10s, tests 30.54s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 2/3) - - RUN v4.1.11 . - + Tests 24 passed (24) + Start at 10:08:55 + Duration 1.77s (transform 689ms, setup 851ms, import 48ms, tests 733ms, environment 0ms) - Test Files 1 passed (1) - Tests 38 passed (38) - Start at 09:29:36 - Duration 32.97s (transform 1.78s, setup 1.09s, import 1.16s, tests 30.57s, environment 0ms) -EXIT 0 +>>> server/instabox/persistence.test.ts -COMMAND: pnpm exec vitest run server/routes/desktop-viewer.test.ts --maxWorkers=1 (run 3/3) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +· Test Files 1 passed (1) - Tests 38 passed (38) - Start at 09:30:10 - Duration 33.20s (transform 1.86s, setup 1.12s, import 1.25s, tests 30.65s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 1/3) - - RUN v4.1.11 . + Tests 1 passed (1) + Start at 10:08:57 + Duration 1.49s (transform 1.04s, setup 880ms, import 459ms, tests 25ms, environment 0ms) - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 09:30:44 - Duration 6.81s (transform 1.63s, setup 1.05s, import 1.11s, tests 4.50s, environment 0ms) +>>> server/instabox/power.test.ts -EXIT 0 + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 -COMMAND: pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 2/3) +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. - RUN v4.1.11 . +stderr | server/instabox/power.test.ts > runs failed suspension in the background without misreporting a saved backend switch as a failed patch +InstaBox machine could not be suspended after a backend change Add an InstaBox API key to use this computer. +······· Test Files 1 passed (1) - Tests 2 passed (2) - Start at 09:30:51 - Duration 6.13s (transform 1.32s, setup 1.01s, import 795ms, tests 4.19s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/request-auth.e2e.test.ts --maxWorkers=1 (run 3/3) - - RUN v4.1.11 . - + Tests 7 passed (7) + Start at 10:08:59 + Duration 2.46s (transform 1.80s, setup 1.06s, import 1.26s, tests 12ms, environment 0ms) - Test Files 1 passed (1) - Tests 2 passed (2) - Start at 09:30:58 - Duration 6.17s (transform 1.24s, setup 897ms, import 785ms, tests 4.36s, environment 0ms) -EXIT 0 +>>> server/instabox/snapshot-wiring.e2e.test.ts -COMMAND: pnpm exec vitest run server/instabox/client.test.ts --maxWorkers=1 (run 1/1) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +······ Test Files 1 passed (1) Tests 6 passed (6) - Start at 09:31:05 - Duration 1.17s (transform 735ms, setup 930ms, import 43ms, tests 68ms, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/key.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 4 passed (4) - Start at 09:31:06 - Duration 1.09s (transform 724ms, setup 935ms, import 10ms, tests 19ms, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/machines.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . + Start at 10:09:02 + Duration 7.45s (transform 1.71s, setup 1.03s, import 1.16s, tests 5.12s, environment 0ms) - Test Files 1 passed (1) - Tests 24 passed (24) - Start at 09:31:08 - Duration 1.82s (transform 720ms, setup 886ms, import 52ms, tests 738ms, environment 0ms) +>>> server/instabox/vnc.e2e.test.ts -EXIT 0 + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 -COMMAND: pnpm exec vitest run server/instabox/persistence.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +·······························- Test Files 1 passed (1) - Tests 1 passed (1) - Start at 09:31:10 - Duration 1.72s (transform 1.21s, setup 1.11s, import 432ms, tests 22ms, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/power.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - + Tests 31 passed | 1 skipped (32) + Start at 10:09:10 + Duration 3.26s (transform 1.37s, setup 961ms, import 789ms, tests 1.37s, environment 0ms) - Test Files 1 passed (1) - Tests 7 passed (7) - Start at 09:31:13 - Duration 2.28s (transform 1.66s, setup 997ms, import 1.15s, tests 9ms, environment 0ms) -EXIT 0 +>>> server/instabox/vnc.test.ts -COMMAND: pnpm exec vitest run server/instabox/vnc.test.ts --maxWorkers=1 (run 1/1) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +·· Test Files 1 passed (1) Tests 2 passed (2) - Start at 09:31:16 - Duration 1.20s (transform 806ms, setup 1.03s, import 11ms, tests 4ms, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/instabox/wiring.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 09:31:17 - Duration 2.14s (transform 1.55s, setup 971ms, import 1.02s, tests 11ms, environment 0ms) + Start at 10:09:14 + Duration 1.22s (transform 824ms, setup 1.04s, import 17ms, tests 5ms, environment 0ms) -EXIT 0 -COMMAND: pnpm exec vitest run server/index.test.ts --maxWorkers=1 (run 1/1) +>>> server/instabox/wiring.e2e.test.ts - RUN v4.1.11 . + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. - Test Files 1 passed (1) - Tests 338 passed (338) - Start at 09:31:20 - Duration 175.86s (transform 1.48s, setup 980ms, import 922ms, tests 173.81s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/bot-box/env.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - +······ Test Files 1 passed (1) - Tests 11 passed (11) - Start at 09:34:17 - Duration 1.66s (transform 1.05s, setup 1.30s, import 22ms, tests 142ms, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/boat-lifecycle.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - + Tests 6 passed (6) + Start at 10:09:16 + Duration 30.67s (transform 1.57s, setup 988ms, import 1.10s, tests 28.42s, environment 0ms) - Test Files 1 passed (1) - Tests 3 passed (3) - Start at 09:34:19 - Duration 1.75s (transform 1.16s, setup 1.24s, import 14ms, tests 304ms, environment 0ms) -EXIT 0 +>>> server/instabox/wiring.test.ts -COMMAND: pnpm exec vitest run server/cloud-computer-tools.test.ts --maxWorkers=1 (run 1/1) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +···· Test Files 1 passed (1) - Tests 33 passed (33) - Start at 09:34:21 - Duration 2.95s (transform 1.45s, setup 1.42s, import 24ms, tests 1.31s, environment 0ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run server/routes/config-instabox.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . + Tests 4 passed (4) + Start at 10:09:47 + Duration 1.81s (transform 1.30s, setup 858ms, import 812ms, tests 7ms, environment 0ms) - Test Files 1 passed (1) - Tests 6 passed (6) - Start at 09:34:25 - Duration 4.46s (transform 3.36s, setup 1.26s, import 2.87s, tests 138ms, environment 0ms) +All instabox files passed -EXIT 0 +>>> wiring e2e run 2 -COMMAND: pnpm exec vitest run src/components/InstaboxSnapshots.test.tsx --maxWorkers=1 (run 1/1) + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +······ Test Files 1 passed (1) Tests 6 passed (6) - Start at 09:34:30 - Duration 3.15s (transform 1.56s, setup 1.63s, import 438ms, tests 115ms, environment 765ms) - -EXIT 0 - -COMMAND: pnpm exec vitest run scripts/testing/file-size-ratchet.test.ts --maxWorkers=1 (run 1/1) - - RUN v4.1.11 . - - - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 09:34:34 - Duration 2.16s (transform 1.23s, setup 1.56s, import 18ms, tests 391ms, environment 0ms) + Start at 10:09:56 + Duration 28.96s (transform 1.31s, setup 950ms, import 805ms, tests 27.06s, environment 0ms) -EXIT 0 -COMMAND: pnpm exec tsc -p tsconfig.server.json -EXIT 0 - -COMMAND: pnpm exec tsc -p tsconfig.json -EXIT 0 - -Changed-file lint -COMMAND: pnpm exec oxlint --deny-warnings server/index.ts server/instabox/client.ts server/instabox/wiring.e2e.test.ts server/instabox/wiring.ts server/routes/instabox-snapshots.e2e.test.ts server/routes/instabox-snapshots.ts server/testing/fake-instabox-core.ts server/instabox/snapshot-wiring.e2e.test.ts server/instabox/snapshot-wiring.ts server/instabox/wiring-backends-fixture.ts server/instabox/wiring.test.ts -EXIT 0 - -Final retained-target regression and lint after sealing its machine stub +>>> wiring e2e run 3 -COMMAND: pnpm exec vitest run server/instabox/wiring.test.ts --maxWorkers=1 + RUN v4.1.11 /data/home/codex-t-1246-instabox-wiring-b90ca37edf34 - RUN v4.1.11 . +stderr | unknown test +Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead. +······ Test Files 1 passed (1) - Tests 3 passed (3) - Start at 09:35:10 - Duration 3.78s (transform 2.89s, setup 1.59s, import 2.01s, tests 14ms, environment 0ms) - -EXIT 0 + Tests 6 passed (6) + Start at 10:10:25 + Duration 28.59s (transform 1.43s, setup 1.04s, import 866ms, tests 26.55s, environment 0ms) -COMMAND: pnpm exec oxlint --deny-warnings server/instabox/wiring.test.ts -EXIT 0 -COMMAND: git diff --check -EXIT 0 +Wiring e2e passed three total runs diff --git a/server/instabox/wiring-backends-fixture.ts b/server/instabox/wiring-backends-fixture.ts index 7ef01212..f101ba00 100644 --- a/server/instabox/wiring-backends-fixture.ts +++ b/server/instabox/wiring-backends-fixture.ts @@ -22,7 +22,7 @@ export async function wiringBackendsFixture() { } if (path === "/sandboxes") return reply({ sandboxes: rows }); if (path.endsWith("/desktop")) return reply({ desktopUrl: "https://desktop.fixture.invalid" }); - if (path.endsWith("/commands")) return reply({ exitCode: 0, stdout: "Boat fixture completed", stderr: "" }); + if (path.endsWith("/commands")) return reply({ exitCode: 0, stdout: "box fixture completed", stderr: "" }); const row = rows.find(row => path === `/sandboxes/${row.id}`); if (row) { if (body.name) row.name = body.name; return reply({ sandbox: row }); } reply({}); diff --git a/server/instabox/wiring.test.ts b/server/instabox/wiring.test.ts index 97e6719b..4d7c6361 100644 --- a/server/instabox/wiring.test.ts +++ b/server/instabox/wiring.test.ts @@ -20,3 +20,13 @@ it.each(["deleted", "backend changed", "key changed"])("revalidates a retained v expect(release).toHaveBeenCalledOnce(); expect(ensure).not.toHaveBeenCalled(); }); + +it("ignores the loopback API override outside a test environment", () => { + vi.stubEnv("NODE_ENV", "production"); + vi.stubEnv("VITEST", ""); + vi.stubEnv("CRYBOT_TEST_SEALED_PATH", ""); + vi.stubEnv("INSTABOX_API_KEY", "instabox-e2e-fixture"); + vi.stubEnv("CRYBOT_TEST_INSTABOX_API", "http://127.0.0.1:43210"); + const wiring = createInstaboxWiring({ cfg: () => ({}), eligible: () => true, claim: () => () => {}, inUse: () => false }); + expect(wiring.allowInsecureLoopbackUpstream).toBe(false); +}); diff --git a/server/instabox/wiring.ts b/server/instabox/wiring.ts index 787550fe..37cd51c7 100644 --- a/server/instabox/wiring.ts +++ b/server/instabox/wiring.ts @@ -1,4 +1,5 @@ import type { AppConfig } from "../config.ts"; +import { sealedFixture } from "../env-path.ts"; import type { DesktopTarget } from "../routes/desktop-viewer.ts"; import { createSnapshotWiring } from "./snapshot-wiring.ts"; import { createInstaboxRequest } from "./client.ts"; @@ -9,7 +10,8 @@ import { requireInstabox } from "./power.ts"; import { instaboxDesktopTarget } from "./vnc.ts"; export function createInstaboxWiring(deps: { cfg(): AppConfig; eligible(botId: string): boolean; claim(botId: string, allowPreview?: boolean): () => void; inUse(botId: string): boolean; snapshotTimeoutMs?: number }) { - const fixtureApi = process.env.CRYBOT_TEST_INSTABOX_API; + const testEnvironment = process.env.NODE_ENV === "test" || process.env.VITEST === "true" || sealedFixture(); + const fixtureApi = testEnvironment ? process.env.CRYBOT_TEST_INSTABOX_API : undefined; const fixture = /^http:\/\/127\.0\.0\.1:[1-9]\d{0,4}$/.test(fixtureApi ?? ""); let cached: { key: string; machines: InstaboxMachines; request: InstaboxRequest } | undefined; const current = new Map();