Skip to content

feat(host): Cindy 后台服务第一阶段,普通本地任务与桌面一致(个人版迁移 M1) - #11536

Closed
dashhuang wants to merge 717 commits into
mainfrom
cindy/host-m1
Closed

dashhuang wants to merge 717 commits into
mainfrom
cindy/host-m1

Conversation

@dashhuang

@dashhuang dashhuang commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

这次改了什么

摘要

这是个人版迁移到 Cindy 后台服务(apps/host)的第一阶段(M1)。目标是在不开桌面窗口时,普通本地任务也能由后台服务运行,并且和桌面一致:后台服务调用的是桌面准备 PR 拆出来的同一份共用代码,不另写一套。

本 PR 依赖的桌面准备 PR #11535 已于 2026-11-19 合入 main(合并提交 ea5e289965)。本 PR 相对 main 的 diff 现在只剩后台服务这一部分。

每项能力的现状、与桌面的差异和证据,都在 docs/host/personal-migration-release-table.md。本 PR 不打开迁移,是否开放迁移另行决定。

和桌面的关系:

  • 桌面内嵌模式零行为变化。 相对准备分支,本 PR 在 apps/desktop 只改了三个测试文件(见下文“只在本 PR 里的三个桌面测试”)。
  • 后台服务和单独运行的桌面不能同时打开同一个 profile。 后台服务启动时如果发现桌面在用,就拒绝启动;运行中发现桌面开始使用,就挡住新输入(见下文“桌面占用期间”)。

变更类型

  • feat 新功能
  • fix 缺陷修复
  • refactor / perf 重构或性能优化
  • docs / test / chore 文档、测试或工程维护(CI 新增后台服务验收步骤、系统代理对比 workflow)
  • 其他:

范围

  • 关联 Issue / 需求:个人版迁移 M1。依据见放行表第一节(逐项的任务行为)、第二节(与桌面不同之处)、第七节(后台服务重写的逻辑 1–44)。
  • 本 PR 包含:
    • apps/host:
      • 三个引擎(Claude Code、Codex、Pi)的普通本地任务;
      • 上下文与压缩;
      • Skill 与插件(8i);
      • 记忆;
      • 用量与花费记录;
      • 账号与登录;
      • 出口代理;
      • Device Link 入口;
      • 桌面占用时的闸门与静默。
    • apps/web 的 shim:读取类型化错误和启动失败码。
    • CI 与测试纪律脚本。
    • docs/host 下的文档。
  • 明确不包含:
    • 移出 M1 的项:
      • M3:供应商分组执行、伙伴任务、自动化和定时任务的直发接入、远程附件;
      • M2:SkillHub 发现隔离、Pi 包的安装卸载、本地模式。
    • 客户端模式下的引擎版本选择:放行表第 34 行,迁移前完成。
    • 个人版切换和迁移开关。
  • 用户可见变化:
    • 普通桌面:无。
    • 窗口主动以客户端模式连接后台服务时,以及网页端:
      • 任务由后台服务执行;
      • 后台服务没启动时显示原因;
      • 桌面正在使用这份数据时,给出明确提示。
  • 是否存在 breaking change:无。

已知限制(仅限测试期)

迁移前必须解决,在那之前只是登记:

  • 窗口连着后台服务时,不要在窗口里切换或添加账号。 窗口会在本地把新账号写成当前账号,后台服务不跟着换,仍在原账号下运行,新建的任务落进原账号的库。之后续期会失败;重启后台服务时可能因为账号不一致而起不来,要重新用 cindy-host login 登录原账号。要换账号,先在窗口退出登录,再用 cindy-host login 登录新账号,然后重启后台服务。
  • 后台服务重启后,已经开着的窗口不会自动重连。 窗口通过鉴权、带旧实例号的请求都会被拒(409 host_instance_changed),而且不提示原因。要重新打开 Cindy。
  • 窗口连着后台服务时装不了插件。 要装缺失的插件,先退出后台服务,在普通桌面里装好、退出普通桌面后再启动后台服务;同一份数据、同一个账号装好的插件,后台服务下次发现或调用时重新扫描就能用,不用重新批准。后台服务任务里遇到缺失插件,只会得到“去这台任务电脑的插件设置里看”的提示:主干 089105c276、d9fc65bd15 给桌面任务加了任务内搜索与安装,后台服务没有接,同时删掉了原来的兜底引导,所以这是同步 4 带来的退化;窗口里的插件设置装不上,是因为主干 a7f5289e84 把安装确认的答复委托给后台服务,窗口本地的确认被拒,这是主干原有的问题。另外窗口的官方市场取不到账号访问令牌,需要登录才能看到的插件可能直接看不到。两件都列为迁移前要解决,见放行表第五节。

