fix: preserve engine activity and host state through 1.14 upgrades

This commit is contained in:
Agent Workbench Dev
2026-10-31 06:48:36 +08:00
parent 482acdeff1
commit 53e196af59
45 changed files with 17761 additions and 55 deletions
+2
View File
@@ -4,6 +4,8 @@
产品目标是让用户给出需求后,工作台能保留项目基线,完成定位、计划、修改、检查、必要修复、审查和Git交付,并在停止、故障、断线后明确保留已完成结果。桌面与手机共享同一执行宿主、任务和证据。
当前接续:1.14的A–E已实现并分别验收,F正在完成升级兼容、编译宿主、完整界面、独立源码/便携及正式状态核对,不跳过发行门槛。下一阶段[Windows桌面与本机加密连接方案](PLAN-1.15.md)已记录六个切片及真实安装/重启/工程/回退标准,尚未开始实现。
## 执行顺序与完成门槛
| 顺序 | 开发范围 | 前置条件 | 完成标准 |
+2 -2
View File
@@ -1,6 +1,6 @@
# 1.14 受控外部引擎与增强策略执行方案
2026-10-31。此文记录1.13隔离协作之后的执行方案,尚未实现或发行。前置是1.13完整独立源码、界面、便携及保留状态升级通过;具体起点以[后续计划](NEXT-STEPS.md)与[1.13回顾](RETROSPECTIVE-1.13.md)为准。
2026-10-31。此文记录1.13隔离协作之后的执行方案及接续状态。A–E受控引擎、工具桥、实际工程、恢复界面和默认关闭提示实验已实现并各自验收;F已补升级活动锁/回退、原宿主身份幂等和旧导出兼容,编译宿主完整工程通过,最终完整回归、独立发行与正式升级仍在推进。正式服务目前仍1.13.0;各轮原结果以[1.14验收](QA-1.14.md)与[回顾](RETROSPECTIVE-1.14.md)为准。
## 要交付的能力
@@ -11,7 +11,7 @@
## 当前可复用的依据
- 自有Task/Run、预算、工具账本、原工件、计划、检查点,以及1.13两个受限子任务的工作区、停止、成果归集和父工程审查。
- 已安装DeepSeek Harness `0.2.1-rc.2`,1.9–1.13固定SDK探针使用独立目录、所属ready/PID/nonce及六个方法探针。`session/cancel`探针记录的是缺少方法的原错误,不能宣称单会话取消已经可用。当前没有发送引擎prompt或开放引擎工程写入。
- 已安装DeepSeek Harness `0.2.1-rc.2`,1.9–1.13固定SDK探针使用独立目录、所属ready/PID/nonce及六个方法探针。`session/cancel`仍缺少方法;1.14通过自有受限工具/模型桥在所属独立工程执行真实prompt/检查/父审查/Git,并用所属进程树停止,不赋予原生项目工具最终写入权限。
- REA `6.8.0`内置三项静态分析;既有Claude Code `2.1.312`与Cursor `3.16.29`来源索引。DSH-purge独立`1.1.78`和Desktop内置`1.1.81`分别登记,不能混用身份或结果。
公开完整源码用普通代码工具核对入口和调用链;发行工件、打包资源或需要运行观察的问题用REA。每份结论记录观测、推断与未知,复用[研究路线](RESEARCH-ROADMAP.md)与原Evidence。
+41
View File
@@ -0,0 +1,41 @@
# 1.15 Windows 桌面宿主与持久连接执行方案
2026-10-31。此阶段尚未实现。前置为1.14最终独立源码、完整界面、真实本地工程、便携和保留状态升级全部通过;具体结果以[1.14验收](QA-1.14.md)为准。每个切片继续审查、保留原失败、复验并本地Git提交,失败的候选不进入正式服务。
## 本阶段交付目标
用户通过一个Windows桌面应用打开现有工作台。窗口和执行宿主各自管理生命周期:关闭、重开窗口可继续观察同一任务;重复启动复用经身份核对的宿主;退出宿主等待所属工具、检查和引擎进程结束。模型连接可由用户选择保存为本机加密凭据,重启后的连接状态有实际核验。安装及升级保持项目、会话、工件和连接,安装失败能退回旧版本。
沿用一个React客户端和现有Runtime/Store/Provider,不另建一套桌面代理。当前390px网页验收只证明窄屏界面;真实手机配对、Windows安装版和加密凭据尚未交付。
## 必须延续的现有契约
- Task/Run/Tool、原工件、检查点、累计预算、计划、unknown和显式恢复继续由执行内核负责。重新打开窗口或宿主恢复不重放已经执行的工具。
- 原生引擎仍通过1.14所属独立工作区和受限工具桥执行,文件提案/检查/父成果审查及Git门槛保持。外部SDK没有单会话取消时,保留所属进程树关闭与原结果核对。
- 继续区分安装目录、当前runtimeRoot和用户dataRoot。新版在新目录中验收,更新不覆盖正在运行的发行,不把旧启动目录当当前代码版本。
- Provider凭据留在所属宿主;渲染页、日志、模型请求工件和Git中不能出现明文Key。新增保存功能仅作用于用户在工作台配置或确认导入的连接。
## 六个可审查切片
| 切片 | 实际实现 | 必须取得的证据 |
| --- | --- | --- |
| A:宿主身份与单实例 | 拆分桌面窗口与Node宿主;固定数据目录、用户身份、创建时间、安装清单及随机实例标识;并发启动经过同一注册锁核对 | 两次启动复用同一实际PID/owner;同名伪服务、旧PID和错误目录拒绝;窗口关闭期间实际任务继续,宿主崩溃后不自动重放 |
| B:本机加密凭据 | 使用Windows用户级DPAPI或系统凭据库,版本化保存连接ID/配置修订/加密块;内存与磁盘提交失败一起回退;可关闭保存、删除及重新配置 | 用户显式保存后真实重启可加载;不同用户或损坏块无法解密且状态可见;多连接/导入失败不留部分状态;日志/导出/数据库扫描不含自有明文测试Key |
| C:桌面窗口与本机入口 | Electron主进程管理窗口与窄范围preload;渲染页启用contextIsolation/sandbox并关闭Node集成;项目选择、原文件打开、终端/审查入口绑定已登记项目与当前任务 | 原桌面窗口实际完成读取/提案/审批/检查/审查;外部导航、任意IPC通道和越界文件入口拒绝;刷新、隐藏与重开保持同一任务/事件/审批身份 |
| D:安装及可回退更新 | 固定程序/依赖/来源清单;安装包、独立新版本目录、更新候选预检、活动阻挡和失败回退;卸载的数据行为明确 | 实际安装、启动、更新及卸载演练;任务/审批或原生进程仍活动时拒绝更新;故障注入后旧程序可继续使用;所有持久行、工件和连接修订逐项核对 |
| E:实际工程和生命周期 | 在桌面中完成固定Node/React/Python工程;测试失败后修复、父审查、检查和Git;覆盖窗口退出、后台任务、宿主停止及unknown核对 | 原测试/源码基线保持,实际Git范围正确,子/父结果与原日志一致;重开后的事件从原seq恢复;停止后所属心跳不继续写入 |
| F:独立发行和回顾 | 固定代码/测试/基准,完整回归、真实桌面与390px兼容、干净安装/便携/保留数据更新、原失败与当前身份封存 | 源码与安装包分别验收;实际运行与Git原字节/清单一致;连接保留有解密及实际状态证据;未测的真实模型推理/手机/电脑操控不计入通过 |
## 模块落点
拟增加desktop/main、desktop/preload、宿主注册与desktop发布脚本;这是拟定目录,不能从本文推断文件已经存在。宿主复用src/server/runtime.mjs、store.mjs、provider.mjs及src/core的执行管理器。加密存储作为ModelHub/ConfigImporter的独立宿主适配层,连接选择、池租约和请求账本不因持久化换成另一套协议。
已有Start-Workbench.ps1只按健康响应复用端口;桌面阶段必须进一步核对所属数据目录、实例和实际创建身份。普通窗口关闭不会调用现有/api/shutdown;明确退出执行宿主才按当前活动/未知状态完成停止。默认运行仍使用本机loopback,手机网关在后续独立阶段开放。
## 外部能力与后续顺序
固定DeepSeek Harness是1.14已实现的受控引擎。Codex实际引擎适配、Claude Code/Cursor/WorkBuddy执行能力继续按具体版本、原工具/模型/审批/取消契约做独立切片;已有静态研究不能替代接入。REA仍用于发行工件及运行证据,完整公开源码直接核对;每项采纳机制需要所属模块、专项和真实工程结果。
桌面宿主通过后实现手机伴随端:一次性配对、设备作用域、加密传输、撤销、同Run审批和断线seq补发,在真实手机上验收。随后推进跨协议能力路由、视觉/语音附件和版本化缓存,再以隔离分支/固定工程评测/多模型复核实现自我迭代候选。每个阶段有独立版本、验收和回退点。
真实模型工程及Purge推理收益继续遵循用户先本地验收的选择;本阶段本机存储和生命周期用自有凭据/HTTP夹具验证。需要真实推理或设备测试时单独记录原结果,不从夹具成功外推成功率。
+8
View File
@@ -59,3 +59,11 @@
实际Edge/Harness的首个2af1c3af界面8节点通过,目视发现重新检测后旧封存失败仍显示;改为当前实验字段更新清除旧失败,新37ca77ef桌面/390px整轮9节点通过。来源缺失/实际变化拒绝、两来源检测/关闭、迟到错误隔离、42px触控和无横向溢出、原字面提示逐请求生效、完整所属树关闭、原SHA报告下载及新目标默认关闭均实际验证。原8节点与3张截图保留,最终9节点/3张截图已核对。
原证据为controlled-engine-purge-source-observation、kernel-first、kernel、kernel-layout、comparison-first、comparison、ui-first-validation与ui-validation及对应-log.txt。E仍使用开发版1.13.0,不能将局部通过计为正式1.14发行;当前正式PID23172/Provider与1.13不变,0真实模型请求。
## F:最终兼容与发行验收(进行中)
已修复原宿主重复claim改写startedAt、无引擎历史导出增加空字段、worker/原生driver/MCP活动遗漏、旧manager继续使用旧方法和失败升级恢复不完整的问题。原升级七项第三轮7/7通过,初始0/7与第二轮6/7原TAP分别保留。所有数据库表逐行、旧会话导出和Provider/凭据对象按原断言核对;未对正式服务执行升级。
编译宿主首轮在异步starting状态、第二轮在Git preparing状态被验收器过早判结束。修正等待明确终态,原失败/现场/日志保留;新f3b0aeb5独立整轮四节点通过,实际原生Harness两次Run正常结束及所属树关闭,7次自有HTTP请求单次记账,原失败/修复、子/父8/8与ESM构建、父审查及Git均核对通过。父已有暂存/工作副本/未跟踪原字节与保护文件保持,所属编译宿主正常exit0。此结果仍属于编译专项,不替代最终完整UI、独立源码/便携与正式状态保留升级。
最新12文件相关回归整轮80/80通过,0失败/取消/跳过/todo;覆盖受控引擎/worker/HTTP/Purge、原隔离worker/停止恢复/父成果与四类升级兼容。原TAP、stderr保存为controlled-engine-final-related,实际QA Python3.12.10/pytest8.4.2;后续最终工程/UI/独立源码使用已重新核对的原独立Python3.10.11/pytest8.4.2,分别登记,不套用目录名或混合统计。
+6
View File
@@ -27,3 +27,9 @@ Purge完整插件含自愈/宿主修改入口,E独立实验见下方;最终
新34/34专项、两版本八工程36节点和最终桌面/390px9节点通过,保持原测试/源码/父审批/Git及全树结束。两版本的各次提示开销真实记录;本地固定回答夹具不能证明推理收益,也不能用相近耗时判定策略有益。真实模型同题实验仍独立待验,默认关闭。
目视核对发现成功重新检测后旧封存错误仍显示,虽功能流程可继续但反馈有误;字段更新清除旧失败,追加真实可见断言后复验9节点。原8节点报告/截图和失败输出分别保存,局部回归不替代F最终独立发行验收。
## F:升级兼容与异步阶段不能靠推断
原宿主身份重复声明必须保留同一owner的原startedAt;无新增引擎记录的旧会话保留原导出字段。运行活动包含worker、尚未结束的原生driver与MCP,外层Task结束不代表子进程结束。安装成功重置旧管理器,失败恢复原对象、处理器与数据库每行,七项原断言第三轮通过,原两轮失败保留。
编译发行验收必须执行真实引擎工程,原SDK零prompt连接核验只能证明连接。新验收器的两轮失败暴露starting与Git preparing等异步中间状态被当成结束;改为等待明确终态后核对原结果、commit、父HEAD和保护字节。新独立编译四节点通过,后续完整源码/界面/便携/正式升级仍需各自原结果,不用局部结果替代发行。
@@ -0,0 +1,9 @@
{
"success": false,
"appRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench",
"directory": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\compiled-controlled-215085a4-9c40-4130-bbe9-cdbb13c4ed49",
"error": "TypeError: Cannot read properties of undefined (reading 'status')\n at verifyControlledApi (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:104:85)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async verifyControlledRelease (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:166:14)\n at async file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:186:18",
"realModelRequests": 0,
"pid": 40404,
"rootExited": true
}
@@ -0,0 +1,2 @@
PASS compiled host seals actual Harness/source identities and prepares one owned worktree while retaining parent bytes and staging
EVIDENCE D:\Ai-project\REA逆向\Agent-Workbench\.qa\compiled-controlled-215085a4-9c40-4130-bbe9-cdbb13c4ed49
@@ -0,0 +1,11 @@
file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:104
const run = (await api(childRoute + '/engine-runs')).at(-1); assert.equal(run.status, 'completed', run.error); assert.equal(run.nativeSummary.treeConfirmed, true);
^
TypeError: Cannot read properties of undefined (reading 'status')
at verifyControlledApi (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:104:85)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async verifyControlledRelease (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:166:14)
at async file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:186:18
Node.js v24.22.1
@@ -0,0 +1 @@
{"app":"agent-workbench","ready":true,"url":"http://127.0.0.1:51304","version":"1.14.0"}
@@ -0,0 +1,13 @@
{
"success": false,
"appRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench",
"directory": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\compiled-controlled-4aed7de5-f1f7-467f-a8f8-5cb9c07b1108",
"error": "AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n+ actual - expected\n\n+ 'preparing'\n- 'completed'\n\n at verifyControlledApi (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:132:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async verifyControlledRelease (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:171:14)\n at async file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:191:18",
"realModelRequests": 0,
"pid": 23088,
"rootExited": true,
"exit": {
"code": 0,
"signal": null
}
}
@@ -0,0 +1,4 @@
PASS compiled host seals actual Harness/source identities and prepares one owned worktree while retaining parent bytes and staging
PASS compiled native execution retains failing tests, requires original check approvals, seals literal prompt/model/receipts/results and accounts each owned HTTP request once
PASS compiled parent review and immutable merge pass the original 8 functional tests and actual ESM build
EVIDENCE D:\Ai-project\REA逆向\Agent-Workbench\.qa\compiled-controlled-4aed7de5-f1f7-467f-a8f8-5cb9c07b1108
@@ -0,0 +1,23 @@
node:internal/modules/run_main:107
triggerUncaughtException(
^
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected
+ 'preparing'
- 'completed'
at verifyControlledApi (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:132:12)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async verifyControlledRelease (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:171:14)
at async file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/verify-controlled-release.mjs:191:18 {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: 'preparing',
expected: 'completed',
operator: 'strictEqual',
diff: 'simple'
}
Node.js v24.22.1
@@ -0,0 +1,6 @@
PASS compiled host seals actual Harness/source identities and prepares one owned worktree while retaining parent bytes and staging
PASS compiled native execution retains failing tests, requires original check approvals, seals literal prompt/model/receipts/results and accounts each owned HTTP request once
PASS compiled parent review and immutable merge pass the original 8 functional tests and actual ESM build
PASS compiled Git delivery contains only reviewed modules, preserves staged/unstaged/untracked owner bytes and completes the parent with sealed original evidence
EVIDENCE D:\Ai-project\REA逆向\Agent-Workbench\.qa\compiled-controlled-f3b0aeb5-b05d-46e1-8f03-8435b237f261
{"success":true,"version":"1.14.0","directory":"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\compiled-controlled-f3b0aeb5-b05d-46e1-8f03-8435b237f261","cases":4,"rootExited":true,"fixtureModelRequests":7,"realModelRequests":0}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
> local-agent-workbench@1.14.0 build
> tsc --noEmit && vite build && node scripts/build-server.mjs
vite v7.3.7 building client environment for production...
transforming...
✓ 1716 modules transformed.
rendering chunks...
computing gzip size...
dist-client/index.html 0.50 kB │ gzip: 0.37 kB
dist-client/assets/index-D4d9CZO8.css 129.14 kB │ gzip: 24.78 kB
dist-client/assets/index-Bf9kaC4h.js 485.57 kB │ gzip: 143.15 kB
✓ built in 1.46s
Server bundle built.
File diff suppressed because it is too large Load Diff
+490
View File
@@ -0,0 +1,490 @@
TAP version 13
# Subtest: controlled installation pins the native kernel and bridge independently of the existing connection-probe identity
ok 1 - controlled installation pins the native kernel and bridge independently of the existing connection-probe identity
---
duration_ms: 1151.9707
type: 'test'
...
# Subtest: controlled profiles disable every native project/terminal provider and native model/retry route using the actual include patch contract
ok 2 - controlled profiles disable every native project/terminal provider and native model/retry route using the actual include patch contract
---
duration_ms: 3.3788
type: 'test'
...
# Subtest: owned tool catalogues seal full schemas canonically and reject duplicate or malformed declarations
ok 3 - owned tool catalogues seal full schemas canonically and reject duplicate or malformed declarations
---
duration_ms: 9.0229
type: 'test'
...
# Subtest: bridge authentication, current Run, process, SDK session and browser-origin checks reject before dispatch
ok 4 - bridge authentication, current Run, process, SDK session and browser-origin checks reject before dispatch
---
duration_ms: 721.6352
type: 'test'
...
# Subtest: bridge duplicates, unknown tools, malformed arguments and source changes are refused before a second side effect
ok 5 - bridge duplicates, unknown tools, malformed arguments and source changes are refused before a second side effect
---
duration_ms: 724.1132
type: 'test'
...
# Subtest: bridge model requests bind the exact catalogue, route and output bound and preserve raw request/result identity
ok 6 - bridge model requests bind the exact catalogue, route and output bound and preserve raw request/result identity
---
duration_ms: 639.9443
type: 'test'
...
# Subtest: stopped and oversized bridge requests never reach a local model or tool callback
ok 7 - stopped and oversized bridge requests never reach a local model or tool callback
---
duration_ms: 619.7513
type: 'test'
...
# Subtest: controlled engine HTTP freezes one child, pages original owned input/report, rejects foreign reads and prevents changed-source reuse
ok 8 - controlled engine HTTP freezes one child, pages original owned input/report, rejects foreign reads and prevents changed-source reuse
---
duration_ms: 12684.1
type: 'test'
...
# Subtest: native text and call IDs preserve original result pairing while unsupported content fails closed
ok 9 - native text and call IDs preserve original result pairing while unsupported content fails closed
---
duration_ms: 0.7982
type: 'test'
...
# Subtest: one engine child freezes real installation identity before creating tasks and rejects a changed source
ok 10 - one engine child freezes real installation identity before creating tasks and rejects a changed source
---
duration_ms: 6166.9441
type: 'test'
...
# Subtest: owned native tools return saved results, use real approvals/checks and account each actual request once across new engine Runs
ok 11 - owned native tools return saved results, use real approvals/checks and account each actual request once across new engine Runs
---
duration_ms: 20342.7705
type: 'test'
...
# Subtest: forged native scope cannot change a parent file and a final completion claim cannot replace worker proof
ok 12 - forged native scope cannot change a parent file and a final completion claim cannot replace worker proof
---
duration_ms: 10503.1743
type: 'test'
...
# Subtest: duplicate native IDs are rejected without replaying a saved tool
ok 13 - duplicate native IDs are rejected without replaying a saved tool
---
duration_ms: 9769.3062
type: 'test'
...
# Subtest: native input exceeding the context budget is retained and sends no model request
ok 14 - native input exceeding the context budget is retained and sends no model request
---
duration_ms: 8368.3851
type: 'test'
...
# Subtest: stop retains a late reported model usage once and executes no tool from that output
ok 15 - stop retains a late reported model usage once and executes no tool from that output
---
duration_ms: 8832.5885
type: 'test'
...
# Subtest: a source change after the original model intent stops before native tools execute
ok 16 - a source change after the original model intent stops before native tools execute
---
duration_ms: 8770.6273
type: 'test'
...
# Subtest: an engine source change while approval is pending invalidates the old permission before any check starts
ok 17 - an engine source change while approval is pending invalidates the old permission before any check starts
---
duration_ms: 12517.1317
type: 'test'
...
# Subtest: missing or noncompleted turn end cannot be adopted even with an owned receipt and assistant text
ok 18 - missing or noncompleted turn end cannot be adopted even with an owned receipt and assistant text
---
duration_ms: 0.6144
type: 'test'
...
# Subtest: closed root with an original live descendant remains unknown and retains its process tree
ok 19 - closed root with an original live descendant remains unknown and retains its process tree
---
duration_ms: 0.265
type: 'test'
...
# Subtest: host recovery reserves original pending attempts exactly once and explicit review preserves unknown outcomes
ok 20 - host recovery reserves original pending attempts exactly once and explicit review preserves unknown outcomes
---
duration_ms: 11895.6241
type: 'test'
...
# Subtest: corrupted model reservation cannot reduce recovered budget or permit a new engine request
ok 21 - corrupted model reservation cannot reduce recovered budget or permit a new engine request
---
duration_ms: 11084.0353
type: 'test'
...
# Subtest: two Purge source versions lock nine original inputs without executing JavaScript or postinstall and remain disabled by default
ok 22 - two Purge source versions lock nine original inputs without executing JavaScript or postinstall and remain disabled by default
---
duration_ms: 590.0825
type: 'test'
...
# Subtest: incomplete, unsupported, relative and oversized sources cannot enable the experiment
ok 23 - incomplete, unsupported, relative and oversized sources cannot enable the experiment
---
duration_ms: 566.0959
type: 'test'
...
# Subtest: invalid source fingerprints and invented privilege or retry fields fail before any parent Task is created
ok 24 - invalid source fingerprints and invented privilege or retry fields fail before any parent Task is created
---
duration_ms: 1797.8737
type: 'test'
...
# Subtest: source edits between detection and plan are rejected without creating a parent Task
ok 25 - source edits between detection and plan are rejected without creating a parent Task
---
duration_ms: 1664.9114
type: 'test'
...
# Subtest: source edits after sealing cannot launch a child and do not reset its cumulative budget
ok 26 - source edits after sealing cannot launch a child and do not reset its cumulative budget
---
duration_ms: 6790.4646
type: 'test'
...
# Subtest: literal experiment text is sealed into the parent, worker and each new Run while actual host approvals and saved results remain required
ok 27 - literal experiment text is sealed into the parent, worker and each new Run while actual host approvals and saved results remain required
---
duration_ms: 20563.1615
type: 'test'
...
# Subtest: source changes after a model response stop before any native tool is accepted, retaining the actual usage once
ok 28 - source changes after a model response stop before any native tool is accepted, retaining the actual usage once
---
duration_ms: 8754.3529
type: 'test'
...
# Subtest: source changes while approval is pending invalidate the old permission before an engineering check starts
ok 29 - source changes while approval is pending invalidate the old permission before an engineering check starts
---
duration_ms: 11209.6943
type: 'test'
...
# Subtest: altered text, interpolation, section order and policy flags cannot reuse a sealed experiment
ok 30 - altered text, interpolation, section order and policy flags cannot reuse a sealed experiment
---
duration_ms: 1936.8173
type: 'test'
...
# Subtest: the observed SDK system-message layout and the explicit system field both require exactly one effective section, never a user or tool copy
ok 31 - the observed SDK system-message layout and the explicit system field both require exactly one effective section, never a user or tool copy
---
duration_ms: 2074.857
type: 'test'
...
# Subtest: a missing or duplicated experimental section in the actual input is rejected before any model dispatch
ok 32 - a missing or duplicated experimental section in the actual input is rejected before any model dispatch
---
duration_ms: 17380.2444
type: 'test'
...
# Subtest: experimental prompt overhead still participates in the original complete-input budget guard
ok 33 - experimental prompt overhead still participates in the original complete-input budget guard
---
duration_ms: 7880.6256
type: 'test'
...
# Subtest: source detection HTTP remains local-authenticated and read-only with no configured model requests
ok 34 - source detection HTTP remains local-authenticated and read-only with no configured model requests
---
duration_ms: 1674.4081
type: 'test'
...
# Subtest: a live SQLite host with the actual 1.9 artifact object upgrades, keeps its original blobs and verifies real browser PNG bytes
ok 35 - a live SQLite host with the actual 1.9 artifact object upgrades, keeps its original blobs and verifies real browser PNG bytes
---
duration_ms: 3990.0537
type: 'test'
...
# Subtest: failed upgrade restores the original artifact object, provider and request handler
ok 36 - failed upgrade restores the original artifact object, provider and request handler
---
duration_ms: 650.2843
type: 'test'
...
# Subtest: claiming the same runtime owner twice preserves its original metadata and every database row
ok 37 - claiming the same runtime owner twice preserves its original metadata and every database row
---
duration_ms: 786.1772
type: 'test'
...
# Subtest: sessions without controlled-engine history retain their prior export shape and never expose another session record
ok 38 - sessions without controlled-engine history retain their prior export shape and never expose another session record
---
duration_ms: 885.3583
type: 'test'
...
# Subtest: live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
ok 39 - live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
---
duration_ms: 719.9001
type: 'test'
...
# Subtest: an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
ok 40 - an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
---
duration_ms: 715.3545
type: 'test'
...
# Subtest: an installation failure restores old managers, original record maps, handlers and all existing database rows
ok 41 - an installation failure restores old managers, original record maps, handlers and all existing database rows
---
duration_ms: 608.5167
type: 'test'
...
# Subtest: the owned controlled driver remains an active session and project even after outer task activity has ended
ok 42 - the owned controlled driver remains an active session and project even after outer task activity has ended
---
duration_ms: 718.2548
type: 'test'
...
# Subtest: release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
ok 43 - release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
---
duration_ms: 778.1488
type: 'test'
...
# Subtest: hot upgrade refreshes retained model and importer methods while preserving credential and routing objects
ok 44 - hot upgrade refreshes retained model and importer methods while preserving credential and routing objects
---
duration_ms: 720.2096
type: 'test'
...
# Subtest: hot upgrade refuses active probes and restores retained model methods if installation fails
ok 45 - hot upgrade refuses active probes and restores retained model methods if installation fails
---
duration_ms: 607.1572
type: 'test'
...
# Subtest: a directly started compiled host upgrades twice with the same PID, sessions, applied bytes and volatile provider
ok 46 - a directly started compiled host upgrades twice with the same PID, sessions, applied bytes and volatile provider
---
duration_ms: 2297.5297
type: 'test'
...
# Subtest: the running 0.1.0 process upgrades in place and retains its project, session, files and volatile model connection
ok 47 - the running 0.1.0 process upgrades in place and retains its project, session, files and volatile model connection
---
duration_ms: 7872.0945
type: 'test'
...
# Subtest: HTTP worker identities require a current sealed plan, reject overrides and close unused plans without touching source
ok 48 - HTTP worker identities require a current sealed plan, reject overrides and close unused plans without touching source
---
duration_ms: 12890.5654
type: 'test'
...
# Subtest: HTTP unknown recovery only accepts the original evidence SHA and preserves changed source for explicit retention
ok 49 - HTTP unknown recovery only accepts the original evidence SHA and preserves changed source for explicit retention
---
duration_ms: 14937.169
type: 'test'
...
# Subtest: verified isolated outputs form a new parent batch, rerun real checks and commit only reviewed source
ok 50 - verified isolated outputs form a new parent batch, rerun real checks and commit only reviewed source
---
duration_ms: 39646.6209
type: 'test'
...
# Subtest: overlapping worker paths are explicit conflicts even if each independent task checks successfully
ok 51 - overlapping worker paths are explicit conflicts even if each independent task checks successfully
---
duration_ms: 25921.6378
type: 'test'
...
# Subtest: source edits after isolated work preserve the owner file and invalidate collection without proposing a merge
ok 52 - source edits after isolated work preserve the owner file and invalidate collection without proposing a merge
---
duration_ms: 24966.3418
type: 'test'
...
# Subtest: changed child bytes after parent preview block the entire batch before any parent write
ok 53 - changed child bytes after parent preview block the entire batch before any parent write
---
duration_ms: 32278.4325
type: 'test'
...
# Subtest: corrupt original check logs cannot become collected outputs or a parent review
ok 54 - corrupt original check logs cannot become collected outputs or a parent review
---
duration_ms: 23980.1217
type: 'test'
...
# Subtest: stopping a parent accounts late responses and executes none of their proposed tools
ok 55 - stopping a parent accounts late responses and executes none of their proposed tools
---
duration_ms: 11578.974
type: 'test'
...
# Subtest: unreported interrupted requests reserve estimated usage and the total deadline cannot reset on resume
ok 56 - unreported interrupted requests reserve estimated usage and the total deadline cannot reset on resume
---
duration_ms: 11701.1139
type: 'test'
...
# Subtest: a response exceeding the cumulative token allocation stops before registering or executing its tools
ok 57 - a response exceeding the cumulative token allocation stops before registering or executing its tools
---
duration_ms: 11891.4924
type: 'test'
...
# Subtest: cumulative tool allocation rejects the entire returned batch before any tool side effect
ok 58 - cumulative tool allocation rejects the entire returned batch before any tool side effect
---
duration_ms: 11005.762
type: 'test'
...
# Subtest: single response 16 tool ceiling rejects the entire returned batch before any tool side effect
ok 59 - single response 16 tool ceiling rejects the entire returned batch before any tool side effect
---
duration_ms: 11839.3924
type: 'test'
...
# Subtest: consumed request steps remain consumed across explicit worker resumes
ok 60 - consumed request steps remain consumed across explicit worker resumes
---
duration_ms: 13171.7007
type: 'test'
...
# Subtest: a saved completed response with missing usage is conservatively accounted exactly once during recovery
ok 61 - a saved completed response with missing usage is conservatively accounted exactly once during recovery
---
duration_ms: 9790.602
type: 'test'
...
# Subtest: an unexecuted second workspace plan resumes its original identity without recreating the first checkout
ok 62 - an unexecuted second workspace plan resumes its original identity without recreating the first checkout
---
duration_ms: 11411.6379
type: 'test'
...
# Subtest: a verified interrupted parent proposal resumes sealing without duplicating or replacing its original change
ok 63 - a verified interrupted parent proposal resumes sealing without duplicating or replacing its original change
---
duration_ms: 35390.0937
type: 'test'
...
# Subtest: recovery attaches a sealed parent batch saved before its group reference without creating another batch
ok 64 - recovery attaches a sealed parent batch saved before its group reference without creating another batch
---
duration_ms: 31619.1511
type: 'test'
...
# Subtest: explicitly retaining an unexecuted parent merge cancels its batch and frees the next parent goal
ok 65 - explicitly retaining an unexecuted parent merge cancels its batch and frees the next parent goal
---
duration_ms: 34596.5256
type: 'test'
...
# Subtest: unknown collaboration blocks ordinary proposals but permits only original batch recovery and rollback
ok 66 - unknown collaboration blocks ordinary proposals but permits only original batch recovery and rollback
---
duration_ms: 31390.4102
type: 'test'
...
# Subtest: after a restart the batch application lazily reinstates the worker result guard before any parent write
ok 67 - after a restart the batch application lazily reinstates the worker result guard before any parent write
---
duration_ms: 27310.6374
type: 'test'
...
# Subtest: unknown original tool inputs must match before acknowledgement, and reviewed checkpoint IDs preserve the unknown fact
ok 68 - unknown original tool inputs must match before acknowledgement, and reviewed checkpoint IDs preserve the unknown fact
---
duration_ms: 11003.5207
type: 'test'
...
# Subtest: a parent stop observes and waits for a manually approved child check and its real descendant process
ok 69 - a parent stop observes and waits for a manually approved child check and its real descendant process
---
duration_ms: 10319.0931
type: 'test'
...
# Subtest: a real host crash preserves unknown checks, refuses a still living owned PID and never replays a model or tool
ok 70 - a real host crash preserves unknown checks, refuses a still living owned PID and never replays a model or tool
---
duration_ms: 18487.4985
type: 'test'
...
# Subtest: a persisted child initialization resumes the original control run after a failure before its worker record
ok 71 - a persisted child initialization resumes the original control run after a failure before its worker record
---
duration_ms: 9501.9025
type: 'test'
...
# Subtest: failed request intent persistence never dispatches a worker request or changes source
ok 72 - failed request intent persistence never dispatches a worker request or changes source
---
duration_ms: 10081.7626
type: 'test'
...
# Subtest: failed usage persistence rolls back the uncommitted usage and conservatively reserves one unknown request without tools
ok 73 - failed usage persistence rolls back the uncommitted usage and conservatively reserves one unknown request without tools
---
duration_ms: 10433.9083
type: 'test'
...
# Subtest: a child file change after observation prevents acknowledgement even when the tool inputs did not change
ok 74 - a child file change after observation prevents acknowledgement even when the tool inputs did not change
---
duration_ms: 9608.3476
type: 'test'
...
# Subtest: worker scopes and allocated budgets reject aliases, extra permissions and aggregate overflow
ok 75 - worker scopes and allocated budgets reject aliases, extra permissions and aggregate overflow
---
duration_ms: 484.9588
type: 'test'
...
# Subtest: two sequential Git workspaces freeze a new parent goal, separate owned tasks and preserve all source bytes
ok 76 - two sequential Git workspaces freeze a new parent goal, separate owned tasks and preserve all source bytes
---
duration_ms: 9834.5953
type: 'test'
...
# Subtest: real isolated changes, approvals and npm checks produce original owned outputs, not model completion claims
ok 77 - real isolated changes, approvals and npm checks produce original owned outputs, not model completion claims
---
duration_ms: 25746.6165
type: 'test'
...
# Subtest: forged worker tools cannot execute terminal or Git even when absent from the advertised tool list
ok 78 - forged worker tools cannot execute terminal or Git even when absent from the advertised tool list
---
duration_ms: 10457.6447
type: 'test'
...
# Subtest: a completion-only model pauses each worker without fabricated changes or checks
ok 79 - a completion-only model pauses each worker without fabricated changes or checks
---
duration_ms: 12938.9405
type: 'test'
...
# Subtest: restart retains frozen scope and marks interrupted parent and workers unknown without sending requests
ok 80 - restart retains frozen scope and marks interrupted parent and workers unknown without sending requests
---
duration_ms: 10242.9614
type: 'test'
...
1..80
# tests 80
# suites 0
# pass 80
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 472534.7525
@@ -0,0 +1,18 @@
{
"success": true,
"observedAt": "2026-10-30T22:45:53.655Z",
"version": "1.13.0",
"pid": 23172,
"registeredPid": 23172,
"appRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\releases\\Agent-Workbench-1.12.0-win-x64-20261030124454517",
"runtimeRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\releases\\Agent-Workbench-1.13.0-win-x64-20261030193314594",
"dataRoot": "C:\\Users\\wangy\\AppData\\Local\\AgentWorkbench",
"busySessions": 0,
"historicalReleasePid": 19084,
"hasKey": true,
"model": "gpt-6.1-sol",
"connections": 2,
"pools": 1,
"inspectorClosed": true,
"credentialsHandling": "Public identity/counts only. No Provider key read, copied or sent; no model request."
}
@@ -0,0 +1,320 @@
TAP version 13
# Subtest: claiming the same runtime owner twice preserves its original metadata and every database row
not ok 1 - claiming the same runtime owner twice preserves its original metadata and every database row
---
duration_ms: 838.6823
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:34:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly deep-equal:
+ actual - expected
{
id: '9b86da44-aa96-4623-b56a-6856399b8e8b',
pid: 40452,
+ startedAt: '2026-10-30T22:19:33.412Z'
- startedAt: '2026-01-01T00:00:00.000Z'
}
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected:
pid: 40452
id: '9b86da44-aa96-4623-b56a-6856399b8e8b'
startedAt: '2026-01-01T00:00:00.000Z'
actual:
pid: 40452
id: '9b86da44-aa96-4623-b56a-6856399b8e8b'
startedAt: '2026-10-30T22:19:33.412Z'
operator: 'deepStrictEqual'
stack: |-
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:40:10)
Test.runInAsyncScope (node:async_hooks:227:14)
Test.run (node:internal/test_runner/test:1402:25)
Test.start (node:internal/test_runner/test:1262:17)
startSubtestAfterBootstrap (node:internal/test_runner/harness:387:17)
...
# Subtest: sessions without controlled-engine history retain their prior export shape and never expose another session record
not ok 2 - sessions without controlled-engine history retain their prior export shape and never expose another session record
---
duration_ms: 629.0196
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:43:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly equal:
true !== false
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected: false
actual: true
operator: 'strictEqual'
stack: |-
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:45:10)
Test.runInAsyncScope (node:async_hooks:227:14)
Test.run (node:internal/test_runner/test:1402:25)
Test.processPendingSubtests (node:internal/test_runner/test:974:18)
Test.postRun (node:internal/test_runner/test:1542:19)
Test.run (node:internal/test_runner/test:1467:12)
async startSubtestAfterBootstrap (node:internal/test_runner/harness:387:3)
...
# Subtest: live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
not ok 3 - live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
---
duration_ms: 703.0919
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:51:1'
failureType: 'testCodeFailure'
error: 'Missing expected exception.'
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected:
operator: 'throws'
stack: |-
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:57:12)
process.processTicksAndRejections (node:internal/process/task_queues:104:5)
async Test.run (node:internal/test_runner/test:1409:7)
async Test.processPendingSubtests (node:internal/test_runner/test:974:7)
...
# Subtest: an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
not ok 4 - an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
---
duration_ms: 803.5062
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:63:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly equal:
+ actual - expected
+ {
+ active: Map(0) {}
+ }
- null
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected: ~
actual:
active:
operator: 'strictEqual'
stack: |-
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:71:10)
process.processTicksAndRejections (node:internal/process/task_queues:104:5)
async Test.run (node:internal/test_runner/test:1409:7)
async Test.processPendingSubtests (node:internal/test_runner/test:974:7)
...
# Subtest: an installation failure restores old managers, original record maps, handlers and all existing database rows
not ok 5 - an installation failure restores old managers, original record maps, handlers and all existing database rows
---
duration_ms: 698.5559
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:79:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly deep-equal:
+ actual - expected
... Skipped lines
{
events: [
[Object: null prototype] {
created_at: '2026-10-30T22:19:36.169Z',
id: '3b63c4ab-ebbb-49d8-a5d7-52dfac909de1',
...
key: 'runtimeOwner',
+ value: '{"pid":40452,"id":"3987f2ef-758c-4d36-be49-ee02299ce4ad","startedAt":"2026-10-30T22:19:36.224Z"}'
- value: '{"pid":40452,"id":"3987f2ef-758c-4d36-be49-ee02299ce4ad","startedAt":"2026-10-30T22:19:36.194Z"}'
}
],
outbox: [
[Object: null prototype] {
published_at: null,
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected:
events:
0:
seq: 1
id: '3b63c4ab-ebbb-49d8-a5d7-52dfac909de1'
session_id: '4e58ca4d-32d7-435c-a967-bdd03273aef6'
project_id: '8684b7bf-63a0-4af3-afc5-bdfc1530e6b1'
task_id: ~
run_id: ~
type: 'session.updated'
revision: 1
created_at: '2026-10-30T22:19:36.169Z'
payload: '{"status":"idle"}'
metadata:
0:
key: 'config'
value: '{"mode":"demo","baseUrl":"http://127.0.0.1:11434/v1","model":"","contextLimit":16000,"maxSteps":12,"maxOutputTokens":2048,"maxRunDurationMs":600000,"maxRunTokens":200000,"maxTaskTokens":1000000,"configRevision":1}'
1:
key: 'migration'
value: 'null'
2:
key: 'initialized'
value: 'true'
3:
key: 'runtimeOwner'
value: '{"pid":40452,"id":"3987f2ef-758c-4d36-be49-ee02299ce4ad","startedAt":"2026-10-30T22:19:36.194Z"}'
outbox:
0:
seq: 1
published_at: ~
projects:
0:
id: '8684b7bf-63a0-4af3-afc5-bdfc1530e6b1'
position: 0
payload: '{"id":"8684b7bf-63a0-4af3-afc5-bdfc1530e6b1","root":"D:\\\\Ai-project\\\\REA逆向\\\\Agent-Workbench\\\\.qa\\\\test-R5Bf5u\\\\project","name":"project","addedAt":"2026-10-30T22:19:36.145Z"}'
records:
sessions:
0:
id: '4e58ca4d-32d7-435c-a967-bdd03273aef6'
project_id: '8684b7bf-63a0-4af3-afc5-bdfc1530e6b1'
revision: 1
payload: '{"id":"4e58ca4d-32d7-435c-a967-bdd03273aef6","projectId":"8684b7bf-63a0-4af3-afc5-bdfc1530e6b1","title":"新任务","status":"idle","createdAt":"2026-10-30T22:19:36.169Z","updatedAt":"2026-10-30T22:19:36.169Z","messages":[],"providerMessages":[],"events":[],"changes":[],"approvals":[],"failure":null,"lastFailure":null,"compactions":0,"estimatedTokens":0,"usage":null,"archived":false,"revision":1,"eventSeq":1}'
sqlite_sequence:
0:
name: 'events'
seq: 1
actual:
events:
0:
seq: 1
id: '3b63c4ab-ebbb-49d8-a5d7-52dfac909de1'
session_id: '4e58ca4d-32d7-435c-a967-bdd03273aef6'
project_id: '8684b7bf-63a0-4af3-afc5-bdfc1530e6b1'
task_id: ~
run_id: ~
type: 'session.updated'
revision: 1
created_at: '2026-10-30T22:19:36.169Z'
payload: '{"status":"idle"}'
metadata:
0:
key: 'config'
value: '{"mode":"demo","baseUrl":"http://127.0.0.1:11434/v1","model":"","contextLimit":16000,"maxSteps":12,"maxOutputTokens":2048,"maxRunDurationMs":600000,"maxRunTokens":200000,"maxTaskTokens":1000000,"configRevision":1}'
1:
key: 'migration'
value: 'null'
2:
key: 'initialized'
value: 'true'
3:
key: 'runtimeOwner'
value: '{"pid":40452,"id":"3987f2ef-758c-4d36-be49-ee02299ce4ad","startedAt":"2026-10-30T22:19:36.224Z"}'
outbox:
0:
seq: 1
published_at: ~
projects:
0:
id: '8684b7bf-63a0-4af3-afc5-bdfc1530e6b1'
position: 0
payload: '{"id":"8684b7bf-63a0-4af3-afc5-bdfc1530e6b1","root":"D:\\\\Ai-project\\\\REA逆向\\\\Agent-Workbench\\\\.qa\\\\test-R5Bf5u\\\\project","name":"project","addedAt":"2026-10-30T22:19:36.145Z"}'
records:
sessions:
0:
id: '4e58ca4d-32d7-435c-a967-bdd03273aef6'
project_id: '8684b7bf-63a0-4af3-afc5-bdfc1530e6b1'
revision: 1
payload: '{"id":"4e58ca4d-32d7-435c-a967-bdd03273aef6","projectId":"8684b7bf-63a0-4af3-afc5-bdfc1530e6b1","title":"新任务","status":"idle","createdAt":"2026-10-30T22:19:36.169Z","updatedAt":"2026-10-30T22:19:36.169Z","messages":[],"providerMessages":[],"events":[],"changes":[],"approvals":[],"failure":null,"lastFailure":null,"compactions":0,"estimatedTokens":0,"usage":null,"archived":false,"revision":1,"eventSeq":1}'
sqlite_sequence:
0:
name: 'events'
seq: 1
operator: 'deepStrictEqual'
stack: |-
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:88:69)
process.processTicksAndRejections (node:internal/process/task_queues:104:5)
async Test.run (node:internal/test_runner/test:1409:7)
async Test.processPendingSubtests (node:internal/test_runner/test:974:7)
...
# Subtest: the owned controlled driver remains an active session and project even after outer task activity has ended
not ok 6 - the owned controlled driver remains an active session and project even after outer task activity has ended
---
duration_ms: 552.6337
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:91:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly equal:
false !== true
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected: true
actual: false
operator: 'strictEqual'
stack: |-
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:94:48)
Test.runInAsyncScope (node:async_hooks:227:14)
Test.run (node:internal/test_runner/test:1402:25)
Test.processPendingSubtests (node:internal/test_runner/test:974:18)
Test.postRun (node:internal/test_runner/test:1542:19)
Test.run (node:internal/test_runner/test:1467:12)
async Test.processPendingSubtests (node:internal/test_runner/test:974:7)
...
# Subtest: release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
not ok 7 - release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
---
duration_ms: 756.1136
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:99:1'
failureType: 'testCodeFailure'
error: |-
node:fs:483
return binding.readFileUtf8(path, stringToFlags(options.flag));
^
Error: ENOENT: no such file or directory, open 'D:\Ai-project\REA逆向\Agent-Workbench\.qa\test-y5A0Ly\package.json'
at Object.readFileSync (node:fs:483:20)
at file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/package.mjs:9:28
at ModuleJob.run (node:internal/modules/esm/module_job:561:25)
at async node:internal/modules/esm/loader:647:26
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\test-y5A0Ly\\package.json'
}
Node.js v24.22.1
1 !== 0
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected: 0
actual: 1
operator: 'strictEqual'
stack: |-
Object.readFileSync (node:fs:483:20)
file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/scripts/package.mjs:9:28
ModuleJob.run (node:internal/modules/esm/module_job:561:25)
async node:internal/modules/esm/loader:647:26
async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:103:12)
Test.runInAsyncScope (node:async_hooks:227:14)
Test.run (node:internal/test_runner/test:1402:25)
Test.processPendingSubtests (node:internal/test_runner/test:974:18)
Test.postRun (node:internal/test_runner/test:1542:19)
Test.run (node:internal/test_runner/test:1467:12)
async Test.processPendingSubtests (node:internal/test_runner/test:974:7)
...
1..7
# tests 7
# suites 0
# pass 0
# fail 7
# cancelled 0
# skipped 0
# todo 0
# duration_ms 5109.7403
@@ -0,0 +1,103 @@
TAP version 13
# Subtest: claiming the same runtime owner twice preserves its original metadata and every database row
ok 1 - claiming the same runtime owner twice preserves its original metadata and every database row
---
duration_ms: 765.6274
type: 'test'
...
# Subtest: sessions without controlled-engine history retain their prior export shape and never expose another session record
ok 2 - sessions without controlled-engine history retain their prior export shape and never expose another session record
---
duration_ms: 670.9611
type: 'test'
...
# Subtest: live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
ok 3 - live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
---
duration_ms: 721.7782
type: 'test'
...
# Subtest: an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
not ok 4 - an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
---
duration_ms: 657.6824
type: 'test'
location: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\tests\\upgrade-controlled-engines.test.mjs:63:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly deep-equal:
+ actual - expected
{
calls: [],
id: '1c46624d-b1fe-496d-b456-e8cc4bc6a5ee',
native: null,
projectId: 'f092c945-9ed4-43cd-a4d5-63dbe43d63c3',
requests: [],
requiresVerification: true,
- runId: undefined,
schemaVersion: 1,
sessionId: '9e3fa09b-2233-4bee-8d0e-575c8a33e589',
startedAt: '2026-01-01T00:00:00.000Z',
status: 'unknown',
- taskId: undefined
}
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected:
id: '1c46624d-b1fe-496d-b456-e8cc4bc6a5ee'
schemaVersion: 1
sessionId: '9e3fa09b-2233-4bee-8d0e-575c8a33e589'
projectId: 'f092c945-9ed4-43cd-a4d5-63dbe43d63c3'
status: 'unknown'
requiresVerification: true
native: ~
requests:
calls:
startedAt: '2026-01-01T00:00:00.000Z'
actual:
id: '1c46624d-b1fe-496d-b456-e8cc4bc6a5ee'
schemaVersion: 1
sessionId: '9e3fa09b-2233-4bee-8d0e-575c8a33e589'
projectId: 'f092c945-9ed4-43cd-a4d5-63dbe43d63c3'
status: 'unknown'
requiresVerification: true
native: ~
requests:
calls:
startedAt: '2026-01-01T00:00:00.000Z'
operator: 'deepStrictEqual'
stack: |-
TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/upgrade-controlled-engines.test.mjs:73:10)
process.processTicksAndRejections (node:internal/process/task_queues:104:5)
async Test.run (node:internal/test_runner/test:1409:7)
async Test.processPendingSubtests (node:internal/test_runner/test:974:7)
...
# Subtest: an installation failure restores old managers, original record maps, handlers and all existing database rows
ok 5 - an installation failure restores old managers, original record maps, handlers and all existing database rows
---
duration_ms: 597.1449
type: 'test'
...
# Subtest: the owned controlled driver remains an active session and project even after outer task activity has ended
ok 6 - the owned controlled driver remains an active session and project even after outer task activity has ended
---
duration_ms: 671.3551
type: 'test'
...
# Subtest: release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
ok 7 - release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
---
duration_ms: 850.5229
type: 'test'
...
1..7
# tests 7
# suites 0
# pass 6
# fail 1
# cancelled 0
# skipped 0
# todo 0
# duration_ms 5054.4683
@@ -0,0 +1,52 @@
TAP version 13
# Subtest: claiming the same runtime owner twice preserves its original metadata and every database row
ok 1 - claiming the same runtime owner twice preserves its original metadata and every database row
---
duration_ms: 667.3825
type: 'test'
...
# Subtest: sessions without controlled-engine history retain their prior export shape and never expose another session record
ok 2 - sessions without controlled-engine history retain their prior export shape and never expose another session record
---
duration_ms: 724.7
type: 'test'
...
# Subtest: live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
ok 3 - live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows
---
duration_ms: 674.961
type: 'test'
...
# Subtest: an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
ok 4 - an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects
---
duration_ms: 759.3005
type: 'test'
...
# Subtest: an installation failure restores old managers, original record maps, handlers and all existing database rows
ok 5 - an installation failure restores old managers, original record maps, handlers and all existing database rows
---
duration_ms: 575.1694
type: 'test'
...
# Subtest: the owned controlled driver remains an active session and project even after outer task activity has ended
ok 6 - the owned controlled driver remains an active session and project even after outer task activity has ended
---
duration_ms: 513.5386
type: 'test'
...
# Subtest: release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
ok 7 - release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory
---
duration_ms: 871.6494
type: 'test'
...
1..7
# tests 7
# suites 0
# pass 7
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 4904.6183
+8
View File
@@ -1,5 +1,13 @@
# 汇总发现
- 独立发行工具生成首轮因旧临时脚本实际LF、生成器锚点假定CRLF而在数据库比较段拒绝,未执行任何升级或正式写入。生成器仅对新临时脚本按LF统一后精确匹配,保留原脚本;不放宽原数据库/工件/接口断言。当前工具宿主实测PowerShell7.6.5,产品终端与检查执行仍为既有PowerShell5.1。
- 本次通过实际运行核对:.qa/python-qa-1.7.0当前是3.12.10,不按目录名当成3.10。原最终源码路径.qa/dev-task-plans/.qa/python-3.10/Scripts/python.exe实测3.10.11/pytest8.4.2,将用于最终工程/UI/源码。一次查询误用engine-installation.mjs不存在,真实导入为deepseek-installation.mjs,后续按已确认路径继续。
- F编译第二轮失败来自验收器仅排除queued/running,遗漏Git真实preparing/prepared/committed等中间阶段。父测试与两次原生结束已通过,但完整Git仍须新整轮证据;等待明确completed/failed/cancelled/unknown终态后才核对实际commit、原父HEAD和owner索引/字节。原失败目录4aed7de5与正式服务隔离,不能补写原失败为成功。
- F七项原专项已实际复现并封存:原owner的startedAt在失败升级也变化;已有worker活动可继续安装处理器,空worker/driver保留旧版本方法,driver未进入会话/项目活动判断;原无引擎会话导出增加engineRuns空数组。帮助测试在独立无package目录提前失败,未触及正式4318或发行目录。补丁保留原CoreKind补齐实现,仅增加其验证。
- E第二輪36节点与新UI8节点报告的294份输入逐份SHA256保持;报告原SHA分别12fa0b633ccd957b9eb4ce63a9a277e6dfbc84fea13ac8fcc5aafe2a67296d79、5a816815ea066f4de25991de75e06df83f9b2fef6413566bba97600ded580e3a,完整原报告/日志/3张PNG已复制docs。目视发现用户重新检测成功后父控制台仍显示此前封存来源失败,虽新计划可封存,但错误反馈过时;在最终E提交前修正字段更新清除旧表单失败并实际复验。此次读取曾误用src/core/runtime与store路径,已按实际src/server纠正;大报告后续只输出具体计数。
- 2026-10-31本轮接续:实际源码HEAD48635be,E工作树未提交,第二轮controlled-purge-84015676报告已结束且36节点成功;上一轮34项原TAP有完整结束统计。不能将历史1.13版本、旧QA指针或未结束执行当新发行结果;后续只推进E界面及F,保留原失败与正式Provider。
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "local-agent-workbench",
"version": "1.13.0",
"version": "1.14.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "local-agent-workbench",
"version": "1.13.0",
"version": "1.14.0",
"dependencies": {
"@babel/parser": "7.29.11",
"diff": "^8.0.2",
+6 -2
View File
@@ -1,6 +1,6 @@
{
"name": "local-agent-workbench",
"version": "1.13.0",
"version": "1.14.0",
"private": true,
"type": "module",
"description": "A local coding workbench with explicit tool execution, reviewable changes and recoverable sessions.",
@@ -28,7 +28,11 @@
"verify:mcp": "node scripts/verify-mcp-ui.mjs",
"verify:mcp-recovery": "node scripts/verify-mcp-recovery-ui.mjs",
"verify:workers": "node scripts/verify-workers-ui.mjs",
"verify:workers-projects": "node scripts/verify-workers-projects.mjs"
"verify:workers-projects": "node scripts/verify-workers-projects.mjs",
"verify:controlled": "node scripts/verify-controlled-ui.mjs",
"verify:controlled-projects": "node scripts/verify-controlled-projects.mjs",
"verify:purge-ui": "node scripts/verify-purge-ui.mjs",
"verify:purge-comparison": "node scripts/verify-controlled-projects.mjs --purge-comparison"
},
"dependencies": {
"@babel/parser": "7.29.11",
+16
View File
@@ -2,6 +2,22 @@
## 2026-10-31 1.14 受控外部引擎阶段
- F相关12文件整轮80/80通过、0失败/取消/跳过/todo,原TAP与stderr保留,耗时472.5秒;实际使用3.12.10/pytest8.4.2,不与历史七项/34项拼接计数。接下来仅规范本次修改输入的LF、重新构建、本地提交并冻结最终输入,串行真实三工程/完整UI,再新独立源码/便携;原正式PID23172/Provider保持。
- F第三轮编译f3b0aeb5完整四节点通过,原生两Run正常结束/全树关闭、7次自有HTTP、子/父8/8及ESM构建、审查/Git和owner原索引/字节均核对,所属宿主正常exit0。相关12文件回归会话80477运行中,实际QA解释器为3.12.10/pytest8.4.2;最终完整源码/工程/UI将使用原独立3.10.11路径并重新登记实际身份,不能套用目录名推断版本。正式23172/1.13保持。
- F第二轮编译宿主4aed7de5原终态为失败,所属PID23088正常exit0,两个原生Run正常结束、7次自有HTTP、子/父8项测试及构建均已实际通过;验收器在Git的preparing阶段过早判结束,未取得完整提交结果。按真实Git多阶段生命周期改为等待明确终态,原结果/现场/日志另存,不改产品或降低原Git、保护文件和索引门槛。继续新独立数据复验,正式23172未变更。
- 本轮接续实际HEAD482acde及F未提交改动,A–E原实现/报告保留,未重新开始下一阶段。正式4318仍由PID23172监听,9229关闭;最新独立编译验收目录为compiled-controlled-4aed7de5,先核对其原终态/进程/输入,再推进F相关回归、完整界面、独立源码/便携与保留状态升级。session-catchup无额外输出;两次过量合并读取已改为限定段落,不把截断或历史通过结果当最新验收。
- F编译宿主首轮215085a4在工作区后失败:验收器把异步starting状态误当运行结束,在创建原生Run前读取undefined。原1节点/日志/数据保留,未改产品或放宽完成条件;等待明确终态,并按实际merge_preparing生命周期同样修正。追加失败上下文封存,下一轮独立数据重验。
- F原升级七项第三轮7/7通过,含所有数据库表每行及新map/原对象/导出保持、活动拒绝和失败恢复;初始0/7、第二轮6/7分别封存。受控driver同时接入各执行管理器的项目活动判断,排除同一所属会话以保留原检查流程。版本已统一1.14;最终UI新增实际受控/Purge两类,QA只显式传入四个已核对解释器/来源路径。
- F核心修复后原七项6/7通过,唯一失败是声明记录的undefined字段在JSON持久化中依法省略;改夹具为明确null,与实际持久表示一致,不修改产品存储或降低新map/原记录核对。原第二轮保存后将连同引擎/worker兼容复验。发行版本统一1.14.0,新证据使用controlled-engine前缀,历史1.13文件保持。
- E已提交482acde,工作树随后仅新增F专项。七项升级初轮实际0/7,原TAP保存controlled-engine-upgrade-initial-failure:同owner的startedAt被重写、旧无引擎会话增加字段、worker/driver/MCP活动遗漏、旧manager未重置、失败后元数据变化、外层结束后的driver仍未视为活动,以及帮助查询未先退出。全部复现仅独立夹具,无正式升级或模型请求;先修复,再按原断言复验。
- E修正旧提示后的新37ca77ef桌面/390px整轮9节点通过,0页面/请求异常;完整原报告、原日志和3张PNG已封存docs,目视确认旧失败已清除、控件与长身份可读。34项内核与八工程36节点各保持原轮身份,不拼称最终发行通过。准备E本地提交,随后F升级/发行兼容修复;一次读取不存在contracts/store文件未写入产品,已用实际执行契约/Store导入继续。
- E真实Edge/Harness首个UI2af1c3af整轮8节点通过,294份冻结输入逐份保持,3张截图已目视核对;追加修正成功检测后的旧失败文案残留,增加实际可见错误清除断言。原8节点报告/日志/PNG保留为修正前结果,重新构建和新UI整轮验证后才提交E。
+5 -3
View File
@@ -5,6 +5,9 @@ import { createHash } from 'node:crypto';
import { planReaBundle, copyReaBundle } from './bundle-rea.mjs';
import { planBrowserBundle, copyBrowserBundle } from './bundle-browser.mjs';
const args = process.argv.slice(2);
if (args.some(value => !['--help', '--immutable'].includes(value))) throw new Error('Unsupported argument; use --help.');
if (args.includes('--help')) { console.log('node scripts/package.mjs [--immutable] - create new portable/source releases and archives; existing release folders are never refreshed.'); process.exit(0); }
const root = process.cwd();
const meta = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const lock = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'));
@@ -13,12 +16,11 @@ const browserPlan = planBrowserBundle(root);
const releases = path.resolve(root, 'releases');
fs.mkdirSync(releases, { recursive: true });
const baseName = 'Agent-Workbench-' + meta.version;
const refresh = process.argv.includes('--refresh');
const buildSuffix = !refresh && (process.argv.includes('--immutable') || fs.existsSync(path.join(releases, baseName + '-win-x64'))) ? '-' + new Date().toISOString().replace(/[-:TZ.]/g, '') : '';
const buildSuffix = args.includes('--immutable') || fs.existsSync(path.join(releases, baseName + '-win-x64')) ? '-' + new Date().toISOString().replace(/[-:TZ.]/g, '') : '';
const portableRoot = path.join(releases, baseName + '-win-x64' + buildSuffix);
const sourceRoot = path.join(releases, baseName + '-source' + buildSuffix);
for (const target of [portableRoot, sourceRoot]) {
if (!path.resolve(target).startsWith(releases + path.sep) || (fs.existsSync(target) && !refresh)) throw new Error('Release output must be a new folder under releases.');
if (!path.resolve(target).startsWith(releases + path.sep) || fs.existsSync(target)) throw new Error('Release output must be a new folder under releases.');
fs.mkdirSync(target, { recursive: true });
}
+1
View File
@@ -6,6 +6,7 @@ const prefixes = Object.freeze({
'1.10.1': 'browser-hotfix', '1.11.0': 'task-plans', '1.12.0': 'model-center',
'1.12.1': 'milestone-audit',
'1.13.0': 'workers',
'1.14.0': 'controlled-engine',
});
export function releaseEvidencePrefix(version) {
const prefix = prefixes[version];
+10 -4
View File
@@ -64,7 +64,7 @@ export async function upgradeRunning({ url, pid, currentRoot, newRoot, handlerRo
if (!fs.existsSync(originalScript) || !fs.existsSync(upgradeScript) || !fs.existsSync(path.join(next, 'dist-client', 'index.html'))) throw new Error('Upgrade bundles are incomplete.');
if (!Number.isInteger(pid) || pid < 1 || pid === process.pid) throw new Error('Invalid target process.');
const before = await readUpgradeJson(origin + '/api/bootstrap', 5000, 'Read original Workbench');
if (!before.token || !['0.1.0', '1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(before.version)) throw new Error('This migration accepts a supported existing Workbench.');
if (!before.token || !['0.1.0', '1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(before.version)) throw new Error('This migration accepts a supported existing Workbench.');
if (before.sessions.some(session => ['running', 'awaiting_approval', 'stopping'].includes(session.status))) throw new Error('Wait for existing tasks and approvals before upgrading.');
let protocol, socket, enabledHere = false, paused = false;
const breakpoints = [];
@@ -150,9 +150,15 @@ export async function upgradeRunning({ url, pid, currentRoot, newRoot, handlerRo
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
const args = Object.fromEntries(process.argv.slice(2).reduce((items, value, index, all) => {
if (value.startsWith('--')) items.push([value.slice(2), all[index + 1]]); return items;
}, []));
const raw = process.argv.slice(2), args = {}, options = new Set(['url', 'pid', 'current-root', 'new-root', 'handler-root']);
if (raw.length === 1 && raw[0] === '--help') { console.log('node scripts/upgrade-running.mjs --pid PID --current-root DIR --new-root DIR [--url http://127.0.0.1:4318] [--handler-root DIR]'); process.exit(0); }
for (let index = 0; index < raw.length; index += 2) {
const key = raw[index].startsWith('--') ? raw[index].slice(2) : '';
if (!options.has(key) || Object.hasOwn(args, key) || !raw[index + 1] || raw[index + 1].startsWith('--')) throw new Error('Unknown or incomplete argument; use --help.');
args[key] = raw[index + 1];
}
if (!/^\d+$/.test(args.pid ?? '') || !path.isAbsolute(args['current-root'] ?? '') || !path.isAbsolute(args['new-root'] ?? '')
|| args['handler-root'] !== undefined && !path.isAbsolute(args['handler-root'])) throw new Error('PID and absolute current/new roots are required arguments; use --help.');
const result = await upgradeRunning({ url: args.url || 'http://127.0.0.1:4318', pid: Number(args.pid), currentRoot: args['current-root'], newRoot: args['new-root'], handlerRoot: args['handler-root'] });
console.log(JSON.stringify(result, null, 2));
}
+17 -12
View File
@@ -6,25 +6,29 @@ import { spawn, execFileSync } from 'node:child_process';
import { gitEnvironment } from '../src/core/git-process.mjs';
import { randomUUID } from 'node:crypto';
if (process.argv.slice(2).some(value => value !== '--help')) throw new Error('Unsupported argument; use --help.');
if (process.argv.includes('--help')) { console.log('node scripts/verify-all-ui.mjs - run serial desktop/390px checks in independent local hosts; use explicit QA Python/Harness/Purge source paths for 1.14.'); process.exit(0); }
const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version;
assert.ok(['1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(version), 'Review evidence paths when introducing the next release.');
assert.ok(['1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version), 'Review evidence paths when introducing the next release.');
const prefix = releaseEvidencePrefix(version), resultFile = `.qa/${prefix}-all-ui-validation.json`, results = [];
const qaEnvironment = process.env.AGENT_WORKBENCH_TEST_PYTHON ? { AGENT_WORKBENCH_TEST_PYTHON: process.env.AGENT_WORKBENCH_TEST_PYTHON } : {};
if (qaEnvironment.AGENT_WORKBENCH_TEST_PYTHON) assert.ok(path.isAbsolute(qaEnvironment.AGENT_WORKBENCH_TEST_PYTHON) && fs.existsSync(qaEnvironment.AGENT_WORKBENCH_TEST_PYTHON), 'Use an existing absolute QA Python interpreter.');
const qaEnvironment = Object.fromEntries(['AGENT_WORKBENCH_TEST_PYTHON', 'AGENT_WORKBENCH_DEEPSEEK_ROOT', 'AGENT_WORKBENCH_PURGE_178_ROOT', 'AGENT_WORKBENCH_PURGE_181_ROOT']
.filter(name => process.env[name]).map(name => [name, process.env[name]]));
for (const [name, value] of Object.entries(qaEnvironment)) assert.ok(path.isAbsolute(value) && fs.existsSync(value), 'Use an existing absolute QA runtime/source path: ' + name);
const cases = [
...(version === '1.13.0' ? [['verify-workers-ui.mjs', null]] : []),
...(['1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(version) ? [['verify-task-plans-ui.mjs', `docs/${prefix}-task-ui-validation.json`]] : []),
...(['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(version) ? [['verify-browser-ui.mjs', `docs/${prefix}-browser-ui-validation.json`]] : []),
...(version === '1.14.0' ? [['verify-controlled-ui.mjs', null], ['verify-purge-ui.mjs', null]] : []),
...(['1.13.0', '1.14.0'].includes(version) ? [['verify-workers-ui.mjs', null]] : []),
...(['1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version) ? [['verify-task-plans-ui.mjs', `docs/${prefix}-task-ui-validation.json`]] : []),
...(['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version) ? [['verify-browser-ui.mjs', `docs/${prefix}-browser-ui-validation.json`]] : []),
['verify-ui.mjs', '.qa/ui-validation.json'], ['verify-diagnostics-ui.mjs', '.qa/diagnostics-ui-validation.json'],
['verify-execution-ui.mjs', '.qa/execution-ui-validation.json'], ['verify-delivery-ui.mjs', '.qa/delivery-ui-validation.json'],
['verify-index-ui.mjs', '.qa/index-ui-result.json'], ['verify-change-sets-ui.mjs', `docs/${prefix}-batch-ui-validation.json`],
['verify-context-ui.mjs', `.qa/${version === '1.6.0' ? 'workspaces-context' : prefix}-ui-validation.json`],
['verify-workspaces-ui.mjs', `docs/${prefix === 'workspaces' ? prefix : prefix + '-workspaces'}-ui-validation.json`],
...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(version) ? [['verify-python-ui.mjs', `docs/${prefix}-python-ui-validation.json`]] : []),
...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(version) ? [['verify-react-delivery.mjs', version === '1.7.0' ? 'docs/react-engine-delivery-validation.json' : `docs/${prefix}-react-delivery-validation.json`]] : []),
...(['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(version) ? [['verify-research-ui.mjs', `docs/${prefix}-research-ui-validation.json`]] : []),
...(['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(version) ? [['verify-engines-ui.mjs', version === '1.9.0' ? 'docs/engines-ui-validation.json' : `docs/${prefix}-engines-ui-validation.json`]] : []),
...(['1.12.0', '1.12.1', '1.13.0'].includes(version) ? ['model-center', 'project-memory', 'task-checkpoints', 'skills', 'mcp', 'mcp-recovery'].map(name => [`verify-${name}-ui.mjs`, null]) : []),
...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version) ? [['verify-python-ui.mjs', `docs/${prefix}-python-ui-validation.json`]] : []),
...(['1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version) ? [['verify-react-delivery.mjs', version === '1.7.0' ? 'docs/react-engine-delivery-validation.json' : `docs/${prefix}-react-delivery-validation.json`]] : []),
...(['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version) ? [['verify-research-ui.mjs', `docs/${prefix}-research-ui-validation.json`]] : []),
...(['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version) ? [['verify-engines-ui.mjs', version === '1.9.0' ? 'docs/engines-ui-validation.json' : `docs/${prefix}-engines-ui-validation.json`]] : []),
...(['1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(version) ? ['model-center', 'project-memory', 'task-checkpoints', 'skills', 'mcp', 'mcp-recovery'].map(name => [`verify-${name}-ui.mjs`, null]) : []),
];
fs.mkdirSync('.qa', { recursive: true });
const externalHost = new Set(['verify-ui.mjs', 'verify-diagnostics-ui.mjs', 'verify-execution-ui.mjs', 'verify-index-ui.mjs']);
@@ -83,7 +87,8 @@ for (const [script, fixedProof] of cases) {
assert.ok(Array.isArray(passed) && passed.length > 0);
const errors = evidence.pageErrors ?? [], failures = evidence.requestFailures ?? [];
assert.equal(errors.length, 0); assert.equal(failures.length, 0);
const saved = script === 'verify-ui.mjs' ? `docs/${prefix}-basic-ui-validation.json`
const saved = ['verify-controlled-ui.mjs', 'verify-purge-ui.mjs'].includes(script) ? `docs/${prefix}-${script.replace('verify-', '').replace('-ui.mjs', '')}-final-ui-validation.json`
: script === 'verify-ui.mjs' ? `docs/${prefix}-basic-ui-validation.json`
: ['verify-workspaces-ui.mjs', 'verify-task-plans-ui.mjs'].includes(script) ? proof
: `docs/${prefix}-${script.replace('verify-', '').replace('.mjs', '')}-validation.json`;
if (path.resolve(saved) !== path.resolve(proof)) fs.copyFileSync(proof, saved);
+1 -1
View File
@@ -34,7 +34,7 @@ child.stdout.on('data', value => { output += value; for (const line of output.sp
child.stderr.on('data', value => { errors += value; });
const wait = async predicate => { const deadline = Date.now() + 15000; while (!await predicate()) { if (Date.now() > deadline) throw new Error('UI fixture timed out: ' + errors); await new Promise(resolve => setTimeout(resolve, 40)); } };
await wait(() => url); const bootstrap = await (await fetch(url + '/api/bootstrap')).json();
assert.ok(['1.4.0', '1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
assert.ok(['1.4.0', '1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
const proofPrefix = releaseEvidencePrefix(bootstrap.version) + '-batch';
const screenshotPrefix = bootstrap.version === '1.4.0' ? '1.4-batch' : proofPrefix;
const api = async (route, input) => { const response = await fetch(url + '/api' + route, { method: input === undefined ? 'GET' : 'POST', headers: { 'Content-Type': 'application/json', 'X-Workbench-Token': bootstrap.token, Connection: 'close' },
+1 -1
View File
@@ -77,7 +77,7 @@ child.stderr.on('data', bytes => { errors += bytes.toString('utf8'); });
const until = async predicate => { const deadline = Date.now() + 20000; while (!await predicate()) { if (Date.now() > deadline) throw new Error('Context UI fixture timeout: ' + errors); await new Promise(resolve => setTimeout(resolve, 40)); } };
await until(() => url || child.exitCode !== null); assert.ok(url, errors);
const bootstrap = await (await fetch(url + '/api/bootstrap', { headers: { Connection: 'close' } })).json();
assert.ok(['1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
assert.ok(['1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.6.2', '1.7.0', '1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
const api = async route => { const response = await fetch(url + '/api' + route, { headers: { 'X-Workbench-Token': bootstrap.token, Connection: 'close' } }); const value = await response.json(); assert.ok(response.ok, value.error); return value; };
const proofPrefix = bootstrap.version === '1.6.0' ? 'workspaces-context' : releaseEvidencePrefix(bootstrap.version);
const browser = await chromium.launch({ channel: 'msedge', headless: true }), page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
+193
View File
@@ -0,0 +1,193 @@
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
import assert from 'node:assert/strict';
import { spawn, execFileSync } from 'node:child_process';
import { createHash, randomUUID } from 'node:crypto';
import { fileURLToPath } from 'node:url';
import { gitEnvironment } from '../src/core/git-process.mjs';
import { assertToolPairs, call } from '../tests/helpers.mjs';
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
const wait = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds));
async function until(predicate, timeout = 45000) {
const deadline = Date.now() + timeout;
while (!await predicate()) { if (Date.now() > deadline) throw new Error('Owned compiled-engine acceptance timed out.'); await wait(50); }
}
// This verifier supplies a declared local response algorithm. The executing
// Runtime/Store/permissions/native bridge all belong to the compiled host.
export async function verifyControlledApi({ api, url, token, directory, appRoot, contained = false }) {
const origin = new URL(url);
assert.equal(origin.hostname, '127.0.0.1'); assert.notEqual(origin.port, '4318');
const bootstrap = await api('/bootstrap'); assert.equal(bootstrap.version, '1.14.0');
assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
const root = path.join(directory, 'compiled-controlled-node'), hooks = path.join(directory, 'disabled-hooks');
fs.mkdirSync(root); fs.mkdirSync(hooks);
fs.cpSync(path.join(appRoot, 'benchmarks/workers-delivery-v1/node'), root, { recursive: true });
fs.writeFileSync(path.join(root, '.gitignore'), 'dist/\nnode_modules/\n.awb-*\n');
for (const name of ['owner-staged.txt', 'owner-unstaged.txt']) fs.writeFileSync(path.join(root, name), 'Owner baseline\n');
const git = args => execFileSync('git', ['-c', 'core.hooksPath=' + hooks, ...args], { cwd: root, env: gitEnvironment(), encoding: 'utf8', windowsHide: true, timeout: 15000 });
git(['init', '--initial-branch=main']); git(['config', 'core.autocrlf', 'false']); git(['config', 'user.name', 'Workbench QA']); git(['config', 'user.email', 'qa@workbench.invalid']);
git(['add', '--', '.']); git(['commit', '--no-gpg-sign', '-m', 'Seal compiled controlled-engine acceptance']);
const initialHead = git(['rev-parse', 'HEAD']).trim(), writable = ['src/add.mjs', 'src/range.mjs'];
const protectedFiles = Object.fromEntries(git(['ls-files', '-z']).split('\0').filter(name => name && !writable.includes(name) && !name.startsWith('owner-'))
.map(name => [name, fs.readFileSync(path.join(root, name))]));
fs.writeFileSync(path.join(root, 'owner-staged.txt'), 'Owner staged change\n'); git(['add', '--', 'owner-staged.txt']);
fs.writeFileSync(path.join(root, 'owner-staged.txt'), 'Owner working copy after staging\n'); fs.writeFileSync(path.join(root, 'owner-unstaged.txt'), 'Owner unstaged change\n');
fs.writeFileSync(path.join(root, 'owner-untracked.txt'), 'Owner untracked file\n');
const owner = () => ({ staged: git(['show', ':owner-staged.txt']), stagedDiff: git(['diff', '--cached', '--binary', '--', 'owner-staged.txt']),
files: Object.fromEntries(['owner-staged.txt', 'owner-unstaged.txt', 'owner-untracked.txt'].map(name => [name, fs.readFileSync(path.join(root, name)).toString('base64')])) });
const originalOwner = owner(), verifyProtected = target => { for (const [name, bytes] of Object.entries(protectedFiles)) assert.deepEqual(fs.readFileSync(path.join(target, name)), bytes, name); };
const requests = [], reviews = [], cases = [], originalRuns = [], exports = [];
const mark = text => { cases.push(text); console.log('PASS ' + text); };
let phase = 'new', childRoute, parentRoute, group;
const modelServer = http.createServer(async (request, response) => {
try {
assert.equal(request.url, '/v1/chat/completions'); assert.equal(request.headers.authorization, 'Bearer owned-compiled-engine-fixture');
const chunks = []; for await (const chunk of request) chunks.push(chunk);
const input = JSON.parse(Buffer.concat(chunks)); assert.equal(input.model, 'owned-compiled-engineering'); assertToolPairs(input.messages);
const session = await api(childRoute), job = session.execution.checks.at(-1), plan = session.execution.plans.at(-1);
let calls = [];
if (session.changes.some(value => value.status === 'pending')) { /* Host review follows native completion. */ }
else if (phase !== 'fixed' && job) {
assert.equal(job.status, 'failed'); assert.ok(job.results.some(value => value.tests?.failed > 0)); phase = 'fixed';
const fixes = { 'src/add.mjs': 'export function add(left, right) {\n if (!Number.isFinite(left) || !Number.isFinite(right)) throw new TypeError("finite numeric inputs required");\n return left + right;\n}\n',
'src/range.mjs': 'export function inclusiveRange(start, end) {\n if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || end < start || end - start >= 10000) throw new RangeError("bounded ascending integer range required");\n return Array.from({ length: end - start + 1 }, (_, index) => start + index);\n}\n' };
calls = Object.entries(fixes).map(([name, content]) => call(randomUUID(), 'propose_file', { path: name, content, reason: 'Declared local acceptance repair; retain protected tests and configuration.' }));
} else if (phase === 'fixed' && job?.status === 'passed') assert.equal(job.results[0].tests.passed, 8);
else if (!plan || job?.planId === plan.id) calls = [call(randomUUID(), 'plan_checks', { names: ['test', 'build'] })];
else calls = [call(randomUUID(), 'run_checks', { plan_id: plan.id })];
requests.push({ input, phase, calls });
response.writeHead(200, { 'Content-Type': 'application/json' }); response.end(JSON.stringify({ choices: [{ message: { role: 'assistant', content: calls.length ? '' : 'Owned compiled native run complete; host proof remains required.',
...(calls.length ? { tool_calls: calls } : {}) }, finish_reason: calls.length ? 'tool_calls' : 'stop' }], usage: { prompt_tokens: 123, completion_tokens: 45, total_tokens: 168 } }));
} catch (error) { response.writeHead(500, { 'Content-Type': 'application/json' }); response.end(JSON.stringify({ error: { message: error.message } })); }
});
await new Promise(resolve => modelServer.listen(0, '127.0.0.1', resolve));
try {
await api('/config', { mode: 'compatible', model: 'owned-compiled-engineering', baseUrl: 'http://127.0.0.1:' + modelServer.address().port + '/v1', apiKey: 'owned-compiled-engine-fixture', contextLimit: 64000 });
const project = await api('/projects', { root }), parent = await api('/sessions', { projectId: project.id }); parentRoute = '/sessions/' + parent.id;
const installation = await api('/engines/deepseek/controlled-availability'); assert.equal(installation.controlledStatus, 'available', installation.message);
assert.equal(installation.version, '0.2.1-rc.2');
if (contained) assert.equal(fs.realpathSync.native(installation.node.path), fs.realpathSync.native(path.join(appRoot, 'runtime/node.exe')));
const source = await api('/engines/purge/source'); assert.equal(source.status, 'available', source.message); assert.equal(source.defaultEnabled, false);
const planned = await api(parentRoute + '/collaborations', { goal: 'Deliver compiled controlled-engine Node library with retained failures, review, checks and Git.',
engine: { id: 'deepseek-harness', root: installation.root, controlledSha256: installation.controlledSha256,
strategy: { kind: 'purge-prompt-experiment', root: source.root, sourceSha256: source.sourceSha256, prompt: '保留原测试与 {{compiled_literal}},按实际失败修复已允许源码,等待宿主审批。' } },
budget: { maxTokens: 200000, maxSteps: 64, maxToolCalls: 128, maxDurationMs: 600000 },
children: [{ label: 'engine-compiled-node', goal: 'Repair two source modules and pass the original 8 tests and build.', paths: writable }] });
group = planned.group;
const groupState = async () => (await api(parentRoute + '/collaborations')).groups.find(value => value.id === group.id);
const operation = name => api(parentRoute + '/collaborations/' + group.id + '/' + name, { fingerprint: group.fingerprint });
await operation('prepare'); await until(async () => { group = await groupState(); return !['preparing', 'planned'].includes(group.status); });
assert.equal(group.status, 'ready', group.summary); const child = group.children[0]; childRoute = '/sessions/' + child.sessionId;
const childProject = (await api('/bootstrap')).projects.find(value => value.id === child.projectId);
assert.notEqual(childProject.root, root); verifyProtected(childProject.root); assert.deepEqual(owner(), originalOwner); assert.equal(requests.length, 0);
mark('compiled host seals actual Harness/source identities and prepares one owned worktree while retaining parent bytes and staging');
const apply = async (route, set) => { reviews.push({ action: 'apply reviewed change set', id: set.id, fingerprint: set.fingerprint, paths: set.files.map(value => value.path) });
await api(route + '/change-sets/' + set.id + '/apply', { fingerprint: set.fingerprint });
let state; await until(async () => { state = await api(route + '/change-sets/' + set.id); return !['prepared', 'applying'].includes(state.status); }); assert.equal(state.status, 'completed', state.summary); };
for (let turn = 0; turn < 4 && group.status !== 'ready_to_collect'; turn++) {
let current = await api(childRoute); const pending = current.changes.filter(value => value.status === 'pending');
if (pending.length) { assert.equal(group.status, 'awaiting_review'); const next = await api(childRoute + '/change-sets', { changeIds: pending.map(value => value.id) }); await apply(childRoute, next.execution.changeSets.at(-1)); }
await operation('start');
await until(async () => {
current = await api(childRoute);
for (const approval of current.approvals.filter(value => value.status === 'pending')) {
const event = current.events.find(value => value.id === approval.eventId); assert.equal(event.tool, 'run_checks');
const plan = current.execution.plans.at(-1); assert.deepEqual(plan.checks.map(value => value.name), ['test', 'build']);
reviews.push({ action: 'approve original check', id: approval.id, taskId: approval.taskId, invocationId: approval.invocationId, planId: plan.id, contractSha256: plan.contractSha256 });
await api(childRoute + '/approvals/' + approval.id, { allow: true });
}
group = await groupState(); return ['ready_to_collect', 'awaiting_review', 'paused', 'unknown', 'failed', 'stale'].includes(group.status);
}, 120000);
const run = (await api(childRoute + '/engine-runs')).at(-1); assert.equal(run.status, 'completed', run.error); assert.equal(run.nativeSummary.treeConfirmed, true);
const response = await fetch(url + '/api' + childRoute + '/engine-runs/' + run.id + '/download', { headers: { 'X-Workbench-Token': token, Connection: 'close' } });
assert.equal(response.status, 200); const bytes = Buffer.from(await response.arrayBuffer()); assert.equal(sha(bytes), run.reportSha256);
const original = JSON.parse(bytes); assert.equal(original.native.stderr, ''); assert.equal(original.native.cleanup.treeConfirmed, true);
assert.equal(original.native.activity.endEvents[0].data.reason.kind, 'completed');
assert.equal(original.native.readiness.promptExperimentSha256, run.installation.strategy.sha256);
const saved = path.join(directory, 'compiled-engine-original-' + run.id + '.json'); fs.writeFileSync(saved, bytes); originalRuns.push({ run, original, reportPath: saved, sha256: sha(bytes) });
}
assert.equal(group.status, 'ready_to_collect', group.summary); const current = await api(childRoute);
assert.ok(current.execution.checks.some(value => value.status === 'failed' && value.results.some(result => result.tests?.failed > 0)));
assert.equal(current.execution.checks.at(-1).status, 'passed'); assert.equal(current.execution.checks.at(-1).results[0].tests.passed, 8);
assert.equal(current.execution.task.usage.requests, requests.length); assert.equal(current.execution.task.usage.totalTokens, requests.length * 168);
for (const request of requests) assert.equal(request.input.messages.filter(value => value.role === 'system').map(value => value.content).join('').split(group.children[0].engine.strategy.section.text).length - 1, 1);
verifyProtected(childProject.root); assert.deepEqual(owner(), originalOwner);
mark('compiled native execution retains failing tests, requires original check approvals, seals literal prompt/model/receipts/results and accounts each owned HTTP request once');
await operation('collect'); await until(async () => { group = await groupState(); return group.status !== 'collecting'; }); assert.equal(group.status, 'collected', group.summary);
const collection = await api(parentRoute + '/collaborations/' + group.id + '/collection'); assert.deepEqual(collection.conflicts, []); assert.deepEqual(collection.paths, writable);
await operation('merge'); await until(async () => { group = await groupState(); return ['merge_prepared', 'unknown', 'stale'].includes(group.status); }); assert.equal(group.status, 'merge_prepared', group.summary);
await apply(parentRoute, (await api(parentRoute + '/change-sets/' + group.merge.changeSetId)));
const checkPlan = (await api(parentRoute + '/check-plans', { names: ['test', 'build'] })).execution.plans.at(-1);
const accepted = (await api(parentRoute + '/check-jobs', { planId: checkPlan.id })).execution.checks.at(-1); let check;
await until(async () => { check = await api(parentRoute + '/check-jobs/' + accepted.id); return !['queued', 'running'].includes(check.status); });
assert.equal(check.status, 'passed', check.summary); assert.equal(check.results[0].tests.passed, 8); verifyProtected(root);
mark('compiled parent review and immutable merge pass the original 8 functional tests and actual ESM build');
const deliveryPlan = (await api(parentRoute + '/delivery-plans', { message: 'feat: deliver compiled controlled-engine Node repair' })).execution.deliveryPlans.at(-1);
assert.deepEqual(deliveryPlan.paths, writable);
const deliveryId = (await api(parentRoute + '/delivery-jobs', { planId: deliveryPlan.id })).execution.deliveries.at(-1).id; let delivery;
await until(async () => { delivery = await api(parentRoute + '/delivery-jobs/' + deliveryId); return ['completed', 'failed', 'cancelled', 'unknown'].includes(delivery.status); });
assert.equal(delivery.status, 'completed', delivery.summary); assert.equal(git(['rev-parse', 'HEAD^']).trim(), initialHead);
assert.deepEqual(git(['diff-tree', '--no-commit-id', '--name-only', '-r', 'HEAD']).trim().split('\n'), writable);
assert.deepEqual(owner(), originalOwner); verifyProtected(root); await operation('finalize'); group = await groupState(); assert.equal(group.status, 'completed', group.summary);
for (const route of [parentRoute, childRoute]) { const value = await api(route); const file = path.join(directory, value.id + '-session.json'); fs.writeFileSync(file, JSON.stringify(value, null, 2)); exports.push({ id: value.id, file, sha256: sha(fs.readFileSync(file)) }); }
mark('compiled Git delivery contains only reviewed modules, preserves staged/unstaged/untracked owner bytes and completes the parent with sealed original evidence');
return { success: true, version: bootstrap.version, appRoot, contained, cases, root, group, requests, reviews, originalRuns, exports,
protectedFiles: Object.fromEntries(Object.entries(protectedFiles).map(([name, bytes]) => [name, sha(bytes)])), owner: originalOwner, installation, purgeSource: source,
checks: check, delivery, fixtureModelRequests: requests.length, realModelRequests: 0,
scope: 'Actual compiled host, local native Harness, checks/reviews/Git and an explicitly owned HTTP response fixture. No configured model or upstream Purge plugin executes; real inference benefit remains unmeasured.' };
} catch (error) {
const sessions = [];
for (const route of [parentRoute, childRoute].filter(Boolean)) { try { sessions.push(await api(route)); } catch {} }
fs.writeFileSync(path.join(directory, 'compiled-api-failure.json'), JSON.stringify({ success: false, error: error.stack, cases, group, requests, reviews, originalRuns, sessions, realModelRequests: 0 }, null, 2));
throw error;
} finally {
if (group?.status === 'running') { try { await api(parentRoute + '/collaborations/' + group.id + '/stop', { fingerprint: group.fingerprint }); } catch {} }
modelServer.closeAllConnections(); await new Promise(resolve => modelServer.close(resolve));
}
}
export async function verifyControlledRelease(appRoot = process.cwd()) {
appRoot = fs.realpathSync.native(appRoot);
const directory = path.resolve('.qa', 'compiled-controlled-' + randomUUID()); fs.mkdirSync(directory, { recursive: true });
const node = fs.existsSync(path.join(appRoot, 'runtime/node.exe')) ? path.join(appRoot, 'runtime/node.exe') : process.execPath;
const env = { ...gitEnvironment(), ...Object.fromEntries(['AGENT_WORKBENCH_DEEPSEEK_ROOT', 'AGENT_WORKBENCH_PURGE_ROOT'].filter(name => process.env[name]).map(name => [name, process.env[name]])),
AGENT_WORKBENCH_APP_DIR: appRoot, AGENT_WORKBENCH_DATA_DIR: path.join(directory, 'data'), AGENT_WORKBENCH_PORT: '0' };
const child = spawn(node, [path.join(appRoot, 'dist-server/server.mjs')], { cwd: appRoot, env, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
let output = '', errors = '', url = '', result, bootstrap;
child.stdout.on('data', bytes => { output += bytes.toString('utf8'); for (const line of output.split('\n')) { try { const value = JSON.parse(line); if (value.ready) url = value.url; } catch {} } });
child.stderr.on('data', bytes => { errors += bytes.toString('utf8'); });
const api = async (route, input) => {
const response = await fetch(url + '/api' + route, { method: input === undefined ? 'GET' : 'POST', signal: AbortSignal.timeout(30000),
headers: { 'Content-Type': 'application/json', 'X-Workbench-Token': bootstrap.token, Connection: 'close' }, ...(input === undefined ? {} : { body: JSON.stringify(input) }) });
const value = await response.json(); assert.equal(response.ok, true, value.error); return value;
};
try {
await until(() => url || child.exitCode !== null, 15000); assert.ok(url, errors);
bootstrap = await (await fetch(url + '/api/bootstrap', { signal: AbortSignal.timeout(5000) })).json();
const health = await api('/health'); assert.equal(health.pid, child.pid);
result = await verifyControlledApi({ api, url, token: bootstrap.token, directory, appRoot, contained: node !== process.execPath });
} catch (error) { result = { success: false, appRoot, directory, error: error.stack, realModelRequests: 0 }; throw error; }
finally {
try { if (url && bootstrap && child.exitCode === null) { await api('/shutdown', {}); await until(() => child.exitCode !== null || child.signalCode !== null, 15000); } }
finally {
if (child.exitCode === null && child.signalCode === null) {
if (process.platform === 'win32') { try { execFileSync('taskkill.exe', ['/PID', String(child.pid), '/T', '/F'], { windowsHide: true, timeout: 10000 }); } catch { child.kill(); } } else child.kill();
}
fs.writeFileSync(path.join(directory, 'host-stdout-log.txt'), output); fs.writeFileSync(path.join(directory, 'host-stderr-log.txt'), errors);
Object.assign(result ??= { success: false }, { directory, pid: child.pid, rootExited: child.exitCode !== null || child.signalCode !== null, exit: { code: child.exitCode, signal: child.signalCode } });
fs.writeFileSync(path.join(directory, 'result.json'), JSON.stringify(result, null, 2));
console.log('EVIDENCE ' + directory);
}
}
assert.equal(result.rootExited, true); assert.equal(result.exit.code, 0); return result;
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
const args = process.argv.slice(2);
if (args.length === 1 && args[0] === '--help') { console.log('node scripts/verify-controlled-release.mjs [--app-root DIR] - run an actual compiled local host/native Harness/owned model/Node repair/check/review/Git/prompt acceptance in independent data. Requires explicit Harness and Purge source paths.'); process.exit(0); }
assert.ok(!args.length || args.length === 2 && args[0] === '--app-root' && path.isAbsolute(args[1]), 'Unsupported argument; use --help.');
const result = await verifyControlledRelease(args[1]); console.log(JSON.stringify({ success: result.success, version: result.version, directory: result.directory, cases: result.cases.length,
rootExited: result.rootExited, fixtureModelRequests: result.fixtureModelRequests, realModelRequests: 0 }));
}
+8 -5
View File
@@ -6,6 +6,8 @@ import { spawn } from 'node:child_process';
import net from 'node:net';
import { createResearchSamples } from './research-fixtures.mjs';
import { verifyBrowserApi } from './verify-browser.mjs';
import { verifyControlledApi } from './verify-controlled-release.mjs';
import { gitEnvironment } from '../src/core/git-process.mjs';
if (process.argv.includes('--help')) { console.log('node scripts/verify-release.mjs [--native-engines] - validate the latest immutable portable release in an isolated host.'); process.exit(0); }
if (process.argv.slice(2).some(value => value !== '--native-engines')) throw new Error('Unsupported argument; use --help.');
@@ -26,7 +28,7 @@ const portProbe = net.createServer();
await new Promise((resolve, reject) => { portProbe.once('error', reject); portProbe.listen(0, '127.0.0.1', resolve); });
const port = portProbe.address().port;
await new Promise(resolve => portProbe.close(resolve));
const env = { ...process.env, AGENT_WORKBENCH_DATA_DIR: data, AGENT_WORKBENCH_PORT: String(port) };
const env = { ...gitEnvironment(), ...Object.fromEntries(['AGENT_WORKBENCH_DEEPSEEK_ROOT', 'AGENT_WORKBENCH_PURGE_ROOT'].filter(name => process.env[name]).map(name => [name, process.env[name]])), AGENT_WORKBENCH_DATA_DIR: data, AGENT_WORKBENCH_PORT: String(port) };
delete env.AGENT_WORKBENCH_API_KEY;
for (const name of Object.keys(env)) if (name.toLowerCase() === 'path') delete env[name];
const windowsRoot = process.env.SystemRoot || 'C:\\Windows';
@@ -95,7 +97,7 @@ try {
const checkLog = await api('/artifacts/' + checked.results[0].logArtifactId + '?session=' + session.id); assert.match(checkLog.content, /tests 4/);
assert.ok(fs.existsSync(path.join(appRoot, 'runtime/node_modules/npm/bin/npm-cli.js')));
const actualRea = [];
if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(manifest.version)) {
if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(manifest.version)) {
const installation = await api('/research/availability'); assert.equal(installation.status, 'available'); assert.equal(installation.version, '6.8.0');
assert.equal(fs.realpathSync.native(installation.packageRoot), fs.realpathSync.native(path.join(appRoot, 'runtime/node_modules/rea-agents')));
assert.equal(fs.realpathSync.native(installation.node.path), fs.realpathSync.native(path.join(appRoot, 'runtime/node.exe')));
@@ -127,7 +129,7 @@ try {
console.log('PASS actual contained REA: ASAR, PE imports and PE resources; zero target execution/model requests');
}
let actualEngine = null;
if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(manifest.version) && process.argv.includes('--native-engines')) {
if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(manifest.version) && process.argv.includes('--native-engines')) {
const installation = await api('/engines/deepseek/availability'); assert.equal(installation.status, 'available', installation.message);
assert.equal(fs.realpathSync.native(installation.node.path), fs.realpathSync.native(path.join(appRoot, 'runtime/node.exe')));
const engineRoot = path.join(data, 'engine-project'); fs.mkdirSync(engineRoot); fs.writeFileSync(path.join(engineRoot, 'README.md'), '# Owned portable engine connection\n');
@@ -147,11 +149,12 @@ try {
assert.equal((await api('/research')).length, 4);
const page = await fetch(url); assert.equal(page.status, 200);
assert.match(await page.text(), /Agent Workbench/);
const actualBrowser = ['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(manifest.version) ? await verifyBrowserApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null;
const actualBrowser = ['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(manifest.version) ? await verifyBrowserApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null;
const actualControlled = manifest.version === '1.14.0' ? await verifyControlledApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null;
console.log((await stop()).trim()); started = false;
await until(async () => { try { await fetch(url + '/api/health'); return false; } catch { return true; } });
const result = { success: true, date: new Date().toISOString(), appRoot, version: manifest.version, nodeVersion: manifest.nodeVersion,
verifiedFiles: manifest.files.length, url, reusedPid: firstInfo.pid, checks: { jobId, status: checked.status, tests: checked.results[0].tests }, actualRea, actualEngine, actualBrowser,
verifiedFiles: manifest.files.length, url, reusedPid: firstInfo.pid, checks: { jobId, status: checked.status, tests: checked.results[0].tests }, actualRea, actualEngine, actualBrowser, actualControlled,
steps: ['manifest hashes', 'bundled Node launch', 'same-service reuse', 'packaged example and static page', 'explicit command consent', 'actual bundled Node version', 'actual bundled npm check without system Node/npm', 'check log artifact', ...(actualRea.length ? ['contained REA installation and Node identity', 'actual ASAR/imports/resources', 'original Bundle and target hash binding', 'verified reuse without producer replay'] : []), 'report availability', 'graceful stop'], realModel: false };
fs.writeFileSync('.qa/release-validation.json', JSON.stringify(result, null, 2));
console.log(JSON.stringify(result, null, 2));
+14 -6
View File
@@ -20,7 +20,7 @@ const files = (root, relative = '') => fs.readdirSync(path.join(root, relative),
.flatMap(entry => entry.isDirectory() ? files(root, path.join(relative, entry.name)) : [path.join(relative, entry.name)]);
const digest = file => createHash('sha256').update(fs.readFileSync(file)).digest('hex');
const expected = Object.fromEntries(['dist-client', 'dist-server'].flatMap(folder => files(path.join(workspace, folder)).map(relative => [path.join(folder, relative), digest(path.join(workspace, folder, relative))])));
const allowedEnv = /^(path|pathext|systemroot|systemdrive|windir|comspec|temp|tmp|userprofile|homedrive|homepath|home|appdata|localappdata|programfiles(?:\(x86\))?|commonprogramfiles(?:\(x86\))?|lang|lc_all|AGENT_WORKBENCH_TEST_PYTHON|AGENT_WORKBENCH_DEEPSEEK_ROOT)$/i;
const allowedEnv = /^(path|pathext|systemroot|systemdrive|windir|comspec|temp|tmp|userprofile|homedrive|homepath|home|appdata|localappdata|programfiles(?:\(x86\))?|commonprogramfiles(?:\(x86\))?|lang|lc_all|AGENT_WORKBENCH_TEST_PYTHON|AGENT_WORKBENCH_DEEPSEEK_ROOT|AGENT_WORKBENCH_PURGE_ROOT)$/i;
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => allowedEnv.test(key)));
const inheritedPath = Object.entries(env).find(([key]) => key.toLowerCase() === 'path')?.[1] || '';
for (const key of Object.keys(env)) if (key.toLowerCase() === 'path') delete env[key];
@@ -82,7 +82,7 @@ try {
assert.deepEqual(actualFiles.slice().sort(), Object.keys(expected).sort());
for (const [relative, sha256] of Object.entries(expected)) assert.equal(digest(path.join(sourceRoot, relative)), sha256, relative);
let actualRea = null;
if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(evidence.version)) {
if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(evidence.version)) {
stage = 'contained REA';
const reaOutput = await run(['scripts/verify-rea.mjs', '--app-root', sourceRoot, '--contained'], 'rea.log');
actualRea = JSON.parse(reaOutput.trim().split('\n').at(-1));
@@ -90,7 +90,7 @@ try {
assert.ok(actualRea.results.every(item => item.rootExited === true));
}
let actualEngine = null;
if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(evidence.version) && process.argv.includes('--native-engines')) {
if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(evidence.version) && process.argv.includes('--native-engines')) {
stage = 'native DeepSeek SDK';
const output = await run(['scripts/verify-engines.mjs'], 'engines.log');
actualEngine = JSON.parse(output.trim().split('\n').at(-1));
@@ -98,7 +98,7 @@ try {
assert.equal(actualEngine.modelRequests, 0); assert.equal(actualEngine.rootExited, true); assert.equal(actualEngine.nativeMethods.length, 6);
}
let actualBrowser = null;
if (['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0'].includes(evidence.version)) {
if (['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0'].includes(evidence.version)) {
stage = 'contained browser runtime';
const output = await run(['scripts/verify-browser.mjs', '--app-root', sourceRoot, '--contained'], 'browser.log');
actualBrowser = JSON.parse(output.trim().split('\n').at(-1));
@@ -107,14 +107,22 @@ try {
assert.ok(actualBrowser.results.every(value => value.status === 'passed' && value.browserExited));
assert.equal(actualBrowser.modelRequests, 0);
}
let actualControlled = null;
if (evidence.version === '1.14.0') {
stage = 'compiled controlled-engine delivery';
const output = await run(['scripts/verify-controlled-release.mjs', '--app-root', sourceRoot], 'controlled-engine.log');
actualControlled = JSON.parse(output.trim().split('\n').at(-1));
assert.equal(actualControlled.success, true); assert.equal(actualControlled.version, evidence.version); assert.equal(actualControlled.rootExited, true);
assert.equal(actualControlled.realModelRequests, 0); assert.equal(actualControlled.cases, 4); assert.ok(actualControlled.fixtureModelRequests > 0);
}
stage = 'tests';
const output = await run(['--test', '--test-concurrency=2', '--test-reporter=tap', ...files(path.join(sourceRoot, 'tests')).filter(file => !file.includes(path.sep) && file.endsWith('.test.mjs')).map(file => path.join('tests', file))], 'tests.tap');
const stats = Object.fromEntries([...output.matchAll(/^# (tests|pass|fail|cancelled|skipped|todo) (\d+)\s*$/gm)].map(match => [match[1], Number(match[2])]));
assert.ok(stats.tests > 0); assert.equal(stats.pass, stats.tests); for (const key of ['fail', 'cancelled', 'skipped', 'todo']) assert.equal(stats[key], 0);
assert.deepEqual(snapshot(), inputs, 'Source package inputs changed during validation.');
const result = { success: true, version: evidence.version, testedAt: new Date().toISOString(), sourceRoot, directory, nodeVersion: process.version, python, offlineInstall: true,
inputs, inputFiles: inputs.length, logs, buildMatchedFiles: Object.keys(expected).length, tests: stats, actualRea, actualEngine, actualBrowser, credentialsHandling: 'Only build/runtime environment paths are inherited; no model configuration or credentials are used.' };
save(result); console.log(JSON.stringify({ success: true, version: result.version, sourceRoot, directory, tests: stats, nodeVersion: process.version, python, inputFiles: inputs.length, buildMatchedFiles: result.buildMatchedFiles, rea: !!actualRea?.success, engine: !!actualEngine?.success, browser: !!actualBrowser?.success }));
inputs, inputFiles: inputs.length, logs, buildMatchedFiles: Object.keys(expected).length, tests: stats, actualRea, actualEngine, actualBrowser, actualControlled, credentialsHandling: 'Only build/runtime environment paths are inherited; no configured model credentials are used. The controlled-engine stage supplies a declared owned local response fixture.' };
save(result); console.log(JSON.stringify({ success: true, version: result.version, sourceRoot, directory, tests: stats, nodeVersion: process.version, python, inputFiles: inputs.length, buildMatchedFiles: result.buildMatchedFiles, rea: !!actualRea?.success, engine: !!actualEngine?.success, browser: !!actualBrowser?.success, controlled: !!actualControlled?.success }));
} catch (error) {
save({ success: false, version: evidence.version, testedAt: new Date().toISOString(), stage, error: error.message, sourceRoot, directory, nodeVersion: process.version, python, inputs, logs });
throw error;
+1 -1
View File
@@ -8,7 +8,7 @@ import { workerHttp } from '../tests/fixtures/workers-http.mjs';
import { workerDefinition, ownerBytes, applyWorkerProposals, approveWorkerChecks } from '../tests/fixtures/workers-project.mjs';
if (process.argv.includes('--help')) { console.log('node scripts/verify-workers-ui.mjs — owned local fixture, real isolated Git/checks/review, desktop/390px, conflicts, stop, recovery and late source errors'); process.exit(0); }
const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version, prefix = version === '1.13.0' ? 'workers' : 'workers-development';
const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version, prefix = version === '1.14.0' ? 'controlled-engine-workers' : version === '1.13.0' ? 'workers' : 'workers-development';
const directory = path.resolve('.qa', 'workers-ui-' + randomUUID()); fs.mkdirSync(directory, { recursive: true });
const disposers = [], t = { after: dispose => disposers.push(dispose) }, f = fixture(t), host = await workerHttp(f);
assert.notEqual(new URL(host.url).port, '4318');
+2
View File
@@ -23,6 +23,8 @@ export class EngineRunner {
this.directoryRoot = directoryRoot; this.drivers = new Map();
}
availability(root) { return resolveControlledInstallation(this.appDirectory, root); }
isActive(sessionId) { return [...this.drivers.values()].some(driver => driver.session.id === sessionId); }
projectActive(projectId, exceptSessionId = null) { return [...this.drivers.values()].some(driver => driver.session.projectId === projectId && driver.session.id !== exceptSessionId); }
selected(input) {
const installation = this.availability(input.root);
if (installation.controlledStatus !== 'available' || installation.controlledSha256 !== input.controlledSha256) {
+2 -2
View File
@@ -38,7 +38,7 @@ export class WorkerManager {
return record ? { ...record, usage: workerUsage(this.store, record), sessionStatus: this.store.session(record.sessionId).status } : { ...child, status: 'unprepared', usage: null };
}) })), worker: workerForProject(this.store, session.projectId) };
}
childActive(id) { return this.runtime.active.has(id) || !!this.runtime.checks?.isActive(id) || !!this.runtime.changeSets?.isActive(id) || !!this.workspaces?.isActive(id); }
childActive(id) { return this.runtime.active.has(id) || !!this.runtime.controlledEngines?.isActive(id) || !!this.runtime.checks?.isActive(id) || !!this.runtime.changeSets?.isActive(id) || !!this.workspaces?.isActive(id); }
isActive(sessionId) { return [...this.active.values()].some(value => value.sessionId === sessionId)
|| [...this.store.core.collaboration.values()].some(group => group.sessionId === sessionId && !COLLABORATION_CLOSED.has(group.status) && group.children.some(child => this.childActive(child.sessionId))); }
projectActive(projectId, excludeGroupId = null) {
@@ -529,7 +529,7 @@ export class WorkerManager {
const report = this.store.owned('artifact', delivery.reportArtifactId, session.id); this.store.artifactStore.read(report);
for (const child of group.children) await this.verifiedResult(group, child);
group.delivery = { jobId: delivery.id, commit: delivery.commit, checkJobId: check.id, reportArtifactId: report.id, reportSha256: report.sha256 };
group.status = 'completed'; group.finishedAt = at(); group.summary = '两个隔离子成果已审查合并,父工程重新检查通过并完成本地Git交付。';
group.status = 'completed'; group.finishedAt = at(); group.summary = group.children.length + ' 个隔离子成果已审查合并,父工程重新检查通过并完成本地Git交付。';
session.status = 'completed'; this.save(session, group, 'completed'); return group;
}
async observe(group) {
+1 -1
View File
@@ -1,6 +1,6 @@
import { randomUUID, createHash } from 'node:crypto';
export const APP_VERSION = '1.13.0';
export const APP_VERSION = '1.14.0';
export function executionEnvironment() {
const windows = process.platform === 'win32';
+3 -3
View File
@@ -14,7 +14,7 @@ import { APP_VERSION } from './diagnostics.mjs';
export function installUpgrade(context, { appDirectory, updateServiceInfo = true }) {
const { server, store, provider, runtime, token, clients, started, exampleProject, shutdown } = context;
if (!server?.listening || !store || !provider || !runtime || !clients || !token) throw new Error('The existing Workbench context is incomplete.');
if (runtime.active.size || runtime.waiters.size || runtime.checks?.active.size || runtime.deliveries?.active.size || runtime.changeSets?.projects.size || runtime.workspaces?.projects.size || runtime.workspaces?.pending.size || runtime.research?.active.size || runtime.engines?.active.size || runtime.browser?.active.size || runtime.taskPlans?.active.size) throw new Error('Wait for active tasks, checks, Git deliveries, file batches, workspaces, research, engines, browsers, task plans and approvals to finish before upgrading.');
if (runtime.active.size || runtime.waiters.size || runtime.workers?.active.size || runtime.controlledEngines?.drivers.size || runtime.mcp?.active.size || runtime.checks?.active.size || runtime.deliveries?.active.size || runtime.changeSets?.projects.size || runtime.workspaces?.projects.size || runtime.workspaces?.pending.size || runtime.research?.active.size || runtime.engines?.active.size || runtime.browser?.active.size || runtime.taskPlans?.active.size) throw new Error('Wait for active tasks, workers, controlled engines, MCP operations, checks, Git deliveries, file batches, workspaces, research, engines, browsers, task plans and approvals to finish before upgrading.');
if (provider.activeRequests || provider.hub?.waiting || [...(provider.hub?.leases.values() ?? [])].some(count => count > 0)) throw new Error('Wait for active model requests and probes before upgrading.');
const root = fs.realpathSync.native(path.resolve(appDirectory));
if (!fs.existsSync(path.join(root, 'dist-client', 'index.html'))) throw new Error('The new client bundle is missing.');
@@ -23,7 +23,7 @@ export function installUpgrade(context, { appDirectory, updateServiceInfo = true
const oldModelPrototypes = { hub: provider.hub ? Object.getPrototypeOf(provider.hub) : null,
importer: provider.hub?.importer ? Object.getPrototypeOf(provider.hub.importer) : null };
const oldStoreProperties = { ...store };
const oldRuntimeProperties = { appDirectory: runtime.appDirectory, checks: runtime.checks, deliveries: runtime.deliveries, codeIndex: runtime.codeIndex, changeSets: runtime.changeSets, contextPlans: runtime.contextPlans, workspaces: runtime.workspaces, research: runtime.research, engines: runtime.engines, browser: runtime.browser, taskPlans: runtime.taskPlans, projectMemories: runtime.projectMemories, taskCheckpoints: runtime.taskCheckpoints, skills: runtime.skills, mcp: runtime.mcp };
const oldRuntimeProperties = { appDirectory: runtime.appDirectory, workers: runtime.workers, controlledEngines: runtime.controlledEngines, checks: runtime.checks, deliveries: runtime.deliveries, codeIndex: runtime.codeIndex, changeSets: runtime.changeSets, contextPlans: runtime.contextPlans, workspaces: runtime.workspaces, research: runtime.research, engines: runtime.engines, browser: runtime.browser, taskPlans: runtime.taskPlans, projectMemories: runtime.projectMemories, taskCheckpoints: runtime.taskCheckpoints, skills: runtime.skills, mcp: runtime.mcp };
const oldUpdates = store.listeners('update');
const closeStorage = () => store.close();
if (oldUpdates.length > 1) throw new Error('Unexpected Store observers; preserve their ownership before upgrading.');
@@ -37,7 +37,7 @@ export function installUpgrade(context, { appDirectory, updateServiceInfo = true
Object.setPrototypeOf(provider.hub, ModelHub.prototype);
if (provider.hub.importer) Object.setPrototypeOf(provider.hub.importer, ConfigImporter.prototype);
}
runtime.appDirectory = root; runtime.checks = null; runtime.deliveries = null; runtime.codeIndex = null; runtime.changeSets = null; runtime.contextPlans = null; runtime.workspaces = null; runtime.research = null; runtime.engines = null; runtime.browser = null; runtime.taskPlans = null; runtime.projectMemories = null; runtime.taskCheckpoints = null; runtime.skills = null; runtime.mcp = null;
runtime.appDirectory = root; runtime.workers = null; runtime.controlledEngines = null; runtime.checks = null; runtime.deliveries = null; runtime.codeIndex = null; runtime.changeSets = null; runtime.contextPlans = null; runtime.workspaces = null; runtime.research = null; runtime.engines = null; runtime.browser = null; runtime.taskPlans = null; runtime.projectMemories = null; runtime.taskCheckpoints = null; runtime.skills = null; runtime.mcp = null;
store.ensureStorage();
// A SQLite host can retain an artifact object from an earlier bundle.
// Reopen the same blobs through the new API without mutating that object;
+7 -7
View File
@@ -106,8 +106,8 @@ export class Runtime {
this.appDirectory = appDirectory;
this.active = new Map(); this.waiters = new Map();
}
isActive(id) { return this.active.has(id) || !!this.workers?.isActive(id) || !!this.checks?.isActive(id) || !!this.deliveries?.isActive(id) || !!this.changeSets?.isActive(id) || !!this.workspaces?.isActive(id) || !!this.research?.isActive(id) || !!this.engines?.isActive(id) || !!this.browser?.isActive(id) || !!this.taskPlans?.isActive(id); }
hasActivity() { return (this.provider.activeRequests ?? 0) > 0 || (this.provider.hub?.waiting ?? 0) > 0 || this.active.size > 0 || (this.workers?.active.size ?? 0) > 0 || (this.checks?.active.size ?? 0) > 0 || (this.deliveries?.active.size ?? 0) > 0 || (this.changeSets?.projects.size ?? 0) > 0 || (this.workspaces?.projects.size ?? 0) > 0 || (this.workspaces?.pending.size ?? 0) > 0 || (this.research?.active.size ?? 0) > 0 || (this.engines?.active.size ?? 0) > 0 || (this.browser?.active.size ?? 0) > 0 || (this.taskPlans?.active.size ?? 0) > 0; }
isActive(id) { return this.active.has(id) || !!this.workers?.isActive(id) || !!this.controlledEngines?.isActive(id) || !!this.checks?.isActive(id) || !!this.deliveries?.isActive(id) || !!this.changeSets?.isActive(id) || !!this.workspaces?.isActive(id) || !!this.research?.isActive(id) || !!this.engines?.isActive(id) || !!this.browser?.isActive(id) || !!this.taskPlans?.isActive(id); }
hasActivity() { return (this.provider.activeRequests ?? 0) > 0 || (this.provider.hub?.waiting ?? 0) > 0 || this.active.size > 0 || (this.workers?.active.size ?? 0) > 0 || (this.controlledEngines?.drivers.size ?? 0) > 0 || (this.mcp?.active.size ?? 0) > 0 || (this.checks?.active.size ?? 0) > 0 || (this.deliveries?.active.size ?? 0) > 0 || (this.changeSets?.projects.size ?? 0) > 0 || (this.workspaces?.projects.size ?? 0) > 0 || (this.workspaces?.pending.size ?? 0) > 0 || (this.research?.active.size ?? 0) > 0 || (this.engines?.active.size ?? 0) > 0 || (this.browser?.active.size ?? 0) > 0 || (this.taskPlans?.active.size ?? 0) > 0; }
workerManager() { return this.workers ??= new WorkerManager(this.store, this); }
projectIndexer() { return this.codeIndex ??= new ProjectIndex(); }
taskPlanner() { return this.taskPlans ??= new TaskPlanManager(this.store, { redact: value => this.provider.redact(value),
@@ -132,27 +132,27 @@ export class Runtime {
redact: value => this.provider.redact(value), projectBusy: (projectId, exceptId) => this.projectHasActivity(projectId, exceptId) });
}
projectHasActivity(projectId, exceptSessionId = null, { excludeGroupId = null } = {}) {
return !!this.workers?.projectActive(projectId, excludeGroupId) || [...this.active.entries()].some(([id, run]) => id !== exceptSessionId && run.project.id === projectId) || !!this.checks?.projectActive(projectId) || !!this.deliveries?.projectActive(projectId) || !!this.changeSets?.projectActive(projectId) || !!this.workspaces?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId);
return !!this.workers?.projectActive(projectId, excludeGroupId) || !!this.controlledEngines?.projectActive(projectId, exceptSessionId) || [...this.active.entries()].some(([id, run]) => id !== exceptSessionId && run.project.id === projectId) || !!this.checks?.projectActive(projectId) || !!this.deliveries?.projectActive(projectId) || !!this.changeSets?.projectActive(projectId) || !!this.workspaces?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId);
}
workspaceManager() {
return this.workspaces ??= new WorkspaceManager(this.store, { initialize: this.store.core.workspace.size === 0,
redact: value => this.provider.redact(value), projectBusy: projectId =>
!!this.workers?.projectActive(projectId) || [...this.active.values()].some(run => run.project.id === projectId) || !!this.checks?.projectActive(projectId)
!!this.workers?.projectActive(projectId) || !!this.controlledEngines?.projectActive(projectId) || [...this.active.values()].some(run => run.project.id === projectId) || !!this.checks?.projectActive(projectId)
|| !!this.deliveries?.projectActive(projectId) || !!this.changeSets?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId) });
}
changeSetManager() {
return this.changeSets ??= new ChangeSetManager(this.store, { beforeApply: (session, set) => this.workerManager().verifyMerge(session, set), projectBusy: (projectId, exceptId) =>
!!this.workers?.projectActive(projectId) || [...this.active.entries()].some(([id, run]) => id !== exceptId && run.project.id === projectId)
!!this.workers?.projectActive(projectId) || !!this.controlledEngines?.projectActive(projectId, exceptId) || [...this.active.entries()].some(([id, run]) => id !== exceptId && run.project.id === projectId)
|| !!this.checks?.projectActive(projectId) || !!this.deliveries?.projectActive(projectId) || !!this.workspaces?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId) });
}
checkRunner() {
return this.checks ??= new CheckRunner(this.store, { redact: value => this.provider.redact(value), runtimeDirectory: this.appDirectory ? path.join(this.appDirectory, 'runtime') : null,
pythonRunnerPath: path.join(this.appDirectory ?? process.cwd(), 'scripts', 'python-check-runner.py'),
projectBusy: (projectId, exceptId) => !!this.workers?.projectActive(projectId) || [...this.active.entries()].some(([id, run]) => id !== exceptId && run.project.id === projectId) || !!this.deliveries?.projectActive(projectId) || !!this.changeSets?.projectActive(projectId) || !!this.workspaces?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId) });
projectBusy: (projectId, exceptId) => !!this.workers?.projectActive(projectId) || !!this.controlledEngines?.projectActive(projectId, exceptId) || [...this.active.entries()].some(([id, run]) => id !== exceptId && run.project.id === projectId) || !!this.deliveries?.projectActive(projectId) || !!this.changeSets?.projectActive(projectId) || !!this.workspaces?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId) });
}
gitDelivery() {
return this.deliveries ??= new GitDelivery(this.store, { redact: value => this.provider.redact(value),
projectBusy: (projectId, exceptId) => !!this.workers?.projectActive(projectId) || [...this.active.entries()].some(([id, run]) => id !== exceptId && run.project.id === projectId) || !!this.checks?.projectActive(projectId) || !!this.changeSets?.projectActive(projectId) || !!this.workspaces?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId) });
projectBusy: (projectId, exceptId) => !!this.workers?.projectActive(projectId) || !!this.controlledEngines?.projectActive(projectId, exceptId) || [...this.active.entries()].some(([id, run]) => id !== exceptId && run.project.id === projectId) || !!this.checks?.projectActive(projectId) || !!this.changeSets?.projectActive(projectId) || !!this.workspaces?.projectActive(projectId) || !!this.research?.projectActive(projectId) || !!this.engines?.projectActive(projectId) || !!this.browser?.projectActive(projectId) || !!this.taskPlans?.projectActive(projectId) });
}
startWorker(session, worker, config) {
if (workerForSession(this.store, session) !== worker || !this.workers?.active.has(worker.collaborationId)
+5 -2
View File
@@ -589,6 +589,7 @@ export class Store extends EventEmitter {
const jobs = [...this.core.check_job.values()].filter(value => value.sessionId === session.id && value.taskId === task?.id).slice(-10);
const projectWorkspaces = [...this.core.workspace.values()].filter(value => value.projectId === session.projectId);
const recentWorkspaceIds = new Set(projectWorkspaces.slice(-12).map(value => value.id));
const engineRuns = [...this.core.engine_run.values()].filter(value => value.sessionId === session.id && (value.taskId === task?.id || value.requiresVerification)).slice(-20).map(publicEngineRun);
return {
schemaVersion: 1, task: task ?? null, run: run ?? null,
workspaceIdentity: projectWorkspaceIdentity(this.project(session.projectId)),
@@ -607,7 +608,7 @@ export class Store extends EventEmitter {
researchTargets: [...this.core.research_target.values()].filter(value => value.sessionId === session.id && value.taskId === task?.id).slice(-32),
researchJobs: [...this.core.research_job.values()].filter(value => value.sessionId === session.id && (value.taskId === task?.id || value.requiresVerification)).slice(-20),
engineJobs: [...this.core.engine_job.values()].filter(value => value.sessionId === session.id && (value.taskId === task?.id || value.requiresVerification)).slice(-20).map(publicEngineJob),
engineRuns: [...this.core.engine_run.values()].filter(value => value.sessionId === session.id && (value.taskId === task?.id || value.requiresVerification)).slice(-20).map(publicEngineRun),
...(engineRuns.length ? { engineRuns } : {}),
browserPlans: [...this.core.browser_plan.values()].filter(value => value.sessionId === session.id && value.taskId === task?.id).slice(-5).map(publicBrowserPlan),
browserJobs: [...this.core.browser_job.values()].filter(value => value.sessionId === session.id && (value.taskId === task?.id || value.requiresVerification)).slice(-12),
contextPlans: [...this.core.context_plan.values()].filter(value => value.sessionId === session.id && value.taskId === task?.id).slice(-30),
@@ -635,8 +636,10 @@ export class Store extends EventEmitter {
}
claimRuntime() {
if (runtimeOwnerAlive(this.storage.meta('runtimeOwner'))) throw new Error('这个数据目录已被另一个执行宿主使用。');
const owner = this.storage.meta('runtimeOwner');
if (runtimeOwnerAlive(owner)) throw new Error('这个数据目录已被另一个执行宿主使用。');
this.ownerId ??= randomUUID();
if (owner?.pid === process.pid && owner.id === this.ownerId) return;
this.storage.transaction(() => this.storage.setMeta('runtimeOwner', { pid: process.pid, id: this.ownerId, startedAt: now() }));
}
+1 -1
View File
@@ -9,7 +9,7 @@
3. [complete] C:实际Harness+自有本地HTTP模型夹具完成Node/React/Python三工程13节点,父8/8、9/9、10/10与构建/编译/Git通过,React1280/390各8项原断言通过;每个原生Run正常结束、全树关闭、完整原结果/逐请求用量核对。默认16K夹具首轮失败保留,明确64K容量后新冻结轮通过,产品守卫不改动。
4. [complete] D:实际固定Harness和Edge桌面/390px完整9节点通过,分页下载原字节、审批目的导航、原生停止/全树关闭及显式未知核对通过;首四轮CSS/遮罩/响应式等待失败保持。旧workers10节点/engines10组完整兼容通过,原1.13证据与Git原字节一致,新结果单独封存。
5. [complete] E:Purge 1.1.78/1.1.81九关键来源分别锁定,独立提示实验默认关闭,不运行原完整插件。34/34相关专项、两版本八工程36节点同题原生对照及修正旧失败反馈后的桌面/390px9节点通过,原失败与原字节/预算/审批保持;真实模型收益未测,不默认启用。
6. [in_progress] F:按最终固定代码/基准完成相关与完整回归、真实工程/UI、独立源码/便携、发行与保留状态升级;先补升级活动守卫/回滚、同PID所属元数据幂等和旧导出兼容,各切片保存原失败、回顾和本地commit。
6. [in_progress] F:升级活动守卫/回滚、同PID所属元数据幂等和旧导出兼容已补,七项第三轮7/7、最新相关整轮80/80与编译宿主四节点通过,原失败保持。最终构建通过,继续固定源码/基准和本地提交,串行真实三工程/完整UI、独立源码/便携及保留状态升级;下一Windows桌面阶段PLAN-1.15已记录,尚未实现。
初步核对:原SDK没有session/cancel,prompt只给入队收据,client/server反向请求审批未实现;sdk-minimal仍包含本机文件/终端工具及danger-full-access策略,不能直接赋予工程写入。本阶段通过自有版本化叠加插件与受限宿主桥接入,实际工具目录和所属账本是验收门槛。完整公开源码使用普通代码工具;需要发行资源与运行观察时复用REA。
+113
View File
@@ -0,0 +1,113 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
import { randomUUID } from 'node:crypto';
import { spawnSync } from 'node:child_process';
import { fixture, workspace } from './helpers.mjs';
import { Provider } from '../src/server/provider.mjs';
import { Runtime } from '../src/server/runtime.mjs';
import { installUpgrade } from '../src/server/hot-upgrade.mjs';
function databaseRows(store) {
const database = store.storage.database;
return Object.fromEntries(database.prepare("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name").all()
.map(({ name }) => [name, database.prepare('SELECT * FROM "' + name.replaceAll('"', '""') + '" ORDER BY rowid').all()]));
}
async function context(t) {
const f = fixture(t), provider = new Provider(), runtime = new Runtime(f.store, provider, { appDirectory: workspace });
provider.setKey('owned-controlled-upgrade-fixture'); f.store.claimRuntime();
const server = http.createServer((_request, response) => response.end('original-owned-handler'));
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
f.onCleanup(() => new Promise(resolve => { server.closeAllConnections(); server.close(resolve); }));
return { ...f, provider, runtime, server, context: { server, store: f.store, provider, runtime,
clients: new Set(), token: 'owned-controlled-upgrade-token', started: Date.now(), exampleProject: f.project, shutdown: () => {} } };
}
function retainedEngineRecord(f, session) {
// A declared persisted record for migration/read ownership; no native execution is claimed.
return { id: randomUUID(), schemaVersion: 1, sessionId: session.id, projectId: session.projectId,
taskId: session.taskId ?? null, runId: session.runId ?? null, status: 'unknown', requiresVerification: true,
native: null, requests: [], calls: [], startedAt: '2026-01-01T00:00:00.000Z' };
}
test('claiming the same runtime owner twice preserves its original metadata and every database row', t => {
const f = fixture(t); f.store.claimRuntime();
const original = f.store.storage.meta('runtimeOwner'); original.startedAt = '2026-01-01T00:00:00.000Z';
f.store.storage.transaction(() => f.store.storage.setMeta('runtimeOwner', original));
const before = databaseRows(f.store);
f.store.claimRuntime(); f.store.claimRuntime();
assert.deepEqual(f.store.storage.meta('runtimeOwner'), original); assert.deepEqual(databaseRows(f.store), before);
});
test('sessions without controlled-engine history retain their prior export shape and never expose another session record', t => {
const f = fixture(t), other = f.store.createSession(f.project.id), record = retainedEngineRecord(f, other);
assert.equal(Object.hasOwn(f.store.executionSnapshot(f.session), 'engineRuns'), false);
f.store.putRecord('engine_run', other, record, 'fixture.persisted-engine');
assert.equal(Object.hasOwn(f.store.executionSnapshot(f.session), 'engineRuns'), false);
assert.deepEqual(f.store.executionSnapshot(other).engineRuns.map(value => value.id), [record.id]);
});
test('live workers, controlled drivers, or MCP operations refuse an upgrade before changing handlers, managers or database rows', async t => {
const f = await context(t), handlers = f.server.listeners('request'), before = databaseRows(f.store);
for (const [name, manager] of [['workers', { active: new Map([[f.session.id, {}]]) }],
['controlledEngines', { drivers: new Map([[f.session.runId, { session: f.session }]]) }],
['mcp', { active: new Map([[randomUUID(), {}]]) }]]) {
f.runtime[name] = manager;
assert.throws(() => installUpgrade(f.context, { appDirectory: workspace, updateServiceInfo: false }), /active|finish|upgrading/);
assert.equal(f.runtime[name], manager); assert.deepEqual(f.server.listeners('request'), handlers);
assert.deepEqual(databaseRows(f.store), before); delete f.runtime[name];
}
});
test('an idle upgrade loads the newly introduced engine record map, resets obsolete managers and preserves original rows, sessions and provider objects', async t => {
const f = await context(t), other = f.store.createSession(f.project.id), record = retainedEngineRecord(f, other);
f.store.putRecord('engine_run', other, record, 'fixture.persisted-engine');
const before = databaseRows(f.store), exported = f.store.publicSession(f.session), tasks = f.store.core.task,
provider = f.provider, credentials = provider.credentials;
delete f.store.core.engine_run;
f.runtime.workers = { active: new Map() }; f.runtime.controlledEngines = { drivers: new Map() };
installUpgrade(f.context, { appDirectory: workspace, updateServiceInfo: false });
assert.equal(f.runtime.workers, null); assert.equal(f.runtime.controlledEngines, null);
assert.equal(f.store.core.task, tasks); assert.equal(f.store.core.engine_run.size, 1);
assert.deepEqual(f.store.core.engine_run.get(record.id), record);
assert.equal(f.context.provider, provider); assert.equal(f.provider.credentials, credentials);
assert.equal(f.provider.hasKey(), true); assert.deepEqual(f.store.publicSession(f.session), exported);
assert.deepEqual(databaseRows(f.store), before);
});
test('an installation failure restores old managers, original record maps, handlers and all existing database rows', async t => {
const f = await context(t), workers = { active: new Map() }, engines = { drivers: new Map() };
f.runtime.workers = workers; f.runtime.controlledEngines = engines; delete f.store.core.engine_run;
const core = f.store.core, handlers = f.server.listeners('request'), before = databaseRows(f.store), provider = f.provider;
fs.mkdirSync(path.join(f.data, 'service-info.json'));
assert.throws(() => installUpgrade(f.context, { appDirectory: workspace }));
assert.equal(f.runtime.workers, workers); assert.equal(f.runtime.controlledEngines, engines);
assert.equal(f.store.core, core); assert.equal(Object.hasOwn(core, 'engine_run'), false);
assert.equal(f.context.provider, provider); assert.equal(provider.hasKey(), true);
assert.deepEqual(f.server.listeners('request'), handlers); assert.deepEqual(databaseRows(f.store), before);
});
test('the owned controlled driver remains an active session and project even after outer task activity has ended', t => {
const f = fixture(t), provider = new Provider(), runtime = new Runtime(f.store, provider), runner = runtime.engineRunner();
assert.equal(runtime.hasActivity(), false); runner.drivers.set(f.session.runId, { session: f.session });
assert.equal(runtime.active.size, 0); assert.equal(runtime.hasActivity(), true);
assert.equal(runtime.isActive(f.session.id), true); assert.equal(runtime.projectHasActivity(f.project.id), true);
const parentRoot = path.join(f.root, 'parent-project'); fs.mkdirSync(parentRoot);
const parentProject = f.store.addProject(parentRoot), parent = f.store.createSession(parentProject.id), manager = runtime.workerManager();
const id = randomUUID(); f.store.core.collaboration.set(id, { id, sessionId: parent.id, projectId: parentProject.id, status: 'paused', children: [{ sessionId: f.session.id }] });
assert.equal(manager.childActive(f.session.id), true); assert.equal(runtime.isActive(parent.id), true); assert.equal(runtime.projectHasActivity(parentProject.id), true);
runner.drivers.clear(); assert.equal(runtime.hasActivity(), false); assert.equal(runtime.isActive(f.session.id), false);
assert.equal(runtime.isActive(parent.id), false); assert.equal(runtime.projectHasActivity(parentProject.id), false);
});
test('release and upgrade help or invalid arguments have no file or network setup side effects in an independent directory', t => {
const f = fixture(t), before = fs.readdirSync(f.root).sort();
for (const script of ['package.mjs', 'upgrade-running.mjs']) {
const help = spawnSync(process.execPath, [path.join(workspace, 'scripts', script), '--help'], { cwd: f.root, encoding: 'utf8', windowsHide: true, timeout: 10000 });
assert.equal(help.status, 0, help.stderr); assert.match(help.stdout, /node scripts/);
const invalid = spawnSync(process.execPath, [path.join(workspace, 'scripts', script), '--unknown-owned-argument'], { cwd: f.root, encoding: 'utf8', windowsHide: true, timeout: 10000 });
assert.notEqual(invalid.status, 0); assert.match(invalid.stderr, /argument|option|Unsupported|Unknown/);
assert.deepEqual(fs.readdirSync(f.root).sort(), before);
}
});