diff --git a/AGENTS.md b/AGENTS.md index e7015909..f5a7bdf4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,7 @@ # Agent Workbench项目执行规范 +AI源码已修复终端Git/结束报告:实际命令窗口核对Task文件/blob/逐提交范围/原非目标索引,独立terminal-git-evidence且不伪造delivery_job、不认证写入进程;范围不符或观察器故障不阻止命令。执行结束追加终态报告、保留原in_progress,失败Run/退出码/上游400不改,诊断/worker/迟到Task隔离。最终独立后端26/26,前一来源相关41/41及边界1/1通过,8/13首夹具失败保持,见docs/QA-TERMINAL-DELIVERY-AI.md。AH已提交5e824dae;正式仍1.25.8/PID71628,尚未部署AH/AI。下一独立发行/升级须明确源码来源,不代验并行品牌/UI;不续跑旧样本/用户项目、不委派/推送/触Key、不恢复额度,Purge收益unknown。下方按历史时点理解。 + AH源码已修复任务级Python解释器选择:模型plan_checks.python_executable/HTTP pythonExecutable进入原不可变检查计划,优先宿主默认,显式路径不可用不回退。独立后端4/4、相关15/15通过(原HTTP回归仍为既有共享bundle,新显式HTTP/工具用独立候选),两轮夹具失败保持,见docs/QA-ENGINEERING-REPAIRS-AH.md。正式仍1.25.8/PID71628,未部署;下一独立修终端Git证据与结束报告。不续跑旧样本/用户项目、不委派/推送/触Key、不恢复额度,不覆盖/代交并行Orven界面。下方按历史时点理解。 AG已一次执行并封存:正式1.25.8/a6e31dec/PID71628不变,11请求109888报告tokens+3unknown/44928本地估算。ab-off/ab-on/ba-on均connect ETIMEDOUT无响应,ba-off8请求完整matched、自主三源码/原9测试/build,自动父归集/限定Git c792069c/finalize与owner/index全过。两个开启组原版入口/apply/335模块/两个原生模块已加载,四进程树均清理;四例不等成功,Purge收益仍unknown。原50841行/119导出/工件/旧尝试/凭据行保持,新增8自有父子项目/会话,DeepSeek17→19/config118→120、原池/其余配置恢复、空闲/窗口0/9229关闭;430份47723074字节封存见docs/QA-LIVE-PURGE-AG.md。事后0HTTP的DNS/三TLS全通只证明该时点,不改写网络失败。AF0请求身份拒绝和71份封存保持;新驱动以正式API身份解决Node路径摘要差异。下一独立修Python解释器选择与终端Git/结束报告衔接,三系统入站契约反馈见docs/THREE-SYSTEM-INTERFACE-FEEDBACK-2026-11-06.md。不续跑AG/AF/旧样本/用户项目,不委派/推送/触Key,不恢复默认额度;并行Orven品牌/UI及其验证器改动不覆盖、不代交或构建。下方旧接续按历史时点。 diff --git a/docs/GIT-DELIVERY.md b/docs/GIT-DELIVERY.md index 625130d1..3ef5ab9a 100644 --- a/docs/GIT-DELIVERY.md +++ b/docs/GIT-DELIVERY.md @@ -1,5 +1,7 @@ # 内置本地Git交付契约 +1.25.5起,默认开放模式在自动写入前保存本地Git基线,文件和本地Git按保存的操作权限执行;下方早期逐项审查条款按历史受控模式理解。终端Git与结束报告的最新源码修复见文末,正式仍为1.25.8,尚未部署该修复。 + 本切片把已审核文件、实际工程检查、只读提交预览、持久提交job和交付报告绑定到同一个Task。代码检查不等同于业务需求已验收;报告只陈述已有证据。 ## 准入与范围 @@ -30,3 +32,13 @@ job持久保存queued/preparing/prepared/publishing/committed/completed阶段及 ## 交付报告 JSON和Markdown工件从实际Task、Run、模型快照、usage、提案、检查日志、源指纹及Git结果生成;带SHA256并可查看/下载。无需额外模型调用。报告明确区分待审核、需检查、检查通过待提交、已验证提交和结果待核对,不把模型文字中的“完成”作为交付证据。 + +## 终端Git与任务结束报告(源码修复) + +实际`run_command`执行前后只读核对Git状态。已应用的本任务文件在暂存前进入Run所属基线,支持先`git add`、随后另次`git commit`。提交链、每次提交路径、最终文件blob、当前源码及原非目标索引一致时,保存独立`terminal-git-evidence`工件;报告的`terminalGit`和`gitOutcome.sources`显示终端来源,不补造内置`delivery_job`。 + +命令输出中的“committed”不作为证明。额外文件、中间提交夹带后又撤回的文件、外部HEAD/索引漂移、原证据损坏和源码后续变化分别保留为未核对或过期。证据核对失败不阻止实际终端命令,也不重试或回放副作用。终端命令失败但先前已产生真实提交时,分别记录提交与原退出码。 + +有改动、检查、交付或阶段报告的执行Run结束后,追加JSON/Markdown终态报告及`run.finalDeliveryReport`引用。`lifecycle`记录snapshot/final、真实Run状态和结束时间。原in_progress报告保留原字节;最终报告不会将失败Run改成成功。普通问候、诊断、worker及已切换Task不追加主线终态报告;报告生成失败保存在`finalDeliveryReportError`,不重放命令。 + +当前可匹配范围是已有已应用提案的任务文件。纯终端写入、未能核对的Git布局或非线性提交保留实际观察及原因,不冒充已认证交付。命令窗口内HEAD发生变化只能证明观察到提交,不能证明某进程是创建者。源码验收与历史失败见[AI阶段验收](QA-TERMINAL-DELIVERY-AI.md);正式发行、真实供应商使用情况另记。 diff --git a/docs/PLAN-1.25.md b/docs/PLAN-1.25.md index 8505efeb..eb7fd48a 100644 --- a/docs/PLAN-1.25.md +++ b/docs/PLAN-1.25.md @@ -1,5 +1,7 @@ # 1.25 计划:任务要求与交付复核 +AI终端Git事实与结束报告已完成源码修复,最终独立26/26、前一来源相关41/41和边界1/1通过,原首失败保持;见[AI验收](QA-TERMINAL-DELIVERY-AI.md)。AH已本地提交5e824dae。正式仍1.25.8,AH/AI尚未部署;下一独立发行和升级,不代验品牌/UI,旧实验不续跑、Purge收益unknown。下方为历史接续。 + AH解释器选择已完成源码修复与独立4/4、相关15/15验证,来源区别和两轮失败见[AH验收](QA-ENGINEERING-REPAIRS-AH.md)。正式1.25.8尚未部署此修复;下一独立处理终端Git登记和结束报告,旧样本不续跑,Purge收益unknown。下文为历史接续。 AG原版Purge ABBA已一次执行并封存:11请求109888报告tokens+3unknown,前三组connect超时、ba-off8请求自主三源码/原9测试/build并自动父Git c792069c/finalize通过。原版两开启组已加载/apply/两个原生模块,四进程树清理;四例不等成功,收益仍unknown。原50841行/119导出/工件/旧尝试/凭据保持、原池与配置恢复,430份原件封存。AF0请求身份拒绝与71份封存保持,正式API身份已在AG解决路径摘要差异。下一独立修Python解释器选择和终端Git/结束报告登记,三系统先只读证据对接;D–F不据此完成。见[AG结果](QA-LIVE-PURGE-AG.md)与[三系统反馈](THREE-SYSTEM-INTERFACE-FEEDBACK-2026-11-06.md)。下方为历史接续。 diff --git a/docs/QA-TERMINAL-DELIVERY-AI.md b/docs/QA-TERMINAL-DELIVERY-AI.md new file mode 100644 index 00000000..8a782946 --- /dev/null +++ b/docs/QA-TERMINAL-DELIVERY-AI.md @@ -0,0 +1,31 @@ +# AI:终端Git证据与任务结束报告 + +状态:源码修复和验证完成,随本阶段本地提交保存。最终独立候选26/26通过;前一来源相关41/41及追加边界1/1保持原记录。正式只读核对仍为1.25.8/PID71628、空闲,unrestricted/full/passthrough/preserve保持;本阶段没有部署或重启。 + +AD/AE的终端Git成功未登记为内置delivery_job,运行中生成的delivery_report也停在in_progress。这两个产品缺口由本切片修复,原AD/AE记录、检查失败和旧报告不重写。 + +## 实现与证据 + +`TerminalGitObserver`复用原Git只读快照和已应用文件链,在实际命令前后核对提交链、逐提交路径、文件blob/模式、源码和非目标索引。Run基线跨git add/commit调用保存,观察工件与当前Task/Run/命令调用/原结果双向绑定。报告明确显示终端来源和processAttribution=unproven,不伪造内部delivery_job。范围不符仍执行命令并记录真实结果。 + +执行Run结束后追加终态报告,保存最终Run状态及结束时间;旧运行中工件保持。已有改动/检查/交付/报告才触发,无额外模型请求,不增加批准停顿。诊断、worker、普通问候、迟到Task和重复finalize均有隔离;报告失败独立记录,不改变原任务结果或重放工具。 + +## 验证来源 + +- 首独立候选:`.qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/`,8/13,输入保持。四个Git夹具漏暂存新增math文件,一个HTTP夹具漏reason,导致实际命令未成功;原失败及stdout/stderr不改。 +- 第二独立候选:`.qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/`,14/14,输入保持。server SHA256为`bd1d246b35d513943a73373a29182349c78ad039a0fab1c6f685ceebc3e4beb6`。 +- 14项包括AH的4项Python选择,以及真实分步Git/用户索引和文件、范围夹带/伪造stdout/外部漂移/中间提交隐藏文件、当前源码及损坏工件、报告生命周期/Task隔离/失败不重放、实际本机HTTP模型工具和上游400保留。HTTP模型服务为自有固定响应,真实供应商请求0。 +- 追加边界1/1:提交成功后终端`exit 7`,实际提交与原命令失败分别保留。相关回归目录为`.qa/engineering-repairs-ai-related-1b396efe-8aa9-418c-bd6d-2ee7f9bffc96/`,Git交付/进展、Runtime、任务控制和诊断共41/41通过,输入保持,来源仍为上述bd1d246b候选。 +- 回顾另发现观察器构造和意外观察后异常也需隔离;增加Runtime外围捕获后,新候选`.qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/`完整26/26通过,包括新16项和既有Runtime10项。server SHA256为`135a2d97b5424784fac6e3fc0d69bf69f188e249d89c0a6695233a86ff044427`,源码输入保持。Git观察核心和报告模块与bd1d246b的41项来源相同,不能把41项说成全部在最终bundle上重跑。 +- 共用测试宿主支持`AGENT_WORKBENCH_TEST_APP_ROOT`,相关旧HTTP用例也指向上述新候选。后端输入逐SHA一致;辅助测试文件另作快照,不把共享旧编译结果冒充本次HTTP验证。 +- 只独立构建server/hot-upgrade/host-launcher,客户端复制正式1.25.8字节以满足宿主登记;没有构建或验收并行Orven界面,也未改共享dist。 +- 全部候选/首失败/相关回归和辅助驱动原件的逐SHA索引见[AI证据索引](terminal-delivery-ai-evidence.json),正式只读状态仅保存版本/进程/开放策略,不读取或转存真实Key。 +- 封存84份、29147488字节,163项最终输入逐SHA保持;离线再次校验通过。收据`.qa/engineering-repairs-ai-seal-c1207201-9e60-4e65-9214-765a3c0b875f.json`,索引SHA256为`8ea938319098789a14095a274d82e4e4d8d6945fdc9cd16e84184260a76cfd94`。 + +## 回顾与限制 + +报告能区分实际终端提交、内部提交与未核对观察;最终报告反映Run结束状态,仍按真实检查/要求/源码判断工程是否验证。终端绿测不会倒填原失败check_job,模型自述不会代替检查。 + +当前认证对象是任务已应用提案的文件链。纯终端直接编辑、非线性提交、其他未支持Git布局或并发写入不能借本结果认证来源;命令照常执行,实际观察和原因保留。即使窗口和内容核对通过,也不认证提交写入进程。没有重测真实供应商、续跑旧工程或扩大默认权限/额度;Purge收益仍unknown。 + +正式打包和升级尚未执行。历史真实交付、网络ETIMEDOUT、unknown用量、重复读取/缓存观察和AF/AG原封存保持原结论。 diff --git a/docs/TIANSHU-ADOPTION-PLAN.md b/docs/TIANSHU-ADOPTION-PLAN.md index 2c0b5188..c4f24b20 100644 --- a/docs/TIANSHU-ADOPTION-PLAN.md +++ b/docs/TIANSHU-ADOPTION-PLAN.md @@ -1,5 +1,7 @@ # Tianshu 研究后的 Agent Workbench 采用计划 +AI终端Git事实与结束报告已完成源码修复,最终独立26/26、前一来源相关41/41和边界1/1通过,原首失败保持;见[AI验收](QA-TERMINAL-DELIVERY-AI.md)。AH已本地提交5e824dae。正式仍1.25.8,AH/AI尚未部署;下一独立发行/升级,不以该修复代签D–F,不代验品牌/UI,旧实验不续跑、Purge收益unknown。下方为历史接续。 + AH解释器选择已完成源码修复与独立4/4、相关15/15验证,来源区别和两轮失败见[AH验收](QA-ENGINEERING-REPAIRS-AH.md)。正式1.25.8尚未部署此修复;下一独立处理终端Git登记和结束报告,不以本切片代签D–F,旧样本不续跑,Purge收益unknown。下文为历史接续。 AG原版Purge ABBA已一次执行并封存:11请求109888报告tokens+3unknown,前三组connect超时、ba-off8请求自主三源码/原9测试/build并自动父Git c792069c/finalize通过。原版两开启组已加载/apply/两个原生模块,四进程树清理;四例不等成功,收益仍unknown。原50841行/119导出/工件/旧尝试/凭据保持、原池与配置恢复,430份原件封存。AF0请求身份拒绝与71份封存保持,正式API身份已在AG解决路径摘要差异。下一独立修Python解释器选择和终端Git/结束报告登记,三系统先只读证据对接;D–F不据此完成。见[AG结果](QA-LIVE-PURGE-AG.md)与[三系统反馈](THREE-SYSTEM-INTERFACE-FEEDBACK-2026-11-06.md)。下方为历史接续。 diff --git a/docs/terminal-delivery-ai-evidence.json b/docs/terminal-delivery-ai-evidence.json new file mode 100644 index 00000000..72f0e943 --- /dev/null +++ b/docs/terminal-delivery-ai-evidence.json @@ -0,0 +1,437 @@ +{ + "schemaVersion": 1, + "kind": "terminal-delivery-ai", + "repositoryHeadAtSeal": "e32996799bdd2e3d226d250a9c0058d5ee18002a", + "finalCandidate": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889", + "finalTests": 26, + "earlierRelatedTests": 41, + "earlierBoundaryTests": 1, + "sourceUnchanged": true, + "sourceInputs": 163, + "realModelRequests": 0, + "formalDeployment": false, + "verificationPath": ".qa/engineering-repairs-ai-seal-c1207201-9e60-4e65-9214-765a3c0b875f.json", + "files": [ + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/.vite/manifest.json", + "bytes": 652, + "sha256": "35a1b310448fddef6a5e0228b0921eee15567e56df80ec461529dff0589ee61b" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/assets/approval-presentation-QyCkfhWb.js", + "bytes": 227033, + "sha256": "fb8f40f222db65579091593dfefdccc0f5119b37f21dbda29d815fd0d91dd8f5" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/assets/desktop-BaSRX_av.css", + "bytes": 180484, + "sha256": "f4d25097bcd8366edd4b101a1bc37ad21e6527e4519a267ebec0d6b39f2c8949" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/assets/desktop-DFGjc6p4.js", + "bytes": 462914, + "sha256": "f4b75e7b04e163e2ab56060d8dfd5aa6a4f7682550091bead4e1bf686cde04ef" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/assets/mobile-DdtBN08G.js", + "bytes": 26971, + "sha256": "ba7f054d0876844246ec16b244b14470d376b903d7dbdd3e47622574a76eeef8" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/assets/mobile-joLHctQw.css", + "bytes": 12387, + "sha256": "fe2dd1892f0bf852ceebedd4d3b3221b4cf274b502c47dedfcd3d7a8410ad5b1" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/favicon.svg", + "bytes": 268, + "sha256": "538fa42445dfd8e78135717e2f30dada6d790d5c05b9011ae7a9bf80d416ae1d" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/index.html", + "bytes": 597, + "sha256": "e721d8d296c44e18c636eab1c34fde1779bb1336d759448159be145545bb421b" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/mobile-assets.json", + "bytes": 115, + "sha256": "92dbeb8a4e6cc566d9b3edf1bc415549885ef7a098c10193c81da2e9eb2766eb" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/mobile-icon.svg", + "bytes": 307, + "sha256": "2241a24a26e67e2587614819d7860575e76bdaf9e2c3de6abeb58538d3f2b81c" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/mobile-sw.js", + "bytes": 1160, + "sha256": "538563113232cbae70754a3f6c41e08d8f3e5327c4056018a4e429a700351c99" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/mobile-touch-icon.png", + "bytes": 1073, + "sha256": "120b1168132b7664af0b159de8fea1ac0a2aead3a43ae0e2ae11833d97a09d6e" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/mobile.html", + "bytes": 842, + "sha256": "accf307fab1dc87a5440890b8c8944db33752bab7227c151eea4b72fc941cd6c" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/mobile.webmanifest", + "bytes": 372, + "sha256": "1d2a9bf8216aadce8fc47de1e236c4c7adda60ce96609133ee7e19e361b4673b" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/workbench-icon.ico", + "bytes": 1095, + "sha256": "f1879074e45f01c480ad9bf50b818637cc60ad56526056c886f808a4812d7b0c" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-client/workbench-icon.png", + "bytes": 1073, + "sha256": "120b1168132b7664af0b159de8fea1ac0a2aead3a43ae0e2ae11833d97a09d6e" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-server/host-launcher.mjs", + "bytes": 32062, + "sha256": "ed4204b7724a8e0dee3a3657ebe41db8758b1a3ad97917047c6b916a675716c7" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-server/hot-upgrade.mjs", + "bytes": 4361913, + "sha256": "2c4077ca72ddea1ff13c2c4a18a4dafe36cfe0ffb832708f9d4c0b32924dfa8b" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/dist-server/server.mjs", + "bytes": 4358889, + "sha256": "77b41243af6dd0a4d6fd74d14d3cbb724114f4742d75c5a10839bbe981b9afff" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/package.json", + "bytes": 4071, + "sha256": "0c3059db35fa668b138a3deccd94c056ef2ab7d786a652dc7399dc1bc567b5b1" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/app/scripts/python-check-runner.py", + "bytes": 9553, + "sha256": "17bd6fd64ad93b8f806e0f5d325e75fd4534c065f4fcb597ad45fb9152caf657" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/engineering.stderr.txt", + "bytes": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/engineering.stdout.txt", + "bytes": 5913, + "sha256": "05feb81cfe701133aa6076b467d47d3dec694a7333cafde9a8a79b83063c9b6f" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/inputs.json", + "bytes": 23007, + "sha256": "e45b20f8c5f313dacf9fe7299065445e1b070049a36ba2caaf8292aca8802c65" + }, + { + "path": ".qa/engineering-repairs-ai-4932cf24-aeb0-4705-99d1-0343c74ce313/result.json", + "bytes": 539, + "sha256": "15d7f8dca083129ebcdbe7253da1e8b31cadaa57f6b41c7b60b1e4fed4e0e9b1" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/.vite/manifest.json", + "bytes": 652, + "sha256": "35a1b310448fddef6a5e0228b0921eee15567e56df80ec461529dff0589ee61b" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/assets/approval-presentation-QyCkfhWb.js", + "bytes": 227033, + "sha256": "fb8f40f222db65579091593dfefdccc0f5119b37f21dbda29d815fd0d91dd8f5" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/assets/desktop-BaSRX_av.css", + "bytes": 180484, + "sha256": "f4d25097bcd8366edd4b101a1bc37ad21e6527e4519a267ebec0d6b39f2c8949" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/assets/desktop-DFGjc6p4.js", + "bytes": 462914, + "sha256": "f4b75e7b04e163e2ab56060d8dfd5aa6a4f7682550091bead4e1bf686cde04ef" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/assets/mobile-DdtBN08G.js", + "bytes": 26971, + "sha256": "ba7f054d0876844246ec16b244b14470d376b903d7dbdd3e47622574a76eeef8" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/assets/mobile-joLHctQw.css", + "bytes": 12387, + "sha256": "fe2dd1892f0bf852ceebedd4d3b3221b4cf274b502c47dedfcd3d7a8410ad5b1" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/favicon.svg", + "bytes": 268, + "sha256": "538fa42445dfd8e78135717e2f30dada6d790d5c05b9011ae7a9bf80d416ae1d" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/index.html", + "bytes": 597, + "sha256": "e721d8d296c44e18c636eab1c34fde1779bb1336d759448159be145545bb421b" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/mobile-assets.json", + "bytes": 115, + "sha256": "92dbeb8a4e6cc566d9b3edf1bc415549885ef7a098c10193c81da2e9eb2766eb" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/mobile-icon.svg", + "bytes": 307, + "sha256": "2241a24a26e67e2587614819d7860575e76bdaf9e2c3de6abeb58538d3f2b81c" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/mobile-sw.js", + "bytes": 1160, + "sha256": "538563113232cbae70754a3f6c41e08d8f3e5327c4056018a4e429a700351c99" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/mobile-touch-icon.png", + "bytes": 1073, + "sha256": "120b1168132b7664af0b159de8fea1ac0a2aead3a43ae0e2ae11833d97a09d6e" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/mobile.html", + "bytes": 842, + "sha256": "accf307fab1dc87a5440890b8c8944db33752bab7227c151eea4b72fc941cd6c" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/mobile.webmanifest", + "bytes": 372, + "sha256": "1d2a9bf8216aadce8fc47de1e236c4c7adda60ce96609133ee7e19e361b4673b" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/workbench-icon.ico", + "bytes": 1095, + "sha256": "f1879074e45f01c480ad9bf50b818637cc60ad56526056c886f808a4812d7b0c" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-client/workbench-icon.png", + "bytes": 1073, + "sha256": "120b1168132b7664af0b159de8fea1ac0a2aead3a43ae0e2ae11833d97a09d6e" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-server/host-launcher.mjs", + "bytes": 32062, + "sha256": "ed4204b7724a8e0dee3a3657ebe41db8758b1a3ad97917047c6b916a675716c7" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-server/hot-upgrade.mjs", + "bytes": 4362159, + "sha256": "27ef32a694765ae7960b023ca91a9da45c0f39b457012013ee4aa0459d1dccf5" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/dist-server/server.mjs", + "bytes": 4359135, + "sha256": "bd1d246b35d513943a73373a29182349c78ad039a0fab1c6f685ceebc3e4beb6" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/package.json", + "bytes": 4071, + "sha256": "0c3059db35fa668b138a3deccd94c056ef2ab7d786a652dc7399dc1bc567b5b1" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/app/scripts/python-check-runner.py", + "bytes": 9553, + "sha256": "17bd6fd64ad93b8f806e0f5d325e75fd4534c065f4fcb597ad45fb9152caf657" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/engineering.stderr.txt", + "bytes": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/engineering.stdout.txt", + "bytes": 1713, + "sha256": "651792420590611d7912ecfb70c5f6069c71a8e8abca218f47ec77bd5c86526d" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/inputs.json", + "bytes": 23007, + "sha256": "18160daf5c053e5286deb764a830c762a76bbdc6e156f4c024bd5ac6a40388ff" + }, + { + "path": ".qa/engineering-repairs-ai-cbc28083-c590-430b-83da-a010c3f7f0a6/result.json", + "bytes": 538, + "sha256": "bdf03be8a26cd46e9592d3c8614cd8e09633275ae0b68b6b72abfdb2e66a86d3" + }, + { + "path": ".qa/engineering-repairs-ai-related-1b396efe-8aa9-418c-bd6d-2ee7f9bffc96/boundary.stderr.txt", + "bytes": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "path": ".qa/engineering-repairs-ai-related-1b396efe-8aa9-418c-bd6d-2ee7f9bffc96/boundary.stdout.txt", + "bytes": 223, + "sha256": "11d086daf5e37702a0ab153435a05d82e295624c95fc30ac21777263fedfe5d2" + }, + { + "path": ".qa/engineering-repairs-ai-related-1b396efe-8aa9-418c-bd6d-2ee7f9bffc96/inputs.json", + "bytes": 1073, + "sha256": "d0f1118bab816810b53316ca0e85e847d8cef6f16eeaf8b064091914b2dd8dd4" + }, + { + "path": ".qa/engineering-repairs-ai-related-1b396efe-8aa9-418c-bd6d-2ee7f9bffc96/related.stderr.txt", + "bytes": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "path": ".qa/engineering-repairs-ai-related-1b396efe-8aa9-418c-bd6d-2ee7f9bffc96/related.stdout.txt", + "bytes": 5071, + "sha256": "97cdc8a1c74e6e2e82218a60ef7b5f613d70c699829e3691e1dfc94ab1742b06" + }, + { + "path": ".qa/engineering-repairs-ai-related-1b396efe-8aa9-418c-bd6d-2ee7f9bffc96/result.json", + "bytes": 930, + "sha256": "b58b5e7f955a0415322c49d373461d52a3ead29d82510c72d203f86ddae7c2aa" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/.vite/manifest.json", + "bytes": 652, + "sha256": "35a1b310448fddef6a5e0228b0921eee15567e56df80ec461529dff0589ee61b" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/assets/approval-presentation-QyCkfhWb.js", + "bytes": 227033, + "sha256": "fb8f40f222db65579091593dfefdccc0f5119b37f21dbda29d815fd0d91dd8f5" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/assets/desktop-BaSRX_av.css", + "bytes": 180484, + "sha256": "f4d25097bcd8366edd4b101a1bc37ad21e6527e4519a267ebec0d6b39f2c8949" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/assets/desktop-DFGjc6p4.js", + "bytes": 462914, + "sha256": "f4b75e7b04e163e2ab56060d8dfd5aa6a4f7682550091bead4e1bf686cde04ef" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/assets/mobile-DdtBN08G.js", + "bytes": 26971, + "sha256": "ba7f054d0876844246ec16b244b14470d376b903d7dbdd3e47622574a76eeef8" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/assets/mobile-joLHctQw.css", + "bytes": 12387, + "sha256": "fe2dd1892f0bf852ceebedd4d3b3221b4cf274b502c47dedfcd3d7a8410ad5b1" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/favicon.svg", + "bytes": 268, + "sha256": "538fa42445dfd8e78135717e2f30dada6d790d5c05b9011ae7a9bf80d416ae1d" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/index.html", + "bytes": 597, + "sha256": "e721d8d296c44e18c636eab1c34fde1779bb1336d759448159be145545bb421b" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/mobile-assets.json", + "bytes": 115, + "sha256": "92dbeb8a4e6cc566d9b3edf1bc415549885ef7a098c10193c81da2e9eb2766eb" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/mobile-icon.svg", + "bytes": 307, + "sha256": "2241a24a26e67e2587614819d7860575e76bdaf9e2c3de6abeb58538d3f2b81c" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/mobile-sw.js", + "bytes": 1160, + "sha256": "538563113232cbae70754a3f6c41e08d8f3e5327c4056018a4e429a700351c99" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/mobile-touch-icon.png", + "bytes": 1073, + "sha256": "120b1168132b7664af0b159de8fea1ac0a2aead3a43ae0e2ae11833d97a09d6e" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/mobile.html", + "bytes": 842, + "sha256": "accf307fab1dc87a5440890b8c8944db33752bab7227c151eea4b72fc941cd6c" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/mobile.webmanifest", + "bytes": 372, + "sha256": "1d2a9bf8216aadce8fc47de1e236c4c7adda60ce96609133ee7e19e361b4673b" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/workbench-icon.ico", + "bytes": 1095, + "sha256": "f1879074e45f01c480ad9bf50b818637cc60ad56526056c886f808a4812d7b0c" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-client/workbench-icon.png", + "bytes": 1073, + "sha256": "120b1168132b7664af0b159de8fea1ac0a2aead3a43ae0e2ae11833d97a09d6e" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-server/host-launcher.mjs", + "bytes": 32062, + "sha256": "ed4204b7724a8e0dee3a3657ebe41db8758b1a3ad97917047c6b916a675716c7" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-server/hot-upgrade.mjs", + "bytes": 4362589, + "sha256": "a5ac8e3716aa69bd532ecb018a65a3d1864a8def76de0c353146d87555cadaee" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/dist-server/server.mjs", + "bytes": 4359565, + "sha256": "135a2d97b5424784fac6e3fc0d69bf69f188e249d89c0a6695233a86ff044427" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/package.json", + "bytes": 4071, + "sha256": "0c3059db35fa668b138a3deccd94c056ef2ab7d786a652dc7399dc1bc567b5b1" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/app/scripts/python-check-runner.py", + "bytes": 9553, + "sha256": "17bd6fd64ad93b8f806e0f5d325e75fd4534c065f4fcb597ad45fb9152caf657" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/engineering.stderr.txt", + "bytes": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/engineering.stdout.txt", + "bytes": 3042, + "sha256": "6e296a5dd1d286084cff49f248d304b34809e1d454f4ac45d4500cca0a27126e" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/formal-status.json", + "bytes": 343, + "sha256": "e4497d29af61a6b37ee87a114db107b5140b90fa4d9e3c0bb646d3005e05ca43" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/inputs.json", + "bytes": 23399, + "sha256": "d5adecd4e1a15709788b94860001d0769a9948e9204913f5bb4694235cfd02e9" + }, + { + "path": ".qa/engineering-repairs-ai-4131aae4-b20c-4299-9fc1-9e238ae91889/result.json", + "bytes": 568, + "sha256": "e09a61a97fa07825bdab843a68dfe90f9eac1f3901e2c6c068ce50949cff95e8" + }, + { + "path": ".qa/ai-related-7da652ac.mjs", + "bytes": 2515, + "sha256": "1a0915b1abe918d323ef29cc7064474981eeff592c9396605c7d06b0ad489743" + }, + { + "path": ".qa/ai-seal-74e1e103.mjs", + "bytes": 2270, + "sha256": "1fbe78536b74598c0bc1c0004f5ce4021cf28c046a20b4ce39589874a1667ca4" + } + ], + "bytes": 29147488 +} diff --git a/findings.md b/findings.md index 48c53e93..92f2b390 100644 --- a/findings.md +++ b/findings.md @@ -1313,3 +1313,9 @@ AG四组中的前三组均connect ETIMEDOUT且无响应,第四关闭组8请求 # AH Python检查解释器选择 AE目标指定解释器未进入内置检查计划。新增模型python_executable/HTTP pythonExecutable后复用原运行身份及输入封存,显式选择优先、不可用不回退。独立候选4/4通过,相关15/15通过但旧HTTP回归仍用共享旧bundle,不能混称来源。第一次旧bundle误用及第一独立候选缺client资产的两轮2/4保持;正式1.25.8未部署。终端Git登记与最终报告待独立修复。 + +AI调查:delivery-report仅把内部completed delivery_job计作提交,终端真实提交未登记;Runtime.finishRun后不追加报告,导致原报告停在in_progress。GitDelivery已有只读snapshot/selectedFiles可复用,但selectedFiles拒绝已暂存目标,所以必须在git add之前捕获当前Run基线,跨命令保留。提交窗口观察不能认证某进程创建提交;报告必须明确来源与边界。读取时两次使用不存在文件名及Windows通配路径失败,无产品写入,已用rg实际路径定位。 + +AI复核发现一处初始化异常边界:若只读观察器依赖的GitDelivery构造失败,当前requestCommand会在实际命令前抛错。应将观察器初始化失败也独立记录并继续真实命令,不能只捕获snapshot错误。先等当前相关回归结束以保持输入SHA,再修正和增加真实命令边界,另建候选验证。 + +AI最终:该异常边界已隔离,真实git --version仍执行且退出0,独立记录观察故障。最终4131aae4的26/26通过,server135a2d97,输入保持;前一cbc28083上41相关及退出7边界1/1通过,来源分开。Git/报告核心未再改,正式1.25.8/PID71628/开放配置保持,没有实际供应商请求、旧样本续跑或正式写入;后续发行单独冻结来源。 diff --git a/progress.md b/progress.md index 53abe11b..cf114b86 100644 --- a/progress.md +++ b/progress.md @@ -1951,3 +1951,13 @@ AG驱动/计划a6830bbf提交后唯一冻结并一次执行:前三组connect E # AH阶段完成源码验证 Python显式解释器选择已贯通核心、HTTP及模型工具。独立候选86900114的4项通过、158项输入SHA保持;相关15项通过,来源区别已写QA。历史两轮失败保持,未新增真实供应商请求/依赖安装/正式升级,未构建并行UI。补齐PYTHON-CHECKS、QA与接续记录后,只暂存本轮文件本地提交。文档首补丁因Tianshu标题上下文不符而原子拒绝,核对实际标题后修正,未部分写入;首次diff检查报告两份记录尾部多余空行,修正后限定diff和六个语法检查通过。下一独立处理终端Git事实与任务结束报告,保留原delivery_job和运行中报告。 + +AI首轮独立候选4932cf24为8/13,输入SHA保持。四个Git夹具漏为新math文件git add,另一个HTTP工具夹具漏reason,均是实际命令未成功而非误认证;原stdout/stderr/收据保留。已修夹具并加强每步真实结果断言,补一条上游400失败仍追加终态报告且保持原错误的HTTP场景。期间继续隔离并行Orven界面,正式无部署/重启/供应商请求。 + +AI第二独立候选cbc28083的14/14通过、输入SHA保持,server bd1d246b。后端实现没有再改;补验一个“实际提交成功后终端退出7”的边界,并将共用测试宿主缺省支持AGENT_WORKBENCH_TEST_APP_ROOT,使旧HTTP相关回归也确实使用该独立新后端,而非共享旧bundle。相关回归的辅助文件和源码另作SHA快照,原14项/首失败结果不重写。 + +AI相关41/41及追加退出7边界1/1全部通过,均绑定cbc28083后端和对应SHA,原输入保持。回顾确认观察器初始化和观察后意外异常也应隔离,现增加Runtime外围捕获和两阶段真实git --version边界,不影响命令退出码。下一新独立候选跑完整新16项+现有Runtime10项;原41项来源明确保留,交付报告和Git观察核心未再修改。 + +AI最终独立候选4131aae4为26/26、输入保持,server135a2d97;包含AH4项、新终端/报告12项和原Runtime10项。原8/13失败、14/14中间通过、41相关及追加1/1均保留且来源分开。只读核对正式1.25.8/PID71628、空闲和unrestricted/full/passthrough/preserve;bootstrap不提供instanceId,空字段不作实例变化结论。准备逐SHA封存、限定diff/语法/本地提交,不部署或代验并行品牌/UI,Purge收益unknown。 + +AI已封存84份29147488字节,163最终输入保持,离线复核成功收据ai-seal-c1207201;索引8ea93831。再次只读正式状态仍1.25.8/PID71628/空闲/开放策略保持。下一仅限定源码/测试/文档本地提交,本轮不推送、发行或重启。 diff --git a/scripts/verify-engineering-repairs.mjs b/scripts/verify-engineering-repairs.mjs index ab1a3444..832b9dd8 100644 --- a/scripts/verify-engineering-repairs.mjs +++ b/scripts/verify-engineering-repairs.mjs @@ -4,7 +4,11 @@ import { randomUUID, createHash } from 'node:crypto'; import { spawnSync, execFileSync } from 'node:child_process'; import { build } from 'esbuild'; -const output = path.resolve('.qa/engineering-repairs-ah-' + randomUUID()); fs.mkdirSync(output); +const withTerminal = process.argv.includes('--with-terminal'); +const tests = ['tests/python-selection.test.mjs', ...(withTerminal ? ['tests/terminal-delivery.test.mjs'] : []), + ...(process.argv.includes('--with-runtime') ? ['tests/runtime.test.mjs'] : [])]; +const label = withTerminal ? 'engineering' : 'python'; +const output = path.resolve('.qa/engineering-repairs-' + (withTerminal ? 'ai-' : 'ah-') + randomUUID()); fs.mkdirSync(output); const appRoot = path.join(output, 'app'); fs.mkdirSync(path.join(appRoot, 'dist-server'), { recursive: true }); fs.mkdirSync(path.join(appRoot, 'scripts')); fs.copyFileSync('scripts/python-check-runner.py', path.join(appRoot, 'scripts/python-check-runner.py')); @@ -21,7 +25,7 @@ function walk(directory) { } } for (const directory of ['src/server', 'src/core', 'src/shared']) walk(directory); -inputs.push(...['scripts/python-check-runner.py', 'tests/python-selection.test.mjs'].map(name => ({ path: name, sha256: sha(fs.readFileSync(name)) }))); +inputs.push(...['scripts/python-check-runner.py', 'tests/helpers.mjs', 'tests/fixtures/delivery-project.mjs', ...tests].map(name => ({ path: name, sha256: sha(fs.readFileSync(name)) }))); fs.writeFileSync(path.join(output, 'inputs.json'), JSON.stringify(inputs, null, 2)); console.log(JSON.stringify({ output, building: 'isolated backend only', sharedBuildsModified: false })); await build({ entryPoints: ['src/server/index.mjs'], outfile: path.join(appRoot, 'dist-server/server.mjs'), bundle: true, platform: 'node', target: 'node24', format: 'esm', @@ -30,10 +34,10 @@ for (const [entry, name] of [['src/server/hot-upgrade.mjs', 'hot-upgrade'], ['sr await build({ entryPoints: [entry], outfile: path.join(appRoot, 'dist-server/' + name + '.mjs'), bundle: true, platform: 'node', target: 'node24', format: 'esm', sourcemap: false, legalComments: 'eof', banner: { js: "import { createRequire as __awbCreateRequire } from 'node:module'; const require = __awbCreateRequire(import.meta.url);" } }); } -const args = ['--test', 'tests/python-selection.test.mjs']; -const result = spawnSync(process.execPath, args, { encoding: 'utf8', windowsHide: true, timeout: 120000, maxBuffer: 32 * 1024 * 1024, +const args = ['--test', '--test-concurrency=1', ...tests]; +const result = spawnSync(process.execPath, args, { encoding: 'utf8', windowsHide: true, timeout: withTerminal ? 240000 : 120000, maxBuffer: 32 * 1024 * 1024, env: { ...process.env, AGENT_WORKBENCH_TEST_APP_ROOT: appRoot, AGENT_WORKBENCH_TEST_PYTHON: process.env.AGENT_WORKBENCH_TEST_PYTHON ?? path.resolve('.qa/reliability-1.25.2/python-env/Scripts/python.exe') } }); -fs.writeFileSync(path.join(output, 'python.stdout.txt'), result.stdout ?? ''); fs.writeFileSync(path.join(output, 'python.stderr.txt'), result.stderr ?? ''); +fs.writeFileSync(path.join(output, label + '.stdout.txt'), result.stdout ?? ''); fs.writeFileSync(path.join(output, label + '.stderr.txt'), result.stderr ?? ''); const sourceUnchanged = inputs.every(row => sha(fs.readFileSync(row.path)) === row.sha256); const receipt = { success: result.status === 0 && sourceUnchanged, status: result.status, signal: result.signal, error: result.error?.message ?? null, args, sourceUnchanged, serverSha256: sha(fs.readFileSync(path.join(appRoot, 'dist-server/server.mjs'))), diff --git a/src/core/delivery-report.mjs b/src/core/delivery-report.mjs index 100e6c36..6426d896 100644 --- a/src/core/delivery-report.mjs +++ b/src/core/delivery-report.mjs @@ -16,6 +16,7 @@ import { taskContract } from '../shared/contracts/task-control.mjs'; import { modelIdentityLabel } from '../shared/contracts/model-identity.mjs'; import { inspectDiagnosticContext } from './tasks/diagnostic-context.mjs'; import { deliveryFollowUp, requirementNextStep, requirementStates } from '../shared/contracts/task-follow-up.mjs'; +import { inspectTerminalGit } from './terminal-git-evidence.mjs'; const labels = { verified_committed: '检查通过并已提交', verified_uncommitted: '检查通过,等待提交', needs_review: '等待改动或交付审查', existing_verified: '当前成果已核对,无新增修改', needs_requirements: '用户要求仍有待复核事项', files_delivered: '当前文件已交付,按约定未测试', needs_results: '当前文件成果仍需核对', @@ -87,6 +88,10 @@ export class DeliveryReporter { requiresVerification.push(...changeSets.filter(set => set.requiresVerification || !set.snapshotVerified) .map(set => ({ id: set.id, tool: 'change_set', status: set.status }))); const commits = jobs.filter(value => value.status === 'completed' && value.commit && value.sourceFingerprint === inspection.sourceFingerprint); + const terminalGit = await inspectTerminalGit(this.store, session, inspection); + const terminalCommits = terminalGit.filter(value => value.currentVerified); + const hasCommit = commits.length > 0 || terminalCommits.length > 0; + requiresVerification.push(...terminalGit.filter(value => !value.evidenceVerified).map(value => ({ id: value.artifactId, tool: 'terminal_git', status: 'evidence_unverified' }))); const contextCache = new Map(); const contextPlans = [...this.store.core.context_plan.values()].filter(plan => plan.sessionId === session.id && plan.taskId === taskId).map(plan => { let evidenceVerified = true, evidenceError = null; @@ -144,9 +149,10 @@ export class DeliveryReporter { : browserVerification.required && browserVerification.status !== 'passed' ? 'needs_browser_checks' : researchScope && !check ? contract.checks === 'skip' ? 'scope_verified' : 'research_verified' : hasFileScope && !fileDelivery.newChanges ? 'existing_verified' : hasFileScope && contract.checks === 'skip' ? 'files_delivered' - : commits.length ? 'verified_committed' : 'verified_uncommitted'; + : hasCommit ? 'verified_committed' : 'verified_uncommitted'; const report = { schemaVersion: 1, kind: 'engineering-delivery', generatedAt: new Date().toISOString(), status, statusLabel: labels[status], + lifecycle: { phase: run.finishedAt ? 'final' : 'snapshot', runStatus: run.status, finishedAt: run.finishedAt ?? null }, project: { id: project.id, name: project.name, root: project.root }, workspace: projectWorkspaceIdentity(project), task: { id: task.id, goal: task.goal, status: task.status, instructions: task.instructions, acceptance: task.acceptance ?? [], contract, delivery: task.delivery ?? null, @@ -160,8 +166,11 @@ export class DeliveryReporter { .map(value => ({ runId: value.id, ...inspectTurnProgress(this.store, session, value) })), fileResults, fileDelivery, checkPolicy: contract.checks === 'skip' ? 'not_requested' : contract.checks, - gitOutcome: { status: !fileDelivery.newChanges && hasFileScope ? 'no_new_changes' : commits.length ? 'committed' : 'uncommitted', - note: !fileDelivery.newChanges && hasFileScope ? '本任务无新增修改;未创建提交,已有用户修改保持原归属。' : '仅本任务实际应用的文件可进入Git交付预览。' }, + gitOutcome: { status: hasCommit ? 'committed' : terminalGit.length ? 'observed_unverified' : !fileDelivery.newChanges && hasFileScope ? 'no_new_changes' : 'uncommitted', + sources: [...(commits.length ? ['internal'] : []), ...(terminalCommits.length ? ['terminal'] : [])], + note: terminalCommits.length ? '实际终端提交与当前任务文件和原索引范围已核对;观察不认证创建提交的进程。' + : terminalGit.length ? '已保存实际Git变化;当前源码、范围或来源仍有未核对项,原观察保留。' + : !fileDelivery.newChanges && hasFileScope ? '本任务无新增修改;未创建提交,已有用户修改保持原归属。' : '仅本任务实际应用的文件可进入Git交付预览。' }, source: { fingerprint: inspection.sourceFingerprint, scope: inspection.scope, gitHead: inspection.git.head, branch: inspection.git.branch }, runs: [...this.store.core.run.values()].filter(value => value.taskId === taskId).map(value => ({ id: value.id, resumeOf: value.resumeOf, engine: value.engine, purpose: value.purpose ?? 'execution', status: value.status, model: value.model, startedAt: value.startedAt, finishedAt: value.finishedAt, usage: value.usage, stopReason: value.stopReason, @@ -187,8 +196,9 @@ export class DeliveryReporter { deliveries: jobs.map(value => ({ id: value.id, status: value.status, commit: value.commit ?? null, expectedCommit: value.expectedCommit ?? null, parent: value.parent, sourceFingerprint: value.sourceFingerprint, paths: value.paths, summary: value.summary, requiresVerification: !!value.requiresVerification, workspacePreserved: value.workspacePreserved ?? null, indexPreserved: value.indexPreserved ?? null, finishedAt: value.finishedAt })), + terminalGit, requiresVerification, - limitations: ['本切片验证已选工程检查和提交范围;业务需求验收另行记录。', '提交为本地普通提交,不执行仓库hooks和GPG签名。', '请求输入为本地UTF-8估算;服务实际分词和用量另行记录。', '未配置模型单价,费用未知。'], + limitations: ['本切片验证已选工程检查和提交范围;业务需求验收另行记录。', '内置Git交付关闭hooks和GPG签名;终端提交按实际命令执行,窗口观察不认证创建提交的进程。', '请求输入为本地UTF-8估算;服务实际分词和用量另行记录。', '未配置模型单价,费用未知。'], }; report.followUp = deliveryFollowUp(report); return JSON.parse(this.redact(JSON.stringify(report))); @@ -308,6 +318,12 @@ export function renderDeliveryMarkdown(report) { if (!report.deliveries.length) lines.push('尚无内置Git提交记录。'); for (const delivery of report.deliveries) lines.push('- ' + delivery.status + ' · ' + (delivery.commit ?? '实际结果未确认') + ' · ' + delivery.paths.join(', '), ' ' + (delivery.summary ?? '')); + if (report.terminalGit?.length) { + lines.push('', '### 终端Git观察', '', '独立核对提交链、任务文件和原非目标索引;不据stdout或模型自述认定成功,不认证写入进程。', '', + '| 实际HEAD | 当前核对 | 文件 | 原证据 |', '| --- | --- | --- | --- |'); + for (const value of report.terminalGit) lines.push('| ' + [value.commit ?? '未核对', value.currentVerified ? '与当前源码匹配' : value.error ?? value.status, + value.paths.join(', '), value.artifactId].map(escapeCell).join(' | ') + ' |'); + } lines.push('', '## 模型与用量', '', 'Run型号为启动配置;每次实际发送与返回型号见下表。型号标识或登记映射不认证底层模型权重。', '', '| Run | 启动型号 | 状态 | 已报告tokens |', '| --- | --- | --- | --- |'); for (const run of report.runs) lines.push('| ' + [run.id, run.model?.mode === 'demo' ? '离线固定演示' : run.model?.model ?? '未记录', run.status, run.usage?.totalTokens ?? 0].map(escapeCell).join(' | ') + ' |'); diff --git a/src/core/terminal-git-evidence.mjs b/src/core/terminal-git-evidence.mjs new file mode 100644 index 00000000..39a6fdbf --- /dev/null +++ b/src/core/terminal-git-evidence.mjs @@ -0,0 +1,189 @@ +import fs from 'node:fs'; +import { createHash } from 'node:crypto'; +import { safePath } from '../server/files.mjs'; +import { inspectProject } from './project-inspector.mjs'; +import { runGit } from './git-process.mjs'; + +const sha = value => createHash('sha256').update(value).digest('hex'); +const sameRepository = (a, b) => ['reference', 'gitDir', 'indexPath'].every(key => a[key] === b[key]); +const sameState = (a, b) => sameRepository(a, b) && ['head', 'stage', 'flags'].every(key => a[key] === b[key]) + && JSON.stringify(a.config) === JSON.stringify(b.config); +const owns = (session, run) => session.taskId === run.taskId && session.runId === run.id && run.record.purpose !== 'diagnostic' && !run.worker; +const scopeFiles = files => files.map(({ path, changeIds, mode, beforeBlob, afterBlob, baseSha256, sha256 }) => + ({ path, changeIds, mode, beforeBlob, afterBlob, baseSha256, sha256 })); + +function protectedIndex(snapshot, files) { + const paths = new Set(files.map(file => file.path)); + return sha(JSON.stringify({ + stage: snapshot.stage.split('\0').filter(line => line && !paths.has(line.slice(line.indexOf('\t') + 1))).sort(), + flags: snapshot.flags.split('\0').filter(line => line && !paths.has(line.slice(2))).sort(), + })); +} + +function assertCurrentFiles(store, session, files) { + const project = store.project(session.projectId); + for (const file of files) { + const change = session.changes.findLast(row => row.taskId === session.taskId && row.path.replaceAll('\\', '/') === file.path && row.status === 'applied'); + const target = safePath(project, file.path), stat = fs.lstatSync(target); + if (!stat.isFile() || stat.isSymbolicLink()) throw new Error('任务交付路径不再是普通文件:' + file.path); + if (!change || change.id !== file.changeIds.at(-1) || change.sha256 !== file.sha256 + || sha(fs.readFileSync(target)) !== file.sha256) throw new Error('任务文件或已应用提案在观察后变化:' + file.path); + } +} + +async function git(project, args) { + const result = await runGit(safePath(project), args); + if (!result.ok) throw new Error(result.error.trim() || '终端提交的Git只读核对失败。'); + return result.text; +} + +async function commitFacts(project, before, after) { + const ids = (await git(project, ['rev-list', '--reverse', before + '..' + after])).trim().split('\n').filter(Boolean); + const commits = []; + for (const id of ids) { + const parents = (await git(project, ['rev-list', '--parents', '-n', '1', id])).trim().split(' ').slice(1); + commits.push({ id, parents }); + } + const paths = (await git(project, ['diff-tree', '--no-commit-id', '--no-renames', '--name-only', '-r', '-z', before, after])).split('\0').filter(Boolean).sort(); + return { commits, paths }; +} + +async function assertCommitScope(project, baseline, before, after, facts) { + if (!sameRepository(baseline.snapshot, before) || !sameRepository(before, after) || baseline.snapshot.head !== before.head) throw new Error('Git仓库、分支或提交父基线已变化。'); + let parent = before.head; + for (const commit of facts.commits) { + if (commit.parents.length !== 1 || commit.parents[0] !== parent) throw new Error('观察到的提交不是原基线上的连续单父提交。'); + parent = commit.id; + } + if (!facts.commits.length || parent !== after.head) throw new Error('未能核对从原HEAD到当前HEAD的提交链。'); + if (JSON.stringify(facts.paths) !== JSON.stringify(baseline.files.map(file => file.path).sort())) throw new Error('实际提交路径与本任务已应用文件范围不一致。'); + if (protectedIndex(baseline.snapshot, baseline.files) !== protectedIndex(after, baseline.files)) throw new Error('非目标Git索引条目或标记发生变化。'); + // Check each commit, too: an unrelated file added and reverted in the same + // command must not disappear from the ownership review of the net diff. + const allowed = new Set(baseline.files.map(file => file.path)); + for (const commit of facts.commits) { + const paths = (await git(project, ['diff-tree', '--no-commit-id', '--no-renames', '--name-only', '-r', '-z', commit.parents[0], commit.id])).split('\0').filter(Boolean); + if (paths.some(name => !allowed.has(name))) throw new Error('中间提交包含本任务范围之外的文件。'); + } + for (const file of baseline.files) { + const tree = (await git(project, ['ls-tree', '-z', after.head, '--', file.path])).split('\0').filter(Boolean); + if (tree.length !== 1 || tree[0] !== file.mode + ' blob ' + file.afterBlob + '\t' + file.path) throw new Error('提交中的文件blob或模式与任务文件不一致:' + file.path); + const index = after.stage.split('\0').filter(line => line.endsWith('\t' + file.path)); + if (index.length !== 1 || index[0] !== file.mode + ' ' + file.afterBlob + ' 0\t' + file.path) throw new Error('提交后的目标索引与当前提交不一致:' + file.path); + } +} + +// Observe actual repository state; this class never stages, commits, resets, +// retries a command, or turns terminal output into an internal delivery job. +export class TerminalGitObserver { + constructor(store, delivery) { this.store = store; this.delivery = delivery; } + + async before(session, event, run) { + if (!owns(session, run)) return null; + const state = run.terminalGitState ??= {}, context = { errors: [], snapshot: null, baseline: null, externalDrift: false }; + try { + context.snapshot = await this.delivery.snapshot(run.project); + if (!owns(session, run)) return null; + if (state.lastSnapshot && !sameState(state.lastSnapshot, context.snapshot)) { + context.externalDrift = true; context.previousHead = state.lastSnapshot.head; state.baseline = null; + context.errors.push('两次终端命令之间Git状态发生外部漂移,不能将该变化认证为本次命令产生。'); + } + if (!state.baseline) { + try { + const files = scopeFiles(await this.delivery.selectedFiles(session, run.project, context.snapshot)); + const inspection = await inspectProject(run.project); + state.baseline = { snapshot: context.snapshot, files, sourceFingerprint: inspection.sourceFingerprint, + invocationId: event.invocationId, taskId: run.taskId, runId: run.id }; + } catch (error) { context.errors.push(error.message); } + } + if (state.baseline) { + assertCurrentFiles(this.store, session, state.baseline.files); + context.baseline = structuredClone(state.baseline); + } + } catch (error) { state.baseline = null; context.errors.push(error.message); } + return context; + } + + async after(session, event, run, context, result) { + if (!context || !owns(session, run)) return null; + try { + const after = await this.delivery.snapshot(run.project); + if (!owns(session, run)) return null; + run.terminalGitState.lastSnapshot = after; + const changed = context.snapshot && context.snapshot.head !== after.head; + if (!changed && !context.externalDrift) return null; + const errors = [...context.errors], baseline = context.baseline, project = run.project; + const facts = changed ? await commitFacts(project, context.snapshot.head, after.head) : { commits: [], paths: [] }; + const inspection = await inspectProject(project); + if (!baseline) errors.push('没有可核对的本任务已应用文件基线,仅保留实际Git观察。'); + else { + try { + assertCurrentFiles(this.store, session, baseline.files); + await assertCommitScope(project, baseline, context.snapshot, after, facts); + if (inspection.sourceFingerprint !== baseline.sourceFingerprint) throw new Error('终端命令同时改变了源码,提交范围需要另行核对。'); + } catch (error) { errors.push(error.message); } + } + if (!owns(session, run)) return null; + const evidence = { schemaVersion: 1, kind: 'terminal-git-evidence', sessionId: session.id, projectId: session.projectId, + taskId: run.taskId, runId: run.id, invocationId: event.invocationId, eventId: event.id, observedAt: new Date().toISOString(), + status: errors.length ? 'unverified' : 'verified', errors, processAttribution: 'unproven', + command: { status: result.status, exitCode: result.exit_code, argsSha256: this.store.core.tool.get(event.invocationId)?.argsSha256 }, + observedInCommand: !!changed, externalDrift: context.externalDrift, previousHead: context.previousHead ?? null, + before: context.snapshot, after, baseline, ...facts, sourceFingerprint: inspection.sourceFingerprint }; + const artifact = this.store.artifactStore.write(session, run.record, evidence, { kind: 'terminal-git-evidence' }); + this.store.core.artifact.set(artifact.id, artifact); + (run.record.terminalGitEvidence ??= []).push({ artifactId: artifact.id, sha256: artifact.sha256 }); + run.terminalGitState.baseline = null; + this.store.save(session, { type: 'git.terminal_observed', detail: { runId: run.id, artifactId: artifact.id, status: evidence.status, commit: after.head } }); + return { status: evidence.status, artifact_id: artifact.id, commit: after.head, process_attribution: 'unproven' }; + } catch (error) { + // Observation failure cannot suppress a completed terminal command. + run.record.terminalGitObservationError = this.delivery.redact(error.message); + return { status: 'unverified', message: run.record.terminalGitObservationError }; + } + } +} + +export async function inspectTerminalGit(store, session, inspection) { + const results = [], project = store.project(session.projectId); + for (const run of store.core.run.values()) { + if (run.sessionId !== session.id || run.taskId !== session.taskId || run.purpose === 'diagnostic') continue; + for (const reference of run.terminalGitEvidence ?? []) { + const row = { runId: run.id, artifactId: reference.artifactId, source: 'terminal', processAttribution: 'unproven', + evidenceVerified: false, currentVerified: false, status: 'unverified', commit: null, paths: [] }; + try { + const artifact = store.owned('artifact', reference.artifactId, session.id); + if (artifact.taskId !== run.taskId || artifact.runId !== run.id || artifact.kind !== 'terminal-git-evidence' || artifact.sha256 !== reference.sha256) throw new Error('终端Git工件归属或SHA256不一致。'); + const evidence = JSON.parse(store.artifactStore.read(artifact)); + if (evidence.schemaVersion !== 1 || evidence.kind !== 'terminal-git-evidence' || evidence.sessionId !== session.id + || evidence.projectId !== project.id || evidence.taskId !== run.taskId || evidence.runId !== run.id) throw new Error('终端Git证据身份不一致。'); + const invocation = store.owned('tool', evidence.invocationId, session.id); + if (invocation.taskId !== run.taskId || invocation.runId !== run.id || invocation.tool !== 'run_command' + || invocation.eventId !== evidence.eventId || invocation.argsSha256 !== evidence.command.argsSha256) throw new Error('终端Git证据不属于原命令调用。'); + const original = store.owned('artifact', invocation.resultArtifactId, session.id); + if (original.taskId !== run.taskId || original.runId !== run.id) throw new Error('终端命令结果归属不一致。'); + const result = JSON.parse(store.artifactStore.read(original)); + if (result.terminal_git?.artifact_id !== artifact.id || result.status !== evidence.command.status || result.exit_code !== evidence.command.exitCode) throw new Error('终端Git证据与原命令结果不一致。'); + row.evidenceVerified = true; row.commit = evidence.after.head; row.commits = evidence.commits; + row.paths = evidence.paths; row.observedInCommand = evidence.observedInCommand; row.command = evidence.command; + row.status = evidence.status; row.error = evidence.errors.join(';') || null; + if (evidence.status === 'verified') { + if (invocation.requiresVerification || !['completed', 'failed'].includes(invocation.state)) throw new Error('原终端命令结果仍未知,未认证当前提交。'); + if (evidence.sourceFingerprint !== inspection.sourceFingerprint || evidence.after.head !== inspection.git.head) { + row.status = 'stale'; row.error = '当前源码或HEAD已变化,原终端提交观察保留。'; + } else { + assertCurrentFiles(store, session, evidence.baseline.files); + const facts = await commitFacts(project, evidence.before.head, evidence.after.head); + if (JSON.stringify(facts.commits) !== JSON.stringify(evidence.commits) || JSON.stringify(facts.paths) !== JSON.stringify(evidence.paths)) throw new Error('Git实际提交链或文件范围与原观察不一致。'); + // The original command window and immutable evidence bind the index; + // live tree checks additionally bind the commit to current task files. + await assertCommitScope(project, evidence.baseline, evidence.before, evidence.after, facts); + row.currentVerified = true; + } + } + } catch (error) { row.status = 'unverified'; row.error = error.message; } + results.push(row); + } + } + return results; +} diff --git a/src/server/runtime.mjs b/src/server/runtime.mjs index 8f2173cb..e4c533d7 100644 --- a/src/server/runtime.mjs +++ b/src/server/runtime.mjs @@ -28,6 +28,7 @@ import { CheckRunner } from '../core/check-runner.mjs'; import { inspectProject } from '../core/project-inspector.mjs'; import { projectEnvironment } from '../core/process-environment.mjs'; import { GitDelivery } from '../core/git-delivery.mjs'; +import { TerminalGitObserver } from '../core/terminal-git-evidence.mjs'; import { ProjectIndex } from '../core/context/project-index.mjs'; import { RequestPlanner, verifyPlanEvidence } from '../core/context/request-plan.mjs'; import { observeToolSurface } from '../core/context/tool-surface.mjs'; @@ -311,17 +312,37 @@ export class Runtime { session.failure = null; this.store.save(session); const deadline = scheduleDeadline(() => controller.abort(new BudgetExceeded('time_limit', '已到达本次运行的时间预算,执行记录已保存。')), record.budget.maxDurationMs); - run.promise = this.run(session, config, run).finally(() => { + run.promise = this.run(session, config, run).finally(async () => { deadline?.(); try { const status = session.status; if (record.purpose === 'diagnostic') session.status = record.taskStatusBefore; this.store.finishRun(session, record, run.stopReason ?? null, { status }); + await this.finalizeDeliveryReport(session, run); } finally { this.active.delete(id); } }); run.promise.catch(() => {}); return session; } + async finalizeDeliveryReport(session, run) { + if (run.worker || run.record.purpose === 'diagnostic' || session.taskId !== run.taskId || session.runId !== run.id) return; + const inRun = row => row.sessionId === session.id && row.taskId === run.taskId && row.runId === run.id; + const hasEvidence = run.record.terminalGitEvidence?.length || session.changes.some(row => row.taskId === run.taskId && row.runId === run.id && row.status === 'applied') + || [...this.store.core.artifact.values()].some(row => inRun(row) && row.kind === 'delivery-report') + || [...this.store.core.delivery_job.values()].some(inRun) || [...this.store.core.check_job.values()].some(inRun); + if (!hasEvidence || run.record.finalDeliveryReport) return; + try { + const saved = await this.gitDelivery().report(session, { source: 'agent' }); + if (session.taskId !== run.taskId || session.runId !== run.id) return; + run.record.finalDeliveryReport = { artifactId: saved.artifactId, markdownArtifactId: saved.markdownArtifactId, + status: saved.report.status, runStatus: run.record.status, generatedAt: saved.report.generatedAt }; + this.store.save(session, { type: 'delivery.final_report', detail: { runId: run.id, artifactId: saved.artifactId, status: saved.report.status } }); + } catch (error) { + if (session.taskId !== run.taskId || session.runId !== run.id) return; + run.record.finalDeliveryReportError = this.provider.redact(error.message); + this.store.save(session, { type: 'delivery.final_report_failed', detail: { runId: run.id, error: run.record.finalDeliveryReportError } }); + } + } async capturePauseInputs(run) { if (!run.worker && run.record.purpose !== 'diagnostic' && ['no_progress', 'step_limit'].includes(run.stopReason)) { try { run.record.finalSourceFingerprint = (await inspectProject(run.project)).sourceFingerprint; } catch { /* No fingerprint means no claim of unchanged inputs. */ } @@ -1007,9 +1028,23 @@ export class Runtime { if (run.worker?.engine) this.engineRunner().assertCurrent(session, run); if (execute) return execute(); if (unrestricted(run.config)) await ensureGitBaseline(this.store, session, { signal: run.controller.signal }); - return this.executeCommand(command, cwd, run.controller.signal, output => { + let observer, observation, observationError; + try { + observer = this.terminalGit ??= new TerminalGitObserver(this.store, this.gitDelivery()); + observation = await observer.before(session, event, run); + } catch (error) { observationError = this.provider.redact(error.message); } + run.controller.signal.throwIfAborted(); + const result = await this.executeCommand(command, cwd, run.controller.signal, output => { event.output = output; this.store.save(session); }, run.config); + let evidence; + try { evidence = await observer?.after(session, event, run, observation, result); } + catch (error) { observationError = this.provider.redact(error.message); } + if (observationError) { + run.record.terminalGitObservationError = observationError; + evidence = { status: 'unverified', message: observationError }; + } + return evidence ? { ...result, terminal_git: evidence } : result; } decide(sessionId, approvalId, allow) { const session = this.store.session(sessionId); diff --git a/task_plan.md b/task_plan.md index a882a2f1..6885a185 100644 --- a/task_plan.md +++ b/task_plan.md @@ -2,9 +2,10 @@ ## 当前产品修复:AH / 终端交付 -- [complete] AH:任务级Python解释器选择,独立候选4/4及相关15/15,原夹具失败保留,回顾见docs/QA-ENGINEERING-REPAIRS-AH.md;源码修复,正式尚未部署。 -- [in_progress] 下一切片:只读核对终端Git实际提交并保存所属证据,任务结束追加准确终态报告;不伪造内部delivery_job、不重放提交。 -- [pending] 相关组合验收、独立发行和正式升级另记;并行Orven品牌/UI不混入本轮提交或构建。AG/AF不重跑,Purge收益unknown。 +- [complete] AH:任务级Python解释器选择,独立候选4/4及相关15/15,原夹具失败保留,本地提交5e824dae;回顾见docs/QA-ENGINEERING-REPAIRS-AH.md,正式尚未部署。 +- [complete] AI切片:只读核对HEAD/提交链/任务文件blob/非目标索引,独立terminal-git-evidence;跨命令git add/commit,外部漂移/范围不符/观察器故障保留原结果,不阻止命令。 +- [complete] 结束追加终态报告并保留运行中原件;诊断/worker/迟到Task隔离,不伪造delivery_job、不重放提交、不增加批准停顿。最终26/26、前一来源相关41/41和边界1/1,原首8/13失败保持;QA/证据/回顾随本阶段本地提交保存。 +- [pending] 独立发行、安装载荷/网页/桌面组合验收和正式升级另记;并行Orven品牌/UI不混入本轮提交或构建。AG/AF不重跑,Purge收益unknown。 当前阶段AG已完成执行/审计/封存:11真实请求、109888报告tokens+3unknown/44928本地估算。前三组connect超时,ba-off8请求自主源码/原9测试/build、自动父Git c792069c/finalize与owner/index通过;开启组原版加载/apply/两个原生模块与四例进程退出核对,四例不等成功,Purge收益仍unknown。原50841行/119导出/工件/尝试/凭据保持、池与配置恢复,430份47723074字节封存。AF0请求原失败/71份封存不改;AG隔离夹具及正式API身份解决Node路径摘要差异。下一独立产品切片修Python检查解释器选择和终端Git/结束报告登记;不重放旧样本,不代交或构建并行品牌/UI。见docs/QA-LIVE-PURGE-AG.md。 diff --git a/tests/helpers.mjs b/tests/helpers.mjs index 82c58e5b..e69fc771 100644 --- a/tests/helpers.mjs +++ b/tests/helpers.mjs @@ -87,7 +87,7 @@ export function assertToolPairs(messages) { } } -export async function launchWorkbench(t, data, extraEnv = {}, { appRoot = workspace, nodePath = process.execPath } = {}) { +export async function launchWorkbench(t, data, extraEnv = {}, { appRoot = process.env.AGENT_WORKBENCH_TEST_APP_ROOT ?? workspace, nodePath = process.execPath } = {}) { const env = { ...process.env, AGENT_WORKBENCH_APP_DIR: appRoot, AGENT_WORKBENCH_DATA_DIR: data, AGENT_WORKBENCH_PORT: '0', ...extraEnv }; delete env.AGENT_WORKBENCH_API_KEY; const child = spawn(nodePath, [path.join(appRoot, 'dist-server', 'server.mjs')], { cwd: appRoot, env, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] }); diff --git a/tests/terminal-delivery.test.mjs b/tests/terminal-delivery.test.mjs new file mode 100644 index 00000000..7bc28d37 --- /dev/null +++ b/tests/terminal-delivery.test.mjs @@ -0,0 +1,221 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import { randomUUID } from 'node:crypto'; +import { Runtime } from '../src/server/runtime.mjs'; +import { Provider } from '../src/server/provider.mjs'; +import { DeliveryReporter } from '../src/core/delivery-report.mjs'; +import { CheckRunner } from '../src/core/check-runner.mjs'; +import { fixture, call, compatibleFixture, completion, launchWorkbench, until } from './helpers.mjs'; +import { createDeliveryProject, applyDeliveryFix, deliveryGit as git, writeDeliveryFile as write } from './fixtures/delivery-project.mjs'; + +const paths = ['src/add.mjs', 'src/math.mjs']; +const commit = message => 'git -c core.hooksPath= commit --no-gpg-sign --only -m "' + message + '" -- ' + paths.join(' '); +function engineering(t, { apply = true } = {}) { + const f = fixture(t, { modernDefaults: true }); f.store.saveConfig({ approvalMode: 'full' }); + createDeliveryProject(f); + const record = f.store.beginRun(f.session, 'Continue the original repair and deliver its exact source files.', true, f.store.config); + f.session.status = 'running'; + const runtime = new Runtime(f.store, new Provider()); f.onCleanup(() => runtime.stopAll()); + const run = { id: record.id, taskId: record.taskId, record, config: f.store.config, project: f.project, controller: new AbortController() }; + if (apply) applyDeliveryFix(f); + return Object.assign(f, { runtime, run, command: text => runtime.executeTool(f.session, + call(randomUUID(), 'run_command', { command: text, reason: 'Owned terminal delivery fixture.' }), run) }); +} +function read(f, id) { return JSON.parse(f.store.artifactStore.read(f.store.core.artifact.get(id))); } +function reports(f) { return [...f.store.core.artifact.values()].filter(row => row.kind === 'delivery-report'); } + +test('split terminal add/commit is independently verified without inventing a delivery job or altering owner index', { timeout: 45000 }, async t => { + const f = engineering(t), parent = git(f, ['rev-parse', 'HEAD']).trim(); + const ownerIndex = git(f, ['show', ':owner-staged.txt']); + const owner = ['owner-staged.txt', 'owner-unstaged.txt', 'owner-untracked.txt'].map(name => [name, fs.readFileSync(path.join(f.projectRoot, name))]); + const checks = new CheckRunner(f.store); f.onCleanup(() => checks.stopAll()); + const job = await (await checks.start(f.session, (await checks.plan(f.session)).id)).promise; + assert.equal(job.status, 'passed'); + assert.equal((await f.command('git add -- ' + paths.join(' '))).status, 'completed'); + const result = await f.command(commit('actual terminal repair')); + assert.equal(result.status, 'completed', result.stderr); assert.equal(result.terminal_git.status, 'verified'); + const head = git(f, ['rev-parse', 'HEAD']).trim(); assert.notEqual(head, parent); + assert.equal(result.terminal_git.commit, head); assert.equal(f.store.core.delivery_job.size, 0); + assert.equal(git(f, ['show', ':owner-staged.txt']), ownerIndex); + for (const [name, bytes] of owner) assert.deepEqual(fs.readFileSync(path.join(f.projectRoot, name)), bytes); + f.session.status = 'completed'; f.store.finishRun(f.session, f.run.record); + const report = (await new DeliveryReporter(f.store).create(f.session)).report; + assert.equal(report.status, 'verified_committed'); assert.equal(report.gitOutcome.status, 'committed'); + assert.deepEqual(report.gitOutcome.sources, ['terminal']); assert.equal(report.deliveries.length, 0); + assert.equal(report.terminalGit[0].currentVerified, true); assert.equal(report.terminalGit[0].processAttribution, 'unproven'); + assert.equal(git(f, ['rev-list', '--count', 'HEAD']).trim(), '2'); +}); + +test('terminal commands still execute when a real commit includes an unrelated file, and the report preserves that mismatch', { timeout: 35000 }, async t => { + const f = engineering(t); + const result = await f.command('git add -- ' + paths.join(' ') + '\ngit -c core.hooksPath= commit --no-gpg-sign --only -m "mixed scope" -- ' + paths.join(' ') + ' owner-unstaged.txt'); + assert.equal(result.status, 'completed', result.stderr); assert.equal(result.terminal_git.status, 'unverified'); + const report = await new DeliveryReporter(f.store).inspect(f.session); + assert.equal(report.gitOutcome.status, 'observed_unverified'); assert.equal(report.terminalGit[0].evidenceVerified, true); + assert.equal(report.terminalGit[0].currentVerified, false); assert.match(report.terminalGit[0].error, /路径/); + assert.ok(report.terminalGit[0].paths.includes('owner-unstaged.txt')); assert.equal(f.store.core.delivery_job.size, 0); +}); + +test('spoofed commit output cannot become terminal Git evidence', { timeout: 25000 }, async t => { + const f = engineering(t), head = git(f, ['rev-parse', 'HEAD']).trim(); + const command = process.platform === 'win32' ? 'Write-Output "[main abc1234] committed successfully"' : 'printf "[main abc1234] committed successfully\\n"'; + assert.equal((await f.command(command)).status, 'completed'); + assert.equal(git(f, ['rev-parse', 'HEAD']).trim(), head); assert.equal(f.run.record.terminalGitEvidence, undefined); + assert.equal((await new DeliveryReporter(f.store).inspect(f.session)).gitOutcome.status, 'uncommitted'); +}); + +test('a changed non-target index and external HEAD drift remain unverified without blocking or replaying the real command', { timeout: 50000 }, async t => { + for (const external of [false, true]) { + const f = engineering(t); + await f.command('git add -- ' + paths.join(' ')); + if (external) git(f, ['-c', 'core.hooksPath=', 'commit', '--no-gpg-sign', '--only', '-m', 'outside terminal window', '--', 'owner-unstaged.txt']); + const result = await f.command((external ? '' : 'git add -- owner-unstaged.txt\n') + commit('scope under observation')); + assert.equal(result.status, 'completed', result.stderr); assert.equal(result.terminal_git.status, 'unverified'); + const evidence = read(f, result.terminal_git.artifact_id); + assert.equal(evidence.externalDrift, external); + assert.match(evidence.errors.join(' '), external ? /外部漂移/ : /非目标Git索引/); + assert.equal(git(f, ['rev-list', '--count', 'HEAD']).trim(), external ? '3' : '2'); + } +}); + +test('intermediate commits cannot hide an unrelated file by reverting it before the final net diff', { timeout: 35000 }, async t => { + const f = engineering(t); + const add = process.platform === 'win32' ? 'Set-Content -LiteralPath transient.txt -Value temporary' : 'printf temporary > transient.txt'; + const remove = process.platform === 'win32' ? 'Remove-Item -LiteralPath transient.txt' : 'rm transient.txt'; + const result = await f.command([add, 'git add -- ' + paths.join(' ') + ' transient.txt', 'git -c core.hooksPath= commit --no-gpg-sign --only -m "transient outside file" -- transient.txt', + remove, 'git -c core.hooksPath= commit --no-gpg-sign --only -m "final repair" -- ' + paths.join(' ') + ' transient.txt'].join('\n')); + assert.equal(result.status, 'completed', result.stderr); assert.equal(result.terminal_git.status, 'unverified'); + const evidence = read(f, result.terminal_git.artifact_id); + assert.deepEqual(evidence.paths, paths); assert.equal(evidence.commits.length, 2); assert.match(evidence.errors.join(' '), /中间提交/); +}); + +test('later source changes and damaged original receipts cannot certify the current terminal commit', { timeout: 35000 }, async t => { + const f = engineering(t); const result = await f.command('git add -- ' + paths.join(' ') + '\n' + commit('receipt verification')); + assert.equal(result.status, 'completed', result.stderr); + assert.equal(result.terminal_git.status, 'verified'); + const reporter = new DeliveryReporter(f.store); + assert.equal((await reporter.inspect(f.session)).terminalGit[0].currentVerified, true); + const original = fs.readFileSync(path.join(f.projectRoot, paths[0])); write(f, paths[0], 'export const modifiedLater = true;\n'); + assert.equal((await reporter.inspect(f.session)).terminalGit[0].status, 'stale'); + write(f, paths[0], original); + const artifact = f.store.core.artifact.get(result.terminal_git.artifact_id); + fs.writeFileSync(path.join(f.store.artifactStore.root, artifact.relative), '{}'); + const damaged = await reporter.inspect(f.session); + assert.equal(damaged.terminalGit[0].evidenceVerified, false); assert.equal(damaged.status, 'needs_verification'); + assert.match(damaged.terminalGit[0].error, /校验失败/); assert.equal(f.store.core.delivery_job.size, 0); +}); + +test('final reports append to immutable in-progress reports and do not appear for greetings, diagnostics, workers or a different task', { timeout: 35000 }, async t => { + const f = engineering(t); + const saved = await f.runtime.gitDelivery().report(f.session, { source: 'agent' }); + const original = f.store.artifactStore.read(f.store.core.artifact.get(saved.artifactId)); + assert.equal(saved.report.status, 'in_progress'); assert.equal(saved.report.lifecycle.phase, 'snapshot'); + f.session.status = 'completed'; f.store.finishRun(f.session, f.run.record); + await f.runtime.finalizeDeliveryReport(f.session, f.run); + const final = read(f, f.run.record.finalDeliveryReport.artifactId); + assert.notEqual(final.status, 'in_progress'); assert.equal(final.lifecycle.phase, 'final'); assert.equal(final.lifecycle.runStatus, 'completed'); + assert.ok(final.lifecycle.finishedAt); assert.equal(f.store.artifactStore.read(f.store.core.artifact.get(saved.artifactId)), original); + await f.runtime.finalizeDeliveryReport(f.session, f.run); assert.equal(reports(f).length, 2); + for (const kind of ['greeting', 'diagnostic', 'worker', 'different-task']) { + const other = engineering(t, { apply: false }); + if (kind !== 'greeting') await other.runtime.gitDelivery().report(other.session, { source: 'agent' }); + const count = reports(other).length; + if (kind === 'diagnostic') other.run.record.purpose = 'diagnostic'; + if (kind === 'worker') other.run.worker = { id: randomUUID() }; + if (kind === 'different-task') other.store.beginRun(other.session, 'A separate new task.', false, other.store.config, { forceNewTask: true }); + await other.runtime.finalizeDeliveryReport(other.session, other.run); + assert.equal(reports(other).length, count, kind); assert.equal(other.run.record.finalDeliveryReport, undefined, kind); + } +}); + +test('report failures preserve the completed run and never retry a terminal side effect', { timeout: 25000 }, async t => { + const f = engineering(t); const result = await f.command('git add -- ' + paths.join(' ') + '\n' + commit('keep completed command')); + assert.equal(result.status, 'completed', result.stderr); + f.session.status = 'completed'; f.store.finishRun(f.session, f.run.record); + f.runtime.gitDelivery().report = async () => { throw new Error('Owned report failure'); }; + await f.runtime.finalizeDeliveryReport(f.session, f.run); + assert.equal(f.session.status, 'completed'); assert.equal(f.run.record.status, 'completed'); + assert.match(f.run.record.finalDeliveryReportError, /Owned report failure/); assert.equal(f.run.record.finalDeliveryReport, undefined); + assert.equal(git(f, ['rev-list', '--count', 'HEAD']).trim(), '2'); +}); + +test('a real commit remains observable when a later command fails and its exit code is preserved', { timeout: 25000 }, async t => { + const f = engineering(t); + const result = await f.command('git add -- ' + paths.join(' ') + '\n' + commit('commit before command failure') + '\nexit 7'); + assert.equal(result.status, 'failed'); assert.equal(result.exit_code, 7); assert.equal(result.terminal_git.status, 'verified'); + f.session.status = 'failed'; f.store.finishRun(f.session, f.run.record); + const report = await new DeliveryReporter(f.store).inspect(f.session); + assert.equal(report.gitOutcome.status, 'committed'); assert.equal(report.terminalGit[0].command.exitCode, 7); + assert.equal(report.lifecycle.runStatus, 'failed'); assert.equal(f.store.core.delivery_job.size, 0); + assert.equal(git(f, ['rev-list', '--count', 'HEAD']).trim(), '2'); +}); + +test('observer initialization and post-observation failures never suppress a real terminal command', { timeout: 25000 }, async t => { + for (const phase of ['initialization', 'after']) { + const f = engineering(t, { apply: false }); + if (phase === 'initialization') f.runtime.gitDelivery = () => { throw new Error('Owned observer initialization failure'); }; + else f.runtime.terminalGit = { before: async () => ({}), after: async () => { throw new Error('Owned post-observation failure'); } }; + const result = await f.command('git --version'); + assert.equal(result.status, 'completed'); assert.equal(result.exit_code, 0); assert.match(result.stdout, /git version/); + assert.equal(result.terminal_git.status, 'unverified'); assert.match(result.terminal_git.message, /Owned/); + assert.match(f.run.record.terminalGitObservationError, /Owned/); assert.equal(f.store.core.delivery_job.size, 0); + } +}); + +test('isolated HTTP model tools register a real terminal commit and append a final report under saved full access', { timeout: 60000 }, async t => { + const f = engineering(t, { apply: false }); f.store.close(); let requests = 0, oldArtifact; + const model = await compatibleFixture(t, (_url, body) => { + requests++; + if (requests === 1) return completion([ + call('http-add', 'propose_file', { path: paths[0], content: "import { sum } from './math.mjs';\nexport const add = sum;\n", reason: 'Owned HTTP repair.' }), + call('http-math', 'propose_file', { path: paths[1], content: 'export const sum = (a, b) => a + b;\n', reason: 'Owned HTTP repair.' }), + ]); + if (requests === 2) return completion([call('http-stage', 'run_command', { command: 'git add -- ' + paths.join(' '), reason: 'Stage only owned task files.' })]); + if (requests === 3) { + const staged = JSON.parse(body.messages.findLast(row => row.role === 'tool').content); + assert.equal(staged.status, 'completed', JSON.stringify(staged)); + return completion([call('http-commit', 'run_command', { command: commit('HTTP terminal delivery'), reason: 'Commit owned task files while preserving owner staging.' })]); + } + if (requests === 4) { + const committed = JSON.parse(body.messages.findLast(row => row.role === 'tool').content); + assert.equal(committed.status, 'completed', JSON.stringify(committed)); assert.equal(committed.terminal_git.status, 'verified'); + return completion([call('http-report', 'delivery_report', {})]); + } + assert.equal(requests, 5); oldArtifact = JSON.parse(body.messages.findLast(row => row.role === 'tool').content).artifact_id; + return completion([], 'The owned terminal repair is committed.'); + }); + const appRoot = process.env.AGENT_WORKBENCH_TEST_APP_ROOT; + assert.ok(appRoot, 'Run this integration with the isolated engineering repair build.'); + const host = await launchWorkbench(t, f.data, {}, { appRoot }); + await host.api('/config', { mode: 'compatible', baseUrl: model.baseUrl, model: 'owned-terminal-delivery', apiKey: 'owned-local-fixture-only' }); + const route = '/sessions/' + f.session.id; await host.api(route + '/messages', { content: 'Complete the addition repair and make a local commit; preserve owner files and index.' }); + let state; await until(async () => { state = await host.api(route); return state.execution.run.finalDeliveryReport || state.execution.run.finalDeliveryReportError; }, 45000); + assert.equal(state.status, 'completed'); assert.equal(requests, 5); assert.ok(state.execution.run.finalDeliveryReport, state.execution.run.finalDeliveryReportError); + assert.equal(state.execution.deliveries.length, 0); assert.ok(state.approvals.every(row => row.status === 'approved' && row.approvalMode === 'full')); + const final = JSON.parse((await host.api('/artifacts/' + state.execution.run.finalDeliveryReport.artifactId + '?session=' + f.session.id + '&limit=1000000')).content); + const old = JSON.parse((await host.api('/artifacts/' + oldArtifact + '?session=' + f.session.id + '&limit=1000000')).content); + assert.equal(final.gitOutcome.status, 'committed'); assert.equal(final.terminalGit[0].currentVerified, true); + assert.equal(final.lifecycle.phase, 'final'); assert.equal(old.status, 'in_progress'); assert.equal(old.lifecycle.phase, 'snapshot'); + assert.equal(git(f, ['rev-list', '--count', 'HEAD']).trim(), '2'); +}); + +test('a real HTTP upstream failure remains a failed run while its applied files get a final evidence report', { timeout: 40000 }, async t => { + const f = engineering(t, { apply: false }); f.store.close(); let requests = 0; + const model = await compatibleFixture(t, () => { + requests++; + if (requests === 1) return completion([call('http-failure-proposal', 'propose_file', { path: paths[0], content: 'export const add = (a, b) => a + b;\n', reason: 'Owned failure fixture repair.' })]); + return { status: 400, body: { error: { message: 'owned upstream failure is preserved', code: 'owned_fixture_error' } } }; + }); + const appRoot = process.env.AGENT_WORKBENCH_TEST_APP_ROOT; assert.ok(appRoot); + const host = await launchWorkbench(t, f.data, {}, { appRoot }); + await host.api('/config', { mode: 'compatible', baseUrl: model.baseUrl, model: 'owned-failure-report', apiKey: 'owned-local-fixture-only' }); + const route = '/sessions/' + f.session.id; await host.api(route + '/messages', { content: 'Repair addition and report the real result.' }); + let state; await until(async () => { state = await host.api(route); return state.execution.run.finalDeliveryReport || state.execution.run.finalDeliveryReportError; }, 30000); + assert.equal(state.status, 'failed'); assert.equal(requests, 2); assert.ok(state.execution.run.finalDeliveryReport, state.execution.run.finalDeliveryReportError); + assert.match(JSON.stringify(state.lastFailure), /owned upstream failure is preserved/); + const final = JSON.parse((await host.api('/artifacts/' + state.execution.run.finalDeliveryReport.artifactId + '?session=' + f.session.id + '&limit=1000000')).content); + assert.equal(final.lifecycle.runStatus, 'failed'); assert.equal(final.lifecycle.phase, 'final'); assert.notEqual(final.status, 'in_progress'); + assert.equal(git(f, ['rev-list', '--count', 'HEAD']).trim(), '1'); +});