主干同步的合并提交

  • 同步 2:65619a35d3。它本身不能构建,要和紧随其后的端口补齐提交 8bee8af5eb 一起用。
  • 同步 3:7f09da233d,准备分支上对应 43a545067c,主干 af8bd193a3。
  • 之后再合一次准备分支(aafac71097,带进 ca1232f084 与 97af5ce056),没有冲突。
  • 同步 4:679b799da5 合入准备分支(准备分支上 1db8b978a4 合入主干 9354a65d1a),本 PR 侧没有冲突。之后 eec45e4d65 让后台服务和主干对齐:发送和移动只刷新已登记项目(touchRecentWorkdir),任务更新接受共用常量 INDEFINITE_SNOOZE_UNTIL 表示的无限期稍后处理。
  • 同步 5:3ba205779d 合入准备分支(准备分支上 b9fa89f919 合入主干 5a92f62d24),本 PR 侧没有冲突。之后 7b068f570a 把主干新加的可选端口显式写成不绑定:主干 fix(model-groups): 修复首轮空交接,支持组内故障接替 #11406 的模型组失败恢复需要桌面登记模型组,后台服务没有对应入口(放行表第五节“主干同步 5 的 Host 接线”);Agent-Net 的供应商分享委派继续不绑定。
  • 同步 6:1dd89e2966 合入准备分支(准备分支上 d76c822a05 合入主干 3ef44274d6,冲突只在 deepLink.ts,见准备 PR),本 PR 侧没有冲突;主干这 61 个提交没有改 apps/host。这批提交里后台服务没有对应入口的新功能清单在 PR 开出后补进放行表第五节“主干同步 6 的 Host 接线”。
  • 同步 7:915dcd9847 合入主干 43fb1df105(已含 refactor(desktop): 为 Cindy 后台服务拆出共用的桌面逻辑(个人版迁移准备) #11535),没有冲突,锁文件与 .nvmrc 未变。主干 e88f240ba6 给 Pi 加了 getLocalPiHttpsProxy,5feea98573 照桌面 pi-host.ts 的判断顺序接上(有代理环境变量时不介入,否则经共用的 CLI 代理桥配后台服务自己的出站解析),并按改名后的 cli-proxy-bridge.ts 更新网络模块登记;其余主干提交没有需要补的接线(放行表第五节“主干同步 7 的 Host 接线”)。
  • 合并提交里只有冲突解决。主干钉在 43fb1df105。
  • 同步 4 里后台服务还没有对应入口的 21 个主干提交(灵动岛、CUA 驱动查更、账单页、媒体 Guide、GitHub 签入恢复、缺失插件的任务内安装等)逐条列在放行表第五节“主干同步 4 的 Host 接线”;主干同时在后台服务的发送路径绑定了两个读端口 readReplyQuoteNote、readBotThreadNote。

8bee8af5eb 的行为清单:

  • Device Link 换引擎改为在 registry 入口核对所有者,原来主干是在 main.ts 判断 scoped 来源。入口同时透传 options 和 thinking。
  • 能力表补回了 supportsRemoteModelWindowRebuild,它在合并提交里被删掉了。
  • Pi 的 agentCommands 在异步读完任务后,再复核一次账号和运行时。
  • Pi 的 Skill 列表接收 forceReload;桌面占用期间忽略强制重载。
  • 换引擎交接不再取“最近 400 条”,改为按已验证的窗口重放历史;confirmNativeHistoryFallback 端口随主干移除。
  • 普通发送只要有待选,都经过后台服务的 applyPendingPick。这是这次同步在发送路径上唯一的结构变化。

同步 3 的后台服务接线:

  • 主干 48f3597f05 新增了项目归档与恢复的远程入口,后台服务一并接上:
    • 桌面占用期间,预览照常(只读);执行被拒。
    • 拒绝顺序:入口先 refuseWhileHeld;进入任务锁后依次 beforeWrite、assertCurrent、refuseWhileHeld,最后开事务。
    • Device Link 传来的 archiveOnRemoval 按主干的共用逻辑不生效。
    • 测试在 apps/host/src/device-link.test.mjs。
  • 主干这次在定时任务、伙伴群聊和 IM 上的改动,后台服务还没有对应入口,不新增待办。

桌面占用期间

  • 启动时:发现桌面在用这份数据,就拒绝启动,停在 blocked,不自动重试。
  • 运行中:每 10 秒重扫一次(COEXISTENCE_RESCAN_MS);另外监听登记目录,有变动时去抖 250 毫秒后重扫。
  • 发现延迟是真实边界:从桌面开库到后台服务察觉最长约十秒,这期间后台服务照常读写。入口检查之后才开始的占用,可能留下一个空任务行或空对话目录,与发现延迟同类,不单独处理。
  • 闸门只挡新输入:
    • 在跑的回合照常跑完。
    • 新的发送(入队、插话、继续、重试、调度入队、Device Link 新建任务)一律返回 [PRECONDITION_FAILED] HOST_PROFILE_IN_USE_BY_DESKTOP: …,窗口提示“这份数据正被单独运行的 Cindy 电脑端使用。请先退出它,再发送。”(logic.errors.hostProfileInUseByDesktop;会改数据的其他操作用 hostProfileInUseByDesktopRetry)。
    • 经 service 路由的入口:只放行读取、停止正在跑的回合、回答它的权限询问和提问,以及账号续期;放行清单之外的写入一律拒绝。
    • 连续两次干净扫描、且在跑的回合都结束后,才重建并解锁。
  • 发送进入模型窗口核验之后才遇到占用的:取消这次落定,保留待选和原路线,以占用提示拒绝本次发送(放行表第五节“主干同步 2 的 Host 接线”)。
  • 整体静默插件(第七节第 44 项,插件基座,迁移前需要白名单确认):
    • 后台服务先中止当前网关信号,再同步停掉逻辑页和插件 Node 进程,保留分区和安装批准。
    • 静默期间,工具调用、拉起、唤醒和宿主请求都返回 PRECONDITION_FAILED。
    • 被静默打断的在途工具调用报告“结果不确定”。
    • 依赖准备 PR 里网关的静默信号。
  • 记忆:在途回合读写记忆一律收到 PRECONDITION_FAILED;工具列表和任务历史搜索照常。
  • 辅助请求:占用期间拒绝独立派发的记忆自审;在途回合仍可按自己的生命周期派发自动复核或工具循环复核,并照写收据。
  • 回合结算、溢出重放、凭据结算:已经在跑的回合照常收尾。解闸后,按登记时的账号、路线和代次复核。逐条见放行表第二节。
  • 不经 service、由 server.mjs 自己应答的入口(逐个登记,根目录源码契约 scripts/__tests__/host-server-hold-classification.test.mjs 有分类守护,由 pnpm test:runner 执行,新增入口不登记就失败):
    • 拒绝:开启远程控制、开关 Agent-Net(入口和设置锁内各查一次);/chat 为不存在的任务建任务(读完任务、建任务前同步查一次)。/chat 的新任务在开流前被拒,返回 500 和 chat_failed 事件,与任务不存在时一样;已存在任务在开流后被队列拒,返回 200 和同一事件,这是原有行为。
    • 登记例外:关闭远程控制、撤销控制设备。它们写 profile 根的 device-link-settings.json,与桌面是同一份文件、同一把跨进程锁,正在运行的桌面每 5 秒轮询跟随:关闭会断开桌面当前所有控制链路,撤销会断开对应设备;写之前先走两端共用的分享可用性策略,有登记时向账号区域的服务停用对应分享的可用性,并移除登记。理由:收紧方向的操作,只有本机持后台服务令牌的客户端能触发,占用期间后台服务的远程控制仍在线,撤销正是这时需要的。
    • 登记例外:登出(持账号库跨进程锁更新共用账号库和登出标记、删除登录令牌记录)。对正在用的桌面:不会立即登出,最迟在下次续期时(通常在令牌到期前五分钟)回到登录页并提示“本机的登录凭证已失效(可能是同一台设备上的其他实例退出了登录),请重新登录。”,同时停止该账号仍在跑的任务;在此之前桌面仍用内存里的令牌工作。用户 2026-11-19 定:保持允许。
    • 登记例外:/control/stop 的关停收尾(排空队列、在途用量入库、有条件写错误行)。
    • 不写共用数据:/control/attachment、/control/platform、/web/pair、/web/session、/events 与读接口、IPC 现有只读绑定。Agent-Net 设备身份是后台服务自己的记录,桌面不读写。
    • 结构性的改法(服务器层对占用期间的写请求统一默认拒绝)登记为待办,不在第一阶段。

改到主干已有代码的地方

  • 记忆自审接线:主干 c9e1fcd68e 在后台服务上用固定的 Claude 默认路线做记忆自审,没有读用户的辅助模型设置和停用开关。本 PR 改为接上桌面已有的辅助模型链,以及两层停用判断。占用时不派发;已发出的请求,收据仍记到发起账号。桌面包装保留原来的默认端口和执行顺序。
  • scripts/check-test-hygiene.mjs:文件 URL 的 .pathname 规则只扫 apps/host/ 下的测试、夹具和脚本。文件 URL 转本地路径一律用 fileURLToPath;HTTP URL 仍可以读 .pathname。hygiene 基线没有增加。
  • apps/host/scripts/lifecycle.e2e.mjs:
    • 五段断言保持原样。跨平台总期限从 30 秒改为 90 秒,结束时逐段报告耗时。
    • 自有 Ubuntu 上实测:主干 37.4 秒,本分支 39.0 秒。
    • 匿名源码启动加载的仓库模块从 3,351 个增至 3,470 个,单次启动约多 0.7 秒,登记为源码模式的已知变化。
  • CI:
    • ci.yml 的 host-regressions 新增 4 步:只加载验收脚本的导入、provider-config、ipc-route、lifecycle。lifecycle 在 Windows 上跳过,那里最后一次 stop 有既有的 ECONNREFUSED 缺口。
    • 新增 macos-system-proxy-compare.yml:在 GitHub 托管 runner 上改系统代理设置,比较后台服务和 Electron 的代理判定。只在手动触发时,或改了代理实现的 PR 上运行;脚本拒绝在 GitHub 托管 runner 以外启动。

只在本 PR 里的三个桌面测试

apps/desktop/src/main/__tests__/authColdStartRecovery.test.ts、maker-host/__tests__/hostDesktopSourceContracts.guard.test.ts 读后台服务的源码;cindy-brain/__tests__/hostToolSlot.test.ts 不读,是随本 PR 新增的插件静默端口补桌面测试夹具一行。三个都要配本 PR 的后台服务代码,所以不进准备 PR。hostDesktopSourceContracts.guard.test.ts 里一条只查表格式的用例已删除(434ed14264),对照真实依赖图的区域分类守护保留。

UI 变化

怎么验证的

PR 首轮 CI 与评审修复(2026-11-19)

PR 开出后的首轮 CI 和机器人评审暴露了下面几项,都只改 apps/host 和本 PR 新加的测试:

问题 修法 提交
CI 不装打包的 ripgrep,outbound-path-fact 一条用例取不到搜索程序 用例注入平台对应的替身,照常执行;生产上缺 ripgrep 仍与桌面一样报错 7743e6f406
Windows 上 usage-recording 清理时数据库句柄未关(EBUSY) 先关句柄再删夹具 a7fa893117
Windows 上代理 helper 验收脚本读到非协议行 脚本跳过非协议行;生产客户端本来就容忍,补了 CRLF 空行与非 JSON 行的用例 d681f5252a
桌面占用期间,读历史消息会触发图片恢复交付并写共用数据 占用期间延后恢复,解除后照常;实时交付不变 79a6e4b526、8160a6ae86
/models 回包在占用开始后才到,仍写共用的报价缓存和币种文件 写入前复核占用,迟到结果丢弃,解除后普通读取重新刷新 caf94959b0
占用解除重建运行时后,空闲回收没有重启 重建后启动空闲回收,重复解除不重复启动 5d0cec971a
主干同步 6 后,Pi 等引擎取消的回复可能被盖上成功章 用桌面同一个成功判据(主干 7ace44b2b7) 59ea890ff5
根目录契约在 Windows 上收集到反斜杠路径 收集处规范成 / 49f68d81ef
macOS 例外列表里一项写着 a.example.com, b.example.com 时,Host 仍走代理而 Electron 直连 照 Chromium 复制配置时的重新解析对齐,用 CI 的同一份字典回放 26/26 一致 4f4e44ab8b
CodeQL:分类守护里一个正则可能指数回溯 改成无歧义的写法,收集结果与改前逐项相同 b4ca7a6873
macOS 系统代理对照的认证组:CI runner 的系统接口不发布代理用户名,脚本的“认证代理应被拒绝”前提不成立 两边路由照常逐条比较(现在一致);拒绝断言只在系统确实发布了用户名时执行,否则在报告里记为未执行 09bafa707d
合上当前 main 后 Host 类型检查失败,两条守护报 Pi 端口未分类、网络模块表缺 cli-proxy-bridge.ts 同步 7,按桌面接上 getLocalPiHttpsProxy 并更新两张表;守护本身没改 915dcd9847、5feea98573
Windows 代理 helper 验收失败时看不到子进程为什么退出 验收脚本逐轮记录退出码、信号、存活时长,接管 stderr 并给子进程加日志文件,失败时打印并作为 CI 产物上传;20 次启动与原断言不变 ef451931bc
Ubuntu 上一条凭据等待用例偶发读到空值 测试在派发完成前就读取;生产顺序与桌面一致(先通知重启,再派发等待的输入)。改为按条件等引擎真正收到输入,断言不变 206bc30b37
macOS、Windows 上源码方式启动 serve 等 endpoint 超过 30 秒 CI 上源码冷启动约 30 秒(本机约 8 到 9 秒),不是回归;两处等待统一放到 90 秒(同 lifecycle),打印实际用时,超时时打印 stderr 尾部;断言不变。这是源码模式的启动耗时,不代表发行包 65a9cbad46、044bf9266e
Windows 上 Chromium 代理 helper 一启动就退出:Electron 42 在 Windows 上把主进程的标准输入设成一开始就已结束,worker 读到结束就退出,从未就绪(本 PR 引入) Windows 上改用子进程 IPC 通道(父端不保活、通道断开时 worker 退出),macOS 仍用原来的标准输入通道;协议内容、就绪判据、超时与回退不变,不开端口 9001d67bf8
helper 关闭时如果子进程既不退出也不报错,关闭没有总期限,可能拖住后台服务停止 保留原有信号顺序,加 3 秒总期限,到期记警告后返回 a6d3182bf6
代理 helper 验收脚本在一组失败后会挂到作业超时 启动时就订阅退出,每组结果即时输出,失败时也清理 PAC 服务和子进程;Windows 的孤儿组走生产传输;20 轮与各组断言不变 7b38ff47e3
改用 IPC 后,Windows 验收仍在“等子进程关闭”这一步失败 父端主动断开 IPC 通道后,Node 不再发出子进程的聚合 close 事件(nodejs/node#65646);IPC 下改为等进程退出且 stderr 流关闭,流传输照旧;强杀与清理超时仍判失败,并记录断开到退出的耗时。生产按 exit 判断,未改 411cc62dd7
Ubuntu 上输入队列几条用例偶发在异步派发完成前读取结果 生产顺序与桌面一致;按条件等到写入结算或引擎真正收到输入再断言;两处“不应发生”的断言在条件满足后仍保留原来的观察窗口,失效注入确认能抓到 b4fc30a9ff、b3cdf74cea
  • 认证代理的拒绝路径由单测覆盖(macos-system-proxy.test.mjs 的 “a proxy that names a user is unresolved, and the user is in no log or judgement”);CI 的对比工作流在托管 runner 上验证不了这一条。
  • Windows 上 Chromium 代理 helper(本 PR 引入的缺陷,已修,CI 已验证)。 根因:Electron 42 在 Windows 上把主进程的标准输入设成一开始就已结束(lib/common/init.ts),helper 读到结束就正常退出,从未就绪;CI 上 20 轮都在 1 秒内以退出码 0 退出。后果:没有代理环境变量时,Windows 上的后台服务读不到系统代理(PAC、自动发现、手动代理),出站按直连处理,依赖代理才能联网的请求会失败。不会卡住启动:预热有 8 秒上限,单次解析约 2 秒,之后只在出站请求时按退避重试(最长 60 秒一次)。验收里那次挂到作业超时来自验收脚本本身,已一并修正。改用 IPC 后的第二轮失败同样是验收判据问题:父端断开后 Node 不发聚合 close,验收却在等它;生产按 exit 判断,未改(见上表 411cc62dd7)。修法见上表 9001d67bf8、a6d3182bf6、7b38ff47e3、411cc62dd7;8874aafb21 上 Windows 验收五组全部通过:20 轮启动全部就绪并返回 PAC 结果,断开到退出 61–136 ms(中位 95 ms),没有强杀;按生产方式启动、崩溃后重启、Host 被杀后不残留三组通过;随后的 Windows 系统代理对照 “All results agree.”。
  • DCO:本 PR 提交数超过 DCO 应用一次能取到的上限,应用报告“取不全提交列表、无法评估”,不是缺签;本机 check:dco 全部已签,合并提交豁免。
  • 第二轮 CI(8160a6ae86):Windows 的数据库检查跑到并通过;Windows 上的清理顺序与路径守护通过(Host 全量 1044/0);Ubuntu 上 lifecycle 通过,约 40 秒(first/busy/replacement/background/reattach 9959/10206/9841/9898/88 ms),低于 60 秒,这一项已结。
  • 验证中发现的五项主干既有问题已登记为 主干既有问题汇总:Cindy 后台服务迁移验证中发现的五项(#11535、#11536) #11545。

自动验证

门禁整套在 b4fc30a9ff 上跑;b3cdf74cea 只多两行测试,重跑了 hygiene、DCO 与该测试文件;最终快照 8874aafb21 再多验收脚本与放行表各一个提交,重跑了 hygiene、DCO、dev-docs 与 e2e 导入检查(开发机,Node 22.22.3):
check:dco                 PASS:629 个提交已签,88 个合并提交豁免(相对 main)
check:test-hygiene        PASS:334 个文件在基线内
check:dev-docs            PASS 15/15
check:brand-terminology、check:endpoints、check:design-inventory、check:design-colors(对 43fb1df105)、
check:settings-search、check:built-in-skills、ci:scheduler-guard、check:i18n、check:i18n-glossary   全部 PASS
apps/host/scripts/check-e2e-imports.mjs   PASS(scheduler-runtime 一条是脚本里登记的已知跳过)
pnpm test:runner          PASS 781/0(含两个 Host 根目录源码契约)
pnpm test:guard           PASS(desktop、mobile、maker-core 三档)
pnpm --filter @cindy/host test   1071 过 / 0 失败 / 0 跳过(带浏览器夹具;审核方本机复跑同样通过)
input-queue.test.mjs      20 个独立进程各一轮,每轮 370/0/0(b3cdf74cea)
chromium-proxy-worker.e2e.mjs(macOS 原样)  20/20 轮、5/5 组通过;macOS 强制走 IPC:新判据 20/20、5/5,旧判据按预期失败;Windows 以 CI 为准
Host 与桌面类型检查         0 错误
桌面读者集合与 vitest related  沿用主干同步 6 那一轮;同步 7 带进来的桌面文件另跑 related,16767 过 / 2 失败(deviceOp 文件监听,与同步 6 同名)

主干同步 6 之后的自有 macOS 补跑(PR 开出后,2026-11-19)。 文件监听正常的 Apple Silicon macOS,Node 22.22.3,准备分支 d76c822a05、集成分支 49b01543ef,对照主干 3ef44274d6;测试 HOME 用临时目录、不带登录凭据,除浏览器三项外只放行回环网络。

  • 集成分支 Host:全量 1042/0/0,test:lifecycle 通过;两个浏览器文件(Chromium 1243)15/0/0,plugin-sandbox e2e 通过。
  • 桌面 unit 全量(进程池,未装 Electron):准备分支 74523 过 / 47 失败 / 44 跳过,主干 74455 / 47 / 44,失败与跳过逐条相同,没有只在准备分支失败的用例。装上 Electron 后补跑未装时收集失败的 88 个文件,两边都是 2628/0/0。其余 46 条两边相同,都是测试环境问题(forge 15 条,其中 12 条是 macOS 临时目录软链接;builtinGhostProvisioner 23 条;llamaCppDownloads 7 条;foreignSourceAdapters 1 条)。
  • Electron+Pi 批:claudeHosted 15/0/0,Pi 系列、groupRelay、claudeGrok 全过;失败的只有已登记的两条(codexHosted 风险命令审批、startupProbe 原生启动对比),主干同样失败。没有启动图形界面的 Electron。
  • 下载只有 Electron 42.11.12(GitHub Releases,校验官方哈希)和按锁文件 sha512 校验的 npm 包。

主干这 61 个提交对放行表前提的重验和“主干同步 6 的 Host 接线”清单已补进放行表第五节:唯一不再成立的一条是回复盖章(第五节甲 9),已在下面的首轮修复里对齐桌面。验证中发现的五项主干既有问题已登记为 #11545。

主干同步 4 之后,在文件监听正常的自有 macOS 机器上跑,Node 22.22.3,集成分支 eec45e4d65、主干 9354a65d1a:

pnpm --filter @cindy/host test            隔离内 1042/0/0,隔离外的两个浏览器文件 15/0/0
pnpm --filter @cindy/host test:lifecycle  通过
scripts/plugin-sandbox.e2e.mjs            通过(隔离外)
装上 Electron 42.11.12 与仓库钉住的 Pi 后,CI 不跑的 7 个文件加 claudeGrokSessionAffinity 全部执行、0 跳过,
  与准备分支结果相同;只有 codexHosted 风险命令、startupProbe 两条失败,主干同机同命令同样失败(见下文)
子进程记录里没有 Electron 进程,没有图形界面
  • 依赖 Electron 的 unit 文件同步 4 之后没有在自有电脑上装 Electron 重跑(最小集只要求跑新增的):准备分支进程池全量里因缺 Electron 没执行的 88 个(86 个收集失败,加 git-review 下的 deviceOp 与 anthropicCompatProxyStartup),审核方在开发机上对两个最终快照补跑——准备分支读者集合覆盖 43 个全过、另 43 个补跑 834 条全过;集成分支读者集合覆盖 45 个全过、另 41 个补跑 825 条全过(开发机文件监听有故障,这批不依赖监听);剩 plugin-market 的 agentTools、defaultMarketPluginSyncOutcome 两个 unit 文件留给 CI,上一次在自有电脑上跑是同步 3 那轮。
  • 主干同步 3 之后在 868941897a 上也跑过同样的一轮(Host 全量 1055/0/0;lifecycle first/busy/replacement/background/reattach 7993/7985/8030/8030/70 ms;两条文件监听登记用例 codexHosted 6 次、claudeHosted 3 次通过;Pi 18 条通过)。
  • 真实 CLI(Claude、Codex、Pi)只在出站网络被隔离的环境里跑,测试用临时 HOME,不带登录凭据。
  • 同步前还跑过一轮:Node 22.22.3 与 22.23.4 各一次,Host 全量、类型检查、ipc-route、provider-config、lifecycle 两个版本都通过。

已执行,主干同样失败(都是主干既有项,不在本 PR 处理):

  • codexHosted.e2e 的 “asks on this computer before Codex runs a risky command, and runs only what was approved”:失败方向是已批准的命令没有生效。“被拒命令没有执行”这一点,本轮没有断言出结果,不能当作权限边界已经验证。原因未定位,怀疑和外层隔离下 Codex 自带的命令沙箱不能嵌套有关,未证实。
  • startupProbe.e2e 的 “compares native startup with and without shortcuts”:原因未定位。这两条所在的目录,在主干和本分支逐字节相同。
  • 桌面 unit 用线程池跑全量时偶发段错误:主干在另一台 Mac 的同一隔离里,合计 4 次崩 3 次;在最后一轮验证的机器上,主干 2 次没崩,准备分支多数崩溃。改用进程池后,准备分支和主干的失败项相同。CI 碰上就重跑一次。

按规则字面有疑问、保留并说明理由的 4 项(放行人可以否决):

  1. apps/host/src/agent/input-queue.test.mjs:4343(队列 API 成员都是函数):按静态契约登记。main.ts 把无类型的队列对象强转成端口类型,编译器查不出缺成员,缺了要到运行时第一次调用才抛 TypeError。入口是真实队列工厂和 startPorts();依据是这处类型强转;最小失败输入是从队列 API 删掉清单里任一成员;tier:guard(静态契约),不算行为覆盖。
  2. apps/host/src/device-link.test.mjs:474(入站分发端口的分类与测试里的副本对照):故意保留的副本对照,只起“改动必须两处同改”的提醒作用,保护权限边界:这张表决定桌面占用期间哪些端口放行、哪些拒绝。失效后果:有人把某个端口从“拒绝”或“过闸门”改成“只读放行”,旁边的完整性检查不会报,只有这条会。各类别的实际准入由行为用例覆盖:refused-at-entry(requestPluginOauth)和 service-gate 的 dispatchLocalInvoke 由第 297–306 行(占用期间发送、新建任务、预热、插件页调用、插件授权都被拒,没有一个到达处理函数)与第 187 行(项目归档执行被拒)覆盖;read 由第 307 行(占用期间读任务照常应答)覆盖一条,其余读端口没有逐个的行为用例;unbound 由第 360 行(未接的平台功能被拒)覆盖;service-gate 的 executeTaskTags 没有占用期间的行为用例。
  3. apps/host/src/startup-account.test.mjs 第 38、174、215、284–384、470–508 行:入口是 main.ts 里的启动阻断、关库、跨区采用、续期排期这几个函数,测试从源码提取后执行,不经过 serve 装配。装配这一层由 lifecycle e2e 覆盖起停、附着与重连,没有覆盖阻断矩阵和续期回调是否传入。放行表第五节已记待办:M2 之前把这些函数移到可以直接 import 的模块,测试改为导入生产模块。
  4. apps/host/src/startup-account.test.mjs:759(测试夹具对子进程的环境隔离):没有生产入口,是保护测试不碰真实数据的守护。失效后果:测试拉起的后台服务子进程带着终端里的真实目录变量启动,可能读写用户的真实数据。故意保留。
测试价值(新增 19 个、改写 35 个)

范围 43a545067c..61c00afebb(之后本轮新增的测试见末尾“本轮新增”)。新增 19 个文件(Host 18 个,其余 1 个),改写 35 个文件(Host 31 个,其余 4 个)。文件数包含 apps/host/scripts 的 6 个脚本式 e2e(新增 2 个,改写 4 个)。脚本中的独立 check() 或新增 PASS 场景按用例核对,无新增场景的 lifecycle.e2e.mjs 仍计为改写文件。仅计普通测试文件为新增 17 个、改写 31 个。

表中行号均指对应测试文件在本 PR 快照中的位置。「本表」为本次补记。最小失败输入是源码所示的代表条件。已有注释已写明的项保留行号引用。tier 保留文件已有称呼,补记处注明测试实际使用的资源。尚未确认测试价值的个别用例在表后列为待评审。

测试文件 变更 生产入口与可观察结果 Bug/规则依据 覆盖缺口 最小失败输入 tier 实测耗时
apps/host/scripts/chromium-proxy-worker.e2e.mjs A 文件内 1–10 文件内 1–10 本表:fake worker 单测可模拟 ready 与退避,无法检验真实 Electron 的 fuse、PAC 冷启动、进程退出和磁盘副作用。 本表:带 cookie 加密 fuse 的构建;PAC 延迟时先发一条 resolve;两个域名一外一内;杀一个 helper 后再解析;杀启动 helper 的 Host。 文件内 1–10 见耗时表
apps/host/scripts/release-region.e2e.mjs A 文件内 1–14 文件内 1–14 文件内 1–14 本表:构建区为 CN、环境明确设 global,serve 必须拒绝且不发布端点。去掉覆盖再核 release/web/CLI 均为 CN、网页语音默认语言与 CN 一致。脚本对 Global 做镜像验证。 文件内 1–14 见耗时表
apps/host/src/agent/idle-release.test.mjs A 本表:createHostIdleRelease.scanNow 接三类生产 watchdog;普通任务到阈值只释放空闲运行时并保留可恢复性,忙碌及特殊任务维持运行。 本表:放行表第一节第 35 行,沿用桌面的可恢复临时关闭和候选筛选。 本表:引擎单测不经过 Host 的 SQLite 候选与队列忙态装配。 本表:同一任务跨过 30 分钟阈值,或者锁等待期间开始发送;另把单个任务变成非普通任务、排队中、结算中、交互待答或后台活跃,观察它保持。 本表:db 集成,真实迁移库、生产锁,注入时钟和运行时。 见耗时表
apps/host/src/agent/outbound-path-fact.test.mjs A 文件内 1–15 文件内 1–15 文件内 1–15 文件内 1–15 文件内 1–15 见耗时表
apps/host/src/agent/profile-coexistence.test.mjs A 文件内 1–14 文件内 1–14 文件内 1–14 文件内 1–14 文件内 1–14 见耗时表
apps/host/src/agent/usage-pricing.test.mjs A 文件内 1–23、225–233 文件内 1–23、225–233 文件内 1–23、225–233 文件内 1–23、225–233 文件内 1–23、225–233 见耗时表
apps/host/src/agent/usage-recording.test.mjs A 文件内 1–14 及各 Case 注释 文件内 1–14 及各 Case 注释 文件内 1–14 及各 Case 注释 文件内 1–14 及各 Case 注释 文件内 1–14 及各 Case 注释 见耗时表
apps/host/src/chromium-proxy.test.mjs A 文件内 1–17、156–193 文件内 1–17、156–193 文件内 1–17、156–193 文件内 1–17、156–193 文件内 1–17、156–193 见耗时表
apps/host/src/macos-system-proxy.test.mjs A 文件内 1–19 文件内 1–19 文件内 1–19 文件内 1–19 文件内 1–19 见耗时表
apps/host/src/outbound-proxy.test.mjs A 文件内 1–16 文件内 1–16 文件内 1–16 文件内 1–16 文件内 1–16 见耗时表
apps/host/src/plugins/gateway-delivery.test.mjs A 文件内 1–3、81–83 文件内 1–3、81–83 本表:只测共享网关的合成回执区分不了 Host 的实际逻辑页交付适配器是否已把消息交给页面。 本表:一条原生 hook 尚未提交时页面不可用;同一条在页面接收后丢回执。分别核对立即走失败策略与只等原截止时间一次。 文件内 1–3、81–83 见耗时表
apps/host/src/plugins/profile-pause.test.mjs A 本表:createHostPluginRuntime、生产网关、Node broker 和 createHostProfileCoexistenceMonitor;占用时停止/拒绝,已有批准、KV 和分区保留。解闸按需恢复且不重放占用期事件,已出站未收结果的操作报 PLUGIN_DELIVERY_UNKNOWN。 本表:放行表第七节 44、第一节第 33 行及 8i,暂停保留存量批准并守住共享状态。 文件内 34–38 本表:一个已批准插件运行时触发 hold;分别保留一个已送工具、一个已打开的设置页、一个待发事件或一个已提交和一个未完 staging。另注入一次清理失败或一次 owner 不可用并触发干净扫描,核对恢复只完成一次。 文件内 34–38(浏览器替身与真实 Chromium 两类) 见耗时表
apps/host/src/project-icon.test.mjs A 文件内 1–14 文件内 1–14 文件内 1–14 文件内 1–14 文件内 1–14 见耗时表
apps/host/src/release-region.test.mjs A 文件内 1–21 文件内 1–21 文件内 1–21 文件内 1–21 文件内 1–21 见耗时表
apps/host/src/server-api.test.mjs A 文件内 11–13 文件内 11–13 文件内 11–13 文件内 11–13 文件内 11–13 见耗时表
apps/host/src/service.test.mjs A 文件内 1–10 文件内 1–10 文件内 1–10 文件内 1–10 文件内 1–10 见耗时表
apps/host/src/test-support/hook-plugin-fixture.test.mjs A 文件内 1–7 文件内 1–7 文件内 1–7 文件内 1–7 文件内 1–7 见耗时表
apps/host/src/ui-text.test.mjs A 文件内 1–10 文件内 1–10 文件内 1–10 文件内 1–10 文件内 1–10 见耗时表
scripts/__tests__/host-skill-projection-owner.test.mjs A 文件内 1–12 文件内 1–12 文件内 1–12 文件内 1–12 文件内 1–12 见耗时表
apps/desktop/src/main/__tests__/authColdStartRecovery.test.ts M 文件内 739–751、861–871 文件内 739–751、861–871 文件内 739–751 组由本表补:之前桌面用例只覆盖桌面自己续期冷启,没有把 Host 刷新后的 v1 与 vault 带回桌面切账号、冷启或认领空 vault。861–871 组见原注释。 文件内 739–751、861–871 文件内 739–751、861–871 见耗时表
apps/desktop/src/main/maker-host/__tests__/hostDesktopSourceContracts.guard.test.ts M 文件内 1–10 及各 it 前的注释;见下方 guard 子表 各 it 前注释;见下表 本表下方 guard 子表 本表下方 guard 子表 文件内 1–10(guard,架构与装配规则) 见耗时表
apps/host/scripts/claude-proxy.e2e.mjs M 文件内 482–485 本表:放行表第一节第 35 行,释放空闲运行时不丢 Claude 原生续接。 本表:watchdog DB 用例只观察假引擎关闭;既有代理 e2e 不让同一个任务释放后再恢复。 本表:真实 Claude 在模拟上游完成一轮,测试时钟跨 30 分钟,下一条仍送上前一轮上下文且原生 session ID 不变。 本表:e2e,真实 Host 与 Claude 子进程、回环上游。 见耗时表
apps/host/scripts/codex-runtime.e2e.mjs M 文件内 598–600 本表:放行表第一节第 35 行,Codex 的原生线程随运行时释放而保留。 本表:watchdog DB 用例只观察释放,既有兼容代理路径不验证原生线程在释放后能重开和继续。 本表:真实 Codex 会话一次回复后推进测试时钟跨 30 分钟,下一条在同一 thread ID 带回旧历史。 本表:e2e,真实 Host 与 Codex 子进程、回环上游。 见耗时表
apps/host/scripts/pi-native.e2e.mjs M 文件内 311–313 本表:放行表第一节第 35 行,Pi 的临时关闭保留原生会话。 本表:watchdog DB 用例不执行真 Pi,既有 Pi e2e 没有验证空闲释放后的实际续接。 本表:真实 Pi 一轮后跨空闲阈值,下一条请求必须包含首轮约定的单词,并沿用同一原生 session。 本表:e2e,真实 Host 与 Pi 子进程、回环上游。 见耗时表
apps/host/src/agent/codex-system-login.test.mjs M 文件内 150、200、342、402–403、508、552、598、633 附近 文件内 402 组由本表补:放行表第五节并存方案 A「后续三」的凭据读写边界,回核覆盖等待账号读取期间发生的占用。其余见各测试价值注释。 同入口各组注释 同入口各组注释 同入口各组注释 见耗时表
apps/host/src/agent/engine-deps.test.mjs M 文件内 136–137、265–267、345 附近 文件内 136–137、265–267、345 附近 本表补 136 组:原 Codex 端口夹具只看默认配置,没有从桌面写出的 owner 文件读取显式 true/false。二进制组见 265–267、345。 文件内 136–137、265–345 附近的测试矩阵 本表补 292–331:文件系统与可执行版本探测的 integration,临时脚本模拟引擎版本。其他组按文件头及 345 附近。 见耗时表
apps/host/src/agent/git-snapshot.test.mjs M 文件内 87–89 本表:放行表第一节 7b(Git 保存点与回退)、第七节 9,后台保存点超时不能阻塞用户回合或迟到落点。 本表:既有基线/成功/失败场景未让同仓队列一直持锁直到保存点截止。 文件内 87–89 文件内 9(integration) 见耗时表
apps/host/src/agent/input-queue.test.mjs M 下方用例组表 下方用例组表 下方用例组表 下方用例组表 下方用例组表 见耗时表
apps/host/src/agent/interactions.test.mjs M 文件内 205–209 文件内 205–209 文件内 205–209 文件内 205–209 文件内 205–209 见耗时表
apps/host/src/agent/memory.test.mjs M 文件内 131–133、193–195、278–281、293–301、324、349 附近。本表补 178 组:createHostMemoryManager 的 getStore / write 从引擎直接进入,hold 时返回 PRECONDITION_FAILED 且不创建目录,解闸后 digest 可读。 本表补 131、178、193 组:放行表第一节 11 的 memory 账号隔离、模型链与辅助用量,第二节的并存记忆限制。其余见相邻规则注释。 本表补 131、178、193、278、293 组:已有权限和模型拒绝用例没有 hold 下冷作用域初始化、直接引擎摘要、辅助候选无回退和回执跨 owner 的交错,也没验证伙伴项目实际落点、Host 真实 MCP session_search 注册。其余见邻注。 本表补 131、178、193 组:hold 下一个冷 memory_list 或引擎 getStore/write;一条记忆加一条选定模型,其中停用、链不可用或 hold 均零请求;模拟一次请求中换当前 DB,回执仍只入旧 DB。其余见 278、293、324、349 的注释。 本表补 278:integration,真实 MCP 管理器与临时项目目录。其他组见相邻注释。 见耗时表
apps/host/src/agent/native-auth.test.mjs M 文件内 189–199 文件内 189–199 文件内 189–199 文件内 189–199 文件内 189–199 见耗时表
apps/host/src/agent/provider-credentials.test.mjs M 文件内 212–220、338 附近 文件内 212–220、338 附近 文件内 212–220、338 附近 文件内 212–220、338 附近 文件内 212–220、338 附近 见耗时表
apps/host/src/agent/session-update.test.mjs M 文件内 1–12 及各分组注释(约 236、341、426、554、690、745、910、936) 同入口各组注释 本表补 restore 锁(527 附近)与 snooze(936 附近):已有恢复验证状态和保留时间,未从同任务锁内部/外部同时触发。现有设置更新不对照桌面延后日期的界限与清除。 本表补 1、426、554、690 附近:存一条 pick 后读运行时仍旧,再发送;一条归档任务尝试恢复并查状态和保留记录;同一运行时经一次关闭/重复关闭,检查用量回执只来一次;有/无一条待选路线时分别改 effort,或给一个 Review 任务改 thinking。其余见邻注。 本表补 690 组:db,真实 owner SQLite 与注入运行时,核对运行时、任务行及拒绝。其余见邻注。 见耗时表
apps/host/src/auth/login.loopback.test.mjs M 文件内 148–157、252–256 文件内 148–157、252–256 文件内 148–157、252–256 文件内 148–157、252–256 本表补 252 组:integration,Node 子进程携带构建区印记与合成身份响应。前两组见 148–157。 见耗时表
apps/host/src/auth/refresh.test.mjs M 文件内 67–76 文件内 67–76 文件内 67–76 文件内 67–76 文件内 67–76 见耗时表
apps/host/src/boundary.test.mjs M 文件内 143–155、289–298、567、596 附近 同入口各组注释 同入口各组注释 本表补 25b(333–537):serve 尝试提交 owner、首次或同账号 login、一个运行中 Host 被另一账号替换、占用扫描返回 PID/拒读、登出时一条旧链接、未获锁准备 Skill、一个被禁用 Skill。分别断言状态不写、链路清扫或清单过滤等对应结果。25a 与后两条见文件注释。 文件内 143–155、289–298、567、596 附近 见耗时表
apps/host/src/credentials/store.test.mjs M 文件内 146–148 本表:a6cb62e1af(源码 Host 解析 Electron 可执行路径不得执行 Electron 的 npm 安装入口),以及放行表登录凭据联合验收的保留密文约定。 文件内 146–148 本表:依赖树只有 Electron JS 入口、无 dist 可执行文件,profile 分别不含记录与只含一条密文。 文件内 146–148 见耗时表
apps/host/src/device-link.test.mjs M 文件内 184、345、441、585 附近。本表补 Agent-Net:通过生产 createHostServer /control/remote 和 createHostDeviceLink;占用时报 409,锁内换 owner 时写拒绝并保持文件。 本表补 archive 与 Agent-Net:放行表第五节并存方案 A、第一节第 34 行后的并存写入准入及第二节 Agent-Net;预览只读、归档写与远控开关均须复核。其余见邻注。 本表补 Agent-Net:已有 service 闸门用例没走 CLI 专用 /control/remote,也没在拿设置锁的瞬间换 owner。 本表补 184 和 585 组:一条任务占用时做 preview 与 apply,或在成员检查里才出现 hold;一次已鉴权 agent-net-on/off 遇到 hold,或获得设置锁时更换 owner。其余见邻注。 文件内 184、345、441、585 附近。441 的独立名单用例见待审核清单。 见耗时表
apps/host/src/host-tools.test.mjs M 文件内 290、394、422 附近 文件内 290、394 附近;本表补 422 组:放行表第五节并存方案 A 的新写入默认拒绝,项目授权后的写入也须再次确认 hold。 文件内 290、394、422 附近 本表补 394、422:活跃会话在 held profile 调一次项目只读再写;HTTP 原生确认等待时改变 hold,或 MCP 已进锁才改变 hold。保持项目文件/行并且不推 patch。 文件内 290、394、422 附近 见耗时表
apps/host/src/ipc-route.test.mjs M 文件内 140–142 文件内 140–142 文件内 140–142 本表:已鉴权调用一个 model 入口,handler 抛带 MODEL_WINDOW_PROTECTION_UNAVAILABLE(或表内任一模型切换拒绝码) 的 Error,再换一个不在状态表的错误码。 本表:integration,真实 IPC HTTP handler 与 socket,注入业务拒绝。 见耗时表
apps/host/src/loaders/raw-hook.test.mjs M 文件内 33–34 本表:放行表第五节 Node 22.22.3 源码 Host 加载 ?raw 的甲项、架构原则 §5。 文件内 33–34 本表:启动带 tsx 与 Host raw loader 的 Node 子进程,导入一个 HTML 文件的 ?raw 并核对原文字节;Markdown 对照覆盖扩展名兜底。 文件内 33–34(文件按 unit 登记,实启一个隔离 Node 子进程) 见耗时表
apps/host/src/plugins.test.mjs M 文件内 147;本表补 281:生产 runPageTool 已受理工具若交付中遇 hold,将不确定状态码送回调用方。 文件内 147;本表补 281:放行表第七节 44,已开始的插件外部操作不能当作未提交或自动重发。 本表:既有页工具用例只测 null task 上下文,OAuth 既有路径不触发占用期间的续期、空 token 失效标记和重试恢复。 本表:一个到续期时间的连接,或一个已有受理的页工具在返回前改变 hold。 文件内 147(unit);本表补 281:unit,真实页工具入口、注入插件调用。 见耗时表
apps/host/src/plugins/managed-skills.test.mjs M 文件内 143、183、279 附近 文件内 143;本表补后两组:放行表第五节「迁移前清点缺批准 receipt 的存量插件」8i,休眠/未认领 owner 和未完成清点均须反映,已有批准及 each-call 策略继续生效。 文件内 143;本表补后两组:活跃 owner 的 census 漏其它 owner 与无法枚举;既有 Skill 清单测试未走旧/新安装布局在真实 gateway 的控制点。 本表:一份缺 receipt 的旧安装,运行桌面回补前后做 preflight;一份未认领/休眠安装或不能完整扫描的 owner 树;一个有批准的 hook 同时要求 each-call。 文件内 143、183、279 附近(integration) 见耗时表
apps/host/src/profile-path.test.mjs M 文件内 25、74 附近 文件内 25、74 附近 本表补 25:既有路径选择测试只给环境区,没有构建区和冲突覆盖。 文件内 25、74 附近 本表补 25:unit,调用 resolveHostRegion 注入构建区及环境覆盖;另一组见 74。 见耗时表
apps/host/src/server.test.mjs M 文件内 112、284、447、491、591、691 附近。本表补 591:createHostServer /api/runtime-plugins 限本机受信桌面,持 bearer 但无实例绑定或仅网页 cookie 得 403,hold 下可信请求也得 409。 文件内 284、447、691;本表补 112、491、591:放行表第五节 8i 存量诊断只向受信本机报告,甲 2/7/8 运行时设置独立入口,第一节第 33 行受信桌面插件设置。 本表补 112、491、591:已有 health/owner 认证没有 census 泄漏对照;业务设置测试不经过 HTTP 参数解包;只测网页授权的用例不能发现凭据缺实例 pin 或 hold 在 worker 设置入口遗漏。其余见邻注。 本表补 112、447、491、591:提供一条缺批准 census,分别经本机 status 和普通健康探测(cookie 或带 Origin 的 bearer)读取,一次带类型错误的更新,一组五个设置各投递一个原始字段值,一次无实例 pin 的本机请求或一条持 pin 的 held 请求。其余见邻注。 文件内 284、691;本表补 112、447、491、591:integration,真实 HTTP server,注入业务端口。 见耗时表
apps/host/src/sessions.test.mjs M 文件内 341、363、380、403、513 附近 同入口各组注释 本表补 341、363、380、513:一般分页没过清空线/回退锚点、没有在读页期间变动的清空线、没有超过扫描预算的大回合,回复修正测试原只核正文与 PR 派生。 文件内 341、363、380、403;本表补 513:一条回复带两张已引用图片,修正后保留其中一张,检查仅被移除的引用释放。 同入口各组注释 见耗时表
apps/host/src/startup-account.test.mjs M H-2、207、251、348、C、甲各组。本表补 660/678:生产 proxy warmUp 与 power worker 预备报告 unavailable,真实 source serve 仍响应 /health 且空 vault refresh 不启子进程。 本表补 251/348:放行表第七节 42(启动扫描只有限复查未明身份)。660/678:第一节 28c 和 a6cb62e(源码 Host 解析 Electron 路径不执行 npm 安装入口)。其余见邻注。 本表补 251/348:相邻一次扫描用例只比对活 PID 与 client 登记,没覆盖超时、复查、登记变更和 PID 复用。源码 worker / serve 用例缺口见 658–677。 本表补 251/348:一个临时登记在第一次进程身份查询时未知,随后退出、变为已确认、被复用,或一直未知耗尽预算。再以一次慢查询返回已知结果对照。660/678:临时源码树保留 Electron JS 包而无 dist,worker 预备及空 profile /health 和 refresh。其余见邻注。 本表补 251/348:扫描器 unit,生产 createDesktopScanner 配注入 OS 和时钟、临时登记文件(main 启动片段仍是提取重执行,见待审核清单)。660/678 见邻注(source integration / e2e),其余见邻注。 见耗时表
apps/host/src/web-shim.test.mjs M 文件内 347–358、449–451 文件内 347–358、449–451 本表补 449:既有 shim 通用错误只验证 HTTP fallback,没有两种占用的 typed 映射和相同客户端调用下的无类型对照。 本表补 449:sessions.list 收一个带 code 的 409、一个启动拒绝带原因的 409、一个无类型/无 message 的失败。 文件内 347–358;本表补 449:unit,执行生产浏览器 shim 并注入 fetch 响应。 见耗时表

apps/host/src/agent/input-queue.test.mjs 用例组

按用例起始行与名称归组,覆盖本次新增用例。测试使用生产 createInputQueue 与 createTurnExecutor,替换引擎或进程外 I/O 的位置由各组标明。

用例(行号) 生产入口与可观察结果 Bug/规则依据 覆盖缺口 最小失败输入及 tier
375(Pi Skill 准备期间占用) 本表:createInputQueue 的设备侧 Pi 准备走生产 turn-executor 的启动检查,hold 后拿到 Skill 也不启运行时。 本表:并存方案 A、甲 17。 本表:前一用例只在等待期间 Stop,没有桌面中途接管。 本表:一次挂起的 Skill 查找,中途开始 hold 再完成。unit,注入查找与引擎。
1036(running history view) 1031–1035 1031–1035 1031–1035 1031–1035(文件登记 unit,实际打开临时 owner 库)
1728–1805(coordinator terminal、next input waits、stale-boundary retry) 1723–1727、1754 附近;本表补:生产队列把终态交协调器一次,持久化未完不放行下一输入,结算后撤掉定时重试。 1723、1754 附近(4a) 1754 附近;本表补:既有失败 Stop 用例不测终态到达与持久化完成分离。 本表:回复写入暂停加一条后续输入并越过陈旧判定时刻,随后放开写入;另用 error→done 和 Stop→idle 检查协调器只有一份对应终态。tier 见 1726、1754 附近。
2444(turn diff) 2436–2443 2436–2443(甲 7) 本表:既有改动记录用例验证 Git 基线/文件差异,不能发现原事件还出现在会话推送或历史。 2436–2443
3241–3260(context usage) 3236–3240、3256–3259 同入口(检查点 3) 同入口 本表:一个带 contextTokens/contextWindow 的 Done status,分别在本轮结束前和结束后送到真实队列,检查任务行不留默认值。tier 见 3236–3240。
3369–3511(owner dispatch、remote Pi skill preparation、cold Pi verification) 本表:createHostRuntimeSelection 与队列/turn-executor 在控制端派发和 Pi Skill 准备中验证 Host 路线,拒绝非法或无法验证的路线;成功才落选项或换实例。 本表:放行表第一节 1、甲 17 和并存方案 A。 本表:已选路线的直接切换测试没有覆盖控制端先准备、冷 Pi 自报窗口和验证中途的占用。 本表:一条带缩小目标窗口的本机选项,Pi 原生窗口证明延迟、缺失或确认时 hold;补一条已有换引擎意图的本机任务确认原引擎退出。db,临时 owner 库与注入引擎。
3557–3782(model change at send 的缩窗、失败、重放、改名、冷启动) 3550–3781 各组注释;本表补:生产选择与发送事务按次序兑现待选路线,失败保留意图或队列头,重试/重放时读取其正确状态。 各组注释(检查点 3、第一节 30) 各组 Rule/Gap 注释 本表:一个已释放任务的已用上下文比目标窗口大;另注入一次同引擎落地失败,之后重试或撤回,或让一次溢出重放遇到新 pick、一次 provider 改名遇到旧 pick。db,真实任务行与替身引擎。
3830–3939(route admission、Device Link create provider group) 各组注释;本表补:生产发送、插件恢复与远程创建入口返回拒绝,或按允许的替代路线启用并写库。 3810 附近、3937 附近(甲 17;Host 未上提供方组) 同规则注释 本表:一个点名的禁用副本;一个后来停用但有已验证续接的任务;一个禁用的原生默认有合法替代;一个远端请求 provider group。db,假引擎和临时库经过各入口。
3954–4076(model change at send 的原生会话、思考、凭据、预算) 各用例前注释;本表补:生产 runtime selection 和 close/settle 钩子核对新运行时的续接 ID、thinking、effort 和预算。 各用例前注释(放行表第一节 6c、6d,甲 3,检查点 3) 各用例前 Gap 本表:引擎切回一次、切换后重新启动、回合中登记一个带目标档位的凭据切换,或关 runtime 前留一个待预算重建,随后发送。db,临时库,替身引擎。
4122–4318(permission、Plan、Bot、等待与重放) 各用例前 Rule;本表补:生产 setPermissionMode、Plan 保存与输入队列,检查行、运行时、grant、客户端通知以及输入派发先后。 各用例前(甲 7) 各用例前 Gap;本表补:单任务成功写未覆盖第二条变更、Bot 其他 lane,或等待期间发生切账号。 本表:活任务一次非法值/写出故障;同任务两次更改;待完成的权限承诺加新输入或既有重放;老代次退出 Plan;带两个 lane 的 Bot 改权限。db,真实库与生产 permission 队列、替身引擎。
4704、4792–4952(context recovery / pre-send recovery / queued overflow) 4700–4703 与各场景;本表补:生产队列与 recovery 决策在超限后留下待接手输入或重放,重建前后不混 owner,跨重启的摘要只消费一次。 4700–4703(4a);本表补:放行表第一节 30、第五节溢出排队裁定。 本表:原重放成功只验证正常重建,没有较新输入、写失败、换账号、重启时未消费摘要或恢复中还要兑现路线。 本表:两条输入,第一条超限;或一条超预算历史在派发前重建期间遇写失败/换 owner;另留一条未消费摘要后重开。4704 见邻注;其余 db,临时库与模拟引擎、注入决策。
4985–5006(idle release watchers / Claude activity) 本表:生产队列的 start/finish 和 idle-release 的 start/stop;后台活动跟踪受回合事件驱动,owner 退出后停止扫描。 本表:放行表第一节 35。 本表:idle-release.test 的 scanNow 不会证明 Host 生命周期启动与取消实际轮询,代理活动也不经队列终态。 本表:启动一次 owner 监视器推进一轮时钟后 dispose 再推进;Claude 跑一轮结束后模拟后台活动。unit,以假时钟和替身运行时观察。
5028–5149(send restore、工作目录、计划/目标、记录模型) 5024–5125 各组注释;本表补:队列经生产发送事务按恢复后的工作目录派发,插入计划/目标提示并记录真实模型和换模型卡片。 各组注释(放行表第一节 32、甲 5) 各组 Gap;本表补:设置端测试没有实际发送前恢复、目录预检及发送附注。 本表:一条给已归档任务的输入;一个删除的普通目录、他人 owner 目录或消失的 managed worktree;一个中断的计划/已结束目标;两轮不同模型。文件夹场景 integration(临时文件系统);其余 unit/db 按夹具(替身运行时、模型历史组使用临时库)。
5197–5242(未派发的错误行、Pi 超时、重试、引用任务) 5159–5241 各组注释 同入口(第一节 32,发送前归一化与失败收口) 同入口 本表:一次用户消息已写入后派发抛错或 Pi 提示超时,重试后只留有效用户/错误行;一条包含可见本机或不可达设备任务的引用。db(真实历史行、替身引擎)。
5316–5351(/api/chat) 5252–5255、5327 附近;本表补:真实 chat handler 在派发前失败时出 error、interrupted 并闭流,派发后按终态闭流,重建中的重连应继续等。 同入口(放行表第七节 21、第一节 30) 同入口 本表:第一条输入在历史已写后分别于派发前/后失败;或重建挂起时用同一个 clientId 重连。db 集成,真实 NDJSON handler、临时库与替身引擎。
5435–5633(auto-resume exit/budget、user row durability) 5369–5632 各组注释;本表补:自动续跑继续同次输入的流,停止、关闭、用户抢占、退出或预算耗尽各收口一次;用户行失败后可替换或重试且不重写幽灵行。 各组注释(第一节 31/32,userMessageDurableWrite) 各组 Gap;本表补:只验证续跑成功不会抓到等待期间被抢占或自动写入失败后的卡死。 预算和行写入见 5467–5572;本表补退出组:一次中断后成功续跑,连发超出预算的中断,或在等待窗口分别 Stop、关任务、退出或插入新消息。unit/db(队列假时钟;持久历史场景用临时库)。
5698–5739(runtime control inputs、第二次中断路线切换) 5698、5737 附近;本表补:生产 runtime selection 在下一次发送兑现模型/引擎选择,effort 可立即生效,自动续跑按已选后备来源执行。 本表:放行表第一节 31、22b 和检查点 3。 5737 附近;本表补:单测 pick 和自动续跑入口分别验证,没分辨三种设置何时生效及后一轮实际发往哪条路线。 本表:同一空闲任务改模型/引擎或 effort,下一次发送查选项。自动切源最小输入见 5737 附近。db(注入引擎,存真实路线)。
5823–6177(plugin route / user message / settings、deferred Pi / runtime-control producer) 本表:生产插件接线、runtime selection、任务插件设置写入口和输入队列;已受理/阻断的回执、任务实际路线与回复、设置文件和通知一致。 本表:放行表 8i、第七节 37–38、并存方案 A;同组 Rule 在 6150 左右。 本表:业务直通用例未在 Pi 确认、锁等待或溢出重放中改变账号/占用,旧中止可能重写新状态。插件消息门禁还需在持久化前生效。 本表:一次 Pi 选择等待回执,中途 hold/换 owner,或 Desktop 改待选路线;另用一条冷发插件 prompt 和一条改写/拒绝消息;设置已开始等待锁时再占用。6155 附近有本组 db 口径,其余为 production assembly integration(临时库/文件、注入插件回执)。
6262–6353、6974–6990(runtime override/cleanup、overflow replay) 各用例前注释;本表补:真实启动覆盖、队列重放与任务关闭钩子决定启动路线、任务读取的实际路线,以及是否消费恢复摘要。 各用例前(第一节 30、第七节 28,甲 22 的归档恢复) 各用例前 Gap;本表补:既有正常读取看不到覆盖及 baseline,也没有在重放前归档或 hold 的竞态。 各用例前 Minimal;本表补:一次恢复重放与一次新 pick 或归档相撞,分别在 hold 与开放下观察。db,临时库和替身运行时。
6400–6949(profile hold settlement、unobserved runtime control、turn settlement、pending credential) 本表:生产 input-queue 的 releaseDesktopHold、runtime selection 与结算端口;释放后按账号/代次复核,选择只提交一次或取消,外部等待者和下一个输入按次序继续。 各组注释;本表补:放行表第七节 37–38、并存方案 A。 本表:只测开放状态下的换凭据无法发现持有中已开始持久化、旧代次、停止、清理失败及先终态后投影。 本表:一条待选择在终态/持久化 await 时进入 hold,再改变 owner、代次或任务状态后放开;加一条等待首任务的输入查唤醒次序。部分最小输入与 db tier 见 6900 附近的各组说明,其余同样使用临时 DB/注入运行时。
7057–7084(move) 7050–7056 附近的 move 组注释 同入口(甲 5) 同入口 同入口(注入引擎,使用真实队列,含 maker-core 运行时关闭)
7162–7329(profile hold、retry due、subscription-limited startup) 7162 附近;本表补:生产 holdForDesktop/releaseDesktopHold 及自动续跑/限额超时回调,开放前拒绝新输入和续跑,重新读 durable queue。 本表:并存方案 A、第一节 31 的续跑裁定。 本表:普通队列重启场景没有桌面在旁消费项目或 hold 期间旧计时器到点。 本表:有一个运行中和一个排队输入时置 hold;给一条桌面已消费的快照;一个自动/静默/限额续跑或订阅启动等待到期同时占用或 Stop。unit/db(假时钟;durable queue 使用临时库)。
7407–7541(owner boundary /chat) 组注释;本表补:生产 createOwnerBoundaryStop、runOwnerBoundary、input queue 和 chat handler,边界提前停发送,原流回 interrupted 并闭合,关库前不写结束状态。 本表:放行表第五节「甲:账号边界停止提前置位」及 8g B。 本表:旧测试只在 dispose 完成后查询,没让回合在 logout/失效/stop 的前置 teardown 时结束。 本表:一个活跃回合在 begin 到 dispose 间收到终态;另一条在静默决策中切边界;有一条活流时开始登出且撤销请求失败。unit/db,使用假引擎与注入 teardown,持久状态组走临时库。
7580–7701(turn seal、list activity 派发/插话、list preview) 各测试价值块(7580、7658、7701 左右) 同入口(甲 9、10、13) 同入口 同入口;续跑/后台分段补充见 7617 前注释。
7777–7894、8142–8192(生成图、确认撤回、独立通知、Opus 错误、图片引用) 7777–7894、8142–8192 的分组注释;本表补:生产 turn-executor 事件与 history/media 恢复,输出引用地址或失败卡、正确任务的撤回行、通知和规范化错误。 各组注释(甲 11、12、14、15) 各组 Gap;本表补:只验正常回合文本会漏掉 done 后的事件、另一个任务的确认以及共享图片引用。 组内 Minimal 条件;本表补 8192 对照:拿另一个任务的运行时撤回一张仍待决的卡。db 集成,临时 owner 库/媒体目录、替身引擎。
7932–8085(list activity 结算与 failed turn tail) 各测试价值块(7932、7989 左右);本表补 8085:生产结算子步骤抛错后仍写错误行并放行收尾。 同入口(甲 9/10、失败回合完成尾事件条目) 同入口 同入口;本表补 8015:已开始下一轮再送前一代 done。多数 unit、假 runtime;上下文恢复多代的场景使用临时库。
8108–8120(runtime retirement) 8108 前组注释;本表补:队列接入生产运行时恢复回执,当前 owner 得本地化 notice、切换后无落库与推送。 8108 前(甲 16) 8108 前 Gap 8108 前;本表补第二分支:一条退役失败回执在 owner 变化后送达。db,生产事件和实际历史。
8278–8391(silent stop) 组注释(8278 前及 8324 前) 同入口(8g B 及评审 1) 同入口 同入口;本表补边界代表:一次静默停止后关闭续跑设置或在决策期间插入新消息、退出调用方;耗尽次数注入一次提示推送失败。
8438–8452(credential switch blocker) 8438 前组注释 8438 前组注释(占用/账号边界用例见 8452 前) 8438 前组注释 8438、8452 前(unit,假运行时和时钟)

apps/desktop/src/main/maker-host/__tests__/hostDesktopSourceContracts.guard.test.ts 补记

文件头第 1–10 行定义 guard tier。守护的是装配和依赖边界。入口及失效后果见各行对应的 it 前注释。

守护用例(行号) 覆盖缺口 最小失败输入 规则及 tier
57、80、149、224 本表:行为测试可直接注入一般 owner/目录端口,不能确认两个实际组装点共享同一插件工厂、每条退出路径先封入口、任务删除清理槽,以及每次凭据变化由 main 交给目录。 本表:从一个启动/退出分支移走 owner guard,删一次 slot 或凭据状态绑定,或让 Host 装自己的插件控制工厂。 各用例前注释(放行表 8i、账号边界停止、显式端口、3a),guard。
133、979、1071–1113 本表:端口注入和 e2e 的测试开关不能覆盖实际 launch/build 装配、Electron 升版对系统代理口径的影响。 本表:换一个 Electron pin、删 macOS 启动读代理或加入测试 PAC flag、默认持久 session 或开 cookie-encryption fuse。 各用例前注释(第 28 行 28b/28c),guard。
433–472 本表:生产 queue 测试只覆盖 Host 运行结果,不能提示桌面的来源读取或静默续跑边界已演进、Host 保留的同义实现需同步。 本表:改变桌面 readSource 或 silent-stop 调度的一个有协议意义的分支,保留 Host 原实现。 各用例前注释(甲 11、8g B、第七节 31–32、36),guard。
541、584–595 本表:用例确认当前数据/过期 token 的行为,不能发现以后桌面调大订阅桥或 xAI 续期裕量却只改一处、或桌面账号校验换了顺序。 本表:改一个生产续期裕量引用,或删掉一次实际 memory caller 校验。 各用例前注释(第七节 25/26、并存方案 A 的凭据边界),guard。
814–882 本表:显式写全端口仍不能检测消费引擎改变、当前被置空的端口变成必需。 本表:在另一个引擎加入一个已归类端口的读取,分类未更新。 组注释(第五节「显式端口」),guard。
1138–1203、1225–1437、1484–1565 本表:只测几个 API 无法发现新增传递依赖,引入未审核出站、进程级写端口或区域读取。 本表:生产图新增一个网络调用、可写 setter、区域读取或 CN 兜底,清单无对应项;或清单声称已绑定但实际没有调用绑定。 各组注释(第 28 行、甲 20、显式端口),guard;1579 的独立格式用例见待审核清单。

无新增用例(6 个)

测试文件 测法变化 实测耗时
apps/host/scripts/lifecycle.e2e.mjs 把原生命周期流程分阶段计时,整体截止时间从 30 秒改为 90 秒。 见耗时表
apps/host/src/chat.interactions.test.mjs 为既有聊天/审批流程打开真实临时 owner 库并绑定 owner,fake runtime 补回合代次和准入端口。 见耗时表
scripts/__tests__/host-agent-deps-contract.test.mjs 静态扫描识别 explicitPorts 包装的构造器参数,并识别新增的类型化端口展开。 见耗时表

其余 3 个只跟随生产端口或夹具调整,原测试场景和断言目标保持一致。耗时见耗时表。

  • apps/desktop/src/main/cindy-brain/__tests__/hostToolSlot.test.ts
  • apps/host/src/agent/learn-send.test.mjs
  • apps/host/src/auth/device-identity.test.mjs

已处理的待评审项

  • hostDesktopSourceContracts.guard.test.ts:1579 只检查表的排版和说明文本形状,已删除(434ed14264);对照真实依赖图的区域规则守护在第 1565 行,保留。
  • 其余四项保留,理由见折叠块前的“按规则字面有疑问、保留并说明理由的 4 项”。

原清单

  • apps/host/src/agent/input-queue.test.mjs:4343 比较队列接口成员的类型,尚无真实调用结果。
  • apps/host/src/device-link.test.mjs:474 比对两份分类表,尚无独立的行为或规则守护证明。
  • apps/host/src/startup-account.test.mjs:38、174、215、284–384、470–508、759 中,main 启动、关库、续期定时的接线只通过取出源码重执行来测,测试环境隔离用例只跑测试夹具。文件内另有真实 scanner、续期原语、HTTP 投影和部分真实 serve 路径的证据。

本轮新增(61c00afebb 之后),四项都写在用例旁

  • apps/host/src/device-link.test.mjs「Agent-Net control refuses profile hold…」扩展:经真实 /control/remote 开启远程控制,占用期间被拒且设置文件字节不变,解除后照常写入。最小失败输入:去掉 setEnabled 里的占用检查。tier:integration。
  • scripts/__tests__/host-server-hold-classification.test.mjs「every path server.mjs answers itself is classified for a desktop hold」(先加在 server.test.mjs,因为普通测试不许读生产源码,移到根目录源码契约并列进 test:runner):静态守护,保护权限边界。失效后果:新入口在桌面占用期间写共用数据而没人审。最小失败输入:往 server.mjs 加一个 /control/x。tier:guard。
  • apps/host/src/chat.interactions.test.mjs「a held profile refuses /chat before creating a task…」:经真实 createChatHandler 走 HTTP,占用期间新任务不建、已存在任务照旧被拒、解除后照常建。最小失败输入:去掉 chat.mjs 建任务前的占用检查。tier:integration。
单独运行耗时(54 个文件,开发机,逐个串行)

每个文件单独运行一次,经同一个排队入口,Node 22.22.3,TMPDIR 不设,临时 HOME,带已批的浏览器夹具;墙钟用 /usr/bin/time -p,不算排队时间;首轮超过 5 秒的再跑一次。5 秒/10 秒是 unit 档的预算,guard、integration、混合档与 e2e 不适用,但能测的都列出读数。49 个有读数,全部通过;apps/host/scripts 下 5 个 e2e 脚本本机不跑,lifecycle 引用自有电脑那轮的读数。超过 10 秒的:input-queue.test.mjs、startup-account.test.mjs(混合档)和 lifecycle(e2e),原因见表。命令:Host node --import ./src/loaders/test-region.mjs --import tsx --import ./src/loaders/register-raw.mjs --test <文件>(在 apps/host 下);桌面同准备 PR;根目录脚本 node --test <文件>。

文件 新增/改写 档位 墙钟秒(首轮 / 确认) 结果(过/失败/跳过) 起始负载 说明
apps/host/scripts/chromium-proxy-worker.e2e.mjs 新增 e2e — 未单独计时 — e2e 脚本,本机不跑;5/10 秒是单测预算,不适用
apps/host/scripts/release-region.e2e.mjs 新增 e2e — 未单独计时 — e2e 脚本,本机不跑;5/10 秒是单测预算,不适用
apps/host/src/agent/idle-release.test.mjs 新增 unit 3.50 PASS 5/0/0 8.11
apps/host/src/agent/outbound-path-fact.test.mjs 新增 integration 4.89 PASS 1/0/0 4.54
apps/host/src/agent/profile-coexistence.test.mjs 新增 unit 0.21 PASS 6/0/0 4.98 上一轮在 Codex 沙箱里跑,读不到进程信息,2 条失败;这一轮在约定的本机环境里全过
apps/host/src/agent/usage-pricing.test.mjs 新增 unit 0.55 PASS 8/0/0 8.82
apps/host/src/agent/usage-recording.test.mjs 新增 unit 3.66 PASS 20/0/0 8.82
apps/host/src/chromium-proxy.test.mjs 新增 unit 0.90 PASS 11/0/0 8.82
apps/host/src/macos-system-proxy.test.mjs 新增 unit 0.31 PASS 72/0/0 8.67
apps/host/src/outbound-proxy.test.mjs 新增 unit 0.27 PASS 13/0/0 8.67
apps/host/src/plugins/gateway-delivery.test.mjs 新增 integration 1.22 PASS 3/0/0 4.50
apps/host/src/plugins/profile-pause.test.mjs 新增 integration 4.78 PASS 14/0/0 4.50
apps/host/src/project-icon.test.mjs 新增 unit 1.02 PASS 1/0/0 8.67
apps/host/src/release-region.test.mjs 新增 unit 0.96 PASS 3/0/0 8.67
apps/host/src/server-api.test.mjs 新增 unit 0.40 PASS 1/0/0 8.67
apps/host/src/service.test.mjs 新增 unit 0.23 PASS 4/0/0 8.67
apps/host/src/test-support/hook-plugin-fixture.test.mjs 新增 integration 0.90 PASS 1/0/0 4.46
apps/host/src/ui-text.test.mjs 新增 unit 0.43 PASS 1/0/0 8.67
scripts/__tests__/host-skill-projection-owner.test.mjs 新增 guard 0.08 PASS 1/0/0 4.46
apps/desktop/src/main/__tests__/authColdStartRecovery.test.ts 改写 unit 1.83 PASS 34/0/0 8.67
apps/desktop/src/main/cindy-brain/__tests__/hostToolSlot.test.ts 改写 unit 7.17 / 6.91 PASS 79/0/0 / PASS 79/0/0 9.02 / 9.26 collect 5.890 s,tests 0.210 s,其余启动/准备等 1.07 s / collect 5.510 s,tests 0.203 s,其余启动/准备等 1.20 s
apps/desktop/src/main/maker-host/__tests__/hostDesktopSourceContracts.guard.test.ts 改写 guard 7.84 / 7.00 PASS 53/0/0 / PASS 53/0/0 4.42 guard 档,不适用单测预算;Host PR 侧要走 Host 的导入图(tests 6.5 s)
apps/host/scripts/claude-proxy.e2e.mjs 改写 e2e — 未单独计时 — e2e 脚本,本机不跑;5/10 秒是单测预算,不适用
apps/host/scripts/codex-runtime.e2e.mjs 改写 e2e — 未单独计时 — e2e 脚本,本机不跑;5/10 秒是单测预算,不适用
apps/host/scripts/lifecycle.e2e.mjs 改写 e2e 32.8(自有机) 自有机 PASS(5 段) 23.28(自有机) 自有 macOS,提交 8689418,Node 22.22.3;TMPDIR 未设,LANG/LC_ALL 未设,LC_CTYPE=C.UTF-8、ICU=en-US。first / busy / replacement / background / reattach 各 7993 / 7985 / 8030 / 8030 / 70 ms。不计本机统计,单测预算不适用。
apps/host/scripts/pi-native.e2e.mjs 改写 e2e — 未单独计时 — e2e 脚本,本机不跑;5/10 秒是单测预算,不适用
apps/host/src/agent/codex-system-login.test.mjs 改写 unit 5.09 / 4.65 PASS 16/0/0 / PASS 16/0/0 9.48 / 9.28 node:test 不提供 collect;顶层用例执行合计 0.598 s;日志中最慢用例 one production Codex runtime: the engine and the bridge see each other's rejection while held(0.13 s) / node:test 不提供 collect;顶层用例执行合计 0.554 s;日志中最慢用例 one production Codex runtime: the engine and the bridge see each other's rejection while held(0.13 s)
apps/host/src/agent/engine-deps.test.mjs 改写 unit 4.80 PASS 16/0/0 11.26
apps/host/src/agent/git-snapshot.test.mjs 改写 integration 1.38 PASS 3/0/0 4.56
apps/host/src/agent/input-queue.test.mjs 改写 混合 20.71 / 20.78 PASS 365/0/0 / PASS 365/0/0 4.56 混合档,不适用单测预算。只加载、不跑用例 3.0 s,执行约 17.7 s;353 个顶层用例(含本次新增 164 个),最慢的单条 0.6 s,没有单条长等待
apps/host/src/agent/interactions.test.mjs 改写 unit 1.29 PASS 11/0/0 11.08
apps/host/src/agent/learn-send.test.mjs 改写 integration 4.02 PASS 2/0/0 4.92
apps/host/src/agent/memory.test.mjs 改写 混合 4.24 PASS 15/0/0 4.77
apps/host/src/agent/native-auth.test.mjs 改写 unit 2.36 PASS 7/0/0 11.08
apps/host/src/agent/provider-credentials.test.mjs 改写 unit 0.54 PASS 13/0/0 11.08
apps/host/src/agent/session-update.test.mjs 改写 unit 6.07 / 6.05 PASS 43/0/0 / PASS 43/0/0 10.67 / 10.46 node:test 不提供 collect;顶层用例执行合计 3.005 s;日志中最慢用例 model change while idle: a user's pick is an intent until the next send(0.16 s) / node:test 不提供 collect;顶层用例执行合计 3.054 s;日志中最慢用例 model change while idle: a user's pick is an intent until the next send(0.16 s)
apps/host/src/auth/device-identity.test.mjs 改写 unit 0.26 PASS 4/0/0 10.34
apps/host/src/auth/login.loopback.test.mjs 改写 unit 4.27 PASS 6/0/0 10.34
apps/host/src/auth/refresh.test.mjs 改写 unit 0.35 PASS 14/0/0 9.91
apps/host/src/boundary.test.mjs 改写 unit 3.31 PASS 17/0/0 9.91
apps/host/src/chat.interactions.test.mjs 改写 integration 2.63 PASS 2/0/0 4.98
apps/host/src/credentials/store.test.mjs 改写 混合 0.34 PASS 9/0/0 4.70
apps/host/src/device-link.test.mjs 改写 混合 2.85 PASS 10/0/0 4.70
apps/host/src/host-tools.test.mjs 改写 混合 2.98 PASS 12/0/0 4.65
apps/host/src/ipc-route.test.mjs 改写 unit 0.80 PASS 11/0/0 9.76
apps/host/src/loaders/raw-hook.test.mjs 改写 unit 0.28 PASS 2/0/0 9.3
apps/host/src/plugins.test.mjs 改写 混合 3.42 PASS 11/0/0 4.65
apps/host/src/plugins/managed-skills.test.mjs 改写 integration 5.49 / 5.43 PASS 8/0/0 / PASS 8/0/0 4.52 integration 档,不适用单测预算;起正式插件运行时
apps/host/src/profile-path.test.mjs 改写 unit 0.13 PASS 8/0/0 9.3
apps/host/src/server.test.mjs 改写 混合 0.62 PASS 34/0/0 5.06 计时时还含分类守护那一条,之后移出,现为 33 条
scripts/__tests__/host-server-hold-classification.test.mjs 新增 guard 0.05 PASS 1/0/0 4.31 根目录源码契约,由 test:runner 执行
apps/host/src/sessions.test.mjs 改写 unit 1.89 PASS 20/0/0 9.3
apps/host/src/startup-account.test.mjs 改写 混合 18.18 / 18.02 PASS 36/0/0 / PASS 36/0/0 5.06 混合档,不适用单测预算。只加载 0.9 s,执行约 17.2 s;其中两条各 8.5 s,起真实的源码 serve 子进程(健康检查与空 profile 续期、启动失败后续期保留原因)
apps/host/src/web-shim.test.mjs 改写 unit 0.41 PASS 21/0/0 9.3
scripts/__tests__/host-agent-deps-contract.test.mjs 改写 guard 0.18 PASS 1/0/0 4.98

手工验证

不涉及。M1 的“真实验证”一项为无:没有用真实账号、打包产物或带界面运行。

未执行的验证

  • 真实浏览器用例只在自有机器上验证过:8i 夹具、profile-pause.test.mjs 的 6 条真实页面、scripts/plugin-sandbox.e2e.mjs。
    • 浏览器自身的沙箱不能套在外层隔离里,所以这组用例在隔离外跑:临时 HOME、不带凭据、代理变量指向无人监听的回环端口。
    • 这一层没有硬隔离:会读代理变量的请求会被挡住,其他请求不受限。
    • CI 没有安装这层用到的浏览器,只跑协议替身用例。
  • 主干同步 3–5 之后,没有在自有 Windows x64、Ubuntu 上重跑 Host 全量,由 PR 首轮 CI 覆盖。三个平台的验证流程见 docs/host/owned-machine-verification.md。
  • Windows 上的已知跳过:两项 POSIX 目录权限的故障注入,以及几条只在 POSIX 上启用的用例,清单见放行表“Windows 上未覆盖的测试”。lifecycle 在 Windows 上不跑。
  • 数据库档整档和移动端检查没有在本机跑,留给 CI。
  • PR 首轮 CI 要看的三项:
    • Windows 上的 Host 全量;
    • Ubuntu 上 lifecycle 的耗时,超过 60 秒就带上分段数字回来复评;
    • System proxy comparison 必须全绿。(第二轮:macOS 通过;Windows 见上面代理 helper 一条。)

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容(客户端模式的窗口和网页端经 HTTP/SSE 连接后台服务;新旧版本组合的行为见准备 PR)
  • 权限 / 安全 / 用户数据(后台服务与桌面读写同一个 profile:单实例锁挡第二个后台服务;运行中发现桌面后暂停新输入和大多数共享写入,已开始的回合收尾、账号续期和登记的例外仍会写;发现最长延迟约十秒)
  • 存量插件兼容
  • 原生层 / fingerprint / OTA
  • 跨平台差异(Windows 上不跑 lifecycle,另有 POSIX 专属用例跳过,见上文)
  • 其他:

存量插件影响:无。 本 PR 没有改安装布局、包格式、批准状态和指纹,所以没有新的升级用例。静默只在后台服务里、桌面占用期间生效,批准状态和分区都保留。现有的存量插件用例照常通过:

  • 桌面的 ghost.test.ts、ghostLocalInstallIdentity.test.ts(结果见准备 PR);
  • 后台服务的 plugins/profile-pause.test.mjs,验证静默与恢复后插件照常可用。

影响与回滚

  • 影响范围:新增的 apps/host 及其文档和 CI 步骤;桌面只动了三个测试文件。默认不启用,用户不主动启动后台服务就没有变化。
  • 回滚 / 降级方式:整体 revert 本 PR,不影响桌面。准备 PR 可以单独保留。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(check:dco 通过)
  • UI 改动已在「UI 变化」注明引用的设计规范章节(本 PR 自身不涉及,见上)
  • 未提交凭证、令牌或授权文件
  • 已核对受影响的文档
  • 已确认测试结果或说明未执行原因
  • 读取频率:
    • 占用扫描每 10 秒一次,另有目录监听,去抖 250 毫秒;每次扫描读登记目录和 SingletonLock,同一份记录只问一次进程身份。
    • 后台服务停止后扫描随之停止。
    • 其余扫描与推送的频率沿用桌面。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…on-move commits

A test main added assumes userDataPath.js exports only userDataPath, which collides with the prep branch's Skill projection boundary reading getUserDataDir(). Record why the fix must ride with the prep PR and the reader-set check that now runs after every main merge.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
The enqueue helper in input-queue.test.mjs waited for the send to reach the fake
engine with waitFor, a budget of 200 polls. A send reaches the engine only after its
working-directory check. Its filesystem probes (workdir-probe-host, each bounded by its
own 5 s deadline) take as long as the machine needs. Under load the poll budget ran out
while the send was still on its way. "A send to a task whose ordinary directory was
deleted recreates it" failed this way in 4 of 72 runs: still in its turn, no error,
nothing sent yet after about 1.2 s.

The helper now waits for the event that ends the send's start:
- the fake engine received a message for the task (createFakeMaker gains onSent) —
  the helper resolves;
- the queue settled the input without one (its published projection carries an error,
  or a recovery point names the input) — the helper fails at once, with the projection;
- neither within 30 s — the helper fails, naming the event that did not come, with the
  projection.

The limit is a real timer taken before any test mocks setTimeout, so ticking a mocked
clock cannot fire it. createHarness forwards every queue event to listeners besides
the hub a test passes (onHubEvent). No assertion changes.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 64bae3e3172c57ddcd99f5053bbbccdfddbc272c)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
… test

"A send to a task whose ordinary directory was deleted recreates it" sends a second
message and counted it with waitFor (200 polls). That send passes the same
working-directory check as the first, so it ran out the same way under load. With the
recovery directory's stat delayed by 1.5 s, the test still failed there after
64bae3e317.

The enqueue helper's event wait becomes enqueueUntilSent(h, id, item, count): it waits
for the runtime to have received count messages in all, or for the input to settle
without one, with the same 30 s limit naming the message that did not come. enqueue is
enqueueUntilSent(..., 1), the old condition. The second send waits for count 2.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit f77c9be00e2882409c002bcadc393d6c98b21fbb)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…vation setters

Main brought two module-level setters into the Host import graph:
- prRefsStore setPrRefsChangedListener: pending. No Host window reads PR
  associations (the web client returns none, client mode does not forward
  git-context:pr-refs:*), so the push has no consumer yet; recorded with the
  missing pieces in release table sections 二 and 六.
- attachmentPreservation bindHostedAttachmentPreservation: not-applicable.
  Only the desktop remote agent hosted run binds it; the Host does not load
  remote agent hosting and its attachment recovery takes the local task path.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 0aa117775db301a45e8dcacc8428106abb0d3d90)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Section 5 of the release table gains one row for the test-writing risk the two
