@aibyzero/cm-workflow 0.16.8 → 0.17.0

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.
Files changed (226) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +31 -0
  3. package/README.md +22 -3
  4. package/VERSION +1 -1
  5. package/compat/claude-commands/cm-notify.md +3 -0
  6. package/docs/cm-control-policy-v2.md +331 -0
  7. package/docs/execution-optimizations.md +1 -1
  8. package/docs/external-models.md +3 -3
  9. package/docs/human-correction.md +5 -5
  10. package/docs/installation.md +1 -1
  11. package/docs/js-workflow-control.md +119 -78
  12. package/docs/next-steps.md +19 -2
  13. package/docs/untested-branches.md +2 -3
  14. package/docs/user-guide.md +105 -5
  15. package/package.json +2 -1
  16. package/runtime/js/cm-ai/claude-review-stream.mjs +49 -13
  17. package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +103 -68
  18. package/runtime/js/cm-ai/cm-ai-qa-log.mjs +79 -27
  19. package/runtime/js/cm-ai/code-projects.mjs +4 -1
  20. package/runtime/js/cm-ai/control-policy.mjs +111 -0
  21. package/runtime/js/cm-ai/developer-adapter.mjs +7 -0
  22. package/runtime/js/cm-ai/drive-bootstrap.mjs +11 -8
  23. package/runtime/js/cm-ai/drive-core.mjs +9 -0
  24. package/runtime/js/cm-ai/durable-runner-state.mjs +883 -69
  25. package/runtime/js/cm-ai/effect-abandon-log.mjs +5 -2
  26. package/runtime/js/cm-ai/effect-contract.mjs +6 -1
  27. package/runtime/js/cm-ai/external-run-guard.mjs +18 -7
  28. package/runtime/js/cm-ai/gate-bridge.mjs +4 -4
  29. package/runtime/js/cm-ai/host-check.mjs +4 -1
  30. package/runtime/js/cm-ai/host-conversation-execution.mjs +33 -24
  31. package/runtime/js/cm-ai/host-documentation.mjs +53 -12
  32. package/runtime/js/cm-ai/host-project-execution.mjs +2 -2
  33. package/runtime/js/cm-ai/host-qa-executor.mjs +49 -4
  34. package/runtime/js/cm-ai/host-qa-fix-owner.mjs +53 -9
  35. package/runtime/js/cm-ai/host-qa-policy.mjs +63 -21
  36. package/runtime/js/cm-ai/host-review-authority.mjs +2 -2
  37. package/runtime/js/cm-ai/host-review-file.mjs +1 -1
  38. package/runtime/js/cm-ai/host-session.mjs +1 -1
  39. package/runtime/js/cm-ai/host-tool-bridge.mjs +43 -3
  40. package/runtime/js/cm-ai/host-workflow-capabilities.mjs +21 -10
  41. package/runtime/js/cm-ai/host.mjs +1 -2
  42. package/runtime/js/cm-ai/operator-guidance.mjs +89 -3
  43. package/runtime/js/cm-ai/provider-review-observation.mjs +50 -0
  44. package/runtime/js/cm-ai/qa-resource-release.mjs +46 -0
  45. package/runtime/js/cm-ai/qa-round-budget.mjs +13 -0
  46. package/runtime/js/cm-ai/review-package.mjs +26 -5
  47. package/runtime/js/cm-ai/reviewed-deliveries.mjs +1 -1
  48. package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +1 -1
  49. package/runtime/js/cm-ai/task-commit.mjs +39 -0
  50. package/runtime/js/cm-ai/task-runner.mjs +629 -121
  51. package/runtime/js/cm-ai/worker-claude-developer.mjs +9 -0
  52. package/runtime/js/cm-ai/worker-claude.mjs +10 -3
  53. package/runtime/js/cm-ai/worker-process-identity.mjs +43 -0
  54. package/runtime/js/cm-fix/execution.mjs +176 -48
  55. package/runtime/js/cm-fix/host.mjs +2 -1
  56. package/runtime/js/cm-fix/pinned-baseline.mjs +24 -0
  57. package/runtime/js/cm-fix/progress.mjs +13 -3
  58. package/runtime/js/cm-fix/protected-edits.mjs +10 -3
  59. package/runtime/js/cm-fix/repair.mjs +11 -3
  60. package/runtime/js/cm-fix/test-author.mjs +10 -3
  61. package/runtime/js/cm-idea/session.mjs +67 -4
  62. package/runtime/js/cm-init/review-evidence.mjs +3 -1
  63. package/runtime/js/cm-prd/review-correction.mjs +10 -4
  64. package/runtime/js/cm-prd/review-host.mjs +1 -1
  65. package/runtime/js/cm-prd/review-publication.mjs +5 -3
  66. package/runtime/js/cm-prd/session.mjs +43 -0
  67. package/runtime/js/cm-refactor/records.mjs +98 -8
  68. package/runtime/js/cm-refactor/workflow.mjs +80 -10
  69. package/runtime/js/cm-test/host.mjs +10 -3
  70. package/runtime/js/cm-test/session.mjs +45 -6
  71. package/runtime/js/notify-safe-read.mjs +49 -0
  72. package/runtime/js/notify-send.mjs +313 -0
  73. package/runtime/js/notify.mjs +164 -37
  74. package/runtime/js/policy-binding-compat.mjs +55 -0
  75. package/runtime/review.md +52 -7
  76. package/runtime/task-gates.md +107 -9
  77. package/scripts/ci-test-shards.mjs +67 -0
  78. package/scripts/ci-test-shards.test.mjs +64 -0
  79. package/scripts/ci-test-weights.json +222 -0
  80. package/scripts/cm-ai-abandon-effect-position.test.mjs +71 -10
  81. package/scripts/cm-ai-answer-gap-dispatch.test.mjs +86 -0
  82. package/scripts/cm-ai-answer-gap-driver.test.mjs +51 -0
  83. package/scripts/cm-ai-answer-gap-fixture.mjs +89 -0
  84. package/scripts/cm-ai-answer-gap-recheck.test.mjs +70 -0
  85. package/scripts/cm-ai-answer-gap-redo.test.mjs +103 -0
  86. package/scripts/cm-ai-batch-drive.mjs +98 -34
  87. package/scripts/cm-ai-batch-drive.test.mjs +124 -16
  88. package/scripts/cm-ai-batch-host.mjs +167 -29
  89. package/scripts/cm-ai-batch-host.test.mjs +303 -31
  90. package/scripts/cm-ai-batch-run-fixture.mjs +452 -0
  91. package/scripts/cm-ai-batch-run-member-stops.test.mjs +26 -0
  92. package/scripts/cm-ai-batch-run-parallel.test.mjs +7 -0
  93. package/scripts/cm-ai-batch-run-reschedule.test.mjs +17 -0
  94. package/scripts/cm-ai-batch-run.mjs +213 -25
  95. package/scripts/cm-ai-batch-run.test.mjs +21 -341
  96. package/scripts/cm-ai-bootstrap-flow.test.mjs +1 -7
  97. package/scripts/cm-ai-bootstrap.test.mjs +2 -3
  98. package/scripts/cm-ai-control-launch.test.mjs +219 -0
  99. package/scripts/cm-ai-control-policy.test.mjs +124 -0
  100. package/scripts/cm-ai-control-v2-drive.test.mjs +270 -0
  101. package/scripts/cm-ai-develop-answer-invalid.test.mjs +97 -0
  102. package/scripts/cm-ai-develop-call-timeout.test.mjs +146 -0
  103. package/scripts/cm-ai-develop-driver-gaps.test.mjs +37 -23
  104. package/scripts/cm-ai-direct-review.test.mjs +348 -0
  105. package/scripts/cm-ai-documentation-sync-gap.test.mjs +424 -0
  106. package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +54 -25
  107. package/scripts/cm-ai-drive.mjs +142 -58
  108. package/scripts/cm-ai-drive.test.mjs +70 -84
  109. package/scripts/cm-ai-fix-integration.test.mjs +3 -5
  110. package/scripts/cm-ai-fix-later-delivery.test.mjs +3 -6
  111. package/scripts/cm-ai-fix-run-delivery.test.mjs +3 -6
  112. package/scripts/cm-ai-host-cli-workflow.test.mjs +267 -0
  113. package/scripts/cm-ai-host-fixture.mjs +296 -0
  114. package/scripts/cm-ai-host-protected.test.mjs +253 -0
  115. package/scripts/cm-ai-host.mjs +122 -100
  116. package/scripts/cm-ai-host.test.mjs +35 -776
  117. package/scripts/cm-ai-launch-diagnostics.test.mjs +5 -3
  118. package/scripts/cm-ai-legacy-history.test.mjs +53 -0
  119. package/scripts/cm-ai-light-modules.test.mjs +54 -0
  120. package/scripts/cm-ai-multi-root.test.mjs +4 -4
  121. package/scripts/cm-ai-nested-execution.test.mjs +16 -19
  122. package/scripts/cm-ai-operator-guidance.test.mjs +30 -5
  123. package/scripts/cm-ai-progress.test.mjs +10 -8
  124. package/scripts/cm-ai-project-qa-gate.test.mjs +37 -10
  125. package/scripts/cm-ai-protected-scope.test.mjs +8 -5
  126. package/scripts/cm-ai-qa-answer-gaps.test.mjs +99 -0
  127. package/scripts/cm-ai-qa-config-revision.test.mjs +1 -9
  128. package/scripts/cm-ai-qa-fingerprint-config.test.mjs +12 -9
  129. package/scripts/cm-ai-qa-fix-cross-session.test.mjs +95 -13
  130. package/scripts/cm-ai-qa-fixed-log.test.mjs +41 -0
  131. package/scripts/cm-ai-qa-recovery-args.test.mjs +7 -0
  132. package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +59 -14
  133. package/scripts/cm-ai-review-drift-precedence.test.mjs +1 -1
  134. package/scripts/cm-ai-review-failure.test.mjs +137 -32
  135. package/scripts/cm-ai-review-timeout-config.test.mjs +3 -1
  136. package/scripts/cm-ai-review-timeout.test.mjs +132 -67
  137. package/scripts/cm-ai-run.mjs +91 -28
  138. package/scripts/cm-ai-run.test.mjs +11 -38
  139. package/scripts/cm-ai-selection-guard.test.mjs +2 -2
  140. package/scripts/cm-ai-session-chain.test.mjs +18 -15
  141. package/scripts/cm-ai-spec-rebind.test.mjs +14 -18
  142. package/scripts/cm-ai-supersede.test.mjs +489 -51
  143. package/scripts/cm-blocked-reason.test.mjs +2 -3
  144. package/scripts/cm-capability-gate.test.mjs +33 -1
  145. package/scripts/cm-check-drive-files.mjs +8 -0
  146. package/scripts/cm-check-drive.test.mjs +2 -5
  147. package/scripts/cm-check-runtime.sh +4 -2
  148. package/scripts/cm-claude-developer-worker.test.mjs +15 -0
  149. package/scripts/cm-claude-review-stream.test.mjs +21 -16
  150. package/scripts/cm-claude-review-synthetic.test.mjs +155 -0
  151. package/scripts/cm-claude-worker.test.mjs +23 -5
  152. package/scripts/cm-controlled-correction.test.mjs +469 -0
  153. package/scripts/cm-external-batch-host.test.mjs +30 -11
  154. package/scripts/cm-external-model-host.test.mjs +1 -1
  155. package/scripts/cm-external-model-recovery.test.mjs +32 -12
  156. package/scripts/cm-external-qa-fix.test.mjs +1 -1
  157. package/scripts/cm-external-review-reconciliation.test.mjs +6 -24
  158. package/scripts/cm-fix-abandon.test.mjs +163 -10
  159. package/scripts/cm-fix-drive-unprotected.test.mjs +37 -0
  160. package/scripts/cm-fix-drive.mjs +25 -7
  161. package/scripts/cm-fix-host.mjs +8 -7
  162. package/scripts/cm-fix-review-budget.test.mjs +13 -0
  163. package/scripts/cm-fix-review-recovery.test.mjs +36 -1
  164. package/scripts/cm-host-answer-timeout.test.mjs +65 -0
  165. package/scripts/cm-host-call-kinds.test.mjs +28 -0
  166. package/scripts/cm-host-documentation.test.mjs +49 -0
  167. package/scripts/cm-host-qa-executor.test.mjs +23 -12
  168. package/scripts/cm-host-qa-policy.test.mjs +43 -16
  169. package/scripts/cm-host-review-authority.test.mjs +0 -31
  170. package/scripts/cm-idea-answer-gaps.test.mjs +164 -0
  171. package/scripts/cm-idea-drive.mjs +49 -11
  172. package/scripts/cm-idea-drive.test.mjs +66 -0
  173. package/scripts/cm-idea-host.mjs +106 -16
  174. package/scripts/cm-init-answer-gaps.test.mjs +258 -0
  175. package/scripts/cm-init-drive.mjs +41 -7
  176. package/scripts/cm-init-host.mjs +61 -12
  177. package/scripts/cm-knowledge-closeout.test.mjs +3 -3
  178. package/scripts/cm-log-event.mjs +21 -10
  179. package/scripts/cm-notify-command.test.mjs +936 -0
  180. package/scripts/cm-notify-read-drift.test.mjs +270 -0
  181. package/scripts/cm-notify.mjs +481 -0
  182. package/scripts/cm-notify.test.mjs +312 -23
  183. package/scripts/cm-patrol.test.mjs +3 -2
  184. package/scripts/cm-prd-answer-gaps.test.mjs +216 -0
  185. package/scripts/cm-prd-drive.mjs +18 -5
  186. package/scripts/cm-prd-drive.test.mjs +15 -0
  187. package/scripts/cm-prd-host.mjs +37 -4
  188. package/scripts/cm-prd-review-disposition.test.mjs +6 -1
  189. package/scripts/cm-prd-review-gate.mjs +56 -0
  190. package/scripts/cm-refactor-answer-gaps.test.mjs +206 -0
  191. package/scripts/cm-refactor-drive.mjs +52 -8
  192. package/scripts/cm-refactor-drive.test.mjs +44 -0
  193. package/scripts/cm-refactor-host.test.mjs +10 -6
  194. package/scripts/cm-release-smoke.sh +2 -0
  195. package/scripts/cm-task-gate-correction.test.mjs +69 -16
  196. package/scripts/cm-task-gate.mjs +368 -34
  197. package/scripts/cm-task-gate.py +2 -0
  198. package/scripts/cm-task-gate.test.mjs +252 -4
  199. package/scripts/cm-test-answer-gaps.test.mjs +151 -0
  200. package/scripts/cm-test-drive.mjs +21 -5
  201. package/scripts/fixtures/bootstrap-review-runner.mjs +1 -7
  202. package/scripts/fixtures/claude-review-process.mjs +1 -1
  203. package/scripts/fixtures/native-gate-fixture.mjs +18 -0
  204. package/scripts/policy-binding-compat.test.mjs +103 -0
  205. package/scripts/scan-public-safety.py +4 -0
  206. package/scripts/validate-public-repo.py +4 -0
  207. package/skills/cm-ai/SKILL.md +8 -6
  208. package/skills/cm-ai/references/N3-execute-task.md +17 -2
  209. package/skills/cm-ai/references/N4-review.md +11 -21
  210. package/skills/cm-ai/references/N5-mark-done.md +1 -1
  211. package/skills/cm-ai/references/N6-qa-eval.md +49 -21
  212. package/skills/cm-ai/references/js-host-modes.md +35 -14
  213. package/skills/cm-ai/references/js-host-qa-recovery.md +85 -11
  214. package/skills/cm-ai/references/js-host-recovery.md +181 -21
  215. package/skills/cm-ai/references/js-host.md +76 -32
  216. package/skills/cm-check/SKILL.md +3 -3
  217. package/skills/cm-fix/SKILL.md +12 -0
  218. package/skills/cm-fix/references/js-host.md +44 -5
  219. package/skills/cm-idea/references/js-host.md +27 -2
  220. package/skills/cm-init/references/js-host.md +17 -4
  221. package/skills/cm-notify/SKILL.md +34 -0
  222. package/skills/cm-prd/references/js-change-recovery.md +35 -1
  223. package/skills/cm-prd/references/js-host.md +1 -1
  224. package/skills/cm-refactor/SKILL.md +12 -0
  225. package/skills/cm-refactor/references/js-host.md +17 -0
  226. package/skills/cm-test/references/js-host.md +14 -1
