@aibyzero/cm-workflow 0.13.3 → 0.15.2
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 +41 -0
- package/README.md +34 -1
- package/VERSION +1 -1
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +55 -0
- package/docs/user-guide.md +3 -0
- package/package.json +1 -1
- package/runtime/js/cm-ai/claude-developer-proposal.schema.json +1 -0
- package/runtime/js/cm-ai/cm-ai-admission.mjs +53 -22
- package/runtime/js/cm-ai/cm-ai-context-refresh.mjs +4 -5
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +40 -17
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +103 -23
- package/runtime/js/cm-ai/cm-ai-run-finalizer.mjs +8 -4
- package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +5 -2
- package/runtime/js/cm-ai/codex-developer-output.schema.json +2 -1
- package/runtime/js/cm-ai/developer-adapter.mjs +17 -5
- package/runtime/js/cm-ai/durable-runner-state.mjs +7 -2
- package/runtime/js/cm-ai/effect-contract.mjs +8 -1
- package/runtime/js/cm-ai/execution-store.mjs +25 -5
- package/runtime/js/cm-ai/host-check.mjs +20 -1
- package/runtime/js/cm-ai/host-conversation-execution.mjs +5 -4
- package/runtime/js/cm-ai/host-documentation.mjs +2 -2
- package/runtime/js/cm-ai/host-qa-executor.mjs +46 -24
- package/runtime/js/cm-ai/host-qa-policy.mjs +3 -1
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +41 -3
- package/runtime/js/cm-ai/qa-environment.mjs +22 -0
- package/runtime/js/cm-ai/task-runner.mjs +1 -0
- package/runtime/js/cm-ai/worker-claude-developer.mjs +2 -1
- package/runtime/js/cm-fix/cause-package.mjs +3 -1
- package/runtime/js/cm-fix/dossier.mjs +7 -2
- package/runtime/js/cm-fix/reproduce.mjs +26 -5
- package/runtime/js/cm-fix/visual.mjs +3 -2
- package/runtime/js/cm-fix/walkthrough.mjs +2 -1
- package/runtime/js/cm-init/draft-generation.mjs +3 -2
- package/runtime/js/cm-init/draft-inspection.mjs +17 -3
- package/runtime/js/cm-init/review-evidence.mjs +1 -1
- package/runtime/js/cm-prd/summary.mjs +6 -8
- package/runtime/js/cm-security/finalize.mjs +164 -0
- package/runtime/js/cm-test/host.mjs +2 -2
- package/runtime/js/specs-status.mjs +66 -0
- package/runtime/project-context.md +4 -1
- package/scripts/cm-ai-admission.mjs +46 -7
- package/scripts/cm-ai-admission.test.mjs +50 -0
- package/scripts/cm-ai-batch-host.mjs +72 -10
- package/scripts/cm-ai-batch-host.test.mjs +128 -4
- package/scripts/cm-ai-batch-run.mjs +366 -17
- package/scripts/cm-ai-batch-run.test.mjs +222 -13
- package/scripts/cm-ai-bootstrap.test.mjs +3 -2
- package/scripts/cm-ai-host.mjs +38 -21
- package/scripts/cm-ai-host.test.mjs +68 -4
- package/scripts/cm-ai-nested-execution.test.mjs +1 -1
- package/scripts/cm-ai-run.mjs +25 -15
- package/scripts/cm-ai-run.test.mjs +48 -0
- package/scripts/cm-blocked-reason.test.mjs +104 -0
- package/scripts/cm-capability-gate.test.mjs +179 -0
- package/scripts/cm-check-update.mjs +5 -2
- package/scripts/cm-check-update.test.mjs +21 -0
- package/scripts/cm-codex-developer-adapter.test.mjs +70 -0
- package/scripts/cm-fix-cause-package.test.mjs +18 -1
- package/scripts/cm-fix-execution.test.mjs +31 -0
- package/scripts/cm-fix-host-review.test.mjs +2 -1
- package/scripts/cm-fix-host.test.mjs +2 -1
- package/scripts/cm-fix-observation-dossier.test.mjs +2 -0
- package/scripts/cm-fix-qa-source.test.mjs +1 -3
- package/scripts/cm-fix-reproduce.test.mjs +53 -2
- package/scripts/cm-fix-review-recovery.test.mjs +4 -3
- package/scripts/cm-host-check.test.mjs +22 -0
- package/scripts/cm-host-qa-executor.test.mjs +302 -3
- package/scripts/cm-host-qa-policy.test.mjs +34 -0
- package/scripts/cm-init-draft-generation.test.mjs +24 -3
- package/scripts/cm-init-draft-inspection.test.mjs +80 -0
- package/scripts/cm-init-host.mjs +2 -2
- package/scripts/cm-init-host.test.mjs +3 -1
- package/scripts/cm-init-session.test.mjs +37 -0
- package/scripts/cm-log-event.mjs +28 -7
- package/scripts/cm-prd-design-phase.test.mjs +2 -1
- package/scripts/cm-prd-host.test.mjs +3 -2
- package/scripts/cm-prd-session-recovery.test.mjs +5 -4
- package/scripts/cm-qa-environment.test.mjs +30 -0
- package/scripts/cm-security.mjs +12 -4
- package/scripts/cm-security.test.mjs +109 -0
- package/scripts/cm-specs-status.test.mjs +130 -0
- package/scripts/cm-workflow-config.mjs +4 -0
- package/scripts/test-shell-compat.sh +0 -0
- package/skills/cm-ai/references/N1-init.md +22 -15
- package/skills/cm-ai/references/N5-mark-done.md +5 -2
- package/skills/cm-ai/references/N6-qa-eval.md +9 -4
- package/skills/cm-ai/references/js-host.md +25 -0
- package/skills/cm-fix/SKILL.md +5 -4
- package/skills/cm-fix/references/js-host.md +13 -0
- package/skills/cm-idea/SKILL.md +2 -0
- package/skills/cm-init/references/runtime-declaration.md +2 -0
- package/skills/cm-prd/SKILL.md +9 -8
- package/skills/cm-prd/references/spec-self-check.md +1 -0
- package/skills/cm-security/SKILL.md +14 -7
- package/skills/cm-security/references/scan-contract.md +45 -1
- package/skills/cm-test/references/js-host.md +4 -3
- package/templates/dashboard/dashboard.html +2 -2
|
@@ -3,8 +3,9 @@ import childProcess from 'node:child_process';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import {fileURLToPath} from 'node:url';
|
|
6
|
-
import {hex,id,json,need,shape,text,validIdentity} from './effect-contract.mjs';
|
|
6
|
+
import {digest,hex,id,json,need,shape,text,validIdentity} from './effect-contract.mjs';
|
|
7
7
|
import {readQaAttachment} from './qa-attachment.mjs';
|
|
8
|
+
import {writeCmAiQaStatus} from './cm-ai-run-finalizer.mjs';
|
|
8
9
|
|
|
9
10
|
const writer=fileURLToPath(new URL('../../../scripts/cm-log-event.py',import.meta.url));
|
|
10
11
|
const MiB=1024*1024;
|
|
@@ -177,19 +178,68 @@ function partialPassCases(items,code){
|
|
|
177
178
|
return [...new Set(cases)].sort();
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
function
|
|
183
|
-
const
|
|
181
|
+
// Read the executor's existing report format, including pre-recovery reports.
|
|
182
|
+
// Summary counts alone cannot distinguish product failures from host evidence gaps.
|
|
183
|
+
function blockedEvidenceCases(items,specsDir,environment,code='qa_rerun_not_blocked_by_evidence'){
|
|
184
|
+
const completes=items.filter(({row})=>row.phase==='complete');
|
|
185
|
+
need(completes.length===1,code);
|
|
186
|
+
const complete=completes[0].row,start=items[0]?.row;
|
|
187
|
+
need(start?.phase==='start'&&complete.result==='BLOCKED'&&complete.failed===0&&complete.blocked>0
|
|
188
|
+
&&complete.mode===start.mode&&complete.case_count===start.case_count
|
|
189
|
+
&&['case_count','passed','failed','blocked'].every(key=>Number.isSafeInteger(complete[key])&&complete[key]>=0)
|
|
190
|
+
&&complete.passed+complete.blocked===start.case_count
|
|
191
|
+
&&!items.some(({row})=>row.phase==='case_complete'&&row.result!=='PASS'),code);
|
|
192
|
+
let cases;
|
|
193
|
+
try{
|
|
194
|
+
const file=reportFile(specsDir,complete.report);need(fs.statSync(file).size<=MiB,code);
|
|
195
|
+
const sections=fs.readFileSync(file,'utf8').split(/^## /m).slice(1);
|
|
196
|
+
cases=sections.flatMap(section=>{
|
|
197
|
+
const split=section.indexOf('\n'),name=section.slice(0,split);
|
|
198
|
+
const row=JSON.parse(section.slice(split+1));
|
|
199
|
+
if(name==='deferred_cases'&&Array.isArray(row))return [];
|
|
200
|
+
need(row.id===name&&['commands','logic','browser'].includes(row.kind),code);id(row.id);return [row];
|
|
201
|
+
});
|
|
202
|
+
}catch{need(false,code);}
|
|
203
|
+
need(cases.length===start.case_count&&new Set(cases.map(row=>row.id)).size===cases.length
|
|
204
|
+
&&cases.filter(row=>row.verdict==='PASS').length===complete.passed
|
|
205
|
+
&&cases.filter(row=>row.verdict==='BLOCKED').length===complete.blocked,code);
|
|
206
|
+
const blocked=cases.filter(row=>row.verdict==='BLOCKED');
|
|
207
|
+
for(const row of blocked)need(!row.sourceChanged&&(
|
|
208
|
+
row.kind==='logic'&&row.staticVerdict==='INSUFFICIENT_EVIDENCE'
|
|
209
|
+
||row.kind==='browser'&&(typeof row.evidenceProblem==='string'&&row.evidenceProblem.length>0
|
|
210
|
+
||row.cleanup==='failed'||row.hostRequestTimeout===true
|
|
211
|
+
||environment!=null&&row.environment!=null&&digest(row.environment)!==digest(environment))),code);
|
|
212
|
+
return blocked.map(row=>row.id).sort();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Abandonment reuses a round; superseded completed evidence advances it.
|
|
216
|
+
function validateRunSequence(items,code='qa_round_invalid',specsDir){
|
|
217
|
+
const starts=[],ids=new Set();let current=null,abandoned=false,superseded=false;
|
|
184
218
|
for(const item of items){
|
|
185
219
|
const row=item.row;
|
|
186
220
|
if(row.phase==='start'){
|
|
187
221
|
id(row.operation_id);need(!ids.has(row.operation_id),code);ids.add(row.operation_id);
|
|
188
222
|
need(row.attempt===(current?current.attempt+(abandoned?0:1):1)&&row.attempt<=3,code);
|
|
189
|
-
if(abandoned)
|
|
190
|
-
|
|
223
|
+
if(abandoned){
|
|
224
|
+
// Legacy successors retain their plan; explicit links may bind a fresh plan.
|
|
225
|
+
if(row.previous_test_run_id===undefined)need(row.mode===current.mode&&row.case_count===current.case_count,code);
|
|
226
|
+
else need(row.previous_test_run_id===current.operation_id,code);
|
|
227
|
+
}else if(superseded)need(row.previous_test_run_id===current.operation_id,code);
|
|
228
|
+
else {
|
|
229
|
+
need(row.previous_test_run_id===undefined,code);
|
|
230
|
+
if(current)need(!items.some(entry=>entry.position<item.position&&entry.row.operation_id===current.operation_id
|
|
231
|
+
&&entry.row.phase==='complete'&&['BLOCKED','NEEDS_MANUAL'].includes(entry.row.result)),code);
|
|
232
|
+
}
|
|
233
|
+
current=row;abandoned=false;superseded=false;starts.push(item);
|
|
191
234
|
}else{
|
|
192
|
-
need(current&&row.operation_id===current.operation_id&&row.attempt===current.attempt&&!abandoned,code);
|
|
235
|
+
need(current&&row.operation_id===current.operation_id&&row.attempt===current.attempt&&!abandoned&&!superseded,code);
|
|
236
|
+
if(row.phase==='superseded'){
|
|
237
|
+
need(current.attempt<3&&row.previous_test_run_id===current.operation_id&&row.reason==='host_evidence_problem'
|
|
238
|
+
&&row.mode===current.mode&&row.case_count===current.case_count,code);
|
|
239
|
+
const prior=items.filter(entry=>entry.position<item.position&&entry.row.operation_id===row.operation_id);
|
|
240
|
+
const blocked=blockedEvidenceCases(prior,specsDir,row.expected_environment,code);
|
|
241
|
+
need(JSON.stringify(row.blocked_cases)===JSON.stringify(blocked),code);superseded=true;
|
|
242
|
+
}
|
|
193
243
|
if(row.phase==='abandoned'){
|
|
194
244
|
need(row.previous_test_run_id===current.operation_id&&row.reason==='host_terminated'
|
|
195
245
|
&&row.mode===current.mode&&row.case_count===current.case_count,code);
|
|
@@ -220,18 +270,24 @@ function qaRunRows(input){
|
|
|
220
270
|
|
|
221
271
|
// Only a trusted resumed owner calls this after fresh explicit authorization.
|
|
222
272
|
// Retain unknown for non-PASS results, even if their evidence files vanished.
|
|
223
|
-
export function inspectCmAiQaRecovery(input){
|
|
224
|
-
const rows=qaRunRows(input),starts=validateRunSequence(rows),start=starts.at(-1).row;
|
|
273
|
+
export function inspectCmAiQaRecovery(input,{blocked=false,environment=null}={}){
|
|
274
|
+
const rows=qaRunRows(input),starts=validateRunSequence(rows,'qa_round_invalid',input.specsDir),start=starts.at(-1).row;
|
|
225
275
|
const runs=rows.filter(item=>item.row.operation_id===start.operation_id);
|
|
226
|
-
const passed=partialPassCases(runs,'qa_execution_unknown');
|
|
227
|
-
const report=path.join(input.specsDir,'.reviews',`${start.operation_id}-execution.md`);
|
|
228
|
-
let exists=false;try{fs.lstatSync(report);exists=true;}catch(error){if(error.code!=='ENOENT')throw error;}
|
|
229
|
-
need(!exists,'qa_execution_unknown');
|
|
230
276
|
// Reject an operation ID reused under another decision, identity or package.
|
|
231
277
|
scanRows(path.join(input.specsDir,'运行日志.jsonl'),row=>{
|
|
232
278
|
if(row.event==='test_run'&&row.operation_id===start.operation_id)
|
|
233
279
|
need(rows.some(item=>JSON.stringify(item.row)===JSON.stringify(row)),'qa_result_mismatch');
|
|
234
280
|
});
|
|
281
|
+
if(blocked){
|
|
282
|
+
const blockedCases=blockedEvidenceCases(runs,input.specsDir,environment);
|
|
283
|
+
need(start.attempt<3,'qa_round_invalid');
|
|
284
|
+
return {testRunId:start.operation_id,qaRound:start.attempt,mode:start.mode,caseCount:start.case_count,
|
|
285
|
+
blockedCases,superseded:runs.some(({row})=>row.phase==='superseded')};
|
|
286
|
+
}
|
|
287
|
+
const passed=partialPassCases(runs,'qa_execution_unknown');
|
|
288
|
+
const report=path.join(input.specsDir,'.reviews',`${start.operation_id}-execution.md`);
|
|
289
|
+
let exists=false;try{fs.lstatSync(report);exists=true;}catch(error){if(error.code!=='ENOENT')throw error;}
|
|
290
|
+
need(!exists,'qa_execution_unknown');
|
|
235
291
|
return {testRunId:start.operation_id,qaRound:start.attempt,mode:start.mode,caseCount:start.case_count,
|
|
236
292
|
partialPassCases:passed,abandoned:runs.some(({row})=>row.phase==='abandoned')};
|
|
237
293
|
}
|
|
@@ -258,16 +314,24 @@ export function recordCmAiQaRun(input) {
|
|
|
258
314
|
if(Object.hasOwn(input,'logHome'))keys.push('logHome');
|
|
259
315
|
if(Object.hasOwn(input,'qaRound'))keys.push('qaRound');
|
|
260
316
|
if(Object.hasOwn(input,'previousTestRunId'))keys.push('previousTestRunId');
|
|
317
|
+
if(Object.hasOwn(input,'deferredCases'))keys.push('deferredCases');
|
|
318
|
+
if(Object.hasOwn(input,'expectedEnvironment'))keys.push('expectedEnvironment');
|
|
261
319
|
shape(input,keys);validIdentity(input.identity);id(input.testRunId);hex(input.packageDigest);
|
|
262
320
|
text(input.specsDir);text(input.codeProject);text(input.feature);
|
|
263
321
|
need(['commands','browser','all'].includes(input.mode));
|
|
264
322
|
need(Number.isSafeInteger(input.caseCount)&&input.caseCount>0);
|
|
265
|
-
need(['start','complete','abandoned'].includes(input.phase));
|
|
323
|
+
need(['start','complete','abandoned','superseded'].includes(input.phase));
|
|
266
324
|
const qaRound=input.qaRound??1;
|
|
267
325
|
need(Number.isSafeInteger(qaRound)&&qaRound>=1&&qaRound<=3,'qa_round_invalid');
|
|
268
326
|
const binding={specsDir:input.specsDir,feature:input.feature,identity:input.identity,packageDigest:input.packageDigest};
|
|
269
|
-
let passed=[];
|
|
270
|
-
if(input.phase==='
|
|
327
|
+
let passed=[],blockedCases=[];
|
|
328
|
+
if(input.phase==='superseded'){
|
|
329
|
+
const previous=inspectCmAiQaRecovery(binding,{blocked:true,environment:input.expectedEnvironment});
|
|
330
|
+
blockedCases=previous.blockedCases;
|
|
331
|
+
need(previous.testRunId===input.testRunId&&previous.qaRound===qaRound
|
|
332
|
+
&&previous.mode===input.mode&&previous.caseCount===input.caseCount,'qa_round_invalid');
|
|
333
|
+
if(previous.superseded)return;
|
|
334
|
+
}else if(input.phase==='abandoned'){
|
|
271
335
|
const previous=inspectCmAiQaRecovery(binding);
|
|
272
336
|
passed=previous.partialPassCases;
|
|
273
337
|
need(previous.testRunId===input.testRunId&&previous.qaRound===qaRound
|
|
@@ -276,9 +340,10 @@ export function recordCmAiQaRun(input) {
|
|
|
276
340
|
}else if(input.phase==='start'){
|
|
277
341
|
let previous;
|
|
278
342
|
if(Object.hasOwn(input,'previousTestRunId')){
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
343
|
+
const rows=qaRunRows(binding),superseded=rows.at(-1)?.row.phase==='superseded';
|
|
344
|
+
previous=inspectCmAiQaRecovery(binding,{blocked:superseded,environment:rows.at(-1)?.row.expected_environment});
|
|
345
|
+
need((previous.abandoned||previous.superseded)&&previous.testRunId===input.previousTestRunId
|
|
346
|
+
&&previous.qaRound+(superseded?1:0)===qaRound,'qa_round_invalid');
|
|
282
347
|
}else previous=latestCmAiQaRun(binding);
|
|
283
348
|
scanRows(path.join(input.specsDir,'运行日志.jsonl'),row=>{
|
|
284
349
|
need(!(row.event==='test_run'&&row.operation_id===input.testRunId),'qa_round_invalid');
|
|
@@ -294,7 +359,19 @@ export function recordCmAiQaRun(input) {
|
|
|
294
359
|
const data={node:'N6',repository_id:input.identity.repositoryId,feature:input.feature,task:input.identity.taskId,
|
|
295
360
|
package_digest:input.packageDigest,qa_decision_id:decision.decisionId,operation_id:input.testRunId,
|
|
296
361
|
attempt:qaRound,mode:input.mode,case_count:input.caseCount};
|
|
362
|
+
if(input.phase==='start'){
|
|
363
|
+
if(Object.hasOwn(input,'previousTestRunId'))data.previous_test_run_id=input.previousTestRunId;
|
|
364
|
+
const deferred=json(input.deferredCases??[]);need(Array.isArray(deferred),'qa_plan_invalid');
|
|
365
|
+
for(const item of deferred){
|
|
366
|
+
shape(item,['id','taskIds']);id(item.id);
|
|
367
|
+
need(Array.isArray(item.taskIds)&&item.taskIds.length>0,'qa_plan_invalid');
|
|
368
|
+
for(const taskId of item.taskIds)id(taskId);
|
|
369
|
+
}
|
|
370
|
+
data.deferred_cases=deferred;
|
|
371
|
+
}
|
|
297
372
|
if(input.phase==='abandoned')Object.assign(data,{previous_test_run_id:input.testRunId,reason:'host_terminated',partial_pass_cases:passed});
|
|
373
|
+
if(input.phase==='superseded')Object.assign(data,{previous_test_run_id:input.testRunId,
|
|
374
|
+
reason:'host_evidence_problem',blocked_cases:blockedCases,expected_environment:input.expectedEnvironment??null});
|
|
298
375
|
if(input.phase==='complete'){
|
|
299
376
|
const result=json(input.result);shape(result,['result','passed','failed','blocked','report']);
|
|
300
377
|
for(const key of ['passed','failed','blocked'])need(Number.isSafeInteger(result[key])&&result[key]>=0,'qa_result_invalid');
|
|
@@ -310,7 +387,10 @@ export function recordCmAiQaRun(input) {
|
|
|
310
387
|
if(Object.hasOwn(input,'logHome')){text(input.logHome);options.env={...process.env,CM_WORKFLOW_LOG_HOME:input.logHome};}
|
|
311
388
|
const result=childProcess.spawnSync('python3',args,options);
|
|
312
389
|
need(!result.error&&result.status===0&&result.signal===null,'qa_log_failed');
|
|
313
|
-
|
|
390
|
+
const logged=readResult(result.stdout,input.identity,input.specsDir);
|
|
391
|
+
if(input.phase==='complete')writeCmAiQaStatus({specsDir:input.specsDir,feature:input.feature,
|
|
392
|
+
identity:input.identity,phase:'complete',result:input.result});
|
|
393
|
+
return logged;
|
|
314
394
|
}
|
|
315
395
|
|
|
316
396
|
// Read the registered round before executing cases or publishing their result.
|
|
@@ -326,7 +406,7 @@ export function readCmAiQaRunRound(input){
|
|
|
326
406
|
&&row.task===input.identity.taskId&&row.package_digest===input.packageDigest
|
|
327
407
|
&&row.qa_decision_id===decision.decisionId)rows.push(row);
|
|
328
408
|
});
|
|
329
|
-
const starts=validateRunSequence(rows.map((row,position)=>({row,position})));
|
|
409
|
+
const starts=validateRunSequence(rows.map((row,position)=>({row,position})),'qa_round_invalid',input.specsDir);
|
|
330
410
|
const start=starts.at(-1).row;
|
|
331
411
|
need(start.operation_id===testRunId&&!rows.some(row=>row.operation_id===testRunId
|
|
332
412
|
&&['complete','abandoned'].includes(row.phase)),'qa_round_invalid');
|
|
@@ -378,7 +458,7 @@ function inspectQaResult(input,failureSource,historical=false) {
|
|
|
378
458
|
&&Number.isSafeInteger(row.attempt)&&row.attempt>=1&&row.attempt<=3,'qa_result_invalid');
|
|
379
459
|
const latestStarts=candidates.filter(item=>item.row.phase==='start');
|
|
380
460
|
need(latestStarts.length>0,'qa_result_incomplete');
|
|
381
|
-
validateRunSequence(candidates,'qa_result_invalid');
|
|
461
|
+
validateRunSequence(candidates,'qa_result_invalid',input.specsDir);
|
|
382
462
|
const latestStart=latestStarts.at(-1);
|
|
383
463
|
if(!historical)need(latestStart.row.operation_id===input.testRunId,'qa_result_stale');
|
|
384
464
|
const runs=candidates.filter(item=>item.row.operation_id===input.testRunId);
|
|
@@ -45,11 +45,15 @@ function prepareStatus({specs,target},feature,identity,progress=null) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Existing status file is only the current log projection, not a task store.
|
|
48
|
-
export function writeCmAiQaStatus({specsDir,feature,identity,caseId,phase}) {
|
|
49
|
-
validIdentity(identity);text(feature);
|
|
50
|
-
need(['case_start','case_complete','case_blocked'].includes(phase));
|
|
48
|
+
export function writeCmAiQaStatus({specsDir,feature,identity,caseId,phase,result}) {
|
|
49
|
+
validIdentity(identity);text(feature);
|
|
50
|
+
need(['case_start','case_complete','case_blocked','complete'].includes(phase));
|
|
51
|
+
if(phase!=='complete')id(caseId);
|
|
52
|
+
else need(['PASS','FAIL','BLOCKED'].includes(result?.result),'qa_result_invalid');
|
|
51
53
|
const prepared=prepareStatus(statusTarget(specsDir),feature,identity,{node:'N6',feature,task:identity.taskId,
|
|
52
|
-
detail
|
|
54
|
+
detail:phase==='complete'?`QA 结果 ${result.result}(通过 ${result.passed} / 失败 ${result.failed} / 阻断 ${result.blocked})`:`QA ${caseId}: ${phase}`,
|
|
55
|
+
state:phase==='complete'?{PASS:'qa_passed',FAIL:'qa_failed',BLOCKED:'qa_blocked'}[result.result]:'qa_running',
|
|
56
|
+
at:new Date().toTimeString().slice(0,8)});
|
|
53
57
|
try{
|
|
54
58
|
fs.renameSync(prepared.temporary,prepared.target);
|
|
55
59
|
const directory=fs.openSync(prepared.specs,fs.constants.O_RDONLY|fs.constants.O_NOFOLLOW);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "object",
|
|
3
3
|
"additionalProperties": false,
|
|
4
|
-
"required": ["outcome"],
|
|
5
|
-
"properties": {
|
|
4
|
+
"required": ["outcome", "reason"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"outcome": {"type": "string", "enum": ["implemented", "blocked"]},
|
|
7
|
+
"reason": {"type": ["string", "null"]}
|
|
8
|
+
}
|
|
6
9
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "object",
|
|
3
3
|
"additionalProperties": false,
|
|
4
|
-
"required": ["outcome", "application", "retrospective"],
|
|
4
|
+
"required": ["outcome", "application", "retrospective", "reason"],
|
|
5
5
|
"properties": {
|
|
6
6
|
"outcome": {"type": "string", "enum": ["implemented", "blocked"]},
|
|
7
|
+
"reason": {"type": ["string", "null"]},
|
|
7
8
|
"application": {
|
|
8
9
|
"type": "object", "additionalProperties": false,
|
|
9
10
|
"required": ["status", "note"],
|
|
@@ -19,7 +19,8 @@ Application status is applied (note explains the lesson and action) or no_releva
|
|
|
19
19
|
Retrospective status is no_new_lesson (candidates empty and reason null), lesson_candidate (1-3 candidates and reason null),
|
|
20
20
|
or writeback_pending (1-3 candidates and a reason). Each candidate has classification (structured or memory_only),
|
|
21
21
|
trigger, action and evidence (relative file paths). The host binds identities and computes digests; do not invent hashes.
|
|
22
|
-
Without learningInput, return only
|
|
22
|
+
Without learningInput, return only outcome and reason. A blocked result may include reason explaining why implementation is impossible (string, at most 1000 UTF-8 bytes, no NUL); application and retrospective are optional when blocked.
|
|
23
|
+
The top-level reason explains blocked outcomes; otherwise it must be null. Use null when no explanation is available.
|
|
23
24
|
Use outcome blocked when implementation is not possible. Do not claim implementation if no implementation was made.`;
|
|
24
25
|
|
|
25
26
|
export function validateDeveloperScope(scope){
|
|
@@ -62,9 +63,18 @@ export function buildDeveloperPrompt(raw,provider) {
|
|
|
62
63
|
// allowed in no_new_lesson.reason (the September 2026 dogfood failure).
|
|
63
64
|
export function validateDeveloperValue(value,request) {
|
|
64
65
|
const learning=Object.hasOwn(request.payload,'learningInput');
|
|
65
|
-
|
|
66
|
+
const blocked=value?.outcome==='blocked';
|
|
67
|
+
shape(value,['outcome',...(learning?(blocked?['application','retrospective'].filter(key=>Object.hasOwn(value,key)):['application','retrospective']):[]),
|
|
68
|
+
...((blocked||value?.reason===null)&&Object.hasOwn(value,'reason')?['reason']:[])]);
|
|
69
|
+
// Nullable CLI schema fields have the same meaning as an omitted reason.
|
|
70
|
+
if(value&&Object.hasOwn(value,'reason')&&value.reason===null){
|
|
71
|
+
const {reason,...rest}=value;value=rest;
|
|
72
|
+
}
|
|
66
73
|
need(['implemented','blocked'].includes(value.outcome),'invalid_result');
|
|
67
|
-
if(
|
|
74
|
+
if(blocked){
|
|
75
|
+
if(Object.hasOwn(value,'reason'))need(typeof value.reason==='string'&&Buffer.byteLength(value.reason,'utf8')<=1000&&!value.reason.includes('\0'),'invalid_result');
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
68
78
|
if(!learning)return value;
|
|
69
79
|
const input=request.payload.learningInput;
|
|
70
80
|
validTaskLearningInput(input,request.identity,input.feature);
|
|
@@ -84,9 +94,10 @@ export function createDeveloperRun({worker,requestedModel,provider,protectedCurr
|
|
|
84
94
|
need(r.requestedModel===requestedModel,'invalid_input');
|
|
85
95
|
need(control?.signal&&typeof control.signal.aborted==='boolean','invalid_input');
|
|
86
96
|
let providerThreadId;
|
|
87
|
-
const envelope=(status,result=null)=>terminalFor({version:1,invocationId:r.invocationId,
|
|
97
|
+
const envelope=(status,result=null,blockedReason=undefined)=>terminalFor({version:1,invocationId:r.invocationId,
|
|
88
98
|
contextId:r.contextId,provider,effectiveModel:'unknown',status,
|
|
89
99
|
accepted:!['unavailable','auth_required','permission_denied'].includes(status),result,
|
|
100
|
+
...(blockedReason===undefined?{}:{blockedReason}),
|
|
90
101
|
...(providerThreadId===undefined?{}:{providerThreadId})},r);
|
|
91
102
|
const failed=(code,reason)=>envelope('failed',{code,reason,
|
|
92
103
|
...(protectedCurrentSession&&code==='invalid_result'?{retryable:true}:{})});
|
|
@@ -106,7 +117,8 @@ export function createDeveloperRun({worker,requestedModel,provider,protectedCurr
|
|
|
106
117
|
try{
|
|
107
118
|
if(Object.hasOwn(response,'providerThread')){id(response.providerThread);providerThreadId=response.providerThread;}
|
|
108
119
|
const result=validateDeveloperValue(response.value,r);
|
|
109
|
-
|
|
120
|
+
// Preserve the null failure result; the explanation is diagnostic only.
|
|
121
|
+
return result.outcome==='blocked'?envelope('failed',null,result.reason):envelope('succeeded',result);
|
|
110
122
|
}catch(error){return failed('invalid_result',error.code??'invalid_input');}
|
|
111
123
|
}
|
|
112
124
|
if(response.status==='failed'&&['invalid_result','protected_edit_stale'].includes(response.code))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Host-only S3b2b journal grammar. Data validation grants no provider authority.
|
|
2
|
-
import {digest,need,shape,id,text,hex,json,validIdentity,validTaskLearningInput,validCallTimeout,requestFor} from './effect-contract.mjs';
|
|
2
|
+
import {digest,need,shape,id,text,hex,json,validIdentity,validTaskLearningInput,validCallTimeout,validBlockedReason,requestFor} from './effect-contract.mjs';
|
|
3
3
|
import {readReviewBaseline,readReviewPackage,reviewSpecsPath} from './review-package.mjs';
|
|
4
4
|
import {reviewResult,reviewReceipt} from './review-runner.mjs';
|
|
5
5
|
import {checkCompletion} from './gate-bridge.mjs';
|
|
@@ -108,7 +108,12 @@ function packageLink(pkg,original,attempt,checks) {
|
|
|
108
108
|
function callRequest(call,adapter,contextId,role,payload,identity,session,index) {
|
|
109
109
|
shape(call,['invocationId','contextId','provider','requestedModel','effectiveModel','channel','started','terminal','requestDigest','resultDigest',
|
|
110
110
|
...(Object.hasOwn(call,'providerThreadId')?['providerThreadId']:[]),
|
|
111
|
-
...(Object.hasOwn(call,'failureResult')?['failureResult']:[])
|
|
111
|
+
...(Object.hasOwn(call,'failureResult')?['failureResult']:[]),
|
|
112
|
+
...(Object.hasOwn(call,'blockedReason')?['blockedReason']:[])]);
|
|
113
|
+
if(Object.hasOwn(call,'blockedReason')){
|
|
114
|
+
need(role==='developer'&&call.terminal==='failed'&&!Object.hasOwn(call,'failureResult'),'runner_call');
|
|
115
|
+
validBlockedReason(call.blockedReason);
|
|
116
|
+
}
|
|
112
117
|
if(Object.hasOwn(call,'providerThreadId')){need(role==='developer','runner_call');id(call.providerThreadId);}
|
|
113
118
|
need(call.invocationId===`${session}.${index}` && call.contextId===contextId && call.provider===adapter.provider
|
|
114
119
|
&& call.requestedModel===adapter.requestedModel && call.channel==='fixture' && call.started===true,'runner_call');
|
|
@@ -26,6 +26,8 @@ export function shape(value,names) {
|
|
|
26
26
|
}
|
|
27
27
|
export const id=v=>need(typeof v==='string' && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(v));
|
|
28
28
|
export const text=v=>need(typeof v==='string' && v.trim().length>0);
|
|
29
|
+
export const validBlockedReason=v=>need(typeof v==='string'&&v.trim().length>0
|
|
30
|
+
&&Buffer.byteLength(v,'utf8')<=1000&&!/[\x00-\x08\x0b-\x1f]/.test(v));
|
|
29
31
|
export const hex=v=>need(typeof v==='string' && /^[a-f0-9]{64}$/.test(v));
|
|
30
32
|
export const freeze=v=>{if(v && typeof v==='object'){Object.values(v).forEach(freeze);Object.freeze(v);}return v;};
|
|
31
33
|
export function arrayItems(value) {
|
|
@@ -80,7 +82,12 @@ export function requestFor({invocationId,identity,role,provider,requestedModel,c
|
|
|
80
82
|
export function terminalFor(raw,request) {
|
|
81
83
|
const v=json(raw);
|
|
82
84
|
shape(v,['version','invocationId','contextId','provider','effectiveModel','status','accepted','result',
|
|
83
|
-
...(Object.hasOwn(v,'providerThreadId')?['providerThreadId']:[])
|
|
85
|
+
...(Object.hasOwn(v,'providerThreadId')?['providerThreadId']:[]),
|
|
86
|
+
...(Object.hasOwn(v,'blockedReason')?['blockedReason']:[])]);
|
|
87
|
+
if(Object.hasOwn(v,'blockedReason')){
|
|
88
|
+
need(request.role==='developer'&&v.status==='failed'&&v.result===null);
|
|
89
|
+
validBlockedReason(v.blockedReason);
|
|
90
|
+
}
|
|
84
91
|
if(Object.hasOwn(v,'providerThreadId')){need(request.role==='developer');id(v.providerThreadId);}
|
|
85
92
|
need(v.version===1 && v.invocationId===request.invocationId && v.contextId===request.contextId
|
|
86
93
|
&& v.provider===request.provider,'terminal_mismatch');text(v.effectiveModel);
|
|
@@ -61,6 +61,9 @@ function validateState(raw,options) {
|
|
|
61
61
|
function runBytes(dir) {
|
|
62
62
|
let total=0;
|
|
63
63
|
for(const name of fs.readdirSync(dir)) {
|
|
64
|
+
if(name==='writer.sqlite' || name==='writer-ready.json') {
|
|
65
|
+
total+=regular(path.join(dir,name),name==='writer.sqlite'?64*1024:1024).size;continue;
|
|
66
|
+
}
|
|
64
67
|
need(name==='state.json' || /^\.state\.[a-f0-9-]{36}\.tmp$/.test(name),'store_unknown_file');
|
|
65
68
|
total+=regular(path.join(dir,name),STATE_LIMIT).size;
|
|
66
69
|
}
|
|
@@ -125,6 +128,8 @@ function acquireWriter(p,create) {
|
|
|
125
128
|
}catch(error){if(error.code!=='EEXIST')throw error;}
|
|
126
129
|
}
|
|
127
130
|
const inode=regular(p,64*1024);need(created || inode.size>0,'store_incomplete');
|
|
131
|
+
// Each run now owns its database. Retain inode keys so pathname aliases
|
|
132
|
+
// cannot open/close a second descriptor and drop this process's locks.
|
|
128
133
|
const candidateKey=`${inode.dev}:${inode.ino}`;need(!activeWriters.has(candidateKey),'store_busy');
|
|
129
134
|
key=candidateKey;activeWriters.add(key);
|
|
130
135
|
// POSIX close(any fd on this DB) drops ALL process locks. Keep this one
|
|
@@ -171,13 +176,28 @@ export function openExecutionStore(input) {
|
|
|
171
176
|
const root=fs.realpathSync(options.specsRoot);directory(root,false,false);
|
|
172
177
|
const reviews=path.join(root,'.reviews'),execution=path.join(reviews,'.execution');
|
|
173
178
|
directory(reviews,options.create,false);directory(execution,options.create);
|
|
174
|
-
const
|
|
175
|
-
|
|
179
|
+
const dir=path.join(execution,options.identity.runId),lockPath=path.join(dir,'writer.sqlite');
|
|
180
|
+
if(options.create) {
|
|
181
|
+
const legacyPath=path.join(execution,'writer.sqlite');let legacy=false;
|
|
182
|
+
try{fs.lstatSync(legacyPath);legacy=true;}catch(error){if(error.code!=='ENOENT')throw error;}
|
|
183
|
+
if(legacy) {
|
|
184
|
+
// Probe with the full existing protocol; never create or migrate old files.
|
|
185
|
+
// release closes SQLite before its inspection fd and removes the inode key.
|
|
186
|
+
let probe;
|
|
187
|
+
try{probe=acquireWriter(legacyPath,false);}catch{need(false,'store_busy');}
|
|
188
|
+
probe.release();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const existed=fs.existsSync(dir);
|
|
192
|
+
directory(dir,options.create);
|
|
193
|
+
// Legacy records must be finished by an old runtime or their runId retired.
|
|
194
|
+
if(!options.create)need(fs.existsSync(lockPath),'store_layout_legacy');
|
|
195
|
+
const directories=[reviews,execution,dir].map(p=>({p,inode:directory(p,false,p!==reviews)}));
|
|
196
|
+
const {db,inode,certificate,inspectionFd,release}=acquireWriter(lockPath,options.create);
|
|
197
|
+
let closed=false,poisoned=false;
|
|
176
198
|
const close=()=>{if(!closed){closed=true;release();}};
|
|
177
199
|
try {
|
|
178
|
-
|
|
179
|
-
if(options.create) {need(!fs.existsSync(dir),'store_exists');fs.mkdirSync(dir,{mode:0o700});syncPath(dir);syncPath(execution);}
|
|
180
|
-
const directories=[reviews,execution,dir].map(p=>({p,inode:directory(p,false,p!==reviews)}));
|
|
200
|
+
if(options.create)need(!existed,'store_exists');
|
|
181
201
|
const guard=()=>{
|
|
182
202
|
need(!closed,'store_closed');need(!poisoned,'store_poisoned');
|
|
183
203
|
for(const d of directories)need(sameInode(d.inode,directory(d.p,false,d.p!==reviews)),'snapshot_changed');
|
|
@@ -5,6 +5,7 @@ import fs from 'node:fs';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import {spawn} from 'node:child_process';
|
|
7
7
|
import {types} from 'node:util';
|
|
8
|
+
import {StringDecoder} from 'node:string_decoder';
|
|
8
9
|
import {cleanEnvironment,specsPermissionArgs} from './codex-config.mjs';
|
|
9
10
|
import {json,shape,need,id,text,validCallTimeout,validIdentity} from './effect-contract.mjs';
|
|
10
11
|
|
|
@@ -38,6 +39,11 @@ export function createHostCheck({cwd,commands,timeoutMs=60000,specsRoot=null,out
|
|
|
38
39
|
}
|
|
39
40
|
catch{resolve({outcome:'unavailable',exitCode:null,evidence:'host check: spawn_failed'});return;}
|
|
40
41
|
let failure=null,cleanup,bytes=0;
|
|
42
|
+
const counts=new Map();
|
|
43
|
+
const collect=line=>{
|
|
44
|
+
const match=line.trim().match(/^[^0-9A-Za-z]*(tests|suites|pass|passed|passing|fail|failed|failing|skipped|todo)\s*[:=]?\s*(\d+)\s*$/i);
|
|
45
|
+
if(match&&counts.size<8&&!counts.has(match[1].toLowerCase()))counts.set(match[1].toLowerCase(),match[2]);
|
|
46
|
+
};
|
|
41
47
|
const kill=name=>{
|
|
42
48
|
if(!Number.isInteger(child.pid)||child.pid<=0)return false;
|
|
43
49
|
try{process.kill(-child.pid,name);return true;}
|
|
@@ -52,6 +58,7 @@ export function createHostCheck({cwd,commands,timeoutMs=60000,specsRoot=null,out
|
|
|
52
58
|
if(signal.aborted)abort();
|
|
53
59
|
for(const [streamName,stream] of [['stdout',child.stdout],['stderr',child.stderr]]){
|
|
54
60
|
let tail=Buffer.alloc(0);
|
|
61
|
+
const decoder=new StringDecoder('utf8');let pending='';
|
|
55
62
|
stream.on('data',chunk=>{
|
|
56
63
|
bytes+=chunk.length;if(bytes>4*1024*1024){stop('output_limit');return;}
|
|
57
64
|
if(onOutput){
|
|
@@ -66,7 +73,10 @@ export function createHostCheck({cwd,commands,timeoutMs=60000,specsRoot=null,out
|
|
|
66
73
|
const joined=Buffer.concat([tail,chunk]);signatureMatched=joined.includes(signature);
|
|
67
74
|
tail=joined.subarray(Math.max(0,joined.length-signature.length+1));
|
|
68
75
|
}
|
|
76
|
+
const lines=(pending+decoder.write(chunk)).split('\n');pending=lines.pop();
|
|
77
|
+
for(const line of lines)collect(line);
|
|
69
78
|
});
|
|
79
|
+
stream.on('end',()=>collect(pending+decoder.end()));
|
|
70
80
|
stream.on('error',()=>stop('output_read_failed'));
|
|
71
81
|
}
|
|
72
82
|
child.once('error',()=>{failure??='spawn_failed';});
|
|
@@ -77,7 +87,16 @@ export function createHostCheck({cwd,commands,timeoutMs=60000,specsRoot=null,out
|
|
|
77
87
|
// credentials and nondeterministic timing; do not put it in review data.
|
|
78
88
|
if(failure||exitSignal||!Number.isInteger(code))resolve({outcome:'unavailable',exitCode:null,
|
|
79
89
|
evidence:`host check: ${failure??'signal_exit'}`});
|
|
80
|
-
else
|
|
90
|
+
else{
|
|
91
|
+
const prefix=`host check exited ${code}`,summary=[];
|
|
92
|
+
for(const [label,count] of counts){
|
|
93
|
+
const item=`${label} ${count}`;
|
|
94
|
+
if(`${prefix} (${[...summary,item].join(', ')})`.length>200)break;
|
|
95
|
+
summary.push(item);
|
|
96
|
+
}
|
|
97
|
+
resolve({outcome:code===0?'passed':'failed',exitCode:code,
|
|
98
|
+
evidence:prefix+(summary.length?` (${summary.join(', ')})`:'')});
|
|
99
|
+
}
|
|
81
100
|
});
|
|
82
101
|
});
|
|
83
102
|
need(!signal.aborted,'cancelled');
|
|
@@ -34,7 +34,8 @@ const protectedConversations=new WeakMap();
|
|
|
34
34
|
export const conversationProtection=execution=>protectedConversations.get(execution)??null;
|
|
35
35
|
export function createConversationExecution(definition,hostContextId,bridge,review=null,allowedAttempt=null,workflow=null,allowQa=false,runtime='codex',options={}){
|
|
36
36
|
definition=json(definition);workflow=workflow===null?null:json(workflow);options=json(options);
|
|
37
|
-
shape(options,[...['protection','batchWorkflowsDigest','qaLogHome','bootstrap','providerDevelopment'].filter(key=>Object.hasOwn(options,key))]);
|
|
37
|
+
shape(options,[...['protection','batchWorkflowsDigest','qaLogHome','bootstrap','providerDevelopment','parallelMember'].filter(key=>Object.hasOwn(options,key))]);
|
|
38
|
+
const parallelMember=options.parallelMember??false;need(typeof parallelMember==='boolean','invalid_input');
|
|
38
39
|
const provider=options.providerDevelopment??null;
|
|
39
40
|
if(provider){
|
|
40
41
|
shape(provider,['model','attempt','coderRuntime','reviewerRuntime']);
|
|
@@ -66,7 +67,7 @@ export function createConversationExecution(definition,hostContextId,bridge,revi
|
|
|
66
67
|
// Keep the unverified native permissions boundary intact for this first host
|
|
67
68
|
// slice too. A transport is not physical protection of nested specs.
|
|
68
69
|
need(protection||!definition.specsDir.startsWith(definition.codeProject+path.sep),'nested_specs_protection_required');
|
|
69
|
-
const configuration={kind:'cm-current-conversation-v1',definitionDigest:digest(definition),hostContextId,
|
|
70
|
+
const configuration={kind:'cm-current-conversation-v1',...(parallelMember?{parallelMember}:{}),definitionDigest:digest(definition),hostContextId,
|
|
70
71
|
...(runtime==='claude'?{runtime}:{}),
|
|
71
72
|
...(provider?{providerDevelopment:{model:provider.model,coderRuntime,reviewerRuntime}}:{}),
|
|
72
73
|
...(protection?{protection}:{}),
|
|
@@ -104,7 +105,7 @@ export function createConversationExecution(definition,hostContextId,bridge,revi
|
|
|
104
105
|
const execution={configuration,timeoutMs:provider?protection.timeoutMs:1800000,excludedContexts:[hostContextId],hostDecision:null,applicableAgentFiles:[],
|
|
105
106
|
...(bootstrap?{bootstrap}:{}),
|
|
106
107
|
...(provider?{developmentAttempt:provider.attempt}:{}),
|
|
107
|
-
...(workflow?createHostWorkflowCapabilities({definition,configuration:workflow,bridge,allowQa,runtime,protectedExecution:protection!==null,bootstrap}):{}),
|
|
108
|
+
...(workflow?createHostWorkflowCapabilities({definition,configuration:workflow,bridge,allowQa,runtime,protectedExecution:protection!==null,bootstrap,parallelMember}):{}),
|
|
108
109
|
...(options.qaLogHome?{qaLogHome:options.qaLogHome}:{}),
|
|
109
110
|
...(authority?{hostDecisionProvider:authority.hostDecisionProvider}:{}),
|
|
110
111
|
developer:{provider:coderRuntime,requestedModel:provider?.model??'current-session',contextId:author,run:async(request,control)=>{
|
|
@@ -126,7 +127,7 @@ export function createConversationExecution(definition,hostContextId,bridge,revi
|
|
|
126
127
|
const expected=projectExecution?projectExecution.expected(bound.payload.scope):null;
|
|
127
128
|
if(protection){
|
|
128
129
|
prompt+=protectedTextInstructions;
|
|
129
|
-
if(documentationPaths.length&&isFinalCmAiTask({specsDir:definition.specsDir,codeProject:definition.codeProject,
|
|
130
|
+
if(!parallelMember&&documentationPaths.length&&isFinalCmAiTask({specsDir:definition.specsDir,codeProject:definition.codeProject,
|
|
130
131
|
feature:definition.feature,taskId:bound.identity.taskId}))prompt+=' Include necessary documentation synchronization in the same edits: '+JSON.stringify(documentationPaths);
|
|
131
132
|
}
|
|
132
133
|
const response=provider?await processWorker({prompt:prompt+'\n'+JSON.stringify({editMode:'protected-text-v1',expected})},control):json(await bridge.call('develop',{request:bound,prompt,codeProject:definition.codeProject,route,
|
|
@@ -16,7 +16,7 @@ export function validateDocumentationPaths(raw,scope){
|
|
|
16
16
|
return paths;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function withHostDocumentation({developer,documentationSync,specsDir,codeProject,feature,scope}){
|
|
19
|
+
export function withHostDocumentation({developer,documentationSync,specsDir,codeProject,feature,scope,parallelSelection=null}){
|
|
20
20
|
shape(documentationSync,['paths','run']);need(typeof documentationSync.run==='function');
|
|
21
21
|
const paths=validateDocumentationPaths(documentationSync.paths,scope),run=documentationSync.run;
|
|
22
22
|
need(paths.length>0);
|
|
@@ -24,7 +24,7 @@ export function withHostDocumentation({developer,documentationSync,specsDir,code
|
|
|
24
24
|
const response=terminalFor(await developer.run(request,control),request);
|
|
25
25
|
if(response.status!=='succeeded')return response;
|
|
26
26
|
need(!control.signal.aborted,'cancelled');
|
|
27
|
-
if(!isFinalCmAiTask({specsDir,codeProject,feature,taskId:request.identity.taskId}))return response;
|
|
27
|
+
if(!isFinalCmAiTask({specsDir,codeProject,feature,taskId:request.identity.taskId,parallelSelection}))return response;
|
|
28
28
|
const baseline=captureReviewBaseline({root:codeProject,specsRoot:specsDir,identity:request.identity,
|
|
29
29
|
scope:paths,requirements:request.payload.requirements.map(file=>file.path),
|
|
30
30
|
...(request.payload.specification?{specification:{specsRoot:specsDir,feature}}:{})});
|