auto-resume and enqueue flakes came from. waitFor in input-queue.test.mjs gives up after
200 polls, not after a real time. Anything that goes through a background thread on its
way, such as a message reaching the fake engine after the send's working-directory
check, can come out one short under load. It is not a production problem.

The row covers:
- how to list the sites again (grep -n 'waitFor(' on the file) and what counts as one;
- the 2026-11-17 count: 199 sites in 120 tests or helpers;
- that a "one short" flake in this file is checked against that list first;
- the rule that new tests wait for such events with the event helpers
  (enqueueUntilSent, settleUntil, dispatched);
- the evidence: 0/72 on both sides of the controlled window; 3/3 failures before and
  3/3 passes after with one stat delayed, the message arriving about 1.8 s after
  waitFor gave up; three breaks, all red.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 260384e2cc0daa8b82f7ee8e412d5626aa5d8f6e)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
check:test-hygiene's realWaits rule counted the 30 s limit in enqueueUntilSent
(cb43b9c) as an unjustified real wait. It is a real timer of 30 000 ms, and the
baseline for input-queue.test.mjs allows none. The rule's own exemption is a
`// real-wait: <reason>` comment on the line above, and the call now has one. The
limit only guards against hanging: it fires only when neither event comes (a
failure); normally the send's event resolves first and the timer is cleared. It is a
real timer because tests mock setTimeout and tick past 30 s. The baseline is
unchanged.

