@aibyzero/cm-workflow 0.16.6 → 0.16.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +12 -1
- package/README.md +7 -1
- package/VERSION +1 -1
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +48 -6
- package/package.json +1 -1
- package/runtime/js/cm-ai/cm-ai-admission.mjs +34 -10
- package/runtime/js/cm-ai/cm-ai-context-refresh.mjs +9 -5
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +32 -14
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +92 -27
- package/runtime/js/cm-ai/developer-adapter.mjs +8 -5
- package/runtime/js/cm-ai/drive-bootstrap.mjs +2 -2
- package/runtime/js/cm-ai/durable-runner-state.mjs +29 -0
- package/runtime/js/cm-ai/host-conversation-execution.mjs +11 -3
- package/runtime/js/cm-ai/host-documentation.mjs +2 -2
- package/runtime/js/cm-ai/host-qa-executor.mjs +52 -6
- package/runtime/js/cm-ai/log-rows.mjs +36 -0
- package/runtime/js/cm-ai/operator-guidance.mjs +3 -0
- package/runtime/js/cm-ai/task-runner.mjs +6 -1
- package/runtime/js/cm-fix/finish.mjs +2 -19
- package/runtime/js/cm-fix/log-events.mjs +29 -0
- package/runtime/js/cm-fix/metrics.mjs +3 -2
- package/runtime/js/cm-prd/analysis.mjs +5 -2
- package/runtime/js/cm-prd/review-host.mjs +2 -1
- package/runtime/js/cm-test/recovery.mjs +4 -4
- package/scripts/cm-ai-admission.mjs +14 -3
- package/scripts/cm-ai-batch-drive.mjs +2 -2
- package/scripts/cm-ai-batch-host.mjs +7 -2
- package/scripts/cm-ai-batch-run.mjs +6 -2
- package/scripts/cm-ai-drive.mjs +14 -3
- package/scripts/cm-ai-drive.test.mjs +22 -0
- package/scripts/cm-ai-feature-selection.test.mjs +178 -0
- package/scripts/cm-ai-host.mjs +18 -6
- package/scripts/cm-ai-host.test.mjs +88 -0
- package/scripts/cm-ai-protected-scope.test.mjs +194 -0
- package/scripts/cm-ai-run.mjs +36 -5
- package/scripts/cm-fix-large-log.test.mjs +113 -0
- package/scripts/cm-host-qa-executor.test.mjs +308 -3
- package/scripts/cm-log-event.mjs +26 -5
- package/scripts/cm-prd-host.mjs +13 -2
- package/scripts/cm-prd-host.test.mjs +4 -0
- package/scripts/cm-prd-review-host.test.mjs +17 -0
- package/scripts/cm-prd-session-recovery.test.mjs +44 -2
- package/scripts/cm-prd-task-grouping.test.mjs +206 -0
- package/scripts/cm-review-scope-recovery.test.mjs +5 -3
- package/scripts/cm-test-branch-impact.test.mjs +11 -0
- package/skills/cm-ai/references/N1-init.md +1 -1
- package/skills/cm-ai/references/js-host.md +3 -2
- package/skills/cm-prd/SKILL.md +5 -4
- package/skills/cm-prd/references/spec-self-check.md +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cm-workflow",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.7",
|
|
4
4
|
"description": "Spec-driven product development workflow for Codex: external research, PRD, implementation, read-only feature testing, review, QA, fixes, refactors, and documentation.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "cm-workflow maintainers",
|
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
## 未发布
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
- `cm-ai` 质检浏览器验收回答 PASS、环境与登记一致,只是证据不在 specs 根 `.reviews/` 下(或缺失、为空)时,宿主在同一用例内带着具体问题再问一次,不再直接记 BLOCKED 占掉一轮质检;第二次回答照原规则判定,报告 `answerCorrection` 保留首次回答。FAIL、BLOCKED、环境不符或清理失败的回答不追问。
|
|
9
|
+
- `cm-fix` 收尾与恢复不再受运行日志大小限制:完成投影和 METRICS 行改为逐行流式读取 `运行日志.jsonl`,只取 cm-fix 行并按本运行身份核对;项目日志超过 1 MiB 后 check_n5 及之后每次恢复都报 `limit_exceeded` 的问题已修,已卡住的运行可直接恢复;`cm-test` 历史恢复同样改为逐行读取,不再受 32 MiB 整份上限限制。读取保留单链接、读取前后文件不变等原有检查。
|
|
10
|
+
- `cm-ai` 质检执行期间范围内文件被改时不再卡死:宿主先把本次观察到的 BLOCKED/FAIL 写成 `test_run/complete`(漂移行为 BLOCKED、`sourceChanged`,并记 `verdictBeforeSourceChange`),再返回 `stale_qa`;观察到的 PASS 不记为完成,经核对后只能用 `--rerun-unknown-qa` 重跑;代码还原后可用 `--rerun-blocked-qa` 重跑。漂移前为 PASS 或宿主可判定 BLOCKED 的行才可重跑,FAIL 与无法判定的行仍拒绝。旧版本留下的「有固定报告、无 complete」调用(`qa_execution_unknown`)也可用 `--rerun-blocked-qa` 按报告恢复,superseded 记 `incomplete_report`,日志只追加不改写。
|
|
11
|
+
- `cm-ai` 任务 scope 含受保护路径(AGENTS.md、CLAUDE.md、`.claude/`、`.codex/`、tasks.md、`.cm-*` 等)时,单任务宿主、批量宿主和 `openControlRun` 在建运行前直接以 `protected_scope` 拒绝并列出路径,不写任何运行记录;派发前确定被拒的开发记为 `blocked/protected_scope`,旧版本停在 `unknown/execution_error` 且无出口的运行按原记录回放为该终态(记录不改写),之后可按原门禁新建运行。文档补充规则文件的受支持修改途径,`cm-prd` 拆任务时提示规则文件不进开发 scope。保护范围不变。
|
|
12
|
+
- `cm-ai` 支持显式选择批次:`cm-ai-admission.mjs --feature N.slug --print-run-definition` 写入运行定义的 `featureSelection`,`cm-ai-host.mjs`、`cm-ai-drive.mjs` 也可用 `--feature`;仍校验全部批准、manifest 与所选批次内依赖,所选批次已无待办时明确提示且不为其他批次生成定义或建运行。不显式选择时行为不变。
|
|
13
|
+
- 普通当前会话宿主新增 `--review-runtime codex|claude`(当前会话开发、另一工具审查,须与 roles 一致并写入运行指纹);批准口令新增整句「可以,请开始开发」。
|
|
14
|
+
|
|
15
|
+
## 0.16.7 — 2026-10-06
|
|
16
|
+
|
|
17
|
+
- `cm-prd` 首次新计划按可独立验证和回滚的目标组织任务:相关低风险文案、样式和小交互可合理合并,保护基线、用户明确要求的独立边界及真实契约依赖继续保留;自检和原 split 独立审查采用同一规则。
|
|
18
|
+
- 角色与模型配置、已有任务列表、旧运行恢复和每任务 N4 独立审查保持原行为;在途规划请求保留原始指引,不迁移既有运行。
|
|
19
|
+
- 有限正式规划对照中,低风险任务数为 2→2,明确拆分为 4→4,四次独立 split 审查通过;高风险仅验证缺少设计审查凭证时阻止生成任务。尚未证明任务数、token、费用或开发审查次数下降。
|
|
9
20
|
|
|
10
21
|
## 0.16.6 — 2026-10-03
|
|
11
22
|
|
package/README.md
CHANGED
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
## 最近更新
|
|
19
19
|
|
|
20
|
+
**0.16.7**
|
|
21
|
+
|
|
22
|
+
- **首次规划按目标组织任务**:相关低风险文案、样式和小交互可合并为能独立验证和回滚的任务;保护基线、明确独立边界及真实契约依赖继续保留。
|
|
23
|
+
- **既有运行保持兼容**:不改角色配置、已有任务列表或每任务 N4 独立审查;在途规划请求继续使用原始指引。
|
|
24
|
+
- **收益仍待验证**:有限规划对照为 2→2、4→4,未显示任务数下降,也未证明 token 或费用节省;高风险仅验证原设计门禁。
|
|
25
|
+
|
|
20
26
|
**0.16.6**
|
|
21
27
|
|
|
22
28
|
- **运行时配置默认保留**:打开 `cm-runtime` 先看当前配置和来源,主动选择修改才进入预设向导;高级模型入口只提供说明和校验方法。
|
|
@@ -194,7 +200,7 @@ $cm-check
|
|
|
194
200
|
|
|
195
201
|
仓库直接分发 Skills 和脚本,无需在仓库根目录运行 `npm install` 或构建。完整安装行为、覆盖范围和卸载说明见[安装指南](docs/installation.md)。
|
|
196
202
|
|
|
197
|
-
需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.16.
|
|
203
|
+
需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.16.7 install`,请在 CM Workflow 源码仓库以外的目录执行,例如用户主目录。npm 安装入口复用原安装器,要求与覆盖范围见[安装指南](docs/installation.md#npm-installation-macos-codex)。
|
|
198
204
|
|
|
199
205
|
## 升级旧版本
|
|
200
206
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.16.
|
|
1
|
+
0.16.7
|
package/docs/installation.md
CHANGED
|
@@ -76,7 +76,7 @@ Install or upgrade with the same command:
|
|
|
76
76
|
npx @aibyzero/cm-workflow@latest install
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
To pin a version, use `npx @aibyzero/cm-workflow@0.16.
|
|
79
|
+
To pin a version, use `npx @aibyzero/cm-workflow@0.16.7 install` from outside
|
|
80
80
|
the CM Workflow source checkout (for example, your home directory). Inside a
|
|
81
81
|
checkout with the same package name and version, npm can select the local
|
|
82
82
|
uninstalled package and report `cm-workflow: command not found`.
|
|
@@ -322,13 +322,21 @@ constraintChanges必须空;application/retrospective沿原Learning字段。此
|
|
|
322
322
|
```
|
|
323
323
|
|
|
324
324
|
scope 和 requirements 是相对代码根的已有 runner 输入,不是额外写入授权。
|
|
325
|
-
键必须恰好如示例,不得任意新增字段(已声明的多代码根模式允许 `codeProjects`,显式任务选择允许生成器写入 `taskSelection`);定义参与摘要绑定,擅加字段会使同一次 run 的摘要漂移并导致 resume 失败。
|
|
325
|
+
键必须恰好如示例,不得任意新增字段(已声明的多代码根模式允许 `codeProjects`,显式任务选择允许生成器写入 `taskSelection`,显式批次选择允许写入 `featureSelection`);定义参与摘要绑定,擅加字段会使同一次 run 的摘要漂移并导致 resume 失败。
|
|
326
326
|
用准入生成器产出定义(`--scope` 必填,填写相对代码根、逗号分隔的允许修改文件;`--requirements` 可选,省略时为空数组):`node scripts/cm-ai-admission.mjs --specs-dir /absolute/specs --code-project /absolute/code --print-run-definition --scope src/login.js --requirements requirements.md > run.json`。需要选择当前 `nextTask` 以外的任务时加 `--task T-xxx`;只能选择同 feature、依赖已满足的 `eligibleTasks`。生成的可选 `taskSelection` 随定义进入持久配置与指纹;不加参数的旧定义及恢复指纹不变。
|
|
327
327
|
`--task` 的依赖判定与 `nextTask` 相同:前置任务已勾选完成或标记 DROPPED 即视为满足。选择不成立时返回 `task_selection_mismatch` 并在 `reason` 写明原因(依赖未完成、已完成、已 DROPPED、不存在或不在当前 feature);运行定义未写 `taskSelection` 却不是 `nextTask` 时也会提示用 `--task` 重新生成。
|
|
328
328
|
|
|
329
|
+
**显式选择批次(feature)**:默认仍选编号最小、有待办任务的 feature。已批准的跨 feature 顺序要求先做后面的批次时(例如 tasks.md「跨批责任」写明先做 6 再回到 5),显式选择:
|
|
330
|
+
`cm-ai-admission.mjs ... --feature 6.api-native-reading --print-run-definition --scope ...` 生成带 `featureSelection: {version:1, feature}` 的运行定义;或对已有运行定义给 `cm-ai-host.mjs serve` 加 `--feature 6.api-native-reading`(须与 `feature` 一致,效果同写入该字段)。
|
|
331
|
+
显式选择只改变「选哪个 feature」:全部规格批准、manifest 一致、bootstrap、测试合同照常校验;所选 feature 内的任务依赖照常判定(`--task` 仍只接受依赖已满足的任务);更早 feature 的待办任务原样保留,不改 tasks.md。
|
|
332
|
+
所选 feature 已无待办任务时,准入返回 `requestedFeatureComplete` 和明确 warning(项目其他 feature 仍有待办时 `state` 为 ready、`nextTask` 是项目自己的下一任务;全部完成时为 complete),`--print-run-definition` 一律以 `feature_tasks_terminal` 退出 1,宿主建运行一律以 `task_selection_mismatch` 拒绝并写明「已无待办任务」,不会为其他 feature 生成定义或建运行;名称不存在时为 `feature_selection_invalid`。所选批次最后一个任务完成后,该运行的上下文刷新仍包含它自己的规格。单步驾驶员 `cm-ai-drive.mjs` 的 `PLAN.permissions` 可写 `--feature N.slug`、`--review-runtime claude`,原样转发给宿主,驾驶员预检也按同一有效定义计算。
|
|
333
|
+
`featureSelection` 进入运行定义与恢复指纹:用 `--feature` 创建的运行恢复时也要带 `--feature`(或改用写入该字段的运行定义);运行内的上下文刷新、Learning 输入、文档同步的末任务判断与 QA 跳过判断都按所选 feature 读准入。未显式选择的运行(含 0.16.6 项目补丁期间创建的运行)不写该字段,恢复与指纹不变。QA 执行计划与合并判断仍按默认准入,所选批次不是默认批次时不做跨 feature 的 QA 合并。
|
|
334
|
+
|
|
335
|
+
**当前会话跨工具审查**:普通单任务宿主可用 `--runtime codex --review-runtime claude`(或反过来)让当前会话开发、另一工具审查。两端须与有效 `.cm-workflow.yml` 的 roles/runtimes 一致,否则 `runtime_selection_mismatch`;该选择以 `reviewRuntime` 写入运行配置与指纹,恢复必须带同一选项。审查配置的 preflight 须由审查端生成(`preflight --runtime claude`)。不能与 `--protected-config`、`--external-models` 同用(它们按 roles 自行选审查端)。此选项不授权真实审查调用,按轮审查授权不变。
|
|
336
|
+
|
|
329
337
|
`tasks.md` 的任务行只有一套语法(`runtime/js/spec-task-line.mjs`),准入、cm-prd 自检与变更守卫、N5 勾选、审批 manifest 的完成标记归一化和 failover 都用它:列表项 + 复选框,任意缩进,可选 `~~`,任务号后接英文冒号、全角冒号或空白,例如 `- [ ] T-003: 描述`、`- [ ] T-003 描述`、`- [ ] T-003:描述`、嵌套的 ` - [ ] T-003: 描述`。``` / ~~~ 围栏内的行是示例,不是任务。全角冒号选择接受而非拒绝:中文输入法常打出它,failover 早已接受,拒绝它只会逼用户为标点改规格再批准。语法随批准绑定:本版本写入的批准在 `.cm-specs-status` 记 `taskGrammar: 2`;更早记录的批准继续用原解析器(准入、规格材料、N5 勾选、supersede 与 failover 都按旧规则读),例如同文件里未加围栏的 `- [ ] T-001:示例` 在旧批准下仍是说明而不是重复任务,已批准的字节含义不变;重新批准后才切换到新语法。重新批准会让全部 feature(包括本次没改的)改用新语法,因此 `--approve` 先按新语法检查每个 feature 的 tasks.md,任一无效(如上例变成重复任务),或从旧语法切换时任何 feature 的任务集合(哪些行是任务、编号、勾选状态)在新旧语法下不一致(如唯一的 `- [ ] T-099:示例` 会变成待办任务),即以 `task_grammar_conflict` 拒绝,`approveReason` 写明文件、行号和原文,提示把这类示例放进围栏或删去后再批准;不会写入 `taskGrammar: 2`,也不退回旧语法——退回会让新写的全角冒号任务行悄悄不算任务。cm-prd 变更守卫读取已批准原文时同样按其批准的语法。状态文件把上次批准的 `taskGrammar` 经 cm-prd 变更与发布一路带到下次批准(重新批准前连续多次 `cm-prd --change` 时,变更守卫按这一携带值读取原文;不带该值的待审状态不会切到新语法);项目一旦用上新语法就不再做新旧对照,从未批准过的项目首次批准直接用新语法。cm-prd 草稿与自检始终用新语法。旧版本批准的 manifest 按旧归一化规则计算,核验时每行同时接受新旧规则的摘要,因此已批准的规格原样继续匹配(有意的小幅放宽:旧批准下全角冒号或缩进任务行的勾选变化也按运行时标记处理);只有旧规则下批准时就已勾选的无冒号/缩进任务行,在之后再勾选别的此类任务时仍会漂移,需要重新批准一次(新批准按新规则记录)。
|
|
330
338
|
|
|
331
|
-
|
|
339
|
+
规格待审批时先展示摘要卡并请用户回复“开始”。只识别“开始”“开始吧”“可以开始”“确认开始”“开始执行”“现在开始”“可以,请开始开发”及其尾部标点/空白(整句匹配,“开始开发”“请开始开发”等仍不算);泛化授权仍是 `not_approval`,提示明确回复“开始”。`--approve` 写入仍须原完整准入门禁。
|
|
332
340
|
|
|
333
341
|
```bash
|
|
334
342
|
node scripts/cm-ai-run.mjs serve --config /absolute/run.json --mode create
|
|
@@ -591,7 +599,7 @@ JS 通过现有通道发出固定请求,结果由原组件校验:
|
|
|
591
599
|
| documentation_sync | Review 前同步列明的文档,返回 `{status:"completed"}` | 原 scope 检查、最终 handoff 与 Review 覆盖 |
|
|
592
600
|
| qa_assess | 返回原 scores/changes 语义评估 | 原 N6 强制触发、评分及日志 |
|
|
593
601
|
| qa_logic | 返回原静态 verdict/evidence | 与实际命令覆盖关联,不把静态结论算执行 PASS |
|
|
594
|
-
| qa_browser | 用获准工具实测,返回原 verdict/evidence/environment/cleanup | 原逐例日志、证据与载体校验、QA 结果 |
|
|
602
|
+
| qa_browser | 用获准工具实测,返回原 verdict/evidence/environment/cleanup;PASS 只因证据不在 specs 根的 `.reviews/` 下(或缺失、为空)时,宿主带 `correction` 再问一次同一用例,只改证据重答 | 原逐例日志、证据与载体校验、QA 结果 |
|
|
595
603
|
| documentation_inspect | 只读核验,返回请求绑定的原文档结果 | 原 N8/finalizer,唯一 run_done |
|
|
596
604
|
|
|
597
605
|
正式 QA commands 由现有 host-check 实际执行,必须是宿主核对的已授权命令;配置文件本身
|
|
@@ -636,6 +644,7 @@ feature。恢复对应运行让 QA 通过后,再次 `advance` 本运行即可
|
|
|
636
644
|
并行批次成员(工作树根不同)
|
|
637
645
|
的交付不被识别;收尾发现文档需改时仍要走已审任务,不能在已完成运行内直接改。
|
|
638
646
|
日志镜像位于 specs/.reviews/host-log-mirror,只是原日志的可重建副本;权威仍是 specs-local 日志。
|
|
647
|
+
运行日志只增不减:cm-fix 收尾(check_n5 之后的完成投影、METRICS 行、观察期与恢复判断)与 cm-ai QA 读取都按行流式扫描 specs-local `运行日志.jsonl`(单行上限 1 MiB、拒绝符号链接),不再整份套用 1 MiB 的审查材料上限;cm-fix 只取 cm-fix 行,各调用方再按本运行身份筛选。日志超过 1 MiB 不影响收尾与恢复。cm-fix 与 cm-test 历史恢复的读取保留原有文件保证:单一链接的普通文件、读取前中后文件身份与大小时间不变、读到记录的大小,行按普通 JSON 解析;cm-test 恢复也不再受 32 MiB 整份上限限制。
|
|
639
648
|
重开复用原 QA/任务结果,只读文档核验可以再次进行,不能重发开发、文档写入或 QA。
|
|
640
649
|
本地命令与合成 reviewer 的 CLI 组合已走到 run_done;这不代表真实模型、浏览器或全 N6 验收。
|
|
641
650
|
|
|
@@ -1004,7 +1013,7 @@ workflow 配置的 `qa` 在 `commands/environment` 之外可选 `timeoutMs`(1
|
|
|
1004
1013
|
browser BLOCKED(执行器在报告行写 `hostDeclaredBlocked: true`;旧报告无此标记仍不适用)、没有退出码的命令结果
|
|
1005
1014
|
(host-check 的 timeout、signal_exit、spawn_failed、output_*、cleanup_failed)以及只因这类映射命令阻断的 logic 用例
|
|
1006
1015
|
(执行器写 `commandUnavailable: true`;`[需确认]` 的 logic 用例写 `needsConfirmation: true`,任何路径都不适用)。
|
|
1007
|
-
没有声明命令、延后用例、`[需确认]
|
|
1016
|
+
没有声明命令、延后用例、`[需确认]`、缺少浏览器能力仍不适用。源码漂移(执行期间范围内文件被改,执行器把全部行改为 BLOCKED 并标 `sourceChanged`)只在该行漂移前的判定是 PASS、或本身符合上述可重跑条件的 BLOCKED 时适用;执行器在报告行另记 `verdictBeforeSourceChange`,并与命令退出码、browser 的 `case_complete`/`case_blocked` 日志行、logic 映射命令的退出码交叉核对,不符按未知拒绝;没有该字段的旧报告由命令退出码和 browser 日志行推出,logic 行无法推出即拒绝。漂移前为 FAIL 的行一律不适用。重跑前运行须回到 `fixture_completed` 且无 code(代码已还原到审查包)。判定以权威输入为准:`[需确认]` 读该 feature 的
|
|
1008
1017
|
`test-cases.json`(契约里找不到的用例按未确认处理),命令阻断由报告中已记录的命令行推出,会话回答的 browser BLOCKED
|
|
1009
1018
|
以执行器在应答时追加的 `test_run/case_blocked` 日志行(`host_declared_blocked: true`)为准;`needsConfirmation`、
|
|
1010
1019
|
`commandUnavailable`、`hostDeclaredBlocked` 只作交叉核对,任一与契约、命令行或日志不符即拒绝。新写入的 superseded 行带 `recovery_rule: 2` 并按此规则回放;旧版本写入、
|
|
@@ -1038,7 +1047,7 @@ node scripts/cm-ai-host.mjs serve --config run.json --mode resume \
|
|
|
1038
1047
|
保留原运行需要的 runtime、保护及审查配置选项;收到 host_ready 后发送原 advance。
|
|
1039
1048
|
`--rerun-unknown-qa` 是本次恢复授权,不改变持久配置指纹;create、缺少 allow-qa 或配置漂移拒绝。
|
|
1040
1049
|
仅最新调用无 complete、已记录 case_complete 的 result 全为 PASS(允许零条)、无 case_blocked、
|
|
1041
|
-
无固定报告 `{testRunId}-execution.md
|
|
1050
|
+
无固定报告 `{testRunId}-execution.md`(或报告 `Overall: PASS` 且逐行 PASS 有权威依据,见下文 `qa_execution_unknown` 的处理),且原资源门禁确认无清理欠账时可重跑。
|
|
1042
1051
|
日志先写 `test_run/abandoned`(`previous_test_run_id` 为旧 ID,`reason: host_terminated`、
|
|
1043
1052
|
`partial_pass_cases: [caseId…]` 记录旧 PASS 用例,零条时为空数组),
|
|
1044
1053
|
再以新 testRunId、同一 qaRound 执行整轮;不复用部分用例,也不重跑开发、Review 或改变任务 attempt。
|
|
@@ -1166,6 +1175,28 @@ QA 重测通过及 N7/N8;重启只重新核验文档,不重复开发/修复/
|
|
|
1166
1175
|
该证据使用真正 CLI 子进程和仓库内合成 reviewer 可执行文件,Learning/开发/诊断/修复等
|
|
1167
1176
|
宿主回答由 fixture 提供,不是实际模型或已安装插件的运行验收。
|
|
1168
1177
|
|
|
1178
|
+
## 项目规则文件的修改通道
|
|
1179
|
+
|
|
1180
|
+
开发者 scope 不能含受保护路径:`AGENTS.md`、`CLAUDE.md`、`.claude/`、`.codex/`、`.git/`、`.reviews/`、`tasks.md`、`运行日志.jsonl` 和 `.cm-*`。
|
|
1181
|
+
`cm-ai-host.mjs serve --mode create`、批量宿主(对每个将新建的成员)和 `openControlRun` 在建运行前用开发适配器的同一规则检查 scope,
|
|
1182
|
+
命中即返回 `protected_scope`,`reason` 列出具体路径(批量前缀任务键);检查在冻结模型/策略配置、加批次锁、写日志、建工作树之前,
|
|
1183
|
+
此时不写 init、不写 intent、不建 `.execution/<runId>`。已存在的运行恢复时不受此检查影响。bootstrap 规范任务按原合同只把
|
|
1184
|
+
它自己的规则目标交给宿主,其余业务 scope 仍按此规则检查。保护范围本身不放宽,developer 仍不能写这些文件。
|
|
1185
|
+
|
|
1186
|
+
已批准任务要求修改规则文件时,按内容走下列受支持的途径,不放进开发 scope:
|
|
1187
|
+
|
|
1188
|
+
- 首次生成或按 cm-init 模板重建规则:bootstrap 规范任务(见上文 bootstrap 一节),由宿主受控写入并交独立 Review。
|
|
1189
|
+
- 任务教训:Learning 回写,由宿主写 `AGENTS.md` 的 `## 项目教训` 段。
|
|
1190
|
+
- 其他规则内容(如「同步项目规则」的具体差异):作为人工步骤,由用户本人或主会话按用户指示,在 CM 运行之外修改并提交。
|
|
1191
|
+
放在相关任务建运行之前(基线会记录新内容)或该任务完成之后;不要在运行进行中修改:`AGENTS.md` 属于审查快照,中途改动会被判为漂移。
|
|
1192
|
+
cm-prd 生成任务时把这类步骤单列为人工步骤并注明不进开发 scope。
|
|
1193
|
+
|
|
1194
|
+
加入建运行拦截之前创建、scope 含受保护路径的运行,第一次派发开发会停在 `unknown/execution_error`、`pendingAction: reconcile`,没有出口。
|
|
1195
|
+
这类记录现在回放为确定的 `blocked/protected_scope`:判定条件是开发 effect 只有一次没有结果的调用、无审查包、无 Learning 结果,
|
|
1196
|
+
且运行配置的 scope 命中受保护路径(开发适配器对这种 scope 总是在派发前拒绝)。原 journal 逐字保留,不追加、不改写。
|
|
1197
|
+
之后按原门禁用新 runId 新建运行(从 scope 移除受保护路径);旧运行已是 `blocked`,`--supersede-reviewed-evidence` 也接受它。
|
|
1198
|
+
尚未派发开发的旧运行恢复后发 `advance`,宿主在派发前直接记 `blocked/protected_scope`,不启动开发调用。
|
|
1199
|
+
|
|
1169
1200
|
## 文档核验与收尾
|
|
1170
1201
|
|
|
1171
1202
|
可信宿主现在可注入 `execution.documentationSync: {paths, run}`,将最后一个任务的
|
|
@@ -1339,6 +1370,7 @@ review.json 与单任务入口相同;有 QA 配置仍必须获得对应命令/
|
|
|
1339
1370
|
| `state: "unknown"` + `execution_error`,`pendingAction: "reconcile"`,且 stderr 显示驱动未应答 `init_generate`/`init_verify` | 驾驶员断联,原 develop effect 结果未定;旧版驾驶员可能错误退出 0 | 先核对原 host 与子进程及代码根实际写入;仅满足下述 pending effect 条件时在原 run 用 `abandon_effect`,之后按原新运行门禁使用当前会话宿主路径;不要原样重发 `advance` |
|
|
1340
1371
|
| `blocked/develop_checks_not_passed`,bootstrap 规范任务 | 规范已写入,`PLAN.checks` 未通过 | 修好检查环境后在原 run `advance`;同一轮以原答案重试,驾驶员与宿主只接受本运行存档记录的那次写入,他人改动先还原 |
|
|
1341
1372
|
| `blocked/bootstrap_verification_failed`,bootstrap 规范任务 | 当前会话宿主路径中 `init_verify` 有核验组不是 verified/not_applicable 或缺证据;宿主在写入规范前停止,`reason` 列出未通过的组与证据 | 本轮规范文件未写入,本运行的 Learning 与已记录规范证据保持不变。按证据修正项目或生成内容后在原 run `advance`:同一轮新 develop effect id 重新询问 `init_generate`/`init_verify`,宿主只接受磁盘文件仍与本运行已记录哈希一致(第 1 轮尚无写入时为不存在);占用计数调用与 effect,受 `develop_retry_limit` 约束。`constraintChanges` 非空或回复结构错误仍停在 `unknown`。旧版本记录的 `unknown` + `bootstrap_verification_blocked` 按原样重放,不改判。单步驾驶员在启动宿主前实跑命令,未通过不会进入宿主 |
|
|
1373
|
+
| `blocked/protected_scope` | 任务 scope 含受保护的规则或工作流文件;开发在派发前被拒绝,未写入文件。旧版本创建的运行原记为 `unknown/execution_error`,现按原记录回放为此状态 | 终态;从 scope 移除 `reason` 列出的路径,按原门禁用新 runId 新建运行;规则文件走「项目规则文件的修改通道」 |
|
|
1342
1374
|
| `state: "unknown"` + pending develop/complete intent(后面可有 control 记录) | 宿主在 effect intent 后、checkpoint 前退出 | `pendingAction: "abandon_effect"`;核对旧 host 与它启动的进程后,在原 run 显式退出 |
|
|
1343
1375
|
| `state: "unknown"` + pending review intent,尚无 host-joined/review 登记 | reviewer 启动前退出 | `pendingAction: "abandon_effect"`;确认旧 host 已退出后在原 run 显式退出 |
|
|
1344
1376
|
| `state: "unknown"` + 已登记且无结果的 review invocation | 审查调用未完成 | `pendingAction: "abandon_review"`;核对旧 host 和 reviewer 进程后在原 run 显式退出 |
|
|
@@ -1373,9 +1405,19 @@ review.json 与单任务入口相同;有 QA 配置仍必须获得对应命令/
|
|
|
1373
1405
|
重跑是从该任务重新开始,不是从整个 feature 重新开始。
|
|
1374
1406
|
|
|
1375
1407
|
**`qa_execution_unknown` 的处理**:按上文 `--rerun-unknown-qa` 的条件恢复。
|
|
1376
|
-
它只接受「已记录的用例结果全部 PASS
|
|
1408
|
+
它只接受「已记录的用例结果全部 PASS,且没有定稿执行报告、或报告为全 PASS 并逐行有权威依据」的未完成调用,
|
|
1377
1409
|
FAIL/BLOCKED 或资源未关闭的仍然拒绝,不会伪造通过。
|
|
1378
1410
|
|
|
1411
|
+
质检执行结束时运行已不是原状态(例如执行期间范围内文件被改,状态变为 `correction_review_required`):
|
|
1412
|
+
宿主先把本次调用观察到的 BLOCKED 或 FAIL 写成 `test_run/complete`(漂移时为 BLOCKED、各行 `sourceChanged`),再返回 `stale_qa`;
|
|
1413
|
+
把代码还原到审查包后,按已完成的 BLOCKED 用 `--rerun-blocked-qa` 重跑。观察到的 PASS 不在状态已变时记为完成:
|
|
1414
|
+
该调用保留为 `qa_execution_unknown`,任何读取方都不把它当通过;确认后用 `--rerun-unknown-qa` 丢弃并重跑,前提是报告 `Overall: PASS`、
|
|
1415
|
+
每行都是 PASS 且有权威依据(命令退出码 0、browser 的 `case_complete` PASS 日志行、契约已确认且映射命令都退出 0 的 logic)。旧版本在写出固定报告 `{testRunId}-execution.md` 之后、
|
|
1416
|
+
写 complete 之前就返回 `stale_qa`,留下「有报告、无 complete」的调用(`qa_execution_unknown`):确认旧宿主已退出、代码已还原后,
|
|
1417
|
+
在原 run 用 `--rerun-blocked-qa` 恢复。宿主以该报告为本次结果(报告 `Overall` 须与逐行 verdict 一致),报告中每条 PASS 行也须有上述权威依据,按上段同一规则判定每条非 PASS 行,
|
|
1418
|
+
superseded 行另记 `incomplete_report: true`,回放同样以报告复核;FAIL、无法判定的漂移行、`--qa-environment-failure` 均不适用。
|
|
1419
|
+
日志不改写,旧调用保留原 start 与 case 行。
|
|
1420
|
+
|
|
1379
1421
|
**单任务无结果 Review 的显式退出**(批次不支持):保留原 `run.json`、review 配置及原 host 身份,
|
|
1380
1422
|
写一个 `abandon-review.json`;若原运行还用了 protected 或 workflow 配置,`permissions` 中也带上原配置参数。
|
|
1381
1423
|
|
package/package.json
CHANGED
|
@@ -34,8 +34,8 @@ export function inspectCmAiBootstrapTask({specsDir,codeProject,taskId},inProgres
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// Read N6 task counts with the original task parser, including later features.
|
|
37
|
-
export function inspectCmAiQaTaskContext({specsDir,codeProject,feature,taskId}) {
|
|
38
|
-
const admission=inspectCmAiAdmission({specsDir,codeProject});
|
|
37
|
+
export function inspectCmAiQaTaskContext({specsDir,codeProject,feature,taskId,featureSelection}) {
|
|
38
|
+
const admission=inspectCmAiAdmission({specsDir,codeProject,...selectedFeature(featureSelection)});
|
|
39
39
|
const fail=code=>{throw Object.assign(new Error(code),{code});};
|
|
40
40
|
if(!['ready','complete'].includes(admission.state))fail(admission.reason);
|
|
41
41
|
const discovered=discoverFeatures(admission.specsDir);if(discovered.error)fail(discovered.error);
|
|
@@ -54,8 +54,8 @@ export function inspectCmAiQaTaskContext({specsDir,codeProject,feature,taskId})
|
|
|
54
54
|
|
|
55
55
|
// Admission's public feature summary stops at the selected feature. Count all
|
|
56
56
|
// approved features with the same parser before treating a task as the last one.
|
|
57
|
-
export function isFinalCmAiTask({specsDir,codeProject,feature,taskId,parallelSelection=null}) {
|
|
58
|
-
const admission=inspectCmAiAdmission({specsDir,codeProject});
|
|
57
|
+
export function isFinalCmAiTask({specsDir,codeProject,feature,taskId,parallelSelection=null,featureSelection}) {
|
|
58
|
+
const admission=inspectCmAiAdmission({specsDir,codeProject,...selectedFeature(featureSelection)});
|
|
59
59
|
if(!matchesCmAiTaskSelection(admission,feature,taskId,parallelSelection))
|
|
60
60
|
throw Object.assign(new Error('documentation_admission_required'),{code:'documentation_admission_required'});
|
|
61
61
|
const discovered=discoverFeatures(admission.specsDir);
|
|
@@ -69,6 +69,11 @@ export function isFinalCmAiTask({specsDir,codeProject,feature,taskId,parallelSel
|
|
|
69
69
|
return pending===1;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
// An explicit feature selection is bound by the run definition (featureSelection)
|
|
73
|
+
// and only then passed to admission. Without it, selection is the original
|
|
74
|
+
// lowest-numbered feature with pending tasks.
|
|
75
|
+
export const selectedFeature=feature=>feature===undefined||feature===null?{}:{feature};
|
|
76
|
+
|
|
72
77
|
function frozen(value){
|
|
73
78
|
if(value && typeof value==='object'){for(const item of Object.values(value))frozen(item);Object.freeze(value);}
|
|
74
79
|
return value;
|
|
@@ -89,7 +94,7 @@ function approvalIntent(response,assumeYes){
|
|
|
89
94
|
if(response===undefined||response===null||response==='')return 'none';
|
|
90
95
|
if(typeof response!=='string')return 'not_approval';
|
|
91
96
|
const normalized=response.trim().replace(/[。!!.~~\s]+$/gu,'');
|
|
92
|
-
return new Set(['开始','开始吧','可以开始','确认开始','开始执行','现在开始']).has(normalized)?'explicit':'not_approval';
|
|
97
|
+
return new Set(['开始','开始吧','可以开始','确认开始','开始执行','现在开始','可以,请开始开发']).has(normalized)?'explicit':'not_approval';
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
|
|
@@ -311,7 +316,7 @@ function dependenciesSatisfied(task,parsed,byId){
|
|
|
311
316
|
});
|
|
312
317
|
}
|
|
313
318
|
|
|
314
|
-
function selectTask(specsDir,names){
|
|
319
|
+
function selectTask(specsDir,names,requestedFeature=null){
|
|
315
320
|
const features=[];
|
|
316
321
|
const warnings=[];
|
|
317
322
|
const evidence=reviewEvidenceNames(specsDir);
|
|
@@ -335,6 +340,9 @@ function selectTask(specsDir,names){
|
|
|
335
340
|
pending:pending.length,
|
|
336
341
|
});
|
|
337
342
|
if(!pending.length)continue;
|
|
343
|
+
// An explicitly selected later feature passes over earlier unfinished ones;
|
|
344
|
+
// they stay pending and unchanged, with their counts in features.
|
|
345
|
+
if(requestedFeature!==null&&name!==requestedFeature)continue;
|
|
338
346
|
// One dependency rule for nextTask and --task/parallel eligibility: a
|
|
339
347
|
// prerequisite is satisfied once it is completed or DROPPED.
|
|
340
348
|
const ready=task=>dependenciesSatisfied(task,parsed,byId);
|
|
@@ -343,6 +351,16 @@ function selectTask(specsDir,names){
|
|
|
343
351
|
return {features,warnings,nextTask:{feature:name,id:eligible.id,description:eligible.description},
|
|
344
352
|
eligibleTasks:pending.filter(ready).map(task=>({feature:name,id:task.id}))};
|
|
345
353
|
}
|
|
354
|
+
// The selected feature has nothing left: say so, and report the project's own
|
|
355
|
+
// next task rather than "complete". Callers never bind it to the selection.
|
|
356
|
+
// Keep this loop's feature summaries (every feature, the selected one too):
|
|
357
|
+
// the run of that feature still refreshes its context after its last task.
|
|
358
|
+
if(requestedFeature!==null){
|
|
359
|
+
const project=selectTask(specsDir,names);
|
|
360
|
+
if(project.error)return project;
|
|
361
|
+
return {...project,features,warnings:[...warnings,`所选 feature ${requestedFeature} 已无待办任务;`
|
|
362
|
+
+'不会为其他 feature 建运行或生成运行定义,请明确选择下一个 feature'],requestedFeatureComplete:requestedFeature};
|
|
363
|
+
}
|
|
346
364
|
return {features,warnings,nextTask:null};
|
|
347
365
|
}
|
|
348
366
|
|
|
@@ -420,6 +438,9 @@ function admissionFor(options,inProgressBootstrap=null){
|
|
|
420
438
|
if(!codeProject)return result(base,'blocked','code_project_missing');
|
|
421
439
|
const discovered=discoverFeatures(specsDir);
|
|
422
440
|
if(discovered.error)return result(base,'blocked',discovered.error);
|
|
441
|
+
const requestedFeature=input.feature===undefined?null:input.feature;
|
|
442
|
+
if(requestedFeature!==null&&!discovered.names.includes(requestedFeature))
|
|
443
|
+
return result(base,'blocked','feature_selection_invalid');
|
|
423
444
|
const status=readSpecsStatus(specsDir);
|
|
424
445
|
if(status.kind==='invalid')return result(base,'blocked','spec_status_invalid');
|
|
425
446
|
if(status.kind==='missing'||status.value.status==='awaiting_review'){
|
|
@@ -439,12 +460,13 @@ function admissionFor(options,inProgressBootstrap=null){
|
|
|
439
460
|
const bootstrapProblem=validateBootstrap(codeProject,specsDir,discovered.names);
|
|
440
461
|
if(bootstrapProblem&&!(bootstrapProblem==='bootstrap_conflict'&&inProgressBootstrap==='T-001'))
|
|
441
462
|
return result(base,'blocked',bootstrapProblem);
|
|
442
|
-
const selection=selectTask(specsDir,discovered.names);
|
|
463
|
+
const selection=selectTask(specsDir,discovered.names,requestedFeature);
|
|
443
464
|
if(selection.error)return result(base,'blocked',selection.error,{features:selection.features,warnings:selection.warnings,
|
|
444
465
|
...(selection.detail?{detail:selection.detail}:{})});
|
|
445
466
|
const warnings=[...selection.warnings,...featureQaWarnings(specsDir,selection.features)];
|
|
446
|
-
|
|
447
|
-
return result(base,'
|
|
467
|
+
const requested=selection.requestedFeatureComplete?{requestedFeatureComplete:selection.requestedFeatureComplete}:{};
|
|
468
|
+
if(!selection.nextTask)return result(base,'complete','all_tasks_terminal',{features:selection.features,warnings,...requested});
|
|
469
|
+
return result(base,'ready','task_selected',{features:selection.features,nextTask:selection.nextTask,eligibleTasks:selection.eligibleTasks,warnings,...requested});
|
|
448
470
|
}
|
|
449
471
|
|
|
450
472
|
// Diagnostic only: why an explicit --task selection is not eligible. Never used
|
|
@@ -452,7 +474,9 @@ function admissionFor(options,inProgressBootstrap=null){
|
|
|
452
474
|
export function explainCmAiTaskSelection(admission,{feature,taskId,selection=null}){
|
|
453
475
|
if(admission.state!=='ready')return `当前准入状态为 ${admission.state}/${admission.reason},不能选择任务`;
|
|
454
476
|
const next=admission.nextTask;
|
|
455
|
-
if(
|
|
477
|
+
if(admission.requestedFeatureComplete===feature)return `所选 feature ${feature} 已无待办任务,不能为它新建运行;请明确选择下一个 feature`;
|
|
478
|
+
if(next&&next.feature!==feature)return `--task 只能选择当前 feature ${next.feature} 的任务(运行定义为 ${feature})`
|
|
479
|
+
+(admission.requestedFeatureComplete===undefined?`;已批准的跨 feature 顺序要先做 ${feature} 时,用 cm-ai-admission.mjs --feature ${feature} --print-run-definition 重新生成运行定义,或给 cm-ai-host.mjs 加 --feature ${feature}`:'');
|
|
456
480
|
if(!admission.specsDir)return `${taskId} 不在可选任务中`;
|
|
457
481
|
let parsed;
|
|
458
482
|
try{parsed=readFeature(admission.specsDir,feature);}catch{return `无法读取 ${feature}/tasks.md`;}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {createHash} from 'node:crypto';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import {inspectCmAiAdmission,matchesCmAiTaskSelection,identifyApprovedBootstrapFeature} from './cm-ai-admission.mjs';
|
|
5
|
+
import {inspectCmAiAdmission,matchesCmAiTaskSelection,identifyApprovedBootstrapFeature,selectedFeature} from './cm-ai-admission.mjs';
|
|
6
6
|
import {arrayItems,digest,freeze,hex,json,need,shape,text,validIdentity,validTaskLearningInput} from './effect-contract.mjs';
|
|
7
7
|
|
|
8
8
|
const BASELINE_RULES=['coding-style.md','testing.md','security.md'];
|
|
@@ -59,9 +59,12 @@ export function readProjectInstructionContext(codeProject,applicableAgentFiles=[
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export function inspectCmAiContextRefresh(input,{admission:trustedAdmission=null}={}) {
|
|
62
|
-
shape(input,['specsDir','codeProject','feature','applicableAgentFiles']);
|
|
62
|
+
shape(input,['specsDir','codeProject','feature','applicableAgentFiles',...(Object.hasOwn(input,'featureSelection')?['featureSelection']:[])]);
|
|
63
63
|
text(input.specsDir);text(input.codeProject);text(input.feature);
|
|
64
|
-
|
|
64
|
+
// A run bound to an explicit feature (featureSelection) reads admission for it.
|
|
65
|
+
need(!Object.hasOwn(input,'featureSelection')||input.featureSelection===input.feature,'context_invalid');
|
|
66
|
+
const admission=trustedAdmission??inspectCmAiAdmission({specsDir:input.specsDir,codeProject:input.codeProject,
|
|
67
|
+
...selectedFeature(input.featureSelection)});
|
|
65
68
|
if(trustedAdmission!==null)need(input.feature===identifyApprovedBootstrapFeature(
|
|
66
69
|
trustedAdmission.features.map(item=>item.name))
|
|
67
70
|
&&admission.specsDir===input.specsDir&&admission.codeProject===input.codeProject,'context_invalid');
|
|
@@ -80,10 +83,11 @@ export function inspectCmAiContextRefresh(input,{admission:trustedAdmission=null
|
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
export function inspectCmAiTaskLearningInput(input,authority={}) {
|
|
83
|
-
shape(input,['specsDir','codeProject','feature','identity','applicableAgentFiles']);
|
|
86
|
+
shape(input,['specsDir','codeProject','feature','identity','applicableAgentFiles',...(Object.hasOwn(input,'featureSelection')?['featureSelection']:[])]);
|
|
84
87
|
text(input.feature);const identity=json(input.identity);validIdentity(identity);
|
|
85
88
|
const refresh=inspectCmAiContextRefresh({specsDir:input.specsDir,codeProject:input.codeProject,
|
|
86
|
-
feature:input.feature,applicableAgentFiles:input.applicableAgentFiles
|
|
89
|
+
feature:input.feature,applicableAgentFiles:input.applicableAgentFiles,
|
|
90
|
+
...(Object.hasOwn(input,'featureSelection')?{featureSelection:input.featureSelection}:{})},authority);
|
|
87
91
|
need(matchesCmAiTaskSelection(refresh,input.feature,identity.taskId,authority.parallelSelection??null),'learning_context_invalid');
|
|
88
92
|
const agentPaths=new Set(['AGENTS.md',...arrayItems(input.applicableAgentFiles)]);
|
|
89
93
|
const selected=refresh.contextFiles.filter(file=>file.scope==='specs'?file.path==='LESSONS.md':
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Fixed Codex-host entry for the existing cm-ai admission and V3 task runner.
|
|
2
|
-
import {inspectCmAiAdmission,matchesCmAiTaskSelection} from './cm-ai-admission.mjs';
|
|
2
|
+
import {inspectCmAiAdmission,matchesCmAiTaskSelection,selectedFeature} from './cm-ai-admission.mjs';
|
|
3
3
|
import {inspectCmAiContextRefresh,inspectCmAiTaskLearningInput} from './cm-ai-context-refresh.mjs';
|
|
4
4
|
import {findCmAiQaDecision,inspectCmAiQaDecision,inspectCmAiQaResult,recordCmAiQaDecision,
|
|
5
5
|
latestCmAiQaRun,recordCmAiQaRun,inspectCmAiQaRecovery,inspectCmAiQaConfigurationRecovery,timedOutQaDecision,
|
|
@@ -69,7 +69,7 @@ const correctionSummary=(operation,status)=>status.code==='correction_review_req
|
|
|
69
69
|
// run_done is a project claim: every approved feature's latest mandatory QA must
|
|
70
70
|
// have passed, not only this final run's own. Read with the strict owner validator.
|
|
71
71
|
function projectQaSummary(operation,status,options){
|
|
72
|
-
const admission=inspectCmAiAdmission({specsDir:options.specsDir,codeProject:options.codeProject});
|
|
72
|
+
const admission=inspectCmAiAdmission({specsDir:options.specsDir,codeProject:options.codeProject,...selectedFeature(options.featureSelection)});
|
|
73
73
|
const outstanding=outstandingFeatureQa({specsDir:options.specsDir,features:admission.features.map(({name,pending})=>({name,pending})),
|
|
74
74
|
currentRunId:status.identity.runId,inspect:latestCmAiQaRun});
|
|
75
75
|
if(!outstanding.length)return null;
|
|
@@ -196,7 +196,9 @@ export function createCmAiConversationEntry(options) {
|
|
|
196
196
|
if(options&&Object.hasOwn(options,'allowAbandonEffect'))optionKeys.push('allowAbandonEffect');
|
|
197
197
|
if(options&&Object.hasOwn(options,'allowBootstrapReviewRecovery'))optionKeys.push('allowBootstrapReviewRecovery');
|
|
198
198
|
if(options&&Object.hasOwn(options,'holdRevision'))optionKeys.push('holdRevision');
|
|
199
|
+
if(options&&Object.hasOwn(options,'featureSelection'))optionKeys.push('featureSelection');
|
|
199
200
|
shape(options,optionKeys);
|
|
201
|
+
need(!Object.hasOwn(options,'featureSelection')||options.featureSelection===options.feature,'invalid_input');
|
|
200
202
|
need(!Object.hasOwn(options,'holdRevision')||options.holdRevision===true,'invalid_input');
|
|
201
203
|
if(Object.hasOwn(options,'developmentAttempt'))need([1,2].includes(options.developmentAttempt),'invalid_development_attempt');
|
|
202
204
|
text(options.specsDir);text(options.codeProject);text(options.feature);
|
|
@@ -313,7 +315,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
313
315
|
need(!controller.signal.aborted,'cancelled');need(result.syncId===syncId,'stale_documentation');
|
|
314
316
|
const current=boundStatus(runner.status(),status.identity);
|
|
315
317
|
need(current.state==='fixture_completed'&¤t.code==null&¤t.packageDigest===status.packageDigest,'stale_documentation');
|
|
316
|
-
const reread=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,
|
|
318
|
+
const reread=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,...(options.featureSelection===undefined?{}:{featureSelection:options.featureSelection}),
|
|
317
319
|
feature:options.feature,applicableAgentFiles});
|
|
318
320
|
need(reread.state==='complete'&&reread.contextDigest===refresh.contextDigest,'stale_documentation');
|
|
319
321
|
validateDocumentationResult(result,current,reread,knowledgeCloseout);
|
|
@@ -330,7 +332,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
330
332
|
need(sameTask(operation.identity,ownerIdentity),'identity_mismatch');
|
|
331
333
|
need(operation.identity.attempt>=ownerIdentity.attempt,'identity_mismatch');
|
|
332
334
|
const admission=['start','resume'].includes(operation.operation)
|
|
333
|
-
?runner.inspectBootstrapAdmission?.()??inspectCmAiAdmission({specsDir:options.specsDir,codeProject:options.codeProject}):null;
|
|
335
|
+
?runner.inspectBootstrapAdmission?.()??inspectCmAiAdmission({specsDir:options.specsDir,codeProject:options.codeProject,...selectedFeature(options.featureSelection)}):null;
|
|
334
336
|
if(admission&&admission.state!=='ready'){
|
|
335
337
|
// Original callers still stop before reading runner state. A caller using
|
|
336
338
|
// a newer attempt must bind it to the runner before we report its block.
|
|
@@ -384,7 +386,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
384
386
|
notCancelled();
|
|
385
387
|
need(pendingExecution===null,'qa_execution_pending');
|
|
386
388
|
const binding={specsDir:options.specsDir,feature:options.feature,identity:result.identity,packageDigest:result.packageDigest};
|
|
387
|
-
let previous,recovery=null,configurationRecovery=false;
|
|
389
|
+
let previous,recovery=null,configurationRecovery=false,incompleteReport=false;
|
|
388
390
|
try{previous=latestCmAiQaRun(binding);}
|
|
389
391
|
catch(error){
|
|
390
392
|
if(error.code==='qa_result_superseded'){
|
|
@@ -396,6 +398,14 @@ export function createCmAiConversationEntry(options) {
|
|
|
396
398
|
try{recovery=inspectCmAiQaRecovery(binding);}
|
|
397
399
|
catch(error){if(error.code!=='qa_execution_unknown')throw error;}
|
|
398
400
|
}
|
|
401
|
+
// The call wrote its fixed report but no complete row (a host before
|
|
402
|
+
// this fix rejected stale_qa in between). --rerun-blocked-qa reads
|
|
403
|
+
// that report under the ordinary blocked-evidence rules.
|
|
404
|
+
if(recovery===null&&rerunBlockedQa){
|
|
405
|
+
recovery=inspectCmAiQaRecovery(binding,{blocked:true,environment:qaExecutor.configuration?.environment,
|
|
406
|
+
environmentFailure:qaEnvironmentFailure});
|
|
407
|
+
incompleteReport=true;
|
|
408
|
+
}
|
|
399
409
|
if(recovery===null)return summary(operation,{...runner.status(),code:'qa_execution_unknown'},'blocked');
|
|
400
410
|
previous=null;
|
|
401
411
|
}
|
|
@@ -404,7 +414,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
404
414
|
// decision with no QA run under it yet (just written, or written
|
|
405
415
|
// before an interruption): run the ordinary first round, not a rerun.
|
|
406
416
|
if(rerunBlockedQa&&previous===null&&replacesTimedOutQaDecision(binding))rerunBlockedQa=false;
|
|
407
|
-
if(rerunBlockedQa){
|
|
417
|
+
if(rerunBlockedQa&&!incompleteReport){
|
|
408
418
|
need(previous!==null,'qa_rerun_not_blocked_by_evidence');
|
|
409
419
|
recovery=inspectCmAiQaRecovery(binding,{blocked:true,environment:qaExecutor.configuration?.environment,
|
|
410
420
|
environmentFailure:qaEnvironmentFailure});
|
|
@@ -449,9 +459,16 @@ export function createCmAiConversationEntry(options) {
|
|
|
449
459
|
return qaExecutor.run(freeze(invocation),controller.signal);
|
|
450
460
|
}),interrupted]);
|
|
451
461
|
need(!controller.signal.aborted,'cancelled');
|
|
462
|
+
// A run that moved on meanwhile (for example files in scope replaced):
|
|
463
|
+
// still record a BLOCKED or FAIL this call observed, so the restored run
|
|
464
|
+
// can take the ordinary --rerun-blocked-qa path instead of staying
|
|
465
|
+
// qa_execution_unknown (a source change is already BLOCKED/sourceChanged).
|
|
466
|
+
// A PASS is never recorded unconfirmed; it stays unknown, and only
|
|
467
|
+
// --rerun-unknown-qa may discard that fully backed all-PASS report.
|
|
452
468
|
const current=boundStatus(runner.status(),result.identity);
|
|
453
|
-
|
|
454
|
-
recordCmAiQaRun({...logInput,phase:'complete',result:executed});
|
|
469
|
+
const fresh=current.state==='fixture_completed'&¤t.code==null&¤t.packageDigest===result.packageDigest;
|
|
470
|
+
if(fresh||executed.result!=='PASS')recordCmAiQaRun({...logInput,phase:'complete',result:executed});
|
|
471
|
+
need(fresh,'stale_qa');
|
|
455
472
|
}finally{clearTimeout(timer);pendingExecution=null;}
|
|
456
473
|
}
|
|
457
474
|
result=await call('qa_result',result.packageDigest,{testRunId});
|
|
@@ -622,7 +639,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
622
639
|
}
|
|
623
640
|
if(decision===null)return summary(operation,{...status,code:'qa_decision_required'},'awaiting');
|
|
624
641
|
if(decision.status==='skipped'){
|
|
625
|
-
const admission=inspectCmAiAdmission({specsDir:options.specsDir,codeProject:options.codeProject});
|
|
642
|
+
const admission=inspectCmAiAdmission({specsDir:options.specsDir,codeProject:options.codeProject,...selectedFeature(options.featureSelection)});
|
|
626
643
|
if(!['ready','complete'].includes(admission.state))
|
|
627
644
|
return summary(operation,{...status,code:admission.reason},'awaiting');
|
|
628
645
|
const feature=admission.features.find(item=>item.name===options.feature);
|
|
@@ -663,7 +680,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
663
680
|
need(status.state==='fixture_completed','context_not_ready');
|
|
664
681
|
contextEvidence(options,identity,operation);
|
|
665
682
|
need(applicableAgentFiles!==null,'context_invalid');
|
|
666
|
-
const refresh=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,
|
|
683
|
+
const refresh=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,...(options.featureSelection===undefined?{}:{featureSelection:options.featureSelection}),
|
|
667
684
|
feature:options.feature,applicableAgentFiles});
|
|
668
685
|
if(!['ready','complete'].includes(refresh.state))return summary(operation,{state:refresh.state,
|
|
669
686
|
code:refresh.reason,identity,packageDigest:status.packageDigest},'awaiting');
|
|
@@ -676,7 +693,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
676
693
|
need(status.state==='fixture_completed','run_not_ready');
|
|
677
694
|
contextEvidence(options,identity,operation);
|
|
678
695
|
need(applicableAgentFiles!==null,'context_invalid');
|
|
679
|
-
const refresh=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,
|
|
696
|
+
const refresh=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,...(options.featureSelection===undefined?{}:{featureSelection:options.featureSelection}),
|
|
680
697
|
feature:options.feature,applicableAgentFiles});
|
|
681
698
|
need(refresh.state==='complete','run_not_ready');
|
|
682
699
|
const projectQa=projectQaSummary(operation,status,options);if(projectQa)return projectQa;
|
|
@@ -701,7 +718,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
701
718
|
need(status.state==='fixture_completed','run_not_ready');
|
|
702
719
|
contextEvidence(options,identity,operation);
|
|
703
720
|
need(applicableAgentFiles!==null,'context_invalid');
|
|
704
|
-
const refresh=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,
|
|
721
|
+
const refresh=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,...(options.featureSelection===undefined?{}:{featureSelection:options.featureSelection}),
|
|
705
722
|
feature:options.feature,applicableAgentFiles});
|
|
706
723
|
need(refresh.state==='complete','run_not_ready');
|
|
707
724
|
const projectQa=projectQaSummary(operation,status,options);if(projectQa)return projectQa;
|
|
@@ -712,7 +729,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
712
729
|
const current=boundStatus(runner.status(),identity);
|
|
713
730
|
need(!current.cancellationRequested&&!current.cancelAfterCommit,'cancelled');
|
|
714
731
|
need(current.state==='fixture_completed'&¤t.code==null&¤t.packageDigest===status.packageDigest,'stale_documentation');
|
|
715
|
-
const finalContext=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,
|
|
732
|
+
const finalContext=inspectCmAiContextRefresh({specsDir:options.specsDir,codeProject:options.codeProject,...(options.featureSelection===undefined?{}:{featureSelection:options.featureSelection}),
|
|
716
733
|
feature:options.feature,applicableAgentFiles});
|
|
717
734
|
need(finalContext.state==='complete'&&finalContext.contextDigest===refresh.contextDigest,'stale_documentation');
|
|
718
735
|
const documentationStatus=validateDocumentationResult(documentation,status,refresh,knowledgeCloseout);
|
|
@@ -747,7 +764,8 @@ export function createCmAiConversationEntry(options) {
|
|
|
747
764
|
if(options.holdRevision===true&&status.state==='changes_requested')
|
|
748
765
|
return summary(operation,{...status,code:'revision_answer_required'},'awaiting');
|
|
749
766
|
const learningInput=inspectCmAiTaskLearningInput({specsDir:options.specsDir,codeProject:options.codeProject,
|
|
750
|
-
feature:options.feature,identity,applicableAgentFiles:applicableAgentFiles??[]
|
|
767
|
+
feature:options.feature,identity,applicableAgentFiles:applicableAgentFiles??[],
|
|
768
|
+
...(options.featureSelection===undefined?{}:{featureSelection:options.featureSelection})},
|
|
751
769
|
{admission:runner.inspectBootstrapAdmission?.()??null,parallelSelection:options.parallelSelection??null});
|
|
752
770
|
// Keep rejected effects immutable. A run-wide rejection count gives each
|
|
753
771
|
// corrected result a new effect id without changing the provider attempt.
|