@@ -7,6 +7,7 @@ import {spawnSync} from 'node:child_process';
7
7
  import {fileURLToPath} from 'node:url';
8
8
  import {buildManifest} from './cm-spec-manifest.mjs';
9
9
  import {configFingerprint} from '../runtime/js/cm-ai/codex-config.mjs';
10
+ import {claudeReviewFingerprint} from '../runtime/js/cm-ai/worker-claude.mjs';
10
11
  import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
11
12
  import {cmInitRuleTargets} from '../runtime/js/cm-init/draft-generation.mjs';
12
13
  import {qaFixAnswerFor,projectDevelopAttempts,bootstrapReviewRecoveryPlanError,buildCmAiDriveRequest} from './cm-ai-drive.mjs';
@@ -31,12 +32,19 @@ function fixture(t){
31
32
  const answers=path.join(root,'answers');fs.mkdirSync(answers);
32
33
  const bin=path.join(root,'bin');fs.mkdirSync(bin);
33
34
  const write=(name,value)=>fs.writeFileSync(path.join(answers,name),JSON.stringify(value));
34
- // create requires a bound review configuration; this one grants no review attempt.
35
- fs.writeFileSync(path.join(root,'placeholder-review.json'),JSON.stringify({model:'fixture',preflight:{}}));
35
+ // Isolated executable reviewers and matching synthetic preflights; no model service.
36
+ for(const provider of ['codex','claude']){
37
+ const executable=path.join(bin,provider);
38
+ fs.copyFileSync(fileURLToPath(new URL(`./fixtures/${provider}-review-process.mjs`,import.meta.url)),executable);
39
+ fs.chmodSync(executable,0o700);
40
+ fs.writeFileSync(path.join(root,`${provider}-review.json`),JSON.stringify({model:'fixture',disabledSkills:[],preflight:{passed:true,
41
+ provider,prompt_transport:'stdin',...(provider==='codex'?{cli_model:'fixture'}:{}),
42
+ config_fingerprint:provider==='codex'?configFingerprint({cwd:codeProject,model:'fixture'}):claudeReviewFingerprint({cwd:codeProject,model:'fixture'})}}));
43
+ }
36
44
  const plan=(extra={})=>{const file=path.join(root,`plan-${Math.random().toString(36).slice(2)}.json`);
37
45
  const value={config:'run.json',mode:'create',hostContext:'drive-host-a',
38
46
  permissions:[],answers:'answers',checks:[{id:'syntax',command:[process.execPath,'--check','target.mjs']}],...extra};
39
- if(!value.permissions.includes('--review-config'))value.permissions=[...value.permissions,'--review-config','placeholder-review.json'];
47
+ if(!value.permissions.includes('--review-config'))value.permissions=[...value.permissions,'--review-config',`${value.runtime==='claude'||value.permissions.includes('--review-runtime')?'claude':'codex'}-review.json`];
40
48
  fs.writeFileSync(file,JSON.stringify(value));
41
49
  return file;};
42
50
  const drive=(file,operation,timeout=30000)=>spawnSync(process.execPath,[DRIVER,'--plan',file,operation],
@@ -57,29 +65,18 @@ function changesRequestedReview(f){
57
65
  const cli=path.join(f.bin,'codex');fs.writeFileSync(cli,fake,{mode:0o700});
58
66
  fs.writeFileSync(path.join(f.root,'review.json'),JSON.stringify({model:'fixture',preflight:{passed:true,
59
67
  cli_model:'fixture',prompt_transport:'stdin',config_fingerprint:configFingerprint({cwd:f.codeProject,model:'fixture'})}}));
60
- return ['--review-config','review.json','--allow-review-attempt','1'];
68
+ return ['--review-config','review.json'];
61
69
  }
62
70
  function reviewPending(f){
63
71
  prepared(f);const permissions=changesRequestedReview(f);
64
72
  const first=f.drive(f.plan({permissions:permissions.slice(0,2)}),'advance');assert.equal(first.status,0,first.stderr);
65
73
  return {permissions,packageDigest:JSON.parse(first.stdout).result.packageDigest};
66
74
  }
67
- function assertActionableFirstReviewHint(stderr){
68
- assert.match(stderr,/develop-a2\.json/);
69
- assert.match(stderr,/审查后可能直接进入第 2 轮 develop/);
70
- assert.match(stderr,/移除 --allow-review-attempt 1/);
71
- assert.match(stderr,/awaiting_review/);
72
- assert.match(stderr,/packageDigest.*decision/);
73
- assert.match(stderr,/\.reviews\/work-T-001-r1\.md/);
74
- assert.match(stderr,/预先写.*develop-a2\.json/);
75
- assert.match(stderr,/逐字节相同时.*develop_unchanged_after_review/);
76
- }
77
- test('review-enabled advance refuses missing second-round answer before host launch',t=>{
78
- const f=fixture(t),{permissions,packageDigest}=reviewPending(f),before=fs.readFileSync(f.store);
75
+ test('direct advance holds at changes_requested before the missing second-round answer',t=>{
76
+ const f=fixture(t),{permissions}=reviewPending(f),before=fs.readFileSync(f.store);
77
+ assert.equal(JSON.parse(before).records.filter(row=>row.payload.type==='review-invocation-started').length,1);
79
78
  const run=f.drive(f.plan({mode:'resume',originalHostContext:'drive-host-a',permissions}),'advance');
80
79
  assert.equal(run.status,2,run.stderr);assert.match(run.stderr,/develop-a2\.json/);
81
- assert.match(run.stderr,/decision/);assert.match(run.stderr,new RegExp(packageDigest));
82
- assert.match(run.stderr,/\.reviews\/work-T-001-r1\.md/);
83
80
  assert.deepEqual(fs.readFileSync(f.store),before);
84
81
  });
85
82
  test('retryable blocked state projects the same develop attempt',()=>{
@@ -101,19 +98,20 @@ test('D1 real host retries a check-output-blocked develop with a fresh effect id
101
98
  const clean=[{id:'build',command:[process.execPath,'-e','0']}];
102
99
  const second=f.drive(f.plan({mode:'resume',originalHostContext:'drive-host-a',runtime:'claude',checks:clean}),'advance');
103
100
  assert.equal(second.status,0,second.stderr);
104
- assert.equal(JSON.parse(second.stdout).result.state,'awaiting_review');
101
+ assert.equal(JSON.parse(second.stdout).result.state,'fixture_completed');
105
102
  assert.match(second.stderr,/应答 develop/);
106
103
  const intents=JSON.parse(fs.readFileSync(f.store)).records.filter(r=>r.payload.type==='effect-intent').map(r=>r.payload.effect.id);
107
- assert.deepEqual(intents,['develop-1','develop-1-retry-1']);
104
+ assert.deepEqual(intents.slice(0,2),['develop-1','develop-1-retry-1']);
105
+ assert.equal(intents.filter(id=>id.startsWith('develop')).length,2);
108
106
  assert.match(fs.readFileSync(path.join(f.codeProject,'App','ContentView.swift'),'utf8'),/import SwiftUI/);
109
107
  });
110
108
 
111
109
  test('D1 per-check timeout lets a 61 second check finish under a 65 second limit',t=>{
112
- const f=fixture(t);prepared(f);
110
+ const f=fixture(t);prepared(f);changesRequestedReview(f);
113
111
  const checks=[{id:'slow',command:[process.execPath,'-e','setTimeout(()=>{},61000)'],timeoutMs:65000}];
114
- const run=f.drive(f.plan({checkTimeoutMs:1000,checks}),'advance',80000);
112
+ const run=f.drive(f.plan({checkTimeoutMs:1000,checks,permissions:['--review-config','review.json']}),'advance',80000);
115
113
  assert.equal(run.status,0,run.stderr);
116
- assert.equal(JSON.parse(run.stdout).result.state,'awaiting_review');
114
+ assert.equal(JSON.parse(run.stdout).result.state,'changes_requested');
117
115
  });
118
116
 
119
117
  for(const plan of [{checkTimeoutMs:0},{checks:[{id:'syntax',command:[process.execPath,'--check','target.mjs'],timeoutMs:3600001}]}])
@@ -122,35 +120,14 @@ test(`D1 single driver rejects invalid timeout before host launch ${Object.keys(
122
120
  const run=f.drive(f.plan(plan),'advance');
123
121
  assert.equal(run.status,2);assert.match(run.stderr,/[tT]imeoutMs/);assert.equal(fs.existsSync(f.store),false);
124
122
  });
125
- test('review-authorized create preflights a possible second develop round',t=>{
123
+ test('create direct review holds for an authored revision when only develop.json exists',t=>{
126
124
  const f=fixture(t);prepared(f);const permissions=changesRequestedReview(f);
127
- const run=f.drive(f.plan({permissions}),'advance');
128
- assert.equal(run.status,2,run.stderr);assertActionableFirstReviewHint(run.stderr);
129
- assert.equal(fs.existsSync(f.store),false);
130
- });
131
- test('review-authorized resume from ready gives the same two paths before launch',t=>{
132
- const f=fixture(t);prepared(f);const permissions=changesRequestedReview(f);
133
- const status=f.drive(f.plan({permissions:permissions.slice(0,2),answers:undefined,checks:undefined}),'status');
134
- assert.equal(status.status,0,status.stderr);assert.equal(JSON.parse(status.stdout).result.state,'ready');
135
- const before=fs.readFileSync(f.store);
136
- const run=f.drive(f.plan({mode:'resume',originalHostContext:'drive-host-a',permissions}),'advance');
137
- assert.equal(run.status,2,run.stderr);assertActionableFirstReviewHint(run.stderr);
138
- assert.deepEqual(fs.readFileSync(f.store),before);
139
- });
140
- test('create advance without review authorization accepts only develop.json',t=>{
141
- const f=fixture(t);prepared(f);const permissions=changesRequestedReview(f).slice(0,2);
142
125
  assert.equal(fs.existsSync(path.join(f.answers,'develop-a2.json')),false);
143
126
  const run=f.drive(f.plan({permissions}),'advance');assert.equal(run.status,0,run.stderr);
144
- assert.equal(JSON.parse(run.stdout).result.state,'awaiting_review');
145
- });
146
- test('decision dispatches only review and leaves changes_requested for authored revision',t=>{
147
- const f=fixture(t),{permissions,packageDigest}=reviewPending(f);
148
- const run=f.drive(f.plan({mode:'resume',originalHostContext:'drive-host-a',permissions,
149
- packageDigest,answers:undefined,checks:undefined}),'decision');
150
- assert.equal(run.status,0,run.stderr);
151
127
  assert.equal(JSON.parse(run.stdout).result.state,'changes_requested');
152
- assert.equal(JSON.parse(run.stdout).result.identity.attempt,2);
153
- assert.equal(fs.readFileSync(path.join(f.codeProject,'target.mjs'),'utf8'),'export const value = 42;\n');
128
+ assert.equal(JSON.parse(run.stdout).result.code,'revision_answer_required');
129
+ const intents=JSON.parse(fs.readFileSync(f.store)).records.filter(row=>row.payload.type==='effect-intent');
130
+ assert.equal(intents.filter(row=>row.payload.effect.kind==='develop').length,1);
154
131
  });
155
132
  test('advance applies develop-a2 content after changes_requested review',t=>{
156
133
  const f=fixture(t),{permissions}=reviewPending(f);
@@ -190,8 +167,7 @@ function qaFixture(f,kinds,caseIds=[]){
190
167
  fs.writeFileSync(path.join(f.root,'workflow.json'),JSON.stringify({documentationPaths:[],applicableAgentFiles:[],
191
168
  qa:{commands:[{id:'unit',command:[process.execPath,'--check','target.mjs'],caseIds}],
192
169
  environment:{kind:'web',carrier:'browser',target:'fixture-local',scope:'local'}}}));
193
- f.write('qa-assess.json',{scores:{scope:1,risk:1,accumulation:1,boundary:1},
194
- changes:{api:false,migration:false,authentication:false,authorization:false,payment:false}});
170
+ f.write('qa-assess.json',{confirmed:true});
195
171
  f.write('documentation-inspect.json',{status:'blocked',reason:'Fixture stops before documentation review'});
196
172
  return f.plan({permissions:['--workflow-config','workflow.json','--allow-qa',
197
173
  ...(kinds.some(item=>item.kind==='browser')?['--browser-qa','available']:[])]});
@@ -243,8 +219,7 @@ test('progress R1: single driver forwards quiet QA command boundaries',t=>{
243
219
  const permissions=changesRequestedReview(f);
244
220
  fs.copyFileSync(fileURLToPath(new URL('./fixtures/codex-review-process.mjs',import.meta.url)),path.join(f.bin,'codex'));
245
221
  fs.chmodSync(path.join(f.bin,'codex'),0o700);
246
- f.write('qa-assess.json',{scores:{scope:2,risk:2,accumulation:2,boundary:2},
247
- changes:{api:false,migration:false,authentication:false,authorization:false,payment:false}});
222
+ f.write('qa-assess.json',{confirmed:true});
248
223
  const workflowPath=path.join(f.root,'workflow.json'),workflow=JSON.parse(fs.readFileSync(workflowPath,'utf8'));
249
224
  workflow.qa.commands=[{id:'quiet-qa',command:[process.execPath,'-e','setTimeout(()=>process.exit(0),400)'],caseIds:[]}];
250
225
  fs.writeFileSync(workflowPath,JSON.stringify(workflow));
@@ -264,17 +239,17 @@ test('create and advance run authored edits and actual check, then resume with o
264
239
  const f=fixture(t);prepared(f);
265
240
  const first=f.drive(f.plan(),'advance');assert.equal(first.status,0,first.stderr);
266
241
  const result=JSON.parse(first.stdout).result;
267
- assert.equal(result.state,'awaiting_review');assert.equal(result.code,'decision_required');
242
+ assert.equal(result.state,'fixture_completed');assert.equal(result.code,'qa_decision_required');
268
243
  assert.match(first.stderr,/应答 develop/);assert.match(first.stderr,/应答 check/);
269
244
  assert.equal(fs.readFileSync(path.join(f.codeProject,'target.mjs'),'utf8'),'export const value = 42;\n');
270
245
  assert(fs.existsSync(f.store));
271
246
  const resumed=f.drive(f.plan({mode:'resume',hostContext:'drive-host-b',originalHostContext:'drive-host-a'}),'advance');
272
- assert.equal(resumed.status,0,resumed.stderr);assert.equal(JSON.parse(resumed.stdout).result.code,'decision_required');
247
+ assert.equal(resumed.status,0,resumed.stderr);assert.equal(JSON.parse(resumed.stdout).result.code,'qa_decision_required');
273
248
  });
274
249
 
275
250
  test('driver resumes an interrupted develop and sends the bound abandon_effect request',t=>{
276
251
  const f=fixture(t);prepared(f);
277
- const first=f.drive(f.plan(),'advance');assert.equal(first.status,0,first.stderr);
252
+ const first=f.drive(f.plan({checks:[{id:'stop-before-review',command:[process.execPath,'-e','process.exit(7)']}]}),'advance');assert.equal(first.status,0,first.stderr);
278
253
  const current=JSON.parse(fs.readFileSync(f.store,'utf8'));
279
254
  const index=current.records.findIndex(row=>row.payload.type==='effect-intent'
280
255
  &&row.payload.effect.kind==='develop');assert(index>=0);
@@ -285,9 +260,11 @@ test('driver resumes an interrupted develop and sends the bound abandon_effect r
285
260
  reason:'Old host and its checks have exited'});
286
261
  const result=f.drive(plan,'abandon_effect');assert.equal(result.status,0,result.stderr);
287
262
  const response=JSON.parse(result.stdout).result;
288
- assert.equal(response.state,'cancelled');assert.equal(response.code,'effect_abandoned');
263
+ // V8: the run continues from develop_interrupted instead of being voided.
264
+ assert.equal(response.state,'blocked');assert.equal(response.code,'develop_interrupted');
265
+ assert.equal(response.pendingAction,'resume');
289
266
  const saved=JSON.parse(fs.readFileSync(f.store,'utf8'));
290
- assert.deepEqual(saved.records.slice(-2).map(row=>row.payload.type),['effect-intent','effect-abandoned']);
267
+ assert.deepEqual(saved.records.slice(-2).map(row=>row.payload.type),['effect-intent','effect-interrupted']);
291
268
  });
292
269
  test('real host drives split-root bootstrap scaffold, then refuses rules without answer files before creating T-002 run',
293
270
  {skip:process.platform!=='darwin'},t=>{
@@ -323,15 +300,8 @@ test('real host drives split-root bootstrap scaffold, then refuses rules without
323
300
  fs.writeFileSync(path.join(root,'review.json'),preview.stdout);
324
301
  writePlan('create',['--bootstrap-config','bootstrap.json','--allow-bootstrap-write','--review-config','review.json']);
325
302
  const scaffold=drive('advance');assert.equal(scaffold.status,0,scaffold.stderr);
326
- const first=JSON.parse(scaffold.stdout).result;assert.equal(first.state,'awaiting_review');
303
+ const first=JSON.parse(scaffold.stdout).result;assert.equal(first.state,'fixture_completed');
327
304
  assert.equal(fs.readFileSync(path.join(codeProject,'app.mjs'),'utf8'),'export const app = true;\n');
328
- writePlan('resume',['--bootstrap-config','bootstrap.json','--allow-bootstrap-write','--review-config','review.json',
329
- '--allow-review-attempt','1'],{packageDigest:first.packageDigest});
330
- const review=drive('decision');
331
- assert.equal(review.status,0,review.stderr);assert.equal(JSON.parse(review.stdout).result.state,'approved');
332
- writePlan('resume',['--bootstrap-config','bootstrap.json','--allow-bootstrap-write','--review-config','review.json']);
333
- const completed=drive('advance');assert.equal(completed.status,0,completed.stderr);
334
- assert.equal(JSON.parse(completed.stdout).result.state,'fixture_completed');
335
305
  assert.match(fs.readFileSync(path.join(specsDir,feature,'tasks.md'),'utf8'),/\[x\] T-001/);
336
306
  writeRun('T-002',cmInitRuleTargets(selection,codeProject));
337
307
  fs.writeFileSync(bootstrap,JSON.stringify({selection}));
@@ -477,7 +447,7 @@ test('same-session resume may omit originalHostContext and cross-session omissio
477
447
  const before=fs.readFileSync(f.store);
478
448
  const same=f.drive(f.plan({mode:'resume',answers:undefined,checks:undefined}),'status');
479
449
  assert.equal(same.status,0,same.stderr);
480
- assert.equal(JSON.parse(same.stdout).result.state,'awaiting_review');
450
+ assert.equal(JSON.parse(same.stdout).result.state,'fixture_completed');
481
451
  const cross=f.drive(f.plan({mode:'resume',hostContext:'drive-host-b',answers:undefined,checks:undefined}),'status');
482
452
  assert.equal(cross.status,1,cross.stderr);assert.match(cross.stderr,/fingerprint_mismatch/);
483
453
  assert.deepEqual(fs.readFileSync(f.store),before);
@@ -507,26 +477,17 @@ test('status reads the existing run without answer files or checks',t=>{
507
477
  const f=fixture(t);prepared(f);assert.equal(f.drive(f.plan(),'advance').status,0);
508
478
  const before=fs.readFileSync(f.store);
509
479
  const status=f.drive(f.plan({mode:'resume',originalHostContext:'drive-host-a',answers:undefined,checks:undefined}),'status');
510
- assert.equal(status.status,0,status.stderr);assert.equal(JSON.parse(status.stdout).result.state,'awaiting_review');
480
+ assert.equal(status.status,0,status.stderr);assert.equal(JSON.parse(status.stdout).result.state,'fixture_completed');
511
481
  assert.deepEqual(fs.readFileSync(f.store),before);
512
482
  });
513
- test('decision sends the package binding and needs no answer files',t=>{
514
- const f=fixture(t);prepared(f);
515
- const first=f.drive(f.plan(),'advance');assert.equal(first.status,0,first.stderr);
516
- const packageDigest=JSON.parse(first.stdout).result.packageDigest;
517
- const decision=f.drive(f.plan({mode:'resume',originalHostContext:'drive-host-a',
518
- packageDigest,answers:undefined,checks:undefined}),'decision');
519
- assert.equal(decision.status,0,decision.stderr);
520
- assert.equal(JSON.parse(decision.stdout).result.code,'decision_required');
521
- });
522
483
  test('explicit allow-development permission reaches the host once',t=>{
523
484
  const f=fixture(t);prepared(f);
524
485
  const run=f.drive(f.plan({permissions:['--allow-development']}),'advance');
525
- assert.equal(run.status,0,run.stderr);assert.equal(JSON.parse(run.stdout).result.code,'decision_required');
486
+ assert.equal(run.status,0,run.stderr);assert.equal(JSON.parse(run.stdout).result.code,'qa_decision_required');
526
487
  });
527
488
  test('QA-fix child operation forwards its binding and returns parent gate result',t=>{
528
- const f=fixture(t);prepared(f);assert.equal(f.drive(f.plan(),'advance').status,0);
529
- const binding={feature:'1.work',identity,packageDigest:'a'.repeat(64),testRunId:'qa-child'};
489
+ const f=fixture(t);prepared(f);changesRequestedReview(f);assert.equal(f.drive(f.plan({permissions:['--review-config','review.json']}),'advance').status,0);
490
+ const binding={feature:'1.work',identity:{...identity,attempt:2},packageDigest:'a'.repeat(64),testRunId:'qa-child'};
530
491
  fs.writeFileSync(path.join(f.root,'fix-owner.json'),JSON.stringify({specsRoot:f.specsDir,identity:{...identity,runId:'fix-run'},
531
492
  configuration:{hostContextId:'drive-host-a',reproduction:{cwd:f.codeProject},qaSource:binding}}));
532
493
  const attempt=f.drive(f.plan({mode:'resume',originalHostContext:'drive-host-a',
@@ -535,8 +496,8 @@ test('QA-fix child operation forwards its binding and returns parent gate result
535
496
  assert.match(attempt.stderr,/qa_fix_parent_not_completed/);
536
497
  });
537
498
  test('QA-fix child action requires its own answer before any host request',t=>{
538
- const f=fixture(t);prepared(f);assert.equal(f.drive(f.plan(),'advance').status,0);
539
- const binding={feature:'1.work',identity,packageDigest:'a'.repeat(64),testRunId:'qa-child'};
499
+ const f=fixture(t);prepared(f);changesRequestedReview(f);assert.equal(f.drive(f.plan({permissions:['--review-config','review.json']}),'advance').status,0);
500
+ const binding={feature:'1.work',identity:{...identity,attempt:2},packageDigest:'a'.repeat(64),testRunId:'qa-child'};
540
501
  fs.writeFileSync(path.join(f.root,'fix-owner.json'),JSON.stringify({specsRoot:f.specsDir,identity:{...identity,runId:'fix-run'},
541
502
  configuration:{hostContextId:'drive-host-a',reproduction:{cwd:f.codeProject},qaSource:binding}}));
542
503
  const options={mode:'resume',originalHostContext:'drive-host-a',packageDigest:'a'.repeat(64),
@@ -554,6 +515,31 @@ test('QA-fix child action requires its own answer before any host request',t=>{
554
515
  {fix_repair:{'target.mjs':'repair.txt'}},f.answers),
555
516
  {outcome:'repaired',edits:[{path:'target.mjs',beforeSha256:'old-hash',content:'export const value = 43;\n'}]});
556
517
  });
518
+ test('Q23 QA-fix recovery fixOperations need their parent flag and fields before any host request',t=>{
519
+ const f=fixture(t);prepared(f);changesRequestedReview(f);assert.equal(f.drive(f.plan({permissions:['--review-config','review.json']}),'advance').status,0);
520
+ const binding={feature:'1.work',identity:{...identity,attempt:2},packageDigest:'a'.repeat(64),testRunId:'qa-child'};
521
+ fs.writeFileSync(path.join(f.root,'fix-owner.json'),JSON.stringify({specsRoot:f.specsDir,identity:{...identity,runId:'fix-run'},
522
+ configuration:{hostContextId:'drive-host-a',reproduction:{cwd:f.codeProject},qaSource:binding}}));
523
+ const base={mode:'resume',originalHostContext:'drive-host-a',packageDigest:'a'.repeat(64),testRunId:'qa-child',
524
+ permissions:['--qa-fix-owner-config','fix-owner.json','--allow-qa-fix-start']};
525
+ const run=(extra,flags=[])=>f.drive(f.plan({...base,...extra,permissions:[...base.permissions,...flags]}),'fix_action');
526
+ let result=run({fixOperation:'rediagnose',reason:'审查要求补证'});
527
+ assert.equal(result.status,2);assert.match(result.stderr,/--allow-qa-fix-rediagnosis/);
528
+ result=run({fixOperation:'rediagnose',reason:'审查要求补证'},['--allow-qa-fix-rediagnosis']);
529
+ assert.equal(result.status,2);assert.match(result.stderr,/learning\.json/);
530
+ f.write('learning.json',{status:'no_relevant_lesson',summary:'No applicable project lesson'});
531
+ f.write('diagnosis.json',{status:'diagnosed',rootCause:'first',affectedPaths:['a.mjs'],affectedModules:['a'],plan:'p',crossLayer:false});
532
+ result=run({fixOperation:'rediagnose',reason:'审查要求补证'},['--allow-qa-fix-rediagnosis']);
533
+ assert.equal(result.status,2);assert.match(result.stderr,/diagnosis-rediagnosis\.json/);
534
+ result=run({fixOperation:'rerun_blocked_step'},['--allow-qa-fix-rerun-blocked-step']);
535
+ assert.equal(result.status,2);assert.match(result.stderr,/reason/);
536
+ result=run({fixOperation:'recover_final_review',reason:'旧审查已停',invocationId:'final-1',reviewPackageDigest:'b'.repeat(64)},
537
+ ['--allow-qa-fix-final-review-recovery']);
538
+ assert.equal(result.status,2);assert.match(result.stderr,/previousInvocationStopped/);
539
+ result=run({fixOperation:'recover_final_review',reason:'旧审查已停',invocationId:'final-1',reviewPackageDigest:'b'.repeat(64),
540
+ previousInvocationStopped:true},['--allow-qa-fix-final-review-recovery','--qa-fix-final-review-recovery-invocation','final-1']);
541
+ assert.equal(result.status,1,result.stderr);assert.match(result.stderr,/qa_fix_parent_not_completed/);
542
+ });
557
543
  test('QA-fix answer travels through the shared JSONL core',t=>{
558
544
  const f=fixture(t),host=path.join(f.root,'child-host.mjs'),wrapper=path.join(f.root,'child-drive.mjs');
559
545
  fs.writeFileSync(host,`process.stdout.write(JSON.stringify({type:'host_ready',sessionId:'child'})+'\\n');
@@ -579,11 +565,11 @@ test('new policy real driver reuses only declared checks and frozen resume keeps
579
565
  const command=[process.execPath,'-e',"require('node:fs').appendFileSync("+JSON.stringify(path.join(f.root,'execution-count'))+",'x');console.log('tests 1\\npass 1')"];
580
566
  const checks=[{id:'tests',command},{id:'ui',command,sameExecutionAs:'tests'}];
581
567
  const plan=f.plan({permissions:['--execution-optimizations'],checks});
582
- const first=f.drive(plan,'advance');assert.equal(first.status,0,first.stderr);assert.equal(JSON.parse(first.stdout).result.state,'awaiting_review',first.stdout+first.stderr);
583
- assert.equal(fs.readFileSync(path.join(f.root,'execution-count'),'utf8'),'x');
568
+ const first=f.drive(plan,'advance');assert.equal(first.status,0,first.stderr);assert.equal(JSON.parse(first.stdout).result.state,'fixture_completed',first.stdout+first.stderr);
569
+ assert.equal(fs.readFileSync(path.join(f.root,'execution-count'),'utf8'),'xx');
584
570
  const before=fs.readFileSync(f.store),snapshot=JSON.parse(before);assert.equal(snapshot.records[0].payload.config.executionPolicy.checkReuse,'declared-adjacent-v1');
585
571
  const resume=f.plan({mode:'resume',checks});const status=f.drive(resume,'status');assert.equal(status.status,0,status.stderr);
586
- assert.equal(fs.readFileSync(path.join(f.root,'execution-count'),'utf8'),'x');assert.deepEqual(fs.readFileSync(f.store),before);
572
+ assert.equal(fs.readFileSync(path.join(f.root,'execution-count'),'utf8'),'xx');assert.deepEqual(fs.readFileSync(f.store),before);
587
573
  });
588
574
  test('legacy real driver rejects optimization aliases before any host or command starts',t=>{
589
575
  const f=fixture(t);prepared(f);const command=[process.execPath,'-e',"require('node:fs').writeFileSync('marker','bad')"];
@@ -7,7 +7,6 @@ import path from 'node:path';
7
7
  import {openControlRun} from './cm-ai-run.mjs';
8
8
  import {createCodexDeveloperRun} from '../runtime/js/cm-ai/codex-developer-adapter.mjs';
9
9
  import {createHostCheck} from '../runtime/js/cm-ai/host-check.mjs';
10
- import {createHostReviewAuthority} from '../runtime/js/cm-ai/host-review-authority.mjs';
11
10
  import {createQaFixOwnerHost} from '../runtime/js/cm-ai/host-qa-fix-owner.mjs';
12
11
  import {createFixReviewHost} from '../runtime/js/cm-fix/host-review.mjs';
13
12
  import {qaFixIdentity} from '../runtime/js/cm-fix/qa-source.mjs';
@@ -42,9 +41,8 @@ for(const mode of ['history','retest','unknown','failed-retest','double-pass','d
42
41
  {event:'item.completed',item_type:'agent_message'},{event:'turn.completed',item_type:null},
43
42
  {event:'process_closed',exit_code:0,signal:null,timed_out:false}])onEvent(event);
44
43
  };
45
- const authority=createHostReviewAuthority({hostContextId:'parent-host',reviewerId:'reviewer',adapterId:'codex-review-adapter',decide:async()=>({status:'approved'})});
46
- const execution={configuration:{kind:'synthetic-parent-fix'},timeoutMs:2000,excludedContexts:['parent-host'],hostDecision:null,
47
- hostDecisionProvider:authority.hostDecisionProvider,
44
+
45
+ const execution={configuration:{kind:'synthetic-parent-fix'},timeoutMs:2000,excludedContexts:['parent-host'],
48
46
  developer:{provider:'codex',requestedModel:'synthetic',contextId:'author',run:createCodexDeveloperRun({requestedModel:'synthetic',worker:async()=>{
49
47
  developers++;fs.writeFileSync(path.join(codeProject,'value.mjs'),'export const value=1;');
50
48
  return {status:'succeeded',value:{outcome:'implemented',application:{status:'no_relevant_lesson',note:null},
@@ -56,7 +54,7 @@ for(const mode of ['history','retest','unknown','failed-retest','double-pass','d
56
54
  return {status:'succeeded',value:{verdict:'approved',packageDigest:request.payload.reviewPackage.packageDigest,
57
55
  examinedPaths:reviewPaths(request.payload.reviewPackage),findings:[],summary:'Synthetic parent review; QA exposes remaining defect'}};
58
56
  }}],
59
- reviewInvocation:{developerThreadId:'author',excludedThreadIds:['parent-host'],authorize:authority.authorize},
57
+ reviewInvocation:{developerThreadId:'author',excludedThreadIds:['parent-host']},
60
58
  check:createHostCheck({cwd:codeProject,commands:[{id:'existing',command:[process.execPath,'existing.mjs']}]}),
61
59
  qaLogHome:path.join(root,'logs'),qaDecisionProvider:{timeoutMs:1000,decide:async binding=>({decisionId:'qa-parent',identity:binding.identity,packageDigest:binding.packageDigest,
62
60
  status:'triggered',reason:'feature_complete',score:null,at:'2026-09-08T01:00:00Z'})},
@@ -9,7 +9,6 @@ import {buildManifest} from './cm-spec-manifest.mjs';
9
9
  import {openControlRun} from './cm-ai-run.mjs';
10
10
  import {createCodexDeveloperRun} from '../runtime/js/cm-ai/codex-developer-adapter.mjs';
11
11
  import {createHostCheck} from '../runtime/js/cm-ai/host-check.mjs';
12
- import {createHostReviewAuthority} from '../runtime/js/cm-ai/host-review-authority.mjs';
13
12
  import {createQaFixOwnerHost} from '../runtime/js/cm-ai/host-qa-fix-owner.mjs';
14
13
  import {createFixReviewHost} from '../runtime/js/cm-fix/host-review.mjs';
15
14
  import {qaFixIdentity} from '../runtime/js/cm-fix/qa-source.mjs';
@@ -56,10 +55,8 @@ for(const variant of ['separate','shared'])test(`#18 a QA fix for an earlier fea
56
55
  fs.writeFileSync(path.join(codeProject,'.cm-workflow.json'),JSON.stringify({version:1,policies:{delivery:'diff'}}));
57
56
  let qaRuns=0,childReviews=0,documentation=0;
58
57
  const execution=({feature,write,retrospective={status:'no_new_lesson',candidates:[],reason:null},qa})=>{
59
- const authority=createHostReviewAuthority({hostContextId:'parent-host',reviewerId:'reviewer',adapterId:'codex-review-adapter',
60
- decide:async()=>({status:'approved'})});
61
- return {configuration:{kind:'synthetic-parent-fix'},timeoutMs:2000,excludedContexts:['parent-host'],hostDecision:null,
62
- hostDecisionProvider:authority.hostDecisionProvider,
58
+
59
+ return {configuration:{kind:'synthetic-parent-fix'},timeoutMs:2000,excludedContexts:['parent-host'],
63
60
  developer:{provider:'codex',requestedModel:'synthetic',contextId:'author',run:createCodexDeveloperRun({requestedModel:'synthetic',worker:async()=>{
64
61
  write();return {status:'succeeded',value:{outcome:'implemented',application:{status:'no_relevant_lesson',note:null},retrospective}};}})},
65
62
  reviewers:[{id:'reviewer',adapterId:'codex-review-adapter',provider:'codex',requestedModel:'synthetic',allowed:true,available:true,
@@ -67,7 +64,7 @@ for(const variant of ['separate','shared'])test(`#18 a QA fix for an earlier fea
67
64
  events(onEvent,`synthetic-review-${request.identity.runId}`);
68
65
  return {status:'succeeded',value:{verdict:'approved',packageDigest:request.payload.reviewPackage.packageDigest,
69
66
  examinedPaths:reviewPaths(request.payload.reviewPackage),findings:[],summary:'Synthetic review'}};}}],
70
- reviewInvocation:{developerThreadId:'author',excludedThreadIds:['parent-host'],authorize:authority.authorize},
67
+ reviewInvocation:{developerThreadId:'author',excludedThreadIds:['parent-host']},
71
68
  check:createHostCheck({cwd:codeProject,commands:[{id:'existing',command:[process.execPath,'existing.mjs']}]}),
72
69
  qaLogHome:path.join(root,'logs'),qaDecisionProvider:{timeoutMs:1000,decide:async binding=>({decisionId:`qa-${binding.identity.runId}`,
73
70
  identity:binding.identity,packageDigest:binding.packageDigest,status:'triggered',reason:'feature_complete',score:null,at:'2026-09-28T01:00:00Z'})},
@@ -12,7 +12,6 @@ import {buildManifest} from './cm-spec-manifest.mjs';
12
12
  import {openControlRun} from './cm-ai-run.mjs';
13
13
  import {createCodexDeveloperRun} from '../runtime/js/cm-ai/codex-developer-adapter.mjs';
14
14
  import {createHostCheck} from '../runtime/js/cm-ai/host-check.mjs';
15
- import {createHostReviewAuthority} from '../runtime/js/cm-ai/host-review-authority.mjs';
16
15
  import {reviewPaths} from '../runtime/js/cm-ai/review-runner.mjs';
17
16
  import {openFixExecution} from '../runtime/js/cm-fix/execution.mjs';
18
17
  import {createFixHost} from '../runtime/js/cm-fix/host.mjs';
@@ -49,10 +48,8 @@ async function completedTaskThenFix({finish}){
49
48
  fs.writeFileSync(path.join(codeProject,'red.mjs'),"import {value} from './value.mjs';if(value!==2){console.error('BUG');process.exit(1)}");
50
49
  fs.writeFileSync(path.join(codeProject,'existing.mjs'),"import {value} from './value.mjs';if(typeof value!=='number')process.exit(1)");
51
50
  fs.writeFileSync(path.join(codeProject,'.cm-workflow.json'),JSON.stringify({version:1,policies:{delivery:'diff'}}));
52
- const authority=createHostReviewAuthority({hostContextId:'parent-host',reviewerId:'reviewer',adapterId:'codex-review-adapter',
53
- decide:async()=>({status:'approved'})});
54
- const execution={configuration:{kind:'synthetic-parent'},timeoutMs:2000,excludedContexts:['parent-host'],hostDecision:null,
55
- hostDecisionProvider:authority.hostDecisionProvider,
51
+
52
+ const execution={configuration:{kind:'synthetic-parent'},timeoutMs:2000,excludedContexts:['parent-host'],
56
53
  developer:{provider:'codex',requestedModel:'synthetic',contextId:'author',run:createCodexDeveloperRun({requestedModel:'synthetic',worker:async()=>{
57
54
  fs.writeFileSync(path.join(codeProject,'value.mjs'),'export const value=1;');
58
55
  return {status:'succeeded',value:{outcome:'implemented',application:{status:'no_relevant_lesson',note:null},
@@ -62,7 +59,7 @@ async function completedTaskThenFix({finish}){
62
59
  events(onEvent,`synthetic-review-${request.identity.runId}`);
63
60
  return {status:'succeeded',value:{verdict:'approved',packageDigest:request.payload.reviewPackage.packageDigest,
64
61
  examinedPaths:reviewPaths(request.payload.reviewPackage),findings:[],summary:'Synthetic review'}};}}],
65
- reviewInvocation:{developerThreadId:'author',excludedThreadIds:['parent-host'],authorize:authority.authorize},
62
+ reviewInvocation:{developerThreadId:'author',excludedThreadIds:['parent-host']},
66
63
  check:createHostCheck({cwd:codeProject,commands:[{id:'existing',command:[process.execPath,'existing.mjs']}]}),
67
64
  qaLogHome:path.join(root,'logs'),qaDecisionProvider:{timeoutMs:1000,decide:async binding=>({decisionId:`qa-${binding.identity.runId}`,
68
65
  identity:binding.identity,packageDigest:binding.packageDigest,status:'triggered',reason:'feature_complete',score:null,at:'2026-10-08T01:00:00Z'})},