The release table row on count-based waits (260384e2cc) notes that new hang guards
carry the same marker.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit bba299b4ef7307b5681721df082f61816ea34430)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…n renew one login in turn

Coexistence plan A, C: the one shared credential the Host writes while a
desktop app holds the profile. refreshHostSession (auth/refresh.mjs) is
the one renewal; the timer, the server API's 401 retry, Device Link's
auth failure, the first startup and /api/auth/refresh all go through it.

1. A rejected token is retried with the replacement another process
   stored: the shared runRefreshWithReplacementRetry over the v1 record,
   the vault's active resource and the legacy token, as the desktop.
2. After the request the v1 record is read again; when it no longer holds
   a token this renewal had rejected, the failure is dropped.
3. Only a definitive failure of the token still stored signs out, this
   process only; DEVICE_MISMATCH the same. Nothing stored is deleted.
4. The result is written under the account-vault lock, after reading
   everything again: the vault by the desktop's rule
   (applyRefreshedCredentialsToVault), the v1 record with its Host device,
   the legacy token when it exists. Without the token, no v1 write.
   The v1 record is also kept when the vault names no or another account
   (cindy-host login writes only the v1 record).
5. A record that exists but cannot be read is a transient failure; only a
   missing one ends the session.
6. The next renewal is armed at the access token's exp minus 300 s with
   the desktop's accessTokenRefreshDelayMs; failures back off with
   AuthRefreshBackoff, a 401 after a network failure may bring one attempt
   forward (server-api.ts now passes serverRejectedToken). The fixed
   30-minute interval is removed.

