@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.
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +31 -0
- package/README.md +22 -3
- package/VERSION +1 -1
- package/compat/claude-commands/cm-notify.md +3 -0
- package/docs/cm-control-policy-v2.md +331 -0
- package/docs/execution-optimizations.md +1 -1
- package/docs/external-models.md +3 -3
- package/docs/human-correction.md +5 -5
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +119 -78
- package/docs/next-steps.md +19 -2
- package/docs/untested-branches.md +2 -3
- package/docs/user-guide.md +105 -5
- package/package.json +2 -1
- package/runtime/js/cm-ai/claude-review-stream.mjs +49 -13
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +103 -68
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +79 -27
- package/runtime/js/cm-ai/code-projects.mjs +4 -1
- package/runtime/js/cm-ai/control-policy.mjs +111 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +7 -0
- package/runtime/js/cm-ai/drive-bootstrap.mjs +11 -8
- package/runtime/js/cm-ai/drive-core.mjs +9 -0
- package/runtime/js/cm-ai/durable-runner-state.mjs +883 -69
- package/runtime/js/cm-ai/effect-abandon-log.mjs +5 -2
- package/runtime/js/cm-ai/effect-contract.mjs +6 -1
- package/runtime/js/cm-ai/external-run-guard.mjs +18 -7
- package/runtime/js/cm-ai/gate-bridge.mjs +4 -4
- package/runtime/js/cm-ai/host-check.mjs +4 -1
- package/runtime/js/cm-ai/host-conversation-execution.mjs +33 -24
- package/runtime/js/cm-ai/host-documentation.mjs +53 -12
- package/runtime/js/cm-ai/host-project-execution.mjs +2 -2
- package/runtime/js/cm-ai/host-qa-executor.mjs +49 -4
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +53 -9
- package/runtime/js/cm-ai/host-qa-policy.mjs +63 -21
- package/runtime/js/cm-ai/host-review-authority.mjs +2 -2
- package/runtime/js/cm-ai/host-review-file.mjs +1 -1
- package/runtime/js/cm-ai/host-session.mjs +1 -1
- package/runtime/js/cm-ai/host-tool-bridge.mjs +43 -3
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +21 -10
- package/runtime/js/cm-ai/host.mjs +1 -2
- package/runtime/js/cm-ai/operator-guidance.mjs +89 -3
- package/runtime/js/cm-ai/provider-review-observation.mjs +50 -0
- package/runtime/js/cm-ai/qa-resource-release.mjs +46 -0
- package/runtime/js/cm-ai/qa-round-budget.mjs +13 -0
- package/runtime/js/cm-ai/review-package.mjs +26 -5
- package/runtime/js/cm-ai/reviewed-deliveries.mjs +1 -1
- package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +1 -1
- package/runtime/js/cm-ai/task-commit.mjs +39 -0
- package/runtime/js/cm-ai/task-runner.mjs +629 -121
- package/runtime/js/cm-ai/worker-claude-developer.mjs +9 -0
- package/runtime/js/cm-ai/worker-claude.mjs +10 -3
- package/runtime/js/cm-ai/worker-process-identity.mjs +43 -0
- package/runtime/js/cm-fix/execution.mjs +176 -48
- package/runtime/js/cm-fix/host.mjs +2 -1
- package/runtime/js/cm-fix/pinned-baseline.mjs +24 -0
- package/runtime/js/cm-fix/progress.mjs +13 -3
- package/runtime/js/cm-fix/protected-edits.mjs +10 -3
- package/runtime/js/cm-fix/repair.mjs +11 -3
- package/runtime/js/cm-fix/test-author.mjs +10 -3
- package/runtime/js/cm-idea/session.mjs +67 -4
- package/runtime/js/cm-init/review-evidence.mjs +3 -1
- package/runtime/js/cm-prd/review-correction.mjs +10 -4
- package/runtime/js/cm-prd/review-host.mjs +1 -1
- package/runtime/js/cm-prd/review-publication.mjs +5 -3
- package/runtime/js/cm-prd/session.mjs +43 -0
- package/runtime/js/cm-refactor/records.mjs +98 -8
- package/runtime/js/cm-refactor/workflow.mjs +80 -10
- package/runtime/js/cm-test/host.mjs +10 -3
- package/runtime/js/cm-test/session.mjs +45 -6
- package/runtime/js/notify-safe-read.mjs +49 -0
- package/runtime/js/notify-send.mjs +313 -0
- package/runtime/js/notify.mjs +164 -37
- package/runtime/js/policy-binding-compat.mjs +55 -0
- package/runtime/review.md +52 -7
- package/runtime/task-gates.md +107 -9
- package/scripts/ci-test-shards.mjs +67 -0
- package/scripts/ci-test-shards.test.mjs +64 -0
- package/scripts/ci-test-weights.json +222 -0
- package/scripts/cm-ai-abandon-effect-position.test.mjs +71 -10
- package/scripts/cm-ai-answer-gap-dispatch.test.mjs +86 -0
- package/scripts/cm-ai-answer-gap-driver.test.mjs +51 -0
- package/scripts/cm-ai-answer-gap-fixture.mjs +89 -0
- package/scripts/cm-ai-answer-gap-recheck.test.mjs +70 -0
- package/scripts/cm-ai-answer-gap-redo.test.mjs +103 -0
- package/scripts/cm-ai-batch-drive.mjs +98 -34
- package/scripts/cm-ai-batch-drive.test.mjs +124 -16
- package/scripts/cm-ai-batch-host.mjs +167 -29
- package/scripts/cm-ai-batch-host.test.mjs +303 -31
- package/scripts/cm-ai-batch-run-fixture.mjs +452 -0
- package/scripts/cm-ai-batch-run-member-stops.test.mjs +26 -0
- package/scripts/cm-ai-batch-run-parallel.test.mjs +7 -0
- package/scripts/cm-ai-batch-run-reschedule.test.mjs +17 -0
- package/scripts/cm-ai-batch-run.mjs +213 -25
- package/scripts/cm-ai-batch-run.test.mjs +21 -341
- package/scripts/cm-ai-bootstrap-flow.test.mjs +1 -7
- package/scripts/cm-ai-bootstrap.test.mjs +2 -3
- package/scripts/cm-ai-control-launch.test.mjs +219 -0
- package/scripts/cm-ai-control-policy.test.mjs +124 -0
- package/scripts/cm-ai-control-v2-drive.test.mjs +270 -0
- package/scripts/cm-ai-develop-answer-invalid.test.mjs +97 -0
- package/scripts/cm-ai-develop-call-timeout.test.mjs +146 -0
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +37 -23
- package/scripts/cm-ai-direct-review.test.mjs +348 -0
- package/scripts/cm-ai-documentation-sync-gap.test.mjs +424 -0
- package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +54 -25
- package/scripts/cm-ai-drive.mjs +142 -58
- package/scripts/cm-ai-drive.test.mjs +70 -84
- package/scripts/cm-ai-fix-integration.test.mjs +3 -5
- package/scripts/cm-ai-fix-later-delivery.test.mjs +3 -6
- package/scripts/cm-ai-fix-run-delivery.test.mjs +3 -6
- package/scripts/cm-ai-host-cli-workflow.test.mjs +267 -0
- package/scripts/cm-ai-host-fixture.mjs +296 -0
- package/scripts/cm-ai-host-protected.test.mjs +253 -0
- package/scripts/cm-ai-host.mjs +122 -100
- package/scripts/cm-ai-host.test.mjs +35 -776
- package/scripts/cm-ai-launch-diagnostics.test.mjs +5 -3
- package/scripts/cm-ai-legacy-history.test.mjs +53 -0
- package/scripts/cm-ai-light-modules.test.mjs +54 -0
- package/scripts/cm-ai-multi-root.test.mjs +4 -4
- package/scripts/cm-ai-nested-execution.test.mjs +16 -19
- package/scripts/cm-ai-operator-guidance.test.mjs +30 -5
- package/scripts/cm-ai-progress.test.mjs +10 -8
- package/scripts/cm-ai-project-qa-gate.test.mjs +37 -10
- package/scripts/cm-ai-protected-scope.test.mjs +8 -5
- package/scripts/cm-ai-qa-answer-gaps.test.mjs +99 -0
- package/scripts/cm-ai-qa-config-revision.test.mjs +1 -9
- package/scripts/cm-ai-qa-fingerprint-config.test.mjs +12 -9
- package/scripts/cm-ai-qa-fix-cross-session.test.mjs +95 -13
- package/scripts/cm-ai-qa-fixed-log.test.mjs +41 -0
- package/scripts/cm-ai-qa-recovery-args.test.mjs +7 -0
- package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +59 -14
- package/scripts/cm-ai-review-drift-precedence.test.mjs +1 -1
- package/scripts/cm-ai-review-failure.test.mjs +137 -32
- package/scripts/cm-ai-review-timeout-config.test.mjs +3 -1
- package/scripts/cm-ai-review-timeout.test.mjs +132 -67
- package/scripts/cm-ai-run.mjs +91 -28
- package/scripts/cm-ai-run.test.mjs +11 -38
- package/scripts/cm-ai-selection-guard.test.mjs +2 -2
- package/scripts/cm-ai-session-chain.test.mjs +18 -15
- package/scripts/cm-ai-spec-rebind.test.mjs +14 -18
- package/scripts/cm-ai-supersede.test.mjs +489 -51
- package/scripts/cm-blocked-reason.test.mjs +2 -3
- package/scripts/cm-capability-gate.test.mjs +33 -1
- package/scripts/cm-check-drive-files.mjs +8 -0
- package/scripts/cm-check-drive.test.mjs +2 -5
- package/scripts/cm-check-runtime.sh +4 -2
- package/scripts/cm-claude-developer-worker.test.mjs +15 -0
- package/scripts/cm-claude-review-stream.test.mjs +21 -16
- package/scripts/cm-claude-review-synthetic.test.mjs +155 -0
- package/scripts/cm-claude-worker.test.mjs +23 -5
- package/scripts/cm-controlled-correction.test.mjs +469 -0
- package/scripts/cm-external-batch-host.test.mjs +30 -11
- package/scripts/cm-external-model-host.test.mjs +1 -1
- package/scripts/cm-external-model-recovery.test.mjs +32 -12
- package/scripts/cm-external-qa-fix.test.mjs +1 -1
- package/scripts/cm-external-review-reconciliation.test.mjs +6 -24
- package/scripts/cm-fix-abandon.test.mjs +163 -10
- package/scripts/cm-fix-drive-unprotected.test.mjs +37 -0
- package/scripts/cm-fix-drive.mjs +25 -7
- package/scripts/cm-fix-host.mjs +8 -7
- package/scripts/cm-fix-review-budget.test.mjs +13 -0
- package/scripts/cm-fix-review-recovery.test.mjs +36 -1
- package/scripts/cm-host-answer-timeout.test.mjs +65 -0
- package/scripts/cm-host-call-kinds.test.mjs +28 -0
- package/scripts/cm-host-documentation.test.mjs +49 -0
- package/scripts/cm-host-qa-executor.test.mjs +23 -12
- package/scripts/cm-host-qa-policy.test.mjs +43 -16
- package/scripts/cm-host-review-authority.test.mjs +0 -31
- package/scripts/cm-idea-answer-gaps.test.mjs +164 -0
- package/scripts/cm-idea-drive.mjs +49 -11
- package/scripts/cm-idea-drive.test.mjs +66 -0
- package/scripts/cm-idea-host.mjs +106 -16
- package/scripts/cm-init-answer-gaps.test.mjs +258 -0
- package/scripts/cm-init-drive.mjs +41 -7
- package/scripts/cm-init-host.mjs +61 -12
- package/scripts/cm-knowledge-closeout.test.mjs +3 -3
- package/scripts/cm-log-event.mjs +21 -10
- package/scripts/cm-notify-command.test.mjs +936 -0
- package/scripts/cm-notify-read-drift.test.mjs +270 -0
- package/scripts/cm-notify.mjs +481 -0
- package/scripts/cm-notify.test.mjs +312 -23
- package/scripts/cm-patrol.test.mjs +3 -2
- package/scripts/cm-prd-answer-gaps.test.mjs +216 -0
- package/scripts/cm-prd-drive.mjs +18 -5
- package/scripts/cm-prd-drive.test.mjs +15 -0
- package/scripts/cm-prd-host.mjs +37 -4
- package/scripts/cm-prd-review-disposition.test.mjs +6 -1
- package/scripts/cm-prd-review-gate.mjs +56 -0
- package/scripts/cm-refactor-answer-gaps.test.mjs +206 -0
- package/scripts/cm-refactor-drive.mjs +52 -8
- package/scripts/cm-refactor-drive.test.mjs +44 -0
- package/scripts/cm-refactor-host.test.mjs +10 -6
- package/scripts/cm-release-smoke.sh +2 -0
- package/scripts/cm-task-gate-correction.test.mjs +69 -16
- package/scripts/cm-task-gate.mjs +368 -34
- package/scripts/cm-task-gate.py +2 -0
- package/scripts/cm-task-gate.test.mjs +252 -4
- package/scripts/cm-test-answer-gaps.test.mjs +151 -0
- package/scripts/cm-test-drive.mjs +21 -5
- package/scripts/fixtures/bootstrap-review-runner.mjs +1 -7
- package/scripts/fixtures/claude-review-process.mjs +1 -1
- package/scripts/fixtures/native-gate-fixture.mjs +18 -0
- package/scripts/policy-binding-compat.test.mjs +103 -0
- package/scripts/scan-public-safety.py +4 -0
- package/scripts/validate-public-repo.py +4 -0
- package/skills/cm-ai/SKILL.md +8 -6
- package/skills/cm-ai/references/N3-execute-task.md +17 -2
- package/skills/cm-ai/references/N4-review.md +11 -21
- package/skills/cm-ai/references/N5-mark-done.md +1 -1
- package/skills/cm-ai/references/N6-qa-eval.md +49 -21
- package/skills/cm-ai/references/js-host-modes.md +35 -14
- package/skills/cm-ai/references/js-host-qa-recovery.md +85 -11
- package/skills/cm-ai/references/js-host-recovery.md +181 -21
- package/skills/cm-ai/references/js-host.md +76 -32
- package/skills/cm-check/SKILL.md +3 -3
- package/skills/cm-fix/SKILL.md +12 -0
- package/skills/cm-fix/references/js-host.md +44 -5
- package/skills/cm-idea/references/js-host.md +27 -2
- package/skills/cm-init/references/js-host.md +17 -4
- package/skills/cm-notify/SKILL.md +34 -0
- package/skills/cm-prd/references/js-change-recovery.md +35 -1
- package/skills/cm-prd/references/js-host.md +1 -1
- package/skills/cm-refactor/SKILL.md +12 -0
- package/skills/cm-refactor/references/js-host.md +17 -0
- package/skills/cm-test/references/js-host.md +14 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
{
|
|
2
|
+
"note": "Seconds per test file from a local node --test run (sum of top-level test durations). Only relative sizes matter. Regenerate when a file grows or is split; missing files count as the median.",
|
|
3
|
+
"seconds": {
|
|
4
|
+
"ci-test-shards.test.mjs": 1,
|
|
5
|
+
"cm-ai-abandon-effect-position.test.mjs": 14,
|
|
6
|
+
"cm-ai-admission.test.mjs": 6,
|
|
7
|
+
"cm-ai-answer-gap-dispatch.test.mjs": 10,
|
|
8
|
+
"cm-ai-answer-gap-driver.test.mjs": 5,
|
|
9
|
+
"cm-ai-answer-gap-recheck.test.mjs": 9,
|
|
10
|
+
"cm-ai-answer-gap-redo.test.mjs": 7,
|
|
11
|
+
"cm-ai-batch-drive.test.mjs": 441,
|
|
12
|
+
"cm-ai-batch-run-member-stops.test.mjs": 377,
|
|
13
|
+
"cm-ai-batch-run-parallel.test.mjs": 338,
|
|
14
|
+
"cm-ai-batch-run-reschedule.test.mjs": 436,
|
|
15
|
+
"cm-ai-batch-run.test.mjs": 260,
|
|
16
|
+
"cm-ai-bootstrap-driver-preflight.test.mjs": 1,
|
|
17
|
+
"cm-ai-bootstrap-flow.test.mjs": 11,
|
|
18
|
+
"cm-ai-bootstrap-merge.test.mjs": 3,
|
|
19
|
+
"cm-ai-checklist-coverage.test.mjs": 1,
|
|
20
|
+
"cm-ai-contracts.test.mjs": 1,
|
|
21
|
+
"cm-ai-conversation-entry-ops.test.mjs": 1,
|
|
22
|
+
"cm-ai-develop-answer-invalid.test.mjs": 3,
|
|
23
|
+
"cm-ai-develop-call-timeout.test.mjs": 13,
|
|
24
|
+
"cm-ai-develop-driver-gaps.test.mjs": 224,
|
|
25
|
+
"cm-ai-drive-bootstrap-rules.test.mjs": 72,
|
|
26
|
+
"cm-ai-drive-timeout.test.mjs": 1,
|
|
27
|
+
"cm-ai-drive.test.mjs": 248,
|
|
28
|
+
"cm-ai-execution-diagnostic.test.mjs": 1,
|
|
29
|
+
"cm-ai-feature-selection.test.mjs": 4,
|
|
30
|
+
"cm-ai-fix-integration.test.mjs": 292,
|
|
31
|
+
"cm-ai-fix-later-delivery.test.mjs": 108,
|
|
32
|
+
"cm-ai-fix-run-delivery.test.mjs": 36,
|
|
33
|
+
"cm-ai-launch-diagnostics.test.mjs": 6,
|
|
34
|
+
"cm-ai-light-modules.test.mjs": 1,
|
|
35
|
+
"cm-ai-operator-guidance.test.mjs": 1,
|
|
36
|
+
"cm-ai-progress.test.mjs": 66,
|
|
37
|
+
"cm-ai-project-qa-gate.test.mjs": 119,
|
|
38
|
+
"cm-ai-protected-scope.test.mjs": 2,
|
|
39
|
+
"cm-ai-qa-answer-gaps.test.mjs": 1,
|
|
40
|
+
"cm-ai-qa-config-revision.test.mjs": 125,
|
|
41
|
+
"cm-ai-qa-fingerprint-config.test.mjs": 21,
|
|
42
|
+
"cm-ai-qa-fix-cross-session.test.mjs": 142,
|
|
43
|
+
"cm-ai-qa-fix-policy.test.mjs": 12,
|
|
44
|
+
"cm-ai-qa-recovery-args.test.mjs": 1,
|
|
45
|
+
"cm-ai-qa-rerun-timeouts.test.mjs": 209,
|
|
46
|
+
"cm-ai-review-drift-precedence.test.mjs": 3,
|
|
47
|
+
"cm-ai-review-dispatch-exit.test.mjs": 5,
|
|
48
|
+
"cm-ai-review-failure.test.mjs": 291,
|
|
49
|
+
"cm-ai-review-timeout-config.test.mjs": 1,
|
|
50
|
+
"cm-ai-review-timeout.test.mjs": 39,
|
|
51
|
+
"cm-ai-run.test.mjs": 36,
|
|
52
|
+
"cm-ai-runner-error-code-regression.test.mjs": 2,
|
|
53
|
+
"cm-ai-selection-guard.test.mjs": 3,
|
|
54
|
+
"cm-ai-session-chain.test.mjs": 85,
|
|
55
|
+
"cm-ai-spec-rebind.test.mjs": 41,
|
|
56
|
+
"cm-ai-supersede.test.mjs": 119,
|
|
57
|
+
"cm-ai-verification-gate.test.mjs": 1,
|
|
58
|
+
"cm-announce-hook.test.mjs": 1,
|
|
59
|
+
"cm-blocked-reason.test.mjs": 3,
|
|
60
|
+
"cm-bootstrap-review-recovery.test.mjs": 6,
|
|
61
|
+
"cm-capability-gate.test.mjs": 6,
|
|
62
|
+
"cm-check-drive.test.mjs": 5,
|
|
63
|
+
"cm-check-host.test.mjs": 19,
|
|
64
|
+
"cm-check-update.test.mjs": 1,
|
|
65
|
+
"cm-claude-developer-worker.test.mjs": 46,
|
|
66
|
+
"cm-claude-install-layout.test.mjs": 54,
|
|
67
|
+
"cm-claude-probe.test.mjs": 19,
|
|
68
|
+
"cm-claude-review-stream.test.mjs": 1,
|
|
69
|
+
"cm-claude-review-synthetic.test.mjs": 1,
|
|
70
|
+
"cm-claude-worker.test.mjs": 14,
|
|
71
|
+
"cm-codex-developer-adapter.test.mjs": 1,
|
|
72
|
+
"cm-codex-developer-worker.test.mjs": 14,
|
|
73
|
+
"cm-codex-plugin-metadata.test.mjs": 1,
|
|
74
|
+
"cm-codex-review-progress.test.mjs": 4,
|
|
75
|
+
"cm-efficiency-checks.test.mjs": 1,
|
|
76
|
+
"cm-efficiency-diagnostics.test.mjs": 2,
|
|
77
|
+
"cm-efficiency-policy.test.mjs": 1,
|
|
78
|
+
"cm-efficiency-presentation.test.mjs": 1,
|
|
79
|
+
"cm-efficiency-response.test.mjs": 1,
|
|
80
|
+
"cm-efficiency-usage.test.mjs": 14,
|
|
81
|
+
"cm-execution-platform.test.mjs": 1,
|
|
82
|
+
"cm-external-batch-host.test.mjs": 194,
|
|
83
|
+
"cm-external-fix-host.test.mjs": 126,
|
|
84
|
+
"cm-external-fix-reconciliation.test.mjs": 9,
|
|
85
|
+
"cm-external-group-models.test.mjs": 1,
|
|
86
|
+
"cm-external-model-host.test.mjs": 47,
|
|
87
|
+
"cm-external-model-recovery.test.mjs": 20,
|
|
88
|
+
"cm-external-models.test.mjs": 1,
|
|
89
|
+
"cm-external-process-cleanup.test.mjs": 1,
|
|
90
|
+
"cm-external-qa-fix.test.mjs": 48,
|
|
91
|
+
"cm-external-review-reconciliation.test.mjs": 34,
|
|
92
|
+
"cm-failover.test.mjs": 1,
|
|
93
|
+
"cm-fix-abandon.test.mjs": 89,
|
|
94
|
+
"cm-fix-cause-invocation.test.mjs": 3,
|
|
95
|
+
"cm-fix-cause-package.test.mjs": 1,
|
|
96
|
+
"cm-fix-code-association.test.mjs": 1,
|
|
97
|
+
"cm-fix-cross-session-host.test.mjs": 1,
|
|
98
|
+
"cm-fix-drive-unprotected.test.mjs": 1,
|
|
99
|
+
"cm-fix-drive.test.mjs": 8,
|
|
100
|
+
"cm-fix-escalation.test.mjs": 32,
|
|
101
|
+
"cm-fix-execution.test.mjs": 6,
|
|
102
|
+
"cm-fix-final-review.test.mjs": 1,
|
|
103
|
+
"cm-fix-host-review-assembly.test.mjs": 1,
|
|
104
|
+
"cm-fix-host-review.test.mjs": 57,
|
|
105
|
+
"cm-fix-host-sequence.test.mjs": 1,
|
|
106
|
+
"cm-fix-host.test.mjs": 6,
|
|
107
|
+
"cm-fix-large-log.test.mjs": 11,
|
|
108
|
+
"cm-fix-learning-writeback.test.mjs": 2,
|
|
109
|
+
"cm-fix-learning.test.mjs": 1,
|
|
110
|
+
"cm-fix-metrics.test.mjs": 1,
|
|
111
|
+
"cm-fix-no-existing-tests.test.mjs": 2,
|
|
112
|
+
"cm-fix-observation-dossier.test.mjs": 187,
|
|
113
|
+
"cm-fix-progress.test.mjs": 1,
|
|
114
|
+
"cm-fix-qa-source.test.mjs": 15,
|
|
115
|
+
"cm-fix-red-owner.test.mjs": 4,
|
|
116
|
+
"cm-fix-red-test.test.mjs": 2,
|
|
117
|
+
"cm-fix-rediagnosis.test.mjs": 10,
|
|
118
|
+
"cm-fix-regression.test.mjs": 1,
|
|
119
|
+
"cm-fix-repair-owner.test.mjs": 108,
|
|
120
|
+
"cm-fix-repair.test.mjs": 1,
|
|
121
|
+
"cm-fix-reproduce.test.mjs": 1,
|
|
122
|
+
"cm-fix-retrospective.test.mjs": 1,
|
|
123
|
+
"cm-fix-review-baseline.test.mjs": 1,
|
|
124
|
+
"cm-fix-review-budget.test.mjs": 2,
|
|
125
|
+
"cm-fix-review-recovery.test.mjs": 77,
|
|
126
|
+
"cm-fix-session-chain.test.mjs": 24,
|
|
127
|
+
"cm-fix-test-author.test.mjs": 2,
|
|
128
|
+
"cm-fix-test-extension.test.mjs": 54,
|
|
129
|
+
"cm-fix-visual-bare.test.mjs": 24,
|
|
130
|
+
"cm-fix-visual-carrier.test.mjs": 1,
|
|
131
|
+
"cm-fix-walkthrough.test.mjs": 1,
|
|
132
|
+
"cm-fixture-process-cleanup.test.mjs": 3,
|
|
133
|
+
"cm-host-answer-timeout.test.mjs": 2,
|
|
134
|
+
"cm-host-call-kinds.test.mjs": 1,
|
|
135
|
+
"cm-host-documentation.test.mjs": 1,
|
|
136
|
+
"cm-host-handoff.test.mjs": 3,
|
|
137
|
+
"cm-host-qa-executor.test.mjs": 284,
|
|
138
|
+
"cm-host-qa-policy.test.mjs": 1,
|
|
139
|
+
"cm-host-review-authority.test.mjs": 1,
|
|
140
|
+
"cm-host-role-routing.test.mjs": 1,
|
|
141
|
+
"cm-host-session-diagnostic.test.mjs": 1,
|
|
142
|
+
"cm-host-tool-bridge.test.mjs": 1,
|
|
143
|
+
"cm-idea-answer-gaps.test.mjs": 4,
|
|
144
|
+
"cm-idea-drive.test.mjs": 3,
|
|
145
|
+
"cm-idea-host.test.mjs": 1,
|
|
146
|
+
"cm-idea-recovery.test.mjs": 1,
|
|
147
|
+
"cm-init-analysis-host.test.mjs": 1,
|
|
148
|
+
"cm-init-answer-gaps.test.mjs": 6,
|
|
149
|
+
"cm-init-draft-generation.test.mjs": 1,
|
|
150
|
+
"cm-init-draft-inspection.test.mjs": 1,
|
|
151
|
+
"cm-init-drive.test.mjs": 2,
|
|
152
|
+
"cm-init-host.test.mjs": 3,
|
|
153
|
+
"cm-init-project-analysis.test.mjs": 1,
|
|
154
|
+
"cm-init-project-scan.test.mjs": 1,
|
|
155
|
+
"cm-init-revision-host.test.mjs": 1,
|
|
156
|
+
"cm-init-session.test.mjs": 4,
|
|
157
|
+
"cm-interactive-qa-diagnostic.test.mjs": 1,
|
|
158
|
+
"cm-knowledge-closeout.test.mjs": 6,
|
|
159
|
+
"cm-live-evidence.test.mjs": 1,
|
|
160
|
+
"cm-log-event.test.mjs": 4,
|
|
161
|
+
"cm-notify-command.test.mjs": 10,
|
|
162
|
+
"cm-notify.test.mjs": 28,
|
|
163
|
+
"cm-patrol.test.mjs": 2,
|
|
164
|
+
"cm-prd-analysis.test.mjs": 1,
|
|
165
|
+
"cm-prd-answer-gaps.test.mjs": 12,
|
|
166
|
+
"cm-prd-completion.test.mjs": 25,
|
|
167
|
+
"cm-prd-design-phase.test.mjs": 96,
|
|
168
|
+
"cm-prd-draft-save.test.mjs": 1,
|
|
169
|
+
"cm-prd-draft.test.mjs": 1,
|
|
170
|
+
"cm-prd-drive.test.mjs": 28,
|
|
171
|
+
"cm-prd-gate-diagnostic.test.mjs": 4,
|
|
172
|
+
"cm-prd-host.test.mjs": 26,
|
|
173
|
+
"cm-prd-inputs-replaced.test.mjs": 5,
|
|
174
|
+
"cm-prd-materials.test.mjs": 1,
|
|
175
|
+
"cm-prd-review-claim.test.mjs": 1,
|
|
176
|
+
"cm-prd-review-disposition.test.mjs": 5,
|
|
177
|
+
"cm-prd-review-gate.test.mjs": 1,
|
|
178
|
+
"cm-prd-review-host.test.mjs": 1,
|
|
179
|
+
"cm-prd-review-preparation.test.mjs": 1,
|
|
180
|
+
"cm-prd-review-publication.test.mjs": 1,
|
|
181
|
+
"cm-prd-revision.test.mjs": 1,
|
|
182
|
+
"cm-prd-self-check-revision.test.mjs": 25,
|
|
183
|
+
"cm-prd-self-check.test.mjs": 1,
|
|
184
|
+
"cm-prd-session-recovery.test.mjs": 21,
|
|
185
|
+
"cm-prd-sources.test.mjs": 1,
|
|
186
|
+
"cm-prd-summary.test.mjs": 3,
|
|
187
|
+
"cm-prd-task-grouping.test.mjs": 1,
|
|
188
|
+
"cm-qa-environment.test.mjs": 1,
|
|
189
|
+
"cm-refactor-answer-gaps.test.mjs": 51,
|
|
190
|
+
"cm-refactor-drive.test.mjs": 47,
|
|
191
|
+
"cm-refactor-gaps.test.mjs": 277,
|
|
192
|
+
"cm-refactor-host.test.mjs": 90,
|
|
193
|
+
"cm-refactor-judge-revision.test.mjs": 218,
|
|
194
|
+
"cm-review-dependency-snapshot.test.mjs": 1,
|
|
195
|
+
"cm-review-inventory.test.mjs": 28,
|
|
196
|
+
"cm-review-schema.test.mjs": 1,
|
|
197
|
+
"cm-review-scope-recovery.test.mjs": 1,
|
|
198
|
+
"cm-runtime-failover.test.mjs": 1,
|
|
199
|
+
"cm-runtime.test.mjs": 5,
|
|
200
|
+
"cm-security.test.mjs": 64,
|
|
201
|
+
"cm-spec-manifest.test.mjs": 1,
|
|
202
|
+
"cm-spec-task-line.test.mjs": 2,
|
|
203
|
+
"cm-specs-status.test.mjs": 2,
|
|
204
|
+
"cm-task-gate-correction.test.mjs": 1,
|
|
205
|
+
"cm-task-gate.test.mjs": 2,
|
|
206
|
+
"cm-test-answer-gaps.test.mjs": 10,
|
|
207
|
+
"cm-test-branch-impact.test.mjs": 61,
|
|
208
|
+
"cm-test-declared-command.test.mjs": 1,
|
|
209
|
+
"cm-test-drive.test.mjs": 11,
|
|
210
|
+
"cm-test-host.test.mjs": 15,
|
|
211
|
+
"cm-test-logic-results.test.mjs": 1,
|
|
212
|
+
"cm-test-session.test.mjs": 10,
|
|
213
|
+
"cm-token-report.test.mjs": 2,
|
|
214
|
+
"cm-tool-preview-context.test.mjs": 1,
|
|
215
|
+
"cm-unit-coverage.test.mjs": 20,
|
|
216
|
+
"cm-workflow-config.test.mjs": 1,
|
|
217
|
+
"cm-workflow.test.mjs": 1,
|
|
218
|
+
"correction-check.test.mjs": 1,
|
|
219
|
+
"policy-binding-compat.test.mjs": 2,
|
|
220
|
+
"validate-test-cases.test.mjs": 1
|
|
221
|
+
}
|
|
222
|
+
}
|
|
@@ -41,14 +41,7 @@ function execution(f,verdict='blocked'){
|
|
|
41
41
|
requestedModel:'fixture',worker:async()=>{fs.writeFileSync(path.join(f.codeProject,'a.mjs'),'written\n');
|
|
42
42
|
return {status:'succeeded',value:{outcome:'implemented',application:{status:'no_relevant_lesson',note:null},
|
|
43
43
|
retrospective:{status:'no_new_lesson',candidates:[],reason:null}}};}})},
|
|
44
|
-
reviewers:[reviewer],reviewInvocation:{developerThreadId:'author-thread',excludedThreadIds:['control'],
|
|
45
|
-
authorize:(value,{authorizationAt})=>{const body={version:1,kind:'cm-review-dispatch-grant',
|
|
46
|
-
grantId:'grant',adapterId:'codex-review-adapter',invocationId:value.invocationId,
|
|
47
|
-
requestDigest:value.requestDigest,identity:value.identity,reviewerId:'reviewer',
|
|
48
|
-
logicalContextId:value.contextId,packageDigest:value.payload.reviewPackage.packageDigest,
|
|
49
|
-
hostContextId:'control',decisionId:'approved',decision:'approved',issuedAt:authorizationAt,
|
|
50
|
-
expiresAt:authorizationAt+60000};return {...body,grantDigest:digest(body)};}},
|
|
51
|
-
hostDecision:{status:'approved'},check:createHostCheck({cwd:f.codeProject,
|
|
44
|
+
reviewers:[reviewer],reviewInvocation:{developerThreadId:'author-thread',excludedThreadIds:['control']},check:createHostCheck({cwd:f.codeProject,
|
|
52
45
|
commands:[{id:'syntax',command:[process.execPath,'--check','a.mjs']}]})};
|
|
53
46
|
}
|
|
54
47
|
async function start(f,runId,verdict='blocked',options={}){
|
|
@@ -154,10 +147,22 @@ test('review intent before any join or registration uses abandon_effect; registr
|
|
|
154
147
|
effectKind:'review',intentDigest:prefix.at(-1).digest,lastRecordDigest:joined.at(-1).digest,
|
|
155
148
|
reason:'old host exited',at:new Date().toISOString()},'result');
|
|
156
149
|
assert.throws(()=>readRunnerHistory(forged,config,3),{code:'runner_abandon'});
|
|
150
|
+
// V8: a join without registration dispatched nothing; abandon_effect now
|
|
151
|
+
// records the interruption and the review returns to awaiting_review.
|
|
157
152
|
savePrefix(f,runId,'host-joined',null);
|
|
158
153
|
const joinedRun=await resume(f,runId);
|
|
159
|
-
try{
|
|
160
|
-
|
|
154
|
+
try{
|
|
155
|
+
const result=await joinedRun.host.handle(request(runId));
|
|
156
|
+
assert.equal(result.outcome,'recorded',JSON.stringify(result));
|
|
157
|
+
assert.equal(result.state,'awaiting_review');assert.equal(result.code,null);assert.equal(result.pendingAction,'decision');
|
|
158
|
+
}finally{joinedRun.close();}
|
|
159
|
+
const interrupted=JSON.parse(fs.readFileSync(statePath(f,runId),'utf8')).records;
|
|
160
|
+
assert.deepEqual(interrupted.slice(-2).map(row=>row.payload.type),['host-joined','effect-interrupted']);
|
|
161
|
+
const replayed=readRunnerHistory(interrupted,config,3);
|
|
162
|
+
assert.equal(replayed.pending,null);assert.deepEqual(replayed.joinedHosts,['fresh-host']);
|
|
163
|
+
// The interrupted intent id is never reused by a later intent.
|
|
164
|
+
const reused=append(f,runId,'effect-intent',{effect:prefix.at(-1).payload.effect},'intent');
|
|
165
|
+
assert.throws(()=>readRunnerHistory(reused,config,3),{code:'runner_cache'});
|
|
161
166
|
}finally{fs.rmSync(f.root,{recursive:true,force:true});}
|
|
162
167
|
});
|
|
163
168
|
|
|
@@ -199,3 +204,59 @@ test('registered review stays on abandon_review and cannot replay effect-abandon
|
|
|
199
204
|
assert.throws(()=>readRunnerHistory(forged,config,3),{code:'runner_abandon'});
|
|
200
205
|
}finally{fs.rmSync(f.root,{recursive:true,force:true});}
|
|
201
206
|
});
|
|
207
|
+
|
|
208
|
+
// A36: a registered review whose one redispatch this attempt is already spent
|
|
209
|
+
// cannot be abandoned with abandon_review, and supersede refuses a pending run.
|
|
210
|
+
// abandon_effect now voids it (effect-abandoned bound to the last record), which
|
|
211
|
+
// breaks that deadlock; a supersede may follow.
|
|
212
|
+
test('a registered review with its two redispatches spent is voided by abandon_effect, then superseded',async()=>{
|
|
213
|
+
const f=fixture(),runId='review-exhausted';
|
|
214
|
+
try{
|
|
215
|
+
await start(f,runId);
|
|
216
|
+
savePrefix(f,runId,'review-invocation-registered',null);
|
|
217
|
+
// The truncated journal never published its review; drop the original's file.
|
|
218
|
+
for(const name of fs.readdirSync(f.reviewsDir))if(/^work-T-002-r\d+\.md$/.test(name))fs.rmSync(path.join(f.reviewsDir,name));
|
|
219
|
+
const file=statePath(f,runId);
|
|
220
|
+
const truncateToLastRegistration=()=>{
|
|
221
|
+
const state=JSON.parse(fs.readFileSync(file,'utf8'));
|
|
222
|
+
const last=state.records.findLastIndex(row=>row.payload.type==='review-invocation-registered');
|
|
223
|
+
const {revision,...body}=state;body.records=state.records.slice(0,last+1);
|
|
224
|
+
fs.writeFileSync(file,JSON.stringify({...body,revision:digest(body)})+'\n');return body;
|
|
225
|
+
};
|
|
226
|
+
// V5: each round has two no-result redispatches; the host dies twice.
|
|
227
|
+
for(const round of [1,2]){
|
|
228
|
+
if(round===2){truncateToLastRegistration();
|
|
229
|
+
for(const name of fs.readdirSync(f.reviewsDir))if(/^work-T-002-r\d+\.md$/.test(name))fs.rmSync(path.join(f.reviewsDir,name));}
|
|
230
|
+
const run=await openControlRun(definition(f,runId),'resume',execution(f),{allowAbandonReview:true});
|
|
231
|
+
try{
|
|
232
|
+
const abandoned=await run.host.handle({version:1,operation:'abandon_review',requestId:`abandon-review-${round}`,
|
|
233
|
+
identity:identity(runId),reason:'Old host and reviewer exited'});
|
|
234
|
+
assert.equal(abandoned.code,'review_abandoned',JSON.stringify(abandoned));
|
|
235
|
+
const redone=await run.host.handle({version:1,operation:'advance',requestId:`advance-${round}`,identity:identity(runId)});
|
|
236
|
+
assert.equal(redone.code,'review_blocked',JSON.stringify(redone));
|
|
237
|
+
}finally{run.close();}
|
|
238
|
+
}
|
|
239
|
+
const body=truncateToLastRegistration();
|
|
240
|
+
for(const name of fs.readdirSync(f.reviewsDir))if(/^work-T-002-r\d+\.md$/.test(name))fs.rmSync(path.join(f.reviewsDir,name));
|
|
241
|
+
const config=body.records[0].payload.config,projected=readRunnerHistory(body.records,config,3);
|
|
242
|
+
assert.equal(projected.pendingReviewExhausted,true);assert.equal(projected.pendingInterruptible,false);
|
|
243
|
+
const run=await openControlRun(definition(f,runId),'resume',execution(f),{allowAbandonReview:true,allowAbandonEffect:true});
|
|
244
|
+
try{
|
|
245
|
+
const status=await run.host.handle({version:1,operation:'status',requestId:'status',identity:identity(runId)});
|
|
246
|
+
assert.equal(status.pendingAction,'abandon_effect');
|
|
247
|
+
const refused=await run.host.handle({version:1,operation:'abandon_review',requestId:'abandon-review',
|
|
248
|
+
identity:identity(runId),reason:'again'});
|
|
249
|
+
assert.equal(refused.code,'review_abandon_budget_exhausted');
|
|
250
|
+
const voided=await run.host.handle(request(runId));
|
|
251
|
+
assert.equal(voided.outcome,'abandoned',JSON.stringify(voided));assert.equal(voided.code,'effect_abandoned');
|
|
252
|
+
}finally{run.close();}
|
|
253
|
+
const records=JSON.parse(fs.readFileSync(file,'utf8')).records;
|
|
254
|
+
assert.equal(records.at(-1).payload.lastRecordDigest,records.at(-2).digest);
|
|
255
|
+
assert.equal(records.at(-1).payload.intentDigest,records.findLast(row=>row.payload.type==='effect-intent').digest);
|
|
256
|
+
const unbound=mutated(records,records.length-1,p=>{delete p.lastRecordDigest;});
|
|
257
|
+
assert.throws(()=>readRunnerHistory(unbound,config,3),{code:'runner_abandon'});
|
|
258
|
+
// The superseding run opens (the accepted drift already holds the delivered bytes).
|
|
259
|
+
const next=await start(f,`${runId}-next`,'blocked',{supersedeReason:'restart',acceptSupersededCodeDrift:true});
|
|
260
|
+
assert.equal(next.identity.runId,`${runId}-next`);assert.equal(next.code,'develop_empty_changes');
|
|
261
|
+
}finally{fs.rmSync(f.root,{recursive:true,force:true});}
|
|
262
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// P1-3: the develop failed before the session was asked anything (the host's
|
|
2
|
+
// own role routing threw). Nothing was dispatched: develop_dispatch_failed is a
|
|
3
|
+
// plain retryable block. A legacy journal that collapsed the same failure into
|
|
4
|
+
// execution_error (real api-native-reading-T-006 shape) gets it only while the
|
|
5
|
+
// code root still equals the round start, else the confirmed develop_redo.
|
|
6
|
+
import test from 'node:test';
|
|
7
|
+
import assert from 'node:assert/strict';
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import {readRunnerHistory} from '../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
11
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
12
|
+
import {gapFixture,gapExecution,gapSession,records,added} from './cm-ai-answer-gap-fixture.mjs';
|
|
13
|
+
|
|
14
|
+
test('develop_dispatch_failed: a role routing failure before dispatch redoes the round without the developer having run',async t=>{
|
|
15
|
+
const f=gapFixture(t,'dispatch');
|
|
16
|
+
const [stuck]=await gapSession(f,'create',gapExecution(f,{developer:[{beforeDispatch:'role_log_failed'}]}),[['advance',1]]);
|
|
17
|
+
assert.deepEqual([stuck.state,stuck.code,stuck.pendingAction],['blocked','develop_dispatch_failed','resume'],JSON.stringify(stuck));
|
|
18
|
+
assert.match(stuck.reason,/未派发/);assert.equal(stuck.guidance.recoveryOperation,'advance');
|
|
19
|
+
const before=records(f),checkpoint=before.at(-1).payload.checkpoint;
|
|
20
|
+
// New runs keep the routing code instead of execution_error.
|
|
21
|
+
assert.deepEqual([checkpoint.state,checkpoint.code,checkpoint.calls.at(-1).terminal,checkpoint.calls.at(-1).resultDigest],
|
|
22
|
+
['unknown','role_log_failed','unknown',null]);
|
|
23
|
+
assert.equal(f.calls.developer,0);
|
|
24
|
+
const [delivered]=await gapSession(f,'resume',gapExecution(f,{developer:['round-1\n'],verdicts:['approved']}),[['advance',1]]);
|
|
25
|
+
assert.equal(f.calls.developer,1);
|
|
26
|
+
assert.deepEqual(added(f,before).slice(0,3),['develop-dispatch-retry','intent:develop-1-retry-1','effect-checkpoint'],JSON.stringify(delivered));
|
|
27
|
+
assert.equal(records(f)[before.length].payload.basis,'baseline');
|
|
28
|
+
assert.equal(readRunnerHistory(records(f),records(f)[0].payload.config,3).answerGaps.developDispatch,1);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('develop_dispatch_failed: a legacy execution_error (T-006 shape) needs an unchanged root, else develop_redo',async t=>{
|
|
32
|
+
const f=gapFixture(t,'legacy');
|
|
33
|
+
// An unlisted code collapses into execution_error, exactly like older runtimes.
|
|
34
|
+
const [stuck]=await gapSession(f,'create',gapExecution(f,{developer:[{beforeDispatch:'legacy_unlisted_failure'}]}),[['advance',1]]);
|
|
35
|
+
const before=records(f),checkpoint=before.at(-1).payload.checkpoint;
|
|
36
|
+
assert.deepEqual([checkpoint.state,checkpoint.code,checkpoint.calls.at(-1).terminal,checkpoint.calls.at(-1).resultDigest],
|
|
37
|
+
['unknown','execution_error','unknown',null]);
|
|
38
|
+
assert.deepEqual([stuck.state,stuck.code,stuck.pendingAction],['blocked','develop_dispatch_failed','resume'],JSON.stringify(stuck));
|
|
39
|
+
// Root changed since the round start: it may have been dispatched, so only the confirmed redo applies.
|
|
40
|
+
fs.writeFileSync(path.join(f.codeProject,'a.mjs'),'someone wrote\n');
|
|
41
|
+
const [changed]=await gapSession(f,'resume',gapExecution(f),[['status',1],['advance',1]]);
|
|
42
|
+
assert.deepEqual([changed.state,changed.code,changed.pendingAction],['blocked','develop_answer_missing','develop_redo'],JSON.stringify(changed));
|
|
43
|
+
assert.equal(records(f).length,before.length,'nothing appended on a changed root');
|
|
44
|
+
// Root restored: the plain exit applies again and the record pins the baseline.
|
|
45
|
+
fs.writeFileSync(path.join(f.codeProject,'a.mjs'),'old\n');
|
|
46
|
+
await gapSession(f,'resume',gapExecution(f,{developer:['round-1\n']}),[['advance',1]]);
|
|
47
|
+
assert.deepEqual(added(f,before).slice(0,2),['develop-dispatch-retry','intent:develop-1-retry-1']);
|
|
48
|
+
assert.equal(records(f)[before.length].payload.basis,'baseline');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Codex round 1 (P2): the start binding outlives the develop-dispatch-retry
|
|
52
|
+
// record. A restart between that record and the develop intent, with the code
|
|
53
|
+
// root changed meanwhile, must not redispatch without the equality check.
|
|
54
|
+
test('develop_dispatch_failed: a restart after the retry record re-verifies the round start before dispatch',async t=>{
|
|
55
|
+
const f=gapFixture(t,'dispatch-crash');
|
|
56
|
+
await gapSession(f,'create',gapExecution(f,{developer:[{beforeDispatch:'role_log_failed'}]}),[['advance',1]]);
|
|
57
|
+
// The redo is journaled before its dispatch; what happens after is cut away below.
|
|
58
|
+
await gapSession(f,'resume',gapExecution(f,{developer:['hang']}),[['advance',1]]);
|
|
59
|
+
// Cut the journal right after develop-dispatch-retry (host died before the intent).
|
|
60
|
+
const state=JSON.parse(fs.readFileSync(f.store,'utf8'));
|
|
61
|
+
const index=state.records.findIndex(row=>row.payload.type==='develop-dispatch-retry');assert.ok(index>0);
|
|
62
|
+
const {revision,...body}=state;body.records=state.records.slice(0,index+1);
|
|
63
|
+
fs.writeFileSync(f.store,JSON.stringify({...body,revision:digest(body)})+'\n');
|
|
64
|
+
const prefix=body.records;
|
|
65
|
+
fs.writeFileSync(path.join(f.codeProject,'a.mjs'),'edited meanwhile\n');
|
|
66
|
+
const calls=f.calls.developer;
|
|
67
|
+
const [status,advanced]=await gapSession(f,'resume',gapExecution(f,{developer:['should-not-run\n']}),[['status',1],['advance',1]]);
|
|
68
|
+
assert.deepEqual([status.state,status.code,status.pendingAction],['blocked','develop_answer_missing','develop_redo'],JSON.stringify(status));
|
|
69
|
+
assert.equal(advanced.pendingAction,'develop_redo');
|
|
70
|
+
assert.equal(f.calls.developer,calls,'nothing dispatched');assert.equal(records(f).length,prefix.length,'no develop intent');
|
|
71
|
+
// Restored root: the journaled block redispatches after the same check.
|
|
72
|
+
fs.writeFileSync(path.join(f.codeProject,'a.mjs'),'old\n');
|
|
73
|
+
const [again]=await gapSession(f,'resume',gapExecution(f),[['status',1]]);
|
|
74
|
+
assert.deepEqual([again.state,again.code,again.pendingAction],['blocked','develop_dispatch_failed','resume']);
|
|
75
|
+
// Equal at the status check, changed in the dispatch tick: refused, nothing dispatched.
|
|
76
|
+
const target=path.join(f.codeProject,'a.mjs'),open=fs.openSync;let raced,changed=false;
|
|
77
|
+
const limit=Error.stackTraceLimit;Error.stackTraceLimit=50;
|
|
78
|
+
fs.openSync=(file,...rest)=>{
|
|
79
|
+
if(file===target&&!changed&&/executeEffect/.test(new Error().stack)){changed=true;fs.writeFileSync(target,'raced edit\n');}
|
|
80
|
+
return open(file,...rest);};
|
|
81
|
+
try{[raced]=await gapSession(f,'resume',gapExecution(f,{developer:['should-not-run\n']}),[['advance',1]]);}
|
|
82
|
+
finally{fs.openSync=open;Error.stackTraceLimit=limit;}
|
|
83
|
+
assert.ok(changed,'the dispatch-time check read the root '+JSON.stringify(raced));
|
|
84
|
+
assert.deepEqual([raced.outcome,raced.code],['rejected','develop_dispatch_root_changed'],JSON.stringify(raced));
|
|
85
|
+
assert.equal(f.calls.developer,calls);assert.equal(records(f).length,prefix.length);
|
|
86
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Q28: the single-task and batch drivers decide which develop answers to prepare
|
|
2
|
+
// from the status the host will show, not the raw replay state. Raw replay of a
|
|
3
|
+
// retryable develop timeout reads unknown/call_timeout, so drivers prepared no
|
|
4
|
+
// answer and ended the real redo in host_close (#198/#199 unusable in driver mode).
|
|
5
|
+
import test from 'node:test';
|
|
6
|
+
import assert from 'node:assert/strict';
|
|
7
|
+
import {readRunnerHistory,projectedRunnerStatus} from '../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
8
|
+
import {projectDevelopAttempts} from './cm-ai-drive.mjs';
|
|
9
|
+
import {batchDevelopAttempts} from './cm-ai-batch-drive.mjs';
|
|
10
|
+
import {gapFixture,gapExecution,gapSession,records} from './cm-ai-answer-gap-fixture.mjs';
|
|
11
|
+
|
|
12
|
+
const replay=f=>{const rows=records(f),config=rows[0].payload.config;return {history:readRunnerHistory(rows,config,3),config};};
|
|
13
|
+
test('drivers prepare the redo answer for a timed-out develop (develop_call_timeout) from the projected status',async t=>{
|
|
14
|
+
const f=gapFixture(t,'driver-timeout');
|
|
15
|
+
const [stuck]=await gapSession(f,'create',gapExecution(f,{developer:['hang']}),[['advance',1]]);
|
|
16
|
+
assert.equal(stuck.code,'develop_call_timeout');
|
|
17
|
+
const {history,config}=replay(f);
|
|
18
|
+
assert.deepEqual([history.state.state,history.state.code],['unknown','call_timeout']);
|
|
19
|
+
// The raw replay state (what drivers used) projects no attempt.
|
|
20
|
+
assert.deepEqual(projectDevelopAttempts(history.state,'advance',[]).attempts,[]);
|
|
21
|
+
const projected=projectedRunnerStatus(history,config);
|
|
22
|
+
assert.deepEqual([projected.state,projected.code],['blocked','develop_call_timeout']);
|
|
23
|
+
assert.deepEqual(projectDevelopAttempts(projected,'advance',[]).attempts,[1,2]);
|
|
24
|
+
assert.deepEqual(batchDevelopAttempts(projected,'1.work/T-002',[]),[1,2]);
|
|
25
|
+
});
|
|
26
|
+
test('drivers prepare no developer answer for a re-check (check_answer_missing)',async t=>{
|
|
27
|
+
const f=gapFixture(t,'driver-recheck');
|
|
28
|
+
await gapSession(f,'create',gapExecution(f,{developer:['round-1\n'],checks:['hang']}),[['advance',1]]);
|
|
29
|
+
const {history,config}=replay(f),projected=projectedRunnerStatus(history,config);
|
|
30
|
+
assert.deepEqual([projected.state,projected.code],['blocked','check_answer_missing']);
|
|
31
|
+
assert.deepEqual(projectDevelopAttempts(projected,'advance',[]).attempts,[2]);
|
|
32
|
+
assert.deepEqual(batchDevelopAttempts(projected,'1.work/T-002',[]),[2]);
|
|
33
|
+
// Codex round 1: with direct round-1 review, the same advance can reach round 2.
|
|
34
|
+
const reach=projectDevelopAttempts(projected,'advance',[]);
|
|
35
|
+
assert.deepEqual([reach.attempts,reach.reviewAfterDevelop,reach.holdable],[[2],true,true]);
|
|
36
|
+
assert.deepEqual(batchDevelopAttempts(projected,'1.work/T-002',[]),[2]);
|
|
37
|
+
// Without a round-2 answer the driver launches with --hold-revision: the re-check and
|
|
38
|
+
// its review run, then the task stops at changes_requested; no develop is asked.
|
|
39
|
+
const before=f.calls.developer;
|
|
40
|
+
const [held]=await gapSession(f,'resume',gapExecution(f),[['advance',1]],{holdRevision:true});
|
|
41
|
+
assert.deepEqual([held.state,held.code,held.identity.attempt],['changes_requested','revision_answer_required',2],JSON.stringify(held));
|
|
42
|
+
assert.equal(f.calls.developer,before);
|
|
43
|
+
});
|
|
44
|
+
test('drivers preflight both rounds for a retryable round-1 block before direct round-1 review',()=>{
|
|
45
|
+
const status={state:'blocked',code:'develop_call_timeout',attempt:1};
|
|
46
|
+
const reach=projectDevelopAttempts(status,'advance',[]);
|
|
47
|
+
assert.deepEqual([reach.attempts,reach.reviewAfterDevelop],[[1,2],true]);
|
|
48
|
+
assert.deepEqual(projectDevelopAttempts(status,'advance',[]).attempts,[1,2]);
|
|
49
|
+
assert.deepEqual(batchDevelopAttempts(status,'1.work/T-002',[]),[1,2]);
|
|
50
|
+
assert.deepEqual(batchDevelopAttempts({...status,attempt:2},'1.work/T-002',[]),[2]);
|
|
51
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Shared real-host fixture for the answer-gap tests (cm-ai-answer-gap-*.test.mjs):
|
|
2
|
+
// one approved feature, one in-scope file, the real control run and host entry.
|
|
3
|
+
// Not a test file itself; it never touches the user's real directories.
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import {openControlRun} from './cm-ai-run.mjs';
|
|
8
|
+
import {buildManifest} from './cm-spec-manifest.mjs';
|
|
9
|
+
import {createCodexDeveloperRun} from '../runtime/js/cm-ai/codex-developer-adapter.mjs';
|
|
10
|
+
import {createHostCheck} from '../runtime/js/cm-ai/host-check.mjs';
|
|
11
|
+
import {reviewPaths} from '../runtime/js/cm-ai/review-runner.mjs';
|
|
12
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
13
|
+
|
|
14
|
+
export const learning={outcome:'implemented',application:{status:'no_relevant_lesson',note:null},
|
|
15
|
+
retrospective:{status:'no_new_lesson',candidates:[],reason:null}};
|
|
16
|
+
export function gapFixture(t,name='gap'){
|
|
17
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),`cm-answer-${name}-`)));
|
|
18
|
+
t.after(()=>fs.rmSync(root,{recursive:true,force:true}));
|
|
19
|
+
const codeProject=path.join(root,'code'),specsDir=path.join(root,'specs'),feature='1.work';
|
|
20
|
+
fs.mkdirSync(codeProject);fs.mkdirSync(path.join(specsDir,feature),{recursive:true});
|
|
21
|
+
fs.writeFileSync(path.join(codeProject,'a.mjs'),'old\n');
|
|
22
|
+
fs.writeFileSync(path.join(codeProject,'requirements.md'),'fixture\n');
|
|
23
|
+
for(const file of ['requirements.md','design.md'])fs.writeFileSync(path.join(specsDir,feature,file),'# Fixture\n');
|
|
24
|
+
fs.writeFileSync(path.join(specsDir,feature,'tasks.md'),'- [ ] T-002: fixture\n');
|
|
25
|
+
fs.writeFileSync(path.join(specsDir,'.cm-specs-status'),JSON.stringify({status:'approved',features:[feature],specFiles:buildManifest(specsDir)}));
|
|
26
|
+
return {root,codeProject,specsDir,feature,calls:{developer:0,check:0},
|
|
27
|
+
store:path.join(specsDir,'.reviews','.execution','answer-gap-run','state.json')};
|
|
28
|
+
}
|
|
29
|
+
export const identity=attempt=>({repositoryId:'answer-gap',runId:'answer-gap-run',taskId:'T-002',attempt});
|
|
30
|
+
export const definition=f=>({version:1,specsDir:f.specsDir,codeProject:f.codeProject,feature:f.feature,
|
|
31
|
+
identity:identity(1),scope:['a.mjs'],requirements:['requirements.md']});
|
|
32
|
+
// developer: one item per developer call: a string is written to a.mjs and
|
|
33
|
+
// answered; 'hang' never answers; {write,response} writes (when given) and
|
|
34
|
+
// returns the raw worker response; {write,throw:code} writes then fails the call.
|
|
35
|
+
// checks: one item per check request: 'hang' never answers, 'invalid' answers a
|
|
36
|
+
// malformed result, anything else (or an empty queue) runs the real host check.
|
|
37
|
+
// verdicts: one per review (default changes_requested).
|
|
38
|
+
export function gapExecution(f,{developer=[],checks=[],verdicts=[]}={}){
|
|
39
|
+
const queue=[...developer],checkQueue=[...checks],verdictQueue=[...verdicts];
|
|
40
|
+
const realCheck=createHostCheck({cwd:f.codeProject,commands:[{id:'syntax',command:[process.execPath,'-e','0']}]});
|
|
41
|
+
const reviewer={id:'reviewer',adapterId:'codex-review-adapter',provider:'codex',requestedModel:'fixture',
|
|
42
|
+
allowed:true,available:true,contexts:['review-one','review-two'],run:(value,{onEvent})=>{
|
|
43
|
+
onEvent({event:'thread.started',provider_thread:`review-thread-${value.identity.attempt}-${Math.random().toString(36).slice(2,8)}`});
|
|
44
|
+
onEvent({event:'turn.started',item_type:null});onEvent({event:'item.completed',item_type:'agent_message'});
|
|
45
|
+
onEvent({event:'turn.completed',item_type:null});onEvent({event:'process_closed',exit_code:0,signal:null,timed_out:false});
|
|
46
|
+
const pkg=value.payload.reviewPackage,verdict=verdictQueue.shift()??'changes_requested';
|
|
47
|
+
return {status:'succeeded',value:verdict==='approved'
|
|
48
|
+
?{verdict,packageDigest:pkg.packageDigest,examinedPaths:reviewPaths(pkg),findings:[],summary:'Fixture approval'}
|
|
49
|
+
:{verdict,packageDigest:pkg.packageDigest,examinedPaths:reviewPaths(pkg),
|
|
50
|
+
findings:[{id:'F1',severity:'P2',path:'a.mjs',message:'Revise',evidence:'Fixture finding'}],summary:'Fixture review'}};
|
|
51
|
+
}};
|
|
52
|
+
const developerRun=createCodexDeveloperRun({requestedModel:'current-session',worker:async()=>{
|
|
53
|
+
f.calls.developer++;
|
|
54
|
+
const item=queue.shift();
|
|
55
|
+
if(item===undefined)throw Object.assign(new Error('unexpected developer call'),{code:'unexpected_developer_call'});
|
|
56
|
+
if(item==='hang')return new Promise(()=>{});
|
|
57
|
+
if(typeof item==='string'){fs.writeFileSync(path.join(f.codeProject,'a.mjs'),item);return {status:'succeeded',value:learning};}
|
|
58
|
+
if(item.write!==undefined)fs.writeFileSync(path.join(f.codeProject,'a.mjs'),item.write);
|
|
59
|
+
if(item.throw)throw Object.assign(new Error(item.throw),{code:item.throw});
|
|
60
|
+
return item.response;
|
|
61
|
+
}});
|
|
62
|
+
return {configuration:{kind:'answer-gap-v1'},timeoutMs:1500,excludedContexts:['control'],
|
|
63
|
+
developer:{provider:'codex',requestedModel:'current-session',contextId:'developer',run:(request,control)=>{
|
|
64
|
+
// {beforeDispatch:code} fails the developer run itself before any worker
|
|
65
|
+
// starts, as the host's own role routing does (e.g. role_log_failed).
|
|
66
|
+
if(queue[0]?.beforeDispatch){const {beforeDispatch}=queue.shift();f.calls.beforeDispatch=(f.calls.beforeDispatch??0)+1;
|
|
67
|
+
throw Object.assign(new Error(beforeDispatch),{code:beforeDispatch});}
|
|
68
|
+
return developerRun(request,control);
|
|
69
|
+
}},
|
|
70
|
+
reviewers:[reviewer],reviewInvocation:{developerThreadId:'author-thread',excludedThreadIds:['control']},check:(request,control)=>{
|
|
71
|
+
f.calls.check++;
|
|
72
|
+
const item=checkQueue.shift();
|
|
73
|
+
if(item==='hang')return new Promise(()=>{});
|
|
74
|
+
if(item==='invalid')return [{id:'syntax',outcome:'passed'}];
|
|
75
|
+
return realCheck(request,control);
|
|
76
|
+
}};
|
|
77
|
+
}
|
|
78
|
+
export async function gapSession(f,mode,execution,operations,options={}){
|
|
79
|
+
const run=await openControlRun(definition(f),mode,execution,options);
|
|
80
|
+
const results=[];
|
|
81
|
+
try{
|
|
82
|
+
for(const [operation,attempt,extra] of operations)
|
|
83
|
+
results.push(await run.host.handle({version:1,operation,requestId:`${operation}-${results.length}`,identity:identity(attempt),...extra}));
|
|
84
|
+
}finally{run.close();}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
export const records=f=>JSON.parse(fs.readFileSync(f.store,'utf8')).records;
|
|
88
|
+
export const added=(f,before)=>records(f).slice(before.length)
|
|
89
|
+
.map(row=>row.payload.type==='effect-intent'?`intent:${row.payload.effect.id}`:row.payload.type);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// V3 (P1-1): the developer call succeeded and its delivery is on disk, but the
|
|
2
|
+
// later task check (or the completion re-check) never got a usable answer. The
|
|
3
|
+
// run shows a retryable block; advance journals develop-recheck/complete-recheck
|
|
4
|
+
// and re-runs only those steps. The developer is never dispatched again.
|
|
5
|
+
import test from 'node:test';
|
|
6
|
+
import assert from 'node:assert/strict';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import {readRunnerHistory,projectedRunnerStatus} from '../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
10
|
+
import {gapFixture,gapExecution,gapSession,records,added} from './cm-ai-answer-gap-fixture.mjs';
|
|
11
|
+
|
|
12
|
+
test('check_answer_missing: a timed-out check after a delivered develop re-runs only the checks, then complete_recheck_failed re-runs only completion',async t=>{
|
|
13
|
+
const f=gapFixture(t,'recheck');
|
|
14
|
+
// Round 1 delivers; its check never answers (the runner limit stops it).
|
|
15
|
+
const [stuck]=await gapSession(f,'create',gapExecution(f,{developer:['round-1\n'],checks:['hang']}),[['advance',1]]);
|
|
16
|
+
assert.deepEqual([stuck.state,stuck.code,stuck.pendingAction],['blocked','check_answer_missing','resume'],JSON.stringify(stuck));
|
|
17
|
+
assert.match(stuck.reason,/原记录 unknown\/call_timeout/);
|
|
18
|
+
assert.equal(stuck.guidance.recoveryOperation,'advance');assert.match(stuck.guidance.nextStep,/只重跑检查/);
|
|
19
|
+
const before=records(f),checkpoint=before.at(-1).payload.checkpoint;
|
|
20
|
+
// The journal keeps exactly what older runtimes wrote (real T-005/T-008 shape).
|
|
21
|
+
assert.deepEqual([checkpoint.state,checkpoint.code,checkpoint.calls.at(-1).terminal],['unknown','call_timeout','succeeded']);
|
|
22
|
+
assert.equal(readRunnerHistory(before,before[0].payload.config,3).state.state,'unknown');
|
|
23
|
+
assert.equal(f.calls.developer,1);
|
|
24
|
+
// Resume: re-check approves; then the completion re-check never answers.
|
|
25
|
+
const resumed=gapExecution(f,{checks:['ok','hang'],verdicts:['approved']});
|
|
26
|
+
const [status,advanced]=await gapSession(f,'resume',resumed,[['status',1],['advance',1]]);
|
|
27
|
+
assert.deepEqual([status.state,status.code,status.pendingAction],['blocked','check_answer_missing','resume']);
|
|
28
|
+
assert.equal(f.calls.developer,1,'the re-check never dispatches the developer');
|
|
29
|
+
assert.deepEqual([advanced.state,advanced.code,advanced.pendingAction],['blocked','complete_recheck_failed','complete'],JSON.stringify(advanced));
|
|
30
|
+
assert.equal(advanced.guidance.recoveryOperation,'complete');
|
|
31
|
+
const steps=added(f,before);
|
|
32
|
+
assert.deepEqual(steps.slice(0,3),['develop-recheck','intent:develop-1-retry-1','effect-checkpoint']);
|
|
33
|
+
assert.ok(steps.includes('intent:review-1')&&steps.includes('intent:complete-1'));
|
|
34
|
+
const after=records(f);assert.deepEqual(after.slice(0,before.length),before,'journal is append-only');
|
|
35
|
+
const rechecked=after[before.length+2].payload.checkpoint;
|
|
36
|
+
assert.equal(rechecked.state,'awaiting_review');assert.equal(rechecked.calls.length,1,'no new developer call');
|
|
37
|
+
assert.equal(Buffer.from(rechecked.reviewPackage.changes.find(c=>c.path==='a.mjs').after.contentBase64,'base64').toString(),'round-1\n');
|
|
38
|
+
// Re-checked completion: complete-recheck, then the run completes.
|
|
39
|
+
const middle=records(f);
|
|
40
|
+
const [done]=await gapSession(f,'resume',gapExecution(f,{checks:['ok']}),[['advance',1]]);
|
|
41
|
+
assert.deepEqual([done.state,done.pendingAction],['fixture_completed','qa'],JSON.stringify(done));
|
|
42
|
+
assert.deepEqual(added(f,middle).slice(0,2),['complete-recheck','intent:complete-1-retry-1']);
|
|
43
|
+
assert.match(fs.readFileSync(path.join(f.specsDir,f.feature,'tasks.md'),'utf8'),/\[x\] T-002/);
|
|
44
|
+
const final=readRunnerHistory(records(f),records(f)[0].payload.config,3);
|
|
45
|
+
assert.equal(final.state.state,'fixture_completed');
|
|
46
|
+
assert.deepEqual([final.answerGaps.developRecheck,final.answerGaps.completeRecheck],[1,1]);
|
|
47
|
+
assert.equal(final.state.receipts.length,1,'one review round');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('check_answer_invalid: a malformed check answer is re-checked at most twice per run, then shows check_answer_retry_limit',async t=>{
|
|
51
|
+
const f=gapFixture(t,'invalid');
|
|
52
|
+
const [stuck]=await gapSession(f,'create',gapExecution(f,{developer:['round-1\n'],checks:['invalid']}),[['advance',1]]);
|
|
53
|
+
assert.deepEqual([stuck.state,stuck.code,stuck.pendingAction],['blocked','check_answer_invalid','resume'],JSON.stringify(stuck));
|
|
54
|
+
const [first]=await gapSession(f,'resume',gapExecution(f,{checks:['hang']}),[['advance',1]]);
|
|
55
|
+
assert.deepEqual([first.state,first.code],['blocked','check_answer_missing'],JSON.stringify(first));
|
|
56
|
+
const [second]=await gapSession(f,'resume',gapExecution(f,{checks:['invalid']}),[['advance',1]]);
|
|
57
|
+
// The cap is spent: an explicit limit block naming the exit that is left, not unknown/reconcile.
|
|
58
|
+
assert.deepEqual([second.state,second.code,second.pendingAction],['blocked','check_answer_retry_limit','none'],JSON.stringify(second));
|
|
59
|
+
assert.match(second.reason,/--supersede-reviewed-evidence/);assert.match(second.guidance.summary,/用满 2 次/);
|
|
60
|
+
// Replay shows the same block (journal only), and the journal keeps unknown/invalid_input.
|
|
61
|
+
const rows=records(f),replayed=projectedRunnerStatus(readRunnerHistory(rows,rows[0].payload.config,3),rows[0].payload.config);
|
|
62
|
+
assert.deepEqual([replayed.state,replayed.code],['blocked','check_answer_retry_limit']);
|
|
63
|
+
assert.deepEqual([rows.at(-1).payload.checkpoint.state,rows.at(-1).payload.checkpoint.code],['unknown','invalid_input']);
|
|
64
|
+
assert.equal(f.calls.developer,1);
|
|
65
|
+
const history=readRunnerHistory(records(f),records(f)[0].payload.config,3);
|
|
66
|
+
assert.equal(history.answerGaps.developRecheck,2);
|
|
67
|
+
// Effects and calls stay inside the run budget: the sources hold no slot.
|
|
68
|
+
assert.deepEqual(records(f).filter(row=>row.payload.type==='effect-intent').map(row=>row.payload.effect.id),
|
|
69
|
+
['develop-1','develop-1-retry-1','develop-1-retry-2']);
|
|
70
|
+
});
|