@aibyzero/cm-workflow 0.16.0 → 0.16.1
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 +20 -0
- package/README.md +2 -2
- package/VERSION +1 -1
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +8 -2
- package/package.json +1 -1
- package/runtime/js/cm-ai/checklist-coverage.mjs +70 -0
- package/runtime/js/cm-ai/effect-contract.mjs +3 -1
- package/runtime/js/cm-ai/host-conversation-execution.mjs +37 -1
- package/runtime/js/cm-ai/review-package.mjs +29 -3
- package/runtime/js/cm-ai/task-runner.mjs +10 -4
- package/runtime/js/cm-fix/cause-invocation.mjs +17 -4
- package/runtime/js/cm-fix/execution.mjs +30 -22
- package/runtime/js/cm-fix/final-review.mjs +18 -11
- package/runtime/js/cm-fix/finish.mjs +14 -1
- package/runtime/js/cm-security/scan.mjs +7 -1
- package/scripts/cm-ai-checklist-coverage.test.mjs +116 -0
- package/scripts/cm-ai-verification-gate.test.mjs +18 -0
- package/scripts/cm-fix-cross-session-host.test.mjs +100 -0
- package/scripts/cm-fix-execution.test.mjs +33 -0
- package/scripts/cm-fix-host.mjs +11 -5
- package/scripts/cm-fix-repair-owner.test.mjs +22 -18
- package/scripts/cm-review-dependency-snapshot.test.mjs +85 -0
- package/scripts/cm-review-inventory.test.mjs +42 -0
- package/scripts/cm-security.test.mjs +24 -0
- package/skills/cm-fix/references/js-host.md +18 -1
- package/templates/auto-update/cm-update.sh +51 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cm-workflow",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
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
|
@@ -7,6 +7,26 @@
|
|
|
7
7
|
|
|
8
8
|
(暂无)
|
|
9
9
|
|
|
10
|
+
## 0.16.1 — 2026-09-21
|
|
11
|
+
|
|
12
|
+
**cm-fix 收尾只认 delivery:diff,把 cm-init 自己生成的默认配置锁在门外**
|
|
13
|
+
|
|
14
|
+
- `finish` 原本硬要求 `policies.delivery === 'diff'`,否则 `fix_delivery_authorization_required`。而 `cm-init` 给任何带 remote 的仓库生成的就是 `draft-mr`,于是这类项目的 JS 运行**永远走不到收尾**,档案、METRICS、`task_done` 一样都写不成。这条限制原本写在 `js-host.md` 里,但它和同一套体系的其它约定互相矛盾:`runtime/logging.md` 把 Git 交付定义成独立的 `delivery` 事件(`commit`/`push`/`pull_request`),cm-ai 在任何交付模式下都照常完成任务,cm-fix 自己的 SKILL 第 7 步也明写 branch/draft-mr 怎么提交。
|
|
15
|
+
- 更要命的是它无法绕开:`findConfig` 只读项目根,而项目根在业务快照范围内,所以临时把 delivery 改成 `diff` 这个动作本身就改了快照,阶段立刻从 `closeout_required` 掉成 `learning_writeback_evidence_required`,收尾照样过不去;改回来又变回 `draft-mr`。两头堵,唯一出路是重跑整轮。
|
|
16
|
+
- 现在 finish 接受任一合法取值,只要求它在写完成记录期间**不变**(`fix_delivery_changed`)。写的还是档案/METRICS/`task_done`,**依然不执行 Git**:branch/draft-mr 的提交、推送、开 MR 仍由执行者单独完成并记 `delivery` 事件。
|
|
17
|
+
|
|
18
|
+
**受保护模式跑不了任何需要本地 IPC 的测试命令(无代码修复,只补文档)**
|
|
19
|
+
|
|
20
|
+
- 受保护模式的沙箱 `network={enabled=false}`,而这个开关同时管着 unix domain socket 的 `listen`。于是 `tsx` CLI(启动时在 TMPDIR 建 `<pid>.pipe`)、`vitest` 之类一律 `Error: listen EPERM`;写 TMPDIR 文件本身不受影响。实测确认过两者的差别。
|
|
21
|
+
- **没有安全的代码修法**:放开它就等于给所有受保护测试命令放开整个外网,那是比问题本身更大的倒退。`js-host.md` 改为写清这条约束、症状、以及可用的替代写法(把 `npm test` 串联的 `tsx xxx.test.ts` 换成逐文件 `node --import .../tsx/dist/loader.mjs <file>`,覆盖面不变),并说明沙箱内失败为什么只留 `host check exited N`(原始输出有意不进证据)以及怎么手工重放看真实原因。
|
|
22
|
+
|
|
23
|
+
**cm-fix 两处让修复跑不下去的阻断**
|
|
24
|
+
|
|
25
|
+
- **换一个会话就再也打不开自己的运行**。`--mode resume` 一直存在,但 durable 配置里存着创建这次运行的会话 ID,指纹又是整份配置的摘要,于是新会话换上自己的 `--host-context` 必然 `fingerprint_mismatch`,而沿用旧 ID 又正是文档禁止的冒用旧会话——两条路都堵死,跨会话恢复实际上从来没能用过。现在把「这次运行绑定的宿主」和「此刻在跑的会话」分开:durable 配置与旧记录一字不改,恢复时用 `--original-host-context` 报上原会话,`--host-context` 仍是当前真实会话。两个身份都算宿主,授权凭据两者皆可、重放旧凭据不受影响,reviewer 必须同时独立于两者;改动 durable 宿主仍然 `fingerprint_mismatch` 关闭。
|
|
26
|
+
- **iOS 项目连基线快照都拍不成**。CocoaPods 装出来的 `ios/Pods/` 是几千个头文件软链接,而快照对软链接一律 `unsupported_file` 失败关闭,于是任何做过 `pod install` 的仓库在编写测试这一步直接阻断(实测 6179 个软链接)。现在把它按 `node_modules` 那样当依赖目录跳过,但**光看名字不算**:目录名要是 `pods`,里面要有 `Manifest.lock` 和 `Pods.xcodeproj`,旁边还要有 `Podfile.lock`,四样齐全才认。业务代码里自己写的 `pods/` 目录照常入快照、其中的软链接照常拒绝。软链接保护一行未放宽,Pods 内的文件也不能选进 scope 或 requirements。
|
|
27
|
+
|
|
28
|
+
判定本身就是安全边界——被它认下的目录会**无声**离开评审视野,所以遍历侧和 scope 守卫必须问同一个函数。初版这两处口径不一致:遍历侧不看名字、只探测生成物,于是在任意目录(例如 `src/`)放一个空 `Manifest.lock` 加一个空 `Pods.xcodeproj/`,整棵目录连同**已声明进 scope 的文件**一起被静默跳过,且不报任何错。现已统一为同一个判定,并补了三条回归测试钉住「两处必须一致」。
|
|
29
|
+
|
|
10
30
|
## 0.16.0 — 2026-09-20
|
|
11
31
|
|
|
12
32
|
一次真实实跑把 cm-ai 从「跑不完」推到「跑得完」,本版是那趟跑出来的修复与新增。
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
## 最近更新
|
|
19
19
|
|
|
20
|
-
**0.16.
|
|
20
|
+
**0.16.1**
|
|
21
21
|
|
|
22
22
|
- **安装时会问你要不要开启新版提示**。此前安装完只有一句含糊的「自动更新器未自动启用」,已经开启的人也会看到这句(是错的),没开启的人又不会当回事,结果几乎没人用上这个功能。现在安装器会先看你实际配没配,再决定说什么;没配且是手动安装时,问一句、你答 y 才写入。用 `--yes` 静默安装的不会被改动任何配置,只会打印该加什么。
|
|
23
23
|
- 它**只加一条「有新版就告诉你」的提示**,不会顺手打开后台自动升级——那是另一回事,仍需你自己决定。你的 `settings.json` 里原有的内容(比如自定义状态栏)不会被动。
|
|
@@ -148,7 +148,7 @@ $cm-check
|
|
|
148
148
|
|
|
149
149
|
仓库直接分发 Skills 和脚本,无需在仓库根目录运行 `npm install` 或构建。完整安装行为、覆盖范围和卸载说明见[安装指南](docs/installation.md)。
|
|
150
150
|
|
|
151
|
-
需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.16.
|
|
151
|
+
需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.16.1 install`,请在 CM Workflow 源码仓库以外的目录执行,例如用户主目录。npm 安装入口复用原安装器,要求与覆盖范围见[安装指南](docs/installation.md#npm-installation-macos-codex)。
|
|
152
152
|
|
|
153
153
|
## 升级旧版本
|
|
154
154
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.16.
|
|
1
|
+
0.16.1
|
package/docs/installation.md
CHANGED
|
@@ -73,7 +73,7 @@ Install or upgrade with the same command:
|
|
|
73
73
|
npx @aibyzero/cm-workflow@latest install
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
To pin a version, use `npx @aibyzero/cm-workflow@0.16.
|
|
76
|
+
To pin a version, use `npx @aibyzero/cm-workflow@0.16.1 install` from outside
|
|
77
77
|
the CM Workflow source checkout (for example, your home directory). Inside a
|
|
78
78
|
checkout with the same package name and version, npm can select the local
|
|
79
79
|
uninstalled package and report `cm-workflow: command not found`.
|
|
@@ -349,8 +349,8 @@ host-context 必须是真实当前会话身份;宿主将其排除出独立审
|
|
|
349
349
|
一轮独立审查要花一到三分钟,返工则要再赔上一整轮开发加审查。
|
|
350
350
|
|
|
351
351
|
启用后,宿主在收齐任务自身的检查之后、**构建审查包与派发独立审查之前**,
|
|
352
|
-
发一个 `verification_precheck` 请求,把该任务 `tasks.md`
|
|
353
|
-
|
|
352
|
+
发一个 `verification_precheck` 请求,把该任务 `tasks.md` 里的**任务描述**与**验证要求**原文、
|
|
353
|
+
连同本次检查结果一起交给对端,由对端逐条核对本次交付并回答:
|
|
354
354
|
|
|
355
355
|
```json
|
|
356
356
|
{"items":[{"requirement":"记录实现前基线","satisfied":true,"evidence":"npm test tests 42 / pass 42 / fail 0"}]}
|
|
@@ -362,6 +362,12 @@ host-context 必须是真实当前会话身份;宿主将其排除出独立审
|
|
|
362
362
|
**它只能拦,不能放。** 通过闸门不产生审查回执、不授予任何批准、不减少后续的完整独立审查。
|
|
363
363
|
这与 `prd_self_check` 的定位一致:机械通过不等于语义通过,不能用自检冒充独立审查。
|
|
364
364
|
|
|
365
|
+
**为什么描述也要核对**:硬性要求经常写在任务描述里而不是验证要求段,例如
|
|
366
|
+
「并核对既有筛选/搜索/编辑/删除不回归」「不修改 `src/todos.js`」。只读验证要求段
|
|
367
|
+
等于放过这一半——实跑中末任务正是因此漏做三项回归检查、被独立审查以 P1 打回。
|
|
368
|
+
描述里同时混着工作量估计与背景说明,**只核对其中可判定的硬性要求**,取舍交给对端;
|
|
369
|
+
两段都没有写时闸门自动让路。
|
|
370
|
+
|
|
365
371
|
**一条要如实说明的限制**:任务的验证要求在 `tasks.md` 里是自由文本,
|
|
366
372
|
**JS 无法机械证明对端把其中每一条都枚举到了**。JS 强制的是:回答的形状、
|
|
367
373
|
每条都必须给出非空的证据落点、以及只有全部满足才放行。形状合规不等于语义覆盖。
|
package/package.json
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Checklist coverage: a reminder, never a verdict.
|
|
2
|
+
//
|
|
3
|
+
// Four of the five development-stage rejections recorded on the reference
|
|
4
|
+
// project were not defects. The task text had enumerated a list — "confirm
|
|
5
|
+
// filter / search / edit / delete / clear-completed / clear-all do not
|
|
6
|
+
// regress", "record the empty, partial and complete states" — and the delivery
|
|
7
|
+
// simply left some entries out. A human reviewer found them, which costs a
|
|
8
|
+
// full review round.
|
|
9
|
+
//
|
|
10
|
+
// Counting entries is mechanical, so it does not need a reviewer. What is NOT
|
|
11
|
+
// mechanical is deciding whether an entry was covered under different wording
|
|
12
|
+
// ("列表为空" in the task, "空列表" in the evidence), which is why every result
|
|
13
|
+
// here is advisory: it says what to look at, never what to reject.
|
|
14
|
+
|
|
15
|
+
const MAX_LISTS = 16, MAX_ITEMS = 12, MAX_TEXT = 512 * 1024;
|
|
16
|
+
|
|
17
|
+
const suffixes = value => {
|
|
18
|
+
const out = [];
|
|
19
|
+
for (let i = 1; i <= value.length - 2; i += 1) out.push(value.slice(i));
|
|
20
|
+
return out;
|
|
21
|
+
};
|
|
22
|
+
const prefixes = value => {
|
|
23
|
+
const out = [];
|
|
24
|
+
for (let i = value.length - 1; i >= 2; i -= 1) out.push(value.slice(0, i));
|
|
25
|
+
return out;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// The first and last entry of a slash list absorb the surrounding sentence
|
|
29
|
+
// ("核对既有筛选", "清空全部不回归"), so they are matched by giving ground from
|
|
30
|
+
// the outside in. Interior entries stand alone and are matched verbatim.
|
|
31
|
+
function locate(item, text, position, length) {
|
|
32
|
+
if (text.includes(item)) return item;
|
|
33
|
+
const relaxed = position === 0 ? suffixes(item) : position === length - 1 ? prefixes(item) : [];
|
|
34
|
+
return relaxed.find(candidate => text.includes(candidate)) ?? null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function extractChecklists(taskText) {
|
|
38
|
+
if (typeof taskText !== 'string' || taskText.length === 0 || taskText.length > MAX_TEXT) return Object.freeze([]);
|
|
39
|
+
const lists = [], seen = new Set();
|
|
40
|
+
const add = (source, items) => {
|
|
41
|
+
const entries = items.map(value => value.trim()).filter(value => value.length >= 2);
|
|
42
|
+
if (entries.length < 3 || entries.length > MAX_ITEMS || lists.length >= MAX_LISTS) return;
|
|
43
|
+
const key = entries.join('\u0000');
|
|
44
|
+
if (seen.has(key)) return;
|
|
45
|
+
seen.add(key);
|
|
46
|
+
lists.push(Object.freeze({ source, items: Object.freeze(entries) }));
|
|
47
|
+
};
|
|
48
|
+
// 核对既有筛选/搜索/编辑/删除/清理已完成/清空全部不回归
|
|
49
|
+
for (const match of taskText.matchAll(/([\u4e00-\u9fa5]{2,8}(?:\/[\u4e00-\u9fa5]{2,8}){2,})/g))
|
|
50
|
+
add(match[1], match[1].split('/'));
|
|
51
|
+
// 分别记录**列表为空、有未完成、全部已完成**三种情形
|
|
52
|
+
for (const match of taskText.matchAll(/\*\*([^*\n]{4,80})\*\*\s*(?:这)?(?:三|四|五|六|七|八)\s*(?:种|类|个|项)/g))
|
|
53
|
+
add(match[1], match[1].split(/[、,,]/));
|
|
54
|
+
return Object.freeze(lists);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Returns only the lists that are missing at least one entry. An empty array
|
|
58
|
+
// means nothing was detected — not that the delivery is complete.
|
|
59
|
+
export function checklistGaps(taskText, evidenceText) {
|
|
60
|
+
if (typeof evidenceText !== 'string' || evidenceText.length === 0) return Object.freeze([]);
|
|
61
|
+
const text = evidenceText.length > MAX_TEXT ? evidenceText.slice(0, MAX_TEXT) : evidenceText;
|
|
62
|
+
const gaps = [];
|
|
63
|
+
for (const list of extractChecklists(taskText)) {
|
|
64
|
+
const missing = list.items.filter((item, index) => locate(item, text, index, list.items.length) === null);
|
|
65
|
+
if (missing.length > 0) gaps.push(Object.freeze({
|
|
66
|
+
source: list.source, total: list.items.length, missing: Object.freeze(missing),
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
return Object.freeze(gaps);
|
|
70
|
+
}
|
|
@@ -140,4 +140,6 @@ export function reviewExclusions(invocation,calls,developerContextId){
|
|
|
140
140
|
// Host configuration allows 32 exclusions. FIX second-round review additionally
|
|
141
141
|
// excludes the cause reviewer, first implementation reviewer and logical context.
|
|
142
142
|
// Preserve that full union; ordinary two-author-attempt callers still fit.
|
|
143
|
-
|
|
143
|
+
// A run resumed in a new session adds that session's host context to the union,
|
|
144
|
+
// so the bound carries one entry more than a single-session run ever needs.
|
|
145
|
+
export const MAX_REVIEW_EXCLUSIONS=36;
|
|
@@ -17,6 +17,7 @@ import {codexWorker,preflightMatches} from './worker-codex.mjs';
|
|
|
17
17
|
import {createHostReviewAuthority} from './host-review-authority.mjs';
|
|
18
18
|
import {createHostWorkflowCapabilities} from './host-workflow-capabilities.mjs';
|
|
19
19
|
import {resolveHostRole} from './host-role-routing.mjs';
|
|
20
|
+
import {checklistGaps} from './checklist-coverage.mjs';
|
|
20
21
|
import {specsPermissionArgs} from './codex-config.mjs';
|
|
21
22
|
import {createProjectExecution} from './host-project-execution.mjs';
|
|
22
23
|
import {codeProjectPaths,codeProjectInstructionPaths,resolveCodeProjects} from './code-projects.mjs';
|
|
@@ -59,7 +60,30 @@ export function readVerificationPrecheck(raw){
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
return freeze({satisfied:items.every(item=>item.satisfied===true),
|
|
62
|
-
unsatisfied:items.filter(item=>item.satisfied!==true).map(item=>item.requirement)
|
|
63
|
+
unsatisfied:items.filter(item=>item.satisfied!==true).map(item=>item.requirement),
|
|
64
|
+
evidence:items.map(item=>item.evidence).join('\n')});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// The delivered evidence usually lives in the scope files (a walkthrough
|
|
68
|
+
// document, a baseline note), not in the gate answers, so the coverage
|
|
69
|
+
// reminder reads both. Unreadable, oversized, symlinked or binary entries are
|
|
70
|
+
// skipped: a file this reminder cannot read is the review's problem, not its
|
|
71
|
+
// own, and it must never turn a readable delivery into a failure.
|
|
72
|
+
const COVERAGE_FILE_LIMIT=256*1024;
|
|
73
|
+
export function deliveredText(codeProject,scope){
|
|
74
|
+
if(typeof codeProject!=='string'||!Array.isArray(scope))return '';
|
|
75
|
+
const parts=[];
|
|
76
|
+
for(const entry of scope.slice(0,64)){
|
|
77
|
+
if(typeof entry!=='string'||entry.length===0)continue;
|
|
78
|
+
try{
|
|
79
|
+
const file=path.join(codeProject,entry);
|
|
80
|
+
const info=fs.lstatSync(file);
|
|
81
|
+
if(!info.isFile()||info.isSymbolicLink()||info.size>COVERAGE_FILE_LIMIT)continue;
|
|
82
|
+
const body=fs.readFileSync(file,'utf8');
|
|
83
|
+
if(!body.includes('\u0000'))parts.push(body);
|
|
84
|
+
}catch{/* a file the reminder cannot read simply contributes nothing */}
|
|
85
|
+
}
|
|
86
|
+
return parts.join('\n');
|
|
63
87
|
}
|
|
64
88
|
|
|
65
89
|
export function resolveReviewTimeout(review,protection){
|
|
@@ -151,6 +175,18 @@ export function createConversationExecution(definition,hostContextId,bridge,revi
|
|
|
151
175
|
task:request.identity.taskId,attempt:request.identity.attempt,
|
|
152
176
|
unsatisfied:verdict.unsatisfied})+'\n');
|
|
153
177
|
}catch{/* diagnostics never change the verdict */}
|
|
178
|
+
// Advisory only. An enumerated list in the task text whose entries are not
|
|
179
|
+
// all present in the delivery is the cheapest rejection to catch, but
|
|
180
|
+
// wording differs legitimately ("列表为空" vs "空列表"), so this reports and
|
|
181
|
+
// never rejects: the verdict below is the gate's, untouched.
|
|
182
|
+
try{
|
|
183
|
+
const gaps=checklistGaps([request.description,request.verification]
|
|
184
|
+
.filter(text=>typeof text==='string').join('\n'),
|
|
185
|
+
[verdict.evidence,deliveredText(definition.codeProject,definition.scope)].join('\n'));
|
|
186
|
+
if(gaps.length>0)process.stderr.write(JSON.stringify({diagnostic:'checklist_coverage',
|
|
187
|
+
task:request.identity.taskId,attempt:request.identity.attempt,advisory:true,
|
|
188
|
+
gaps:gaps.map(gap=>({total:gap.total,missing:gap.missing}))})+'\n');
|
|
189
|
+
}catch{/* diagnostics never change the verdict */}
|
|
154
190
|
return {satisfied:verdict.satisfied};
|
|
155
191
|
}:null;
|
|
156
192
|
const execution={configuration,timeoutMs:provider?protection.timeoutMs:1800000,excludedContexts:[hostContextId],hostDecision:null,applicableAgentFiles:[],
|
|
@@ -16,6 +16,28 @@ const materialPath=(p,selected)=>selected.has(p)||p.split('/').at(-1)==='AGENTS.
|
|
|
16
16
|
// Keep this narrower than the discovery scanner: dist/build may be authored files.
|
|
17
17
|
const dependencyDirectories=new Set(['.venv','node_modules','__pycache__','.pytest_cache','.ruff_cache']);
|
|
18
18
|
const inDependencyDirectory=p=>p.split('/').slice(0,-1).some(part=>dependencyDirectories.has(part.toLowerCase()));
|
|
19
|
+
// CocoaPods installs ios/Pods as a generated tree whose headers are symlinks.
|
|
20
|
+
// It is a dependency root like node_modules, but every other dependency root
|
|
21
|
+
// here is a fixed name, while this one is recognised from the filesystem. That
|
|
22
|
+
// makes the predicate itself a security boundary: whatever it accepts leaves
|
|
23
|
+
// the snapshot silently, so both the traversal and the scope guard must ask
|
|
24
|
+
// exactly this one function, and it must be expensive to satisfy by accident
|
|
25
|
+
// or on purpose. Four independent CocoaPods artefacts are required — the name,
|
|
26
|
+
// the two generated entries inside, and the Podfile.lock beside it — so an
|
|
27
|
+
// authored directory called pods/ still enters the snapshot and its symlinks
|
|
28
|
+
// still fail closed.
|
|
29
|
+
function isCocoaPodsRoot(absolute) {
|
|
30
|
+
if(path.basename(absolute).toLowerCase()!=='pods')return false;
|
|
31
|
+
try {
|
|
32
|
+
return fs.lstatSync(path.join(absolute,'Manifest.lock')).isFile()
|
|
33
|
+
&& fs.lstatSync(path.join(absolute,'Pods.xcodeproj')).isDirectory()
|
|
34
|
+
&& fs.lstatSync(path.join(path.dirname(absolute),'Podfile.lock')).isFile();
|
|
35
|
+
} catch { return false; }
|
|
36
|
+
}
|
|
37
|
+
const inCocoaPodsTree=(root,p)=>{
|
|
38
|
+
const parts=p.split('/');
|
|
39
|
+
return parts.slice(0,-1).some((part,index)=>isCocoaPodsRoot(path.join(root,...parts.slice(0,index+1))));
|
|
40
|
+
};
|
|
19
41
|
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
20
42
|
const fail = code => { const error=new Error(code); error.code=code; throw error; };
|
|
21
43
|
const need = (condition,code='invalid_input') => { if(!condition) fail(code); };
|
|
@@ -55,8 +77,12 @@ function filePath(p) {
|
|
|
55
77
|
&& p.normalize('NFC')===p,'unsupported_path');
|
|
56
78
|
const parts=p.split('/');
|
|
57
79
|
need(parts.every(s=>s && s!=='.' && s!=='..'),'unsupported_path');
|
|
80
|
+
// Committed placeholder files are ordinary source: .env.example and friends
|
|
81
|
+
// exist to be copied, and a repository that contains one must still be able to
|
|
82
|
+
// capture a baseline at all. Only these four explicit suffixes are allowed, so
|
|
83
|
+
// .env, .env.local and even .env.example.bak stay rejected as before.
|
|
58
84
|
need(parts.every(s=>!['.git','.ssh','.aws','.gnupg'].includes(s.toLowerCase())
|
|
59
|
-
&& !/^\.env(?:\.|$)/i.test(s)),'unsupported_path');
|
|
85
|
+
&& (!/^\.env(?:\.|$)/i.test(s) || /^\.env\.(?:example|sample|template|dist)$/i.test(s))),'unsupported_path');
|
|
60
86
|
return p;
|
|
61
87
|
}
|
|
62
88
|
function paths(input) {
|
|
@@ -141,7 +167,7 @@ function snapshot(root,specsPath=null,projectPaths=null,retainedPaths=[],selecte
|
|
|
141
167
|
if(p===specsPath){need(s.isDirectory()&&!s.isSymbolicLink(),'unsupported_path');continue;}
|
|
142
168
|
// Never follow a dependency-root symlink. Old baselines that captured
|
|
143
169
|
// these files still verify their original material instead of dropping it.
|
|
144
|
-
if(s.isDirectory()&&dependencyDirectories.has(name)
|
|
170
|
+
if(s.isDirectory()&&(dependencyDirectories.has(name.toLowerCase())||isCocoaPodsRoot(path.join(root,p)))
|
|
145
171
|
&&!retainedPaths.some(file=>file.startsWith(p+'/')))continue;
|
|
146
172
|
if(s.isDirectory()) walk(p,depth+1,codeRoot);
|
|
147
173
|
else add(p,s);
|
|
@@ -183,7 +209,7 @@ export function captureReviewBaseline(options) {
|
|
|
183
209
|
specification=captureSpecificationMaterial({...v.specification,taskId:v.identity.taskId});
|
|
184
210
|
}
|
|
185
211
|
const scope=paths(v.scope), requirements=requirementPaths(v.requirements,bootstrap!==null||specification!==null),root=rootPath(v.root);
|
|
186
|
-
need(![...scope,...requirements].some(inDependencyDirectory),'excluded_snapshot_path');
|
|
212
|
+
need(![...scope,...requirements].some(p=>inDependencyDirectory(p)||inCocoaPodsTree(root,p)),'excluded_snapshot_path');
|
|
187
213
|
const projectPaths=Object.hasOwn(v,'codeProjectPaths')?validateCodeProjectPaths(v.codeProjectPaths):null;
|
|
188
214
|
if(projectPaths!==null)resolveCodeProjects(v.root,projectPaths.map(prefix=>path.join(root,prefix)));
|
|
189
215
|
const specsPath=Object.hasOwn(v,'specsRoot')?reviewSpecsPath(root,v.specsRoot):null;
|
|
@@ -578,13 +578,19 @@ export function createTaskRunner(options) {
|
|
|
578
578
|
// verification never spends an independent review round.
|
|
579
579
|
async function verificationSatisfied(checks) {
|
|
580
580
|
if(verificationGate===null)return true;
|
|
581
|
-
//
|
|
582
|
-
//
|
|
581
|
+
// The description carries hard requirements too ("also confirm X/Y/Z do not
|
|
582
|
+
// regress", "do not modify A"), and a gate that reads only the verification
|
|
583
|
+
// section lets exactly those through to the independent review. Both are
|
|
584
|
+
// sent; neither is required to exist.
|
|
583
585
|
const specification=Object.hasOwn(original,'specification')?verifySpecificationMaterial(original):null;
|
|
584
586
|
const verification=specification?.task?.verification??null;
|
|
585
|
-
|
|
587
|
+
const description=specification?.task?.description??null;
|
|
588
|
+
const written=value=>typeof value==='string'&&value.trim().length>0;
|
|
589
|
+
if(!written(verification)&&!written(description))return true;
|
|
586
590
|
const verdict=json(await bounded(verificationGate,
|
|
587
|
-
json({identity:{...config.identity,attempt},
|
|
591
|
+
json({identity:{...config.identity,attempt},
|
|
592
|
+
...(written(description)?{description}:{}),
|
|
593
|
+
...(written(verification)?{verification}:{}),checks})));
|
|
588
594
|
shape(verdict,['satisfied']);need(typeof verdict.satisfied==='boolean','invalid_result');
|
|
589
595
|
return verdict.satisfied;
|
|
590
596
|
}
|
|
@@ -3,7 +3,19 @@ import {validateReviewDispatchGrant} from '../cm-ai/durable-runner-state.mjs';
|
|
|
3
3
|
import {inspectProviderCauseReview} from '../cm-ai/provider-review-observation.mjs';
|
|
4
4
|
import {digest,id,json,need,shape,text,hex} from '../cm-ai/effect-contract.mjs';
|
|
5
5
|
|
|
6
|
+
// A run outlives the session that created it. Its durable configuration keeps the
|
|
7
|
+
// original hostContextId, so stored records and fingerprints stay byte-identical;
|
|
8
|
+
// a resumed session declares its own next to it. Both are host identities: a grant
|
|
9
|
+
// may carry either, and the reviewer stays independent of both.
|
|
10
|
+
export function fixHostContexts(configuration){
|
|
11
|
+
const hosts=configuration.hostContextIds??[configuration.hostContextId];
|
|
12
|
+
need(Array.isArray(hosts)&&hosts.length>=1&&hosts.length<=2&&new Set(hosts).size===hosts.length
|
|
13
|
+
&&hosts[0]===configuration.hostContextId,'invalid_host_context');
|
|
14
|
+
hosts.forEach(id);return hosts;
|
|
15
|
+
}
|
|
6
16
|
export function validateCauseReviewer(raw,hostContextId,maxExclusions=32){
|
|
17
|
+
const hosts=Array.isArray(hostContextId)?hostContextId:[hostContextId];
|
|
18
|
+
need(hosts.length>=1&&hosts.length<=2,'invalid_cause_reviewer');hosts.forEach(id);
|
|
7
19
|
need([32,33,34].includes(maxExclusions),'invalid_cause_reviewer');
|
|
8
20
|
const value=json(raw);shape(value,['reviewerId','adapterId','provider','requestedModel','contextId','excludedThreadIds',
|
|
9
21
|
...(Object.hasOwn(value,'workerConfigurationDigest')?['workerConfigurationDigest']:[])]);
|
|
@@ -11,12 +23,13 @@ export function validateCauseReviewer(raw,hostContextId,maxExclusions=32){
|
|
|
11
23
|
for(const key of ['reviewerId','adapterId','contextId'])id(value[key]);text(value.requestedModel);
|
|
12
24
|
need(['codex','claude'].includes(value.provider),'invalid_cause_reviewer');
|
|
13
25
|
need(Array.isArray(value.excludedThreadIds)&&value.excludedThreadIds.length<=maxExclusions,'invalid_cause_reviewer');
|
|
14
|
-
value.excludedThreadIds.forEach(id);need(value.contextId
|
|
26
|
+
value.excludedThreadIds.forEach(id);need(!hosts.includes(value.contextId)&&!value.excludedThreadIds.includes(value.contextId),'invalid_cause_reviewer');
|
|
15
27
|
return value;
|
|
16
28
|
}
|
|
17
29
|
export function causeExpectation(request,configuration){
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
const hosts=fixHostContexts(configuration);
|
|
31
|
+
return {request,developerThreadId:hosts[0],
|
|
32
|
+
excludedThreadIds:[...configuration.causeReview.excludedThreadIds,...hosts.slice(1),request.contextId,
|
|
20
33
|
...(request.payload.reviewPackage.correction?.finalReview?[request.payload.reviewPackage.correction.finalReview.providerThreadId]:[])]};
|
|
21
34
|
}
|
|
22
35
|
export function inspectCauseRegistration(raw,configuration){
|
|
@@ -24,7 +37,7 @@ export function inspectCauseRegistration(raw,configuration){
|
|
|
24
37
|
const r=configuration.causeReview,request=value.request;
|
|
25
38
|
need(request.provider===r.provider&&request.requestedModel===r.requestedModel&&request.contextId===r.contextId,'cause_registration_mismatch');
|
|
26
39
|
validateReviewDispatchGrant(value.grant,{request,reviewerId:r.reviewerId,adapterId:r.adapterId,
|
|
27
|
-
packageDigest:request.payload.reviewPackage.packageDigest,hostContextIds:
|
|
40
|
+
packageDigest:request.payload.reviewPackage.packageDigest,hostContextIds:fixHostContexts(configuration),
|
|
28
41
|
authorizationAt:value.authorizationAt,registeredAt:value.registeredAt});
|
|
29
42
|
inspectProviderCauseReview(JSON.stringify({version:1,kind:'cm-provider-review-observation',
|
|
30
43
|
requestDigest:request.requestDigest,events:[],result:{status:'failed',code:'in_progress'}}),
|
|
@@ -9,7 +9,7 @@ import {digest,id,json,need,shape,text,validIdentity,requestFor,failureCode} fro
|
|
|
9
9
|
import {createFixReproduction,inspectFixReproduction} from './reproduce.mjs';
|
|
10
10
|
import {inspectFixLearning} from './learning.mjs';
|
|
11
11
|
import {createFixCausePackage} from './cause-package.mjs';
|
|
12
|
-
import {validateCauseReviewer,inspectCauseRegistration,inspectCauseResult,causeExpectation} from './cause-invocation.mjs';
|
|
12
|
+
import {validateCauseReviewer,inspectCauseRegistration,inspectCauseResult,causeExpectation,fixHostContexts} from './cause-invocation.mjs';
|
|
13
13
|
import {inspectProviderCauseReview} from '../cm-ai/provider-review-observation.mjs';
|
|
14
14
|
import {publishCauseEvidence} from './cause-evidence.mjs';
|
|
15
15
|
import {createFixRedTest,inspectFixRedTest,verifyFixRedEvidence,redTestFiles} from './red-test.mjs';
|
|
@@ -60,7 +60,8 @@ function diagnosis(raw){
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export function openFixExecution(options,{bridge=null,prepare=null,causeReview=null,finalReview=null,assertReviewReady=null}={}){
|
|
63
|
-
shape(options,['identity','configuration','create',...(Object.hasOwn(options,'
|
|
63
|
+
shape(options,['identity','configuration','create',...(Object.hasOwn(options,'hostContextId')?['hostContextId']:[]),
|
|
64
|
+
...(Object.hasOwn(options,'specsRoot')?['specsRoot']:[])]);
|
|
64
65
|
const {identity,configuration:originalConfiguration,create}=json(options,64*1024);validIdentity(identity);
|
|
65
66
|
const bare=options.specsRoot==null;
|
|
66
67
|
need(!Object.hasOwn(originalConfiguration,'archiveMode'),'invalid_fix_config');
|
|
@@ -90,7 +91,14 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
90
91
|
need(digest(identity)===digest(qaFixIdentity(configuration.qaSource)),'fix_qa_identity_mismatch');
|
|
91
92
|
if(Object.hasOwn(configuration,'runtime'))need(configuration.runtime==='claude'
|
|
92
93
|
&&(!configuration.causeReview||configuration.causeReview.provider==='claude'),'invalid_runtime');
|
|
93
|
-
|
|
94
|
+
// configuration is the durable run record: its hostContextId stays the session
|
|
95
|
+
// that created the run, so stored bytes and the store fingerprint never move.
|
|
96
|
+
// options.hostContextId is the live session; reviewConfiguration carries both so
|
|
97
|
+
// a resumed run keeps issuing and replaying grants without impersonating either.
|
|
98
|
+
const liveHostContextId=options.hostContextId??configuration.hostContextId;id(liveHostContextId);
|
|
99
|
+
const hostContextIds=[...new Set([configuration.hostContextId,liveHostContextId])];
|
|
100
|
+
const reviewConfiguration=hostContextIds.length>1?{...configuration,hostContextIds}:configuration;
|
|
101
|
+
if(configuration.causeReview)validateCauseReviewer(configuration.causeReview,hostContextIds);
|
|
94
102
|
if(Object.hasOwn(configuration,'applicableAgentFiles')){
|
|
95
103
|
need(Array.isArray(configuration.applicableAgentFiles),'invalid_input');
|
|
96
104
|
for(const file of configuration.applicableAgentFiles){
|
|
@@ -134,14 +142,14 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
134
142
|
const finalCycleRecord=(row,suffix)=>new RegExp(`^fix-final-(?:recovery-(?:[1-9]\\d*-)?)?${suffix}$`).test(row.id);
|
|
135
143
|
const publishCause=(inspectOnly=false)=>{
|
|
136
144
|
const records=store.snapshot().records;
|
|
137
|
-
return publishCauseEvidence({specsRoot:evidenceSpecsRoot,configuration,inspectOnly,
|
|
145
|
+
return publishCauseEvidence({specsRoot:evidenceSpecsRoot,configuration:reviewConfiguration,inspectOnly,
|
|
138
146
|
registration:records.find(record=>record.id==='fix-cause-registered')?.payload,
|
|
139
147
|
started:records.find(record=>record.id==='fix-cause-started')?.payload.providerThreadId??null,
|
|
140
148
|
result:records.find(record=>record.id==='fix-cause-result')?.payload});
|
|
141
149
|
};
|
|
142
150
|
const publishFinal=(inspectOnly=false)=>{
|
|
143
151
|
const records=store.snapshot().records;
|
|
144
|
-
return publishFixFinalEvidence({specsRoot:evidenceSpecsRoot,configuration,inspectOnly,
|
|
152
|
+
return publishFixFinalEvidence({specsRoot:evidenceSpecsRoot,configuration:reviewConfiguration,inspectOnly,
|
|
145
153
|
causeThread:records.find(record=>record.id==='fix-cause-started')?.payload.providerThreadId??null,
|
|
146
154
|
registration:finalRecord(records,'registered')?.payload,
|
|
147
155
|
started:finalRecord(records,'started')?.payload.providerThreadId??null,
|
|
@@ -151,7 +159,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
151
159
|
const records=store.snapshot().records;
|
|
152
160
|
const failed=records.find(row=>row.id==='fix-walkthrough-result')?.payload;
|
|
153
161
|
const regression=records.find(row=>row.id==='fix-post-regression-result')?.payload;
|
|
154
|
-
return {configuration:fixFinalReviewConfiguration(
|
|
162
|
+
return {configuration:fixFinalReviewConfiguration(reviewConfiguration,records.find(row=>row.id==='fix-cause-started')?.payload.providerThreadId??null),
|
|
155
163
|
registration:finalRecord(records,'registered')?.payload,
|
|
156
164
|
started:finalRecord(records,'started')?.payload.providerThreadId??null,
|
|
157
165
|
result:finalRecord(records,'result')?.payload,
|
|
@@ -164,7 +172,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
164
172
|
};
|
|
165
173
|
const publishRevisionFinal=(inspectOnly=false)=>{
|
|
166
174
|
const records=store.snapshot().records;
|
|
167
|
-
return publishFixFinalEvidence({specsRoot:evidenceSpecsRoot,configuration,inspectOnly,reviewFeedback:revisionFeedback(),
|
|
175
|
+
return publishFixFinalEvidence({specsRoot:evidenceSpecsRoot,configuration:reviewConfiguration,inspectOnly,reviewFeedback:revisionFeedback(),
|
|
168
176
|
registration:records.find(row=>row.id==='fix-revision-final-registered')?.payload,
|
|
169
177
|
started:records.find(row=>row.id==='fix-revision-final-started')?.payload.providerThreadId??null,
|
|
170
178
|
result:records.find(row=>row.id==='fix-revision-final-result')?.payload});
|
|
@@ -448,7 +456,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
448
456
|
}
|
|
449
457
|
if(record.id==='fix-revision-final-registered'){
|
|
450
458
|
need(revision&&stage==='revision_final_review_required'&&record.kind==='intent','fix_history_invalid');
|
|
451
|
-
revisionFinalRegistration=inspectFixFinalRegistration(record.payload,fixRevisionReviewConfiguration(revisionFeedback(),revision.nextIdentity));
|
|
459
|
+
revisionFinalRegistration=inspectFixFinalRegistration(record.payload,fixRevisionReviewConfiguration(revisionFeedback(),revision.nextIdentity,hostContextIds));
|
|
452
460
|
const {handoff:boundHandoff,packageDigest,...body}=revisionFinalRegistration.request.payload.reviewPackage;
|
|
453
461
|
need(digest(body)===(revisionLearningPackage??revisionRetrospectivePackage).packageDigest&&boundHandoff.sha256===revisionHandoff.handoffSha256
|
|
454
462
|
&&boundHandoff.path===path.basename(revisionHandoffPath()),'final_package_mismatch');
|
|
@@ -458,13 +466,13 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
458
466
|
need(revision&&pending==='revision_final_review'&&revisionFinalStarted===null&&record.kind==='result','fix_history_invalid');
|
|
459
467
|
need(record.payload.providerThreadId!==finalRecovery?.providerThreadId,'final_context_mismatch');
|
|
460
468
|
shape(record.payload,['providerThreadId']);id(record.payload.providerThreadId);
|
|
461
|
-
const config=fixRevisionReviewConfiguration(revisionFeedback(),revision.nextIdentity);
|
|
462
|
-
need(![config
|
|
469
|
+
const config=fixRevisionReviewConfiguration(revisionFeedback(),revision.nextIdentity,hostContextIds);
|
|
470
|
+
need(![...fixHostContexts(config),config.reviewer.contextId,...config.reviewer.excludedThreadIds].includes(record.payload.providerThreadId),'final_context_mismatch');
|
|
463
471
|
revisionFinalStarted=record.payload.providerThreadId;continue;
|
|
464
472
|
}
|
|
465
473
|
if(record.id==='fix-revision-final-result'){
|
|
466
474
|
need(revision&&pending==='revision_final_review'&&record.kind==='result','fix_history_invalid');
|
|
467
|
-
revisionFinalResult=inspectFixFinalResult(record.payload,revisionFinalRegistration,fixRevisionReviewConfiguration(revisionFeedback(),revision.nextIdentity),revisionFinalStarted);
|
|
475
|
+
revisionFinalResult=inspectFixFinalResult(record.payload,revisionFinalRegistration,fixRevisionReviewConfiguration(revisionFeedback(),revision.nextIdentity,hostContextIds),revisionFinalStarted);
|
|
468
476
|
pending=null;stage=revisionFinalResult.observationStatus==='completed'
|
|
469
477
|
?revisionFinalResult.review.verdict==='approved'?'revision_final_review_evidence_required':revisionFinalResult.review.verdict==='changes_requested'?'revision_review_limit_reached':'revision_final_review_blocked':'unknown';continue;
|
|
470
478
|
}
|
|
@@ -528,7 +536,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
528
536
|
}
|
|
529
537
|
if(record.id==='fix-final-registered'){
|
|
530
538
|
need(stage==='final_review_required'&&record.kind==='intent','fix_history_invalid');
|
|
531
|
-
finalRegistration=inspectFixFinalRegistration(record.payload,fixFinalReviewConfiguration(
|
|
539
|
+
finalRegistration=inspectFixFinalRegistration(record.payload,fixFinalReviewConfiguration(reviewConfiguration,started));
|
|
532
540
|
need(!finalInvocations.has(finalRegistration.request.invocationId),'fix_review_recovery_mismatch');
|
|
533
541
|
finalInvocations.add(finalRegistration.request.invocationId);
|
|
534
542
|
if(finalRecovery)need(finalRegistration.request.invocationId!==finalRecovery.invocationId
|
|
@@ -541,14 +549,14 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
541
549
|
if(record.id==='fix-final-started'){
|
|
542
550
|
need(pending==='final_review'&&finalStarted===null&&record.kind==='result','fix_history_invalid');
|
|
543
551
|
shape(record.payload,['providerThreadId']);id(record.payload.providerThreadId);
|
|
544
|
-
const config=fixFinalReviewConfiguration(
|
|
552
|
+
const config=fixFinalReviewConfiguration(reviewConfiguration,started);
|
|
545
553
|
need(!finalThreads.has(record.payload.providerThreadId),'final_context_mismatch');
|
|
546
|
-
need(![config
|
|
554
|
+
need(![...fixHostContexts(config),config.reviewer.contextId,...config.reviewer.excludedThreadIds].includes(record.payload.providerThreadId),'final_context_mismatch');
|
|
547
555
|
finalStarted=record.payload.providerThreadId;finalThreads.add(finalStarted);continue;
|
|
548
556
|
}
|
|
549
557
|
if(record.id==='fix-final-result'){
|
|
550
558
|
need(pending==='final_review'&&record.kind==='result','fix_history_invalid');
|
|
551
|
-
finalResult=inspectFixFinalResult(record.payload,finalRegistration,fixFinalReviewConfiguration(
|
|
559
|
+
finalResult=inspectFixFinalResult(record.payload,finalRegistration,fixFinalReviewConfiguration(reviewConfiguration,started),finalStarted);
|
|
552
560
|
pending=null;stage=finalResult.observationStatus==='completed'
|
|
553
561
|
?finalResult.review.verdict==='approved'?'final_review_evidence_required':finalResult.review.verdict==='changes_requested'?'final_review_changes_requested':'final_review_blocked':'unknown';
|
|
554
562
|
continue;
|
|
@@ -682,7 +690,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
682
690
|
need((stage==='cause_review_required'||late&&pending===null&&(!finalRegistration||prior)
|
|
683
691
|
&&correctionStages.includes(resumeStage))
|
|
684
692
|
&&cause===null&&record.kind==='intent','fix_history_invalid');
|
|
685
|
-
cause=inspectCauseRegistration(record.payload,
|
|
693
|
+
cause=inspectCauseRegistration(record.payload,reviewConfiguration);
|
|
686
694
|
const pkg=cause.request.payload.reviewPackage;
|
|
687
695
|
if(late){
|
|
688
696
|
let repairPackage=null;
|
|
@@ -720,11 +728,11 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
720
728
|
if(record.id==='fix-cause-started'){
|
|
721
729
|
need(pending==='cause_review'&&started===null&&record.kind==='result','fix_history_invalid');
|
|
722
730
|
shape(record.payload,['providerThreadId']);id(record.payload.providerThreadId);started=record.payload.providerThreadId;
|
|
723
|
-
need(![
|
|
731
|
+
need(![...hostContextIds,configuration.causeReview.contextId,finalStarted,...configuration.causeReview.excludedThreadIds].includes(started),'cause_registration_mismatch');continue;
|
|
724
732
|
}
|
|
725
733
|
if(record.id==='fix-cause-result'){
|
|
726
734
|
need(pending==='cause_review'&&record.kind==='result','fix_history_invalid');
|
|
727
|
-
causeResult=inspectCauseResult(record.payload,cause,
|
|
735
|
+
causeResult=inspectCauseResult(record.payload,cause,reviewConfiguration,started);pending=null;
|
|
728
736
|
stage=causeResult.observationStatus!=='completed'?'unknown':causeResult.review.verdict==='approved'
|
|
729
737
|
?(causeResumeStage??(diagnosed.status==='design_change'?'design_change_required':'red_test_required'))
|
|
730
738
|
:causeResult.review.verdict==='changes_requested'?'rediagnosis_required':'cause_review_blocked';continue;
|
|
@@ -1110,7 +1118,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
1110
1118
|
const checks=reviewChecks(revising?start.revisionRegression:start.regression),selectedHandoff=revising?revisionHandoffPath():handoffPath();
|
|
1111
1119
|
const pkg=createReviewPackage({root:configuration.reproduction.cwd,baseline,checks,handoffPath:selectedHandoff});
|
|
1112
1120
|
if(start.finalReviewRecovery&&!revising)need(pkg.packageDigest===start.finalReviewRecovery.packageDigest,'fix_review_recovery_drift');
|
|
1113
|
-
const run=createFixFinalReview({reviewPackage:pkg,configuration:revising?fixRevisionReviewConfiguration(revisionFeedback(),start.revision.nextIdentity):fixFinalReviewConfiguration(
|
|
1121
|
+
const run=createFixFinalReview({reviewPackage:pkg,configuration:revising?fixRevisionReviewConfiguration(revisionFeedback(),start.revision.nextIdentity,hostContextIds):fixFinalReviewConfiguration(reviewConfiguration,start.causeReview?.providerThreadId??null),
|
|
1114
1122
|
timeoutMs:configuration.reproduction.timeoutMs},finalReview);
|
|
1115
1123
|
const controller=new AbortController();active=controller;let registered=false;
|
|
1116
1124
|
try{
|
|
@@ -1403,7 +1411,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
1403
1411
|
if(types.isPromise(grant)){grant.catch(()=>{});need(false,'cause_authorization_invalid');}
|
|
1404
1412
|
need(!controller.signal.aborted,'cancelled');
|
|
1405
1413
|
if(digest(grant)===digest({status:'denied',code:'permission_denied'}))return {...project(),reason:'permission_denied'};
|
|
1406
|
-
const registration=inspectCauseRegistration({request,authorizationAt,registeredAt:Date.now(),grant},
|
|
1414
|
+
const registration=inspectCauseRegistration({request,authorizationAt,registeredAt:Date.now(),grant},reviewConfiguration);
|
|
1407
1415
|
append('fix-cause-registered','intent',registration);
|
|
1408
1416
|
registered=true;
|
|
1409
1417
|
const dispatchAt=Date.now();need(dispatchAt>=registration.registeredAt&&dispatchAt<grant.expiresAt,'grant_expired');
|
|
@@ -1414,7 +1422,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
1414
1422
|
try{
|
|
1415
1423
|
const event=json(raw,64*1024);
|
|
1416
1424
|
inspectProviderCauseReview(JSON.stringify({...observation({status:'failed',code:'in_progress'}),events:[...events,event]}),
|
|
1417
|
-
JSON.stringify(causeExpectation(request,
|
|
1425
|
+
JSON.stringify(causeExpectation(request,reviewConfiguration)));
|
|
1418
1426
|
if(event.event==='thread.started'){
|
|
1419
1427
|
append('fix-cause-started','result',{providerThreadId:event.provider_thread});started=event.provider_thread;
|
|
1420
1428
|
}
|
|
@@ -1434,7 +1442,7 @@ export function openFixExecution(options,{bridge=null,prepare=null,causeReview=n
|
|
|
1434
1442
|
}finally{sealed=true;controller.signal.removeEventListener('abort',rejectAbort);}
|
|
1435
1443
|
if(invalid||controller.signal.aborted)return project();
|
|
1436
1444
|
const value={dispatchAt,observation:observation(timedOut?{status:'failed',code:'timeout'}:result)};
|
|
1437
|
-
inspectCauseResult(value,registration,
|
|
1445
|
+
inspectCauseResult(value,registration,reviewConfiguration,started);
|
|
1438
1446
|
append('fix-cause-result','result',value);
|
|
1439
1447
|
if(project().causeReview?.observationStatus==='completed')publishCause();
|
|
1440
1448
|
return project();
|