The vault lock file name comes from authRefreshCommit.ts in the logout
and cindy-host login too. Release table: coexistence row, follow-up nine;
the login-cli passport question; the account session row; the M4 rows.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 88ea01d79355a3b8acb817c94fa7f7b28041f661)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…k and a cold start

The reproduction of 2026-11-17 becomes a regression test: the Host's
production refreshHostSession renews three times on the records the
cold-start harness keeps (v1 and the account vault), then
- scenario 1: refreshSavedResourceSession, the step of switchSavedAccount
  that renews a saved account from its vault copy, renews it (before the
  Host wrote the vault, the copy was rotated out and the account removed);
  switchSavedAccount itself does not compile into this harness;
- scenario 2: the cold start finds v1 and the vault current.
The Host module is imported with a non-literal specifier, outside the
desktop typecheck.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit fe7ae5751f4dedcf6503b89841c81553385d82db)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
createHostServerApi now passes the desktop request contract's
serverRejectedToken to the renewal; this pins it at the production port.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 36c2b2090e051e80e030d5e64a0ee5e7e3fae7b6)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
… the desktop cold start

cindy-host login writes only the v1 record, so the vault may hold no
account. After Host renewals the desktop's cold start claims the empty
vault (canClaimUninitializedVault) and both records hold the new token.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit acfd1c16d61665400fafc2b6cd1c6cca6b97d1fa)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
… account writes

Release table: the cold start starts from v1 and fills the vault back in
under the lock, provided the vault's active account is still the one
renewed; an empty vault is claimed. The window's switchSavedAccount,
completeLogin and rememberResourceSession all take the account-vault
lock and re-read inside it.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 825ae4dd449e955afe5506f6e1a57b44077c6daf)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
The check that every renewal function was found asserted on the source
read, which the test hygiene gate counts as a source-text assertion; it
now throws while building the harness instead.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit d15a8ed439ef0833de23585d742eb8afcc7d6d17)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…versions the desktop writes

Reviewer rulings on C (2026-11-17):
- /api/auth/refresh moves from the held gate's refusals into
  HOST_PATHS_ALLOWED_WHILE_HELD (renew): the renewal is the one shared
  credential the Host writes while held, and a client-mode window asks
  the Host to renew through it; refused, the window takes it as a failed
  renewal.
- readVault accepts version 1 and AUTH_ACCOUNT_VAULT_VERSION instead of
  a fixed [1, 2], so a desktop version bump is not silently refused.
- A test pins that a token without a numeric exp arms nothing and the
  server API's 401 still renews it (difference d).
Release table: the rulings a to e, the cindy-host login item (B list),
the desktop item for b, the three-column row for /api/auth/refresh.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit a590c89c1b8d5f32742de5ffe73d8de81e6d9dc2)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…byte

The desktop's production vault functions, compiled from authManager.ts
over an in-memory record store shared with the Host's store, make a vault
with three accounts (one current, one logged out with its tombstone), a
passport and fields the Host does not know. After one Host renewal only
the current account's refreshToken, metadata and lastUsedAt differ, the
tombstones are untouched, and the desktop reads back the same accounts
with the new token.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 1617778ffc901adfe6aace7bb2c3bf11fdf55fd9)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
The desktop typecheck rejected the fixture's kind and role as plain
strings; they are the membership literals now. No behavior change.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 2c63c5c7f74a87609383bfb5d324b78cba5a0e15)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…de account switch row

The reviewer registered it as part of that unit; the C branch did not have the row yet, so it was listed on its own.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…e-locale machine

Compared against main e8b5e2f in the same environment: the same failures and errors on both sides, all passing once TMPDIR is a realpath, the locale is English, or the watcher test runs alone. CI is unaffected. Record them with fix suggestions; the Pi package watcher test stays open until its paired comparison is done.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
… an owner boundary

The input runtime only entered its stopping state inside inputQueue.dispose,
after logout had revoked the session on the server and after invalidation
and shutdown had paused requests and closed confirmations, plugins and the
platform client. A turn that failed on that teardown was written as ended,
with an error row, instead of interrupted; a /chat stream got no receipt.

agent/owner-boundary.ts begins every owner boundary (logout, the HTTP
logout entry, session invalidation, shutdown; an account switch later):
inputQueue.beginStop sets the stopping state, the shared turn-end
suppression is held until the teardown and the storage close end, as the
desktop's account boundary does, and open /chat streams end with the
interrupted receipt a stopped turn gets. Logout now stops and disposes the
runtime before signing out and revoking, the desktop's order; a failed
revoke still signs out.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 53472047517fe90b4643ec7d07d7dbc304971617)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 363e81df03c93027a5eb66ddf4016d8544956283)
… a step before it fails

The HTTP logout entry begins the owner boundary's stop, then revokes browser
sessions, closes the platform client and drains requests before calling the
logout. If cancelling a pending login rejected, the logout (and with it the
dispose that replaces the stopped input runtime) never ran: the Host stayed
signed in with every send refused until it restarted. If closing the platform
client threw, the flight was never created and the turn-end suppression was
never released.

Those steps are now in a try; a failed step no longer skips the logout,
whose runOwnerBoundary disposes, and the release stays in the flight's
finally. owner-boundary.ts states the invariant (a begin reaches dispose, or
the path rebuilds the input runtime; the release is in a finally) and lists
the four calls of begin checked against it.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit d87e11732e76f74b6025c191c6a537224a66854b)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 3f997358d5fd01a90fe7483d1d02b33a6407e7f0)
…nerBoundary

main.ts starts the Host at its top level, so the unit tests drive
runOwnerBoundary itself. The source guard pins the wiring: logout, session
invalidation and shutdown each go through runOwnerBoundary with their
teardown inside it, logout signs out after dispose, and the HTTP logout
entry begins the stop before it closes the platform client.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 844bad4f104ea30ed58437782446a12e3b6e9c75)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 14fe9afd6ae66ffb727b9f752d362c6151745391)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Main (2656e83) installs the hosted inference model catalog on both
sides: the desktop projects the subscription pools without the account
filter, the Host applies the same filter as the selectable catalog, as
main's own Host test asserts. Unreachable today (the Host refuses hosted
sessions and never runs signed out); recorded in section 二 with when to
revisit it.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit cd6e3e77d0d418b5f606d31fefd85be4094802ac)
…a port

Host PR guard (reads sources only; no desktop behaviour changes).

The module-level setter guard missed setGuestProviderModelCatalogReader
because its slot started as an imported function, the third initial-value
shape found only after the fact. The guard now takes as a slot any
module-level let/var whose initial value can hold a function: a literal,
a module function or a binding that starts as one, any import, any call
(bind included) or await, a new instance, a choice among those, or an
object literal holding one; and object literals whose properties a setter
replaces. Writes also count through ??=, ||=, &&=, Object.assign and module
functions the setter calls. The forms it still cannot see are listed in
the guard's header.

Thirteen setters come in and are classified in desktop-module-setters.ts:
seven bound (setGuestProviderModelCatalogReader, setActiveCatalog,
setLocalCatalogOverrides, setSessionRouteLockImplementation, initLogger,
installDesktopInteractionHandler, registerCodexProcessRole), four pending
(setChatEmbeddingEnabled and installInteractionLifecycleObserver with row
33, setOpenAiImagesApiKeyConfigured with 乙 12, configureProjectIconRuntime
with row 28) and two internal (setBrowserRuntimeLogSink,
registerReadSheetTool).

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 3df3b19b7f9f1b24382194edecdf6c902714da86)
The Host wrote messages without recording their PR references and
recomputed them only after a clear recovery, so a PR that a Host task
mentioned never reached session_pr_refs (release table 甲 24). The Host
now calls the same shared code as the desktop (localDb/messagePrRefs.ts):
- message-store.ts: a published row records its PR references, broadcast
  or not, without waiting (desktop createMessage);
- event-persistence.ts updateDbMessageContent: with an original row
  (final corrections) reconcileCorrectedMessagePrRefs, also when the row
  is gone on readback; otherwise, for user and assistant rows,
  reconcileUpdatedMessagePrRefs (desktop updateMessageContent);
- event-persistence.ts discardPersistedAssistantMessage: after the
  rollback, reconcileCorrectedMessagePrRefs (desktop
  reconcileAssistantDerivedState).

The window channels and push stay apart as 乙 13 with the M2 push batch;
release table sections 二, 五 and 六 and the setter table say so.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 42ddea6c41d5cace9fa17ccb0b3c770399a93e2d)
The widened setter guard found two Host differences; recorded in section
二 only, no code change, grading left to the reviewer:
- configureProjectIconRuntime is unbound, so the Host's auto icon fetch
  reads proxy environment variables only, not the Host outbound proxy;
- setOpenAiImagesApiKeyConfigured is unbound, so the flag stays false and
  an OpenAI subscription keeps the hosted gpt-image-2 entry.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit e5c21e5a1ffda6b711a289a1c6f2e6f021f3a5ba)
…at fail

The HTTP logout ran the web session revoke and the platform client close in one
try, then cancelled the pending sign-in in a .then of that teardown. A revoke
that threw therefore skipped closing the platform client and cancelling the
pending sign-in, so a sign-in in progress could complete after the sign-out.
This is not the rule runOwnerBoundary follows: one step failing does not skip
the steps after it. The failures were also swallowed without a trace.

Each of the three steps now runs on its own; a failed one skips neither the
others nor the logout itself. Each failure leaves one warning with the step
name and the error's code or name only, never its message, which can carry
account or sign-in details. The existing owner boundary group in
server.test.mjs gains the revoke-throws case and checks, for every case, that
the pending sign-in is cancelled and exactly one warning without the message
is logged.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit f00a187dc25b0d61c49b8c08bbfcb37c9824cc6f)
… with the paired counts

Twenty alternating runs each on main and the prep branch in the same environment: the prep branch fails no more often than main, and the test mocks the agent-binaries module the prep branch changed.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
…ge store flakiness

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
… in client mode

The decisions for switching and adding accounts while the window is a client
of the Host were spread over several review rounds and a few release table
rows. docs/host/client-mode-account-switch.md puts them in one document that
reads on its own: the background (the window as a second writer), the Host
taking the work with the window as interface only and the /api/auth/accounts/*
routes, the switch-only owner commit entry with its three tests, the 25b
revision, the discoverHostOwner gap, cindy-host login writing the desktop's
storage state, the user's decision and the security review, the security
section S1-S6 with the threat model boundary and the two required items, the
default behaviours (with the desktop's confirm dialog, keys and copy), the
reuse of runOwnerBoundary (begin is not reversible, so B is validated first;
the switch is the fifth begin call site), the Host-side order, the change and
test lists for each side, and the test-period limitation with its exit
condition. File and line references are checked against dca9dc2.

The docs/host index links it, and the release table's row for this item
points to it.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
(cherry picked from commit 984a671f84a963119201683b14a9f23937930df6)
A terminal notification schedules the shared queue drain. Wait for the engine to receive the queued input before making the existing assertions, since the retry can still be waiting on workspace I/O.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Include the captured stderr tail when the failed-start refresh regression times out. Keep the existing polling budget and capture UTF-8 across stream chunks.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Share a deadline across both source serve endpoint waits and log the measured startup time. Keep the stderr tail on timeout and the existing budgets for health, account state, and teardown.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Document the source-only endpoint wait budget and the Ubuntu test race fixed after upstream sync 7.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Keep the same JSON frames and readiness semantics over the Windows child-process channel. Preserve the stream transport on macOS and verify short Host commands can exit.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Keep the existing transport close and signal sequence, then stop waiting and log if the worker never reports its exit.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Exercise the selected transport in all twenty startup rounds. Observe process exit from spawn, report each group as it finishes, and clean up the PAC server and owned children on failure.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Record the Windows EOF behavior, existing direct fallback, and the CI acceptance improvements.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Wait for the actual reply write and queued send after delayed provider idle. Observe the completed turn before checking stale retries or exercising desktop profile holds. Keep the existing assertions and mocked retry windows.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Keep the original observation window after the reply reaches persistence and after a held turn finishes, so the negative assertions can see asynchronous dispatch or receipts.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Node may omit the aggregate child close event after a parent disconnects IPC. Require process exit and stderr closure for IPC helpers, preserve the stream transport checks, and report forced stops and shutdown timing separately.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Record the parent-disconnect event accounting issue and distinguish the acceptance check from production helper exit handling.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@MagicLizi MagicLizi added status:ci-failed CI 失败(review-pr 自动维护,仅展示) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示) touches:security 改动碰到安全边界(review-pr 自动维护,仅展示) labels Nov 19, 2026
dashhuang added a commit that referenced this pull request Nov 20, 2026
The macOS background stage took 19,885 ms on the final #11536 run, 20,117 ms on the failing first #11629 run, and 12,146 ms after the port fix. The 20-second override was a readiness wait, with no performance assertion. Use the launcher default of 60 seconds. Keep the 90-second suite deadline, the lifecycle assertions and per-stage timings.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
dashhuang added a commit that referenced this pull request Nov 20, 2026
The final #11536 macOS run took about 76.7 seconds across all stages. The first #11629 macOS run took 81.6 seconds across four stages before reattachment, leaving about eight seconds under the 90-second suite deadline. Keep the whole-script hang limit above twice the slowest observed run by raising it to 180 seconds. The 60-second readiness wait and Ubuntu performance review threshold are unchanged. The CI job allows 20 minutes.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
dashhuang added a commit that referenced this pull request Nov 20, 2026
feat(host): Cindy 后台服务第一阶段,普通本地任务与桌面一致(个人版迁移 M1,单提交重提 #11536)
zqchris pushed a commit to zqchris/cindy that referenced this pull request Nov 20, 2026
Adds the Node Host (apps/host) so ordinary local tasks can run without a
desktop window and behave as they do on the desktop, using the shared
desktop code that the desktop prep PR (makecindy#11535) extracted.

This is the same change as makecindy#11536, carried as one commit. makecindy#11536 has 717
commits, more than the DCO app can read (it retrieves 250 and reports
that it cannot evaluate the pull request), so the required DCO check
could not pass there. All 629 non-merge commits in makecindy#11536 are signed
off by their author; the 88 merge commits are exempt. The
full commit history, review threads and per-commit verification remain
on makecindy#11536 at 8874aaf.

The tree of this commit is identical to merging
8874aaf into main at
3af7adb.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@dashhuang

Copy link
Copy Markdown
Member Author

这一批改动已随 #11629 合入 main(合并提交 a0f50a3ce0),本 PR 保留原有的 717 个提交和完整评审记录,供回溯。

@dashhuang dashhuang closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:ci-failed CI 失败(review-pr 自动维护,仅展示) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示) touches:security 改动碰到安全边界(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants