@aibyzero/cm-workflow 0.17.1 → 0.19.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/AGENTS.md +23 -0
- package/CHANGELOG.md +242 -0
- package/README.md +20 -3
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/VERSION +1 -1
- package/compat/claude-commands/cm-challenge.md +3 -0
- package/docs/architecture.md +11 -0
- package/docs/cm-control-policy-v2.md +127 -9
- package/docs/installation.md +310 -4
- package/docs/js-workflow-control.md +150 -15
- package/docs/live-evidence-drivers.md +28 -4
- package/docs/out-of-scope/README.md +25 -0
- package/docs/out-of-scope/background-supervisor.md +32 -0
- package/docs/reviewed-integration.md +48 -0
- package/docs/user-guide.md +50 -21
- package/install-codex.sh +331 -18
- package/install.ps1 +28 -2
- package/install.sh +321 -17
- package/package.json +2 -1
- package/runtime/js/autonomy.mjs +152 -0
- package/runtime/js/cm-ai/batch-location.mjs +55 -0
- package/runtime/js/cm-ai/batch-plan.mjs +242 -0
- package/runtime/js/cm-ai/checkpoint-package-material.mjs +162 -0
- package/runtime/js/cm-ai/claude-developer-proposal.schema.json +55 -1
- package/runtime/js/cm-ai/claude-review-stream.mjs +83 -14
- package/runtime/js/cm-ai/claude-tool-preview.mjs +11 -9
- package/runtime/js/cm-ai/cm-ai-admission.mjs +56 -17
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +91 -6
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +5 -1
- package/runtime/js/cm-ai/codex-config.mjs +6 -2
- package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +3 -2
- package/runtime/js/cm-ai/codex-developer-output.schema.json +2 -1
- package/runtime/js/cm-ai/codex-reconnect-notice.mjs +6 -0
- package/runtime/js/cm-ai/codex-review-adapter.mjs +27 -7
- package/runtime/js/cm-ai/control-policy.mjs +21 -4
- package/runtime/js/cm-ai/developer-adapter.mjs +19 -5
- package/runtime/js/cm-ai/drive-core.mjs +115 -11
- package/runtime/js/cm-ai/drive-rate-limit.mjs +105 -0
- package/runtime/js/cm-ai/durable-runner-state.mjs +234 -33
- package/runtime/js/cm-ai/effect-contract.mjs +11 -2
- package/runtime/js/cm-ai/execution-policy.mjs +3 -1
- package/runtime/js/cm-ai/execution-snapshot.mjs +4 -2
- package/runtime/js/cm-ai/execution-store-limits.mjs +14 -7
- package/runtime/js/cm-ai/execution-store.mjs +60 -17
- package/runtime/js/cm-ai/fix-code-association.mjs +73 -2
- package/runtime/js/cm-ai/host-check.mjs +11 -5
- package/runtime/js/cm-ai/host-conversation-execution.mjs +70 -28
- package/runtime/js/cm-ai/host-qa-executor.mjs +38 -5
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +2 -2
- package/runtime/js/cm-ai/host-qa-policy.mjs +19 -2
- package/runtime/js/cm-ai/host-replay.mjs +148 -0
- package/runtime/js/cm-ai/host-session.mjs +1 -1
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +19 -2
- package/runtime/js/cm-ai/host.mjs +1 -1
- package/runtime/js/cm-ai/implicit-qa-decision.mjs +5 -0
- package/runtime/js/cm-ai/integration-snapshots.mjs +50 -0
- package/runtime/js/cm-ai/live-evidence.mjs +28 -6
- package/runtime/js/cm-ai/operator-guidance.mjs +9 -2
- package/runtime/js/cm-ai/owned-process-cleanup.mjs +27 -9
- package/runtime/js/cm-ai/process-group-exit.mjs +46 -0
- package/runtime/js/cm-ai/provider-review-observation.mjs +3 -2
- package/runtime/js/cm-ai/qa-attachment.mjs +22 -0
- package/runtime/js/cm-ai/qa-config-revision.mjs +7 -2
- package/runtime/js/cm-ai/requirement-evidence.mjs +102 -0
- package/runtime/js/cm-ai/review-package.mjs +79 -7
- package/runtime/js/cm-ai/review-presentation-delta.mjs +166 -0
- package/runtime/js/cm-ai/review-presentation.mjs +177 -8
- package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +70 -2
- package/runtime/js/cm-ai/reviewed-integration.mjs +260 -0
- package/runtime/js/cm-ai/scope-revision.mjs +38 -0
- package/runtime/js/cm-ai/specification-material.mjs +2 -2
- package/runtime/js/cm-ai/task-runner.mjs +242 -39
- package/runtime/js/cm-ai/verification-auto.mjs +38 -0
- package/runtime/js/cm-ai/worker-claude-developer.mjs +39 -15
- package/runtime/js/cm-ai/worker-claude.mjs +35 -13
- package/runtime/js/cm-ai/worker-codex-developer.mjs +43 -17
- package/runtime/js/cm-ai/worker-codex.mjs +41 -7
- package/runtime/js/cm-fix/cause-invocation.mjs +16 -2
- package/runtime/js/cm-fix/cause-package.mjs +46 -1
- package/runtime/js/cm-fix/command-correction.mjs +37 -0
- package/runtime/js/cm-fix/cooperative.mjs +12 -0
- package/runtime/js/cm-fix/dossier.mjs +8 -2
- package/runtime/js/cm-fix/execution.mjs +578 -100
- package/runtime/js/cm-fix/final-review.mjs +39 -8
- package/runtime/js/cm-fix/finish.mjs +15 -11
- package/runtime/js/cm-fix/host-review.mjs +65 -10
- package/runtime/js/cm-fix/host.mjs +35 -12
- package/runtime/js/cm-fix/jest-command-correction.mjs +69 -0
- package/runtime/js/cm-fix/metrics.mjs +18 -5
- package/runtime/js/cm-fix/regression-evidence.mjs +3 -2
- package/runtime/js/cm-fix/regression.mjs +16 -7
- package/runtime/js/cm-fix/repair.mjs +29 -8
- package/runtime/js/cm-fix/review-verification-command.mjs +135 -0
- package/runtime/js/cm-fix/review-verification-contract.mjs +54 -0
- package/runtime/js/cm-fix/review-verification-diagnostic.mjs +75 -0
- package/runtime/js/cm-fix/review-verification-recovery.mjs +44 -0
- package/runtime/js/cm-fix/review-verification-server.mjs +38 -0
- package/runtime/js/cm-fix/review-verification.mjs +214 -0
- package/runtime/js/cm-fix/source-correction-recovery.mjs +65 -0
- package/runtime/js/cm-fix/start.mjs +6 -3
- package/runtime/js/cm-fix/test-type-correction.mjs +86 -0
- package/runtime/js/cm-fix/test-type-recovery.mjs +51 -0
- package/runtime/js/cm-fix/type-import-correction.mjs +89 -0
- package/runtime/js/cm-prd/accepted-design.mjs +8 -0
- package/runtime/js/cm-prd/analysis.mjs +13 -9
- package/runtime/js/cm-prd/change.mjs +37 -16
- package/runtime/js/cm-prd/draft-save.mjs +13 -6
- package/runtime/js/cm-prd/draft.mjs +31 -3
- package/runtime/js/cm-prd/failed-correction.mjs +19 -3
- package/runtime/js/cm-prd/inputs-replaced.mjs +3 -0
- package/runtime/js/cm-prd/review-correction.mjs +6 -4
- package/runtime/js/cm-prd/review-disposition.mjs +7 -1
- package/runtime/js/cm-prd/self-check-revision.mjs +2 -2
- package/runtime/js/cm-prd/self-check.mjs +125 -6
- package/runtime/js/cm-prd/session.mjs +30 -1
- package/runtime/js/cm-prd/summary.mjs +11 -5
- package/runtime/js/cm-prd/task-scope-record.mjs +97 -0
- package/runtime/js/cm-prd/tree-digest.mjs +34 -0
- package/runtime/js/cm-prd/validation-reason.mjs +8 -4
- package/runtime/js/cm-security/scan.mjs +1 -1
- package/runtime/js/commander/decision.mjs +44 -0
- package/runtime/js/commander/dispatch-registry.mjs +110 -0
- package/runtime/js/commander/ledger.mjs +265 -0
- package/runtime/js/commander/preflight.mjs +107 -0
- package/runtime/js/notify-later.mjs +13 -0
- package/runtime/js/notify-send.mjs +6 -2
- package/runtime/js/notify.mjs +581 -65
- package/runtime/js/review-findings.mjs +38 -0
- package/runtime/js/session-boundary.mjs +56 -0
- package/runtime/js/session-handoff.mjs +68 -0
- package/runtime/js/spec-task-line.mjs +27 -13
- package/runtime/js/specs-status.mjs +5 -4
- package/runtime/js/task-scope.mjs +197 -0
- package/runtime/logging.md +6 -1
- package/runtime/model-efficiency.md +69 -10
- package/runtime/orchestration.md +3 -1
- package/runtime/project-learning.md +2 -0
- package/runtime/review.md +3 -2
- package/runtime/test-contract.md +1 -0
- package/scripts/ci-test-weights.json +3 -0
- package/scripts/cm-ai-admission.mjs +21 -7
- package/scripts/cm-ai-admission.test.mjs +171 -3
- package/scripts/cm-ai-batch-drive.mjs +79 -18
- package/scripts/cm-ai-batch-drive.test.mjs +169 -3
- package/scripts/cm-ai-batch-host.mjs +38 -9
- package/scripts/cm-ai-batch-host.test.mjs +6 -5
- package/scripts/cm-ai-batch-learning-merge.test.mjs +36 -0
- package/scripts/cm-ai-batch-location.test.mjs +57 -0
- package/scripts/cm-ai-batch-plan.mjs +52 -0
- package/scripts/cm-ai-batch-plan.test.mjs +397 -0
- package/scripts/cm-ai-batch-run-fixture.mjs +446 -35
- package/scripts/cm-ai-batch-run-member-stops.test.mjs +16 -0
- package/scripts/cm-ai-batch-run-parallel.test.mjs +28 -1
- package/scripts/cm-ai-batch-run.mjs +471 -57
- package/scripts/cm-ai-batch-run.test.mjs +23 -4
- package/scripts/cm-ai-batch-session-e2e.test.mjs +235 -0
- package/scripts/cm-ai-batch-session-member.test.mjs +293 -0
- package/scripts/cm-ai-batch-session-recovery.test.mjs +423 -0
- package/scripts/cm-ai-check-recheck-cancellation.test.mjs +247 -0
- package/scripts/cm-ai-checklist-coverage.test.mjs +4 -2
- package/scripts/cm-ai-checkpoint-package-material.test.mjs +221 -0
- package/scripts/cm-ai-checkpoint-package-owner.test.mjs +193 -0
- package/scripts/cm-ai-control-launch.test.mjs +21 -0
- package/scripts/cm-ai-control-policy.test.mjs +14 -0
- package/scripts/cm-ai-control-v2-drive.test.mjs +398 -3
- package/scripts/cm-ai-control-v2-supersede-race.mjs +25 -0
- package/scripts/cm-ai-control-v2-supersede.test.mjs +318 -0
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +163 -0
- package/scripts/cm-ai-development-rework.test.mjs +423 -0
- package/scripts/cm-ai-drive.mjs +73 -17
- package/scripts/cm-ai-drive.test.mjs +34 -2
- package/scripts/cm-ai-execution-store-legacy-probe.test.mjs +84 -0
- package/scripts/cm-ai-host.mjs +60 -19
- package/scripts/cm-ai-integration-adoption.test.mjs +223 -0
- package/scripts/cm-ai-integration-independence.test.mjs +23 -0
- package/scripts/cm-ai-integration-launch.test.mjs +240 -0
- package/scripts/cm-ai-integration-preview.mjs +41 -0
- package/scripts/cm-ai-integration-snapshots.test.mjs +197 -0
- package/scripts/cm-ai-nested-execution.test.mjs +29 -1
- package/scripts/cm-ai-operator-guidance.test.mjs +16 -1
- package/scripts/cm-ai-prefinal-delivery.test.mjs +278 -0
- package/scripts/cm-ai-project-qa-gate.test.mjs +56 -0
- package/scripts/cm-ai-qa-fingerprint-config.test.mjs +28 -0
- package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +36 -2
- package/scripts/cm-ai-requirement-evidence.test.mjs +65 -0
- package/scripts/cm-ai-review-failure.test.mjs +150 -5
- package/scripts/cm-ai-run.mjs +88 -21
- package/scripts/cm-ai-scope-revision.test.mjs +341 -0
- package/scripts/cm-ai-spec-rebind.test.mjs +13 -0
- package/scripts/cm-ai-supersede.test.mjs +28 -0
- package/scripts/cm-ai-verification-auto.test.mjs +99 -0
- package/scripts/cm-announce-hook.mjs +35 -8
- package/scripts/cm-announce-hook.test.mjs +25 -0
- package/scripts/cm-autonomy.mjs +94 -0
- package/scripts/cm-autonomy.test.mjs +162 -0
- package/scripts/cm-challenge.test.mjs +61 -0
- package/scripts/cm-check-drive-files.mjs +1 -1
- package/scripts/cm-check-runtime.sh +60 -1
- package/scripts/cm-claude-developer-worker.test.mjs +56 -7
- package/scripts/cm-claude-install-layout.test.mjs +1 -1
- package/scripts/cm-claude-review-diagnostics.test.mjs +235 -0
- package/scripts/cm-claude-review-stream.test.mjs +13 -0
- package/scripts/cm-codex-developer-reconnect-notice.test.mjs +98 -0
- package/scripts/cm-codex-developer-worker.test.mjs +120 -0
- package/scripts/cm-codex-install-local-edit-guard.test.mjs +436 -0
- package/scripts/cm-codex-prompt-input.test.mjs +153 -0
- package/scripts/cm-codex-reconnect-notice.test.mjs +167 -0
- package/scripts/cm-commander-ledger.test.mjs +260 -0
- package/scripts/cm-commander-p2.test.mjs +295 -0
- package/scripts/cm-commander-preflight.mjs +84 -0
- package/scripts/cm-commander.mjs +116 -0
- package/scripts/cm-config-lock.mjs +35 -0
- package/scripts/cm-controlled-correction.test.mjs +10 -1
- package/scripts/cm-developer-failure-code.test.mjs +62 -0
- package/scripts/cm-display-task-id.test.mjs +41 -0
- package/scripts/cm-efficiency-presentation-delta.test.mjs +218 -0
- package/scripts/cm-execution-snapshot-reuse.test.mjs +115 -0
- package/scripts/cm-external-batch-host.test.mjs +4 -3
- package/scripts/cm-external-process-cleanup.test.mjs +128 -0
- package/scripts/cm-external-qa-fix.test.mjs +89 -7
- package/scripts/cm-external-review-reconciliation.test.mjs +11 -0
- package/scripts/cm-failover.mjs +48 -10
- package/scripts/cm-failover.test.mjs +46 -0
- package/scripts/cm-fix-cause-invocation.test.mjs +19 -4
- package/scripts/cm-fix-command-correction.mjs +17 -0
- package/scripts/cm-fix-command-correction.test.mjs +211 -0
- package/scripts/cm-fix-cooperative-closeout.test.mjs +87 -0
- package/scripts/cm-fix-diagnosis-module-correction.test.mjs +217 -0
- package/scripts/cm-fix-drive.mjs +33 -5
- package/scripts/cm-fix-drive.test.mjs +49 -0
- package/scripts/cm-fix-host-review-assembly.test.mjs +197 -1
- package/scripts/cm-fix-host-review.test.mjs +21 -9
- package/scripts/cm-fix-host.mjs +26 -8
- package/scripts/cm-fix-monorepo-map.test.mjs +92 -0
- package/scripts/cm-fix-observation-task-id.test.mjs +122 -0
- package/scripts/cm-fix-regression-input-budget.test.mjs +111 -0
- package/scripts/cm-fix-repair-input-budget.test.mjs +119 -0
- package/scripts/cm-fix-review-file-paging.test.mjs +91 -0
- package/scripts/cm-fix-review-preflight.mjs +24 -0
- package/scripts/cm-fix-review-storage.test.mjs +233 -0
- package/scripts/cm-fix-review-verification-command.test.mjs +242 -0
- package/scripts/cm-fix-review-verification-evidence.test.mjs +218 -0
- package/scripts/cm-fix-review-verification-integration.test.mjs +81 -0
- package/scripts/cm-fix-review-verification-recovery.test.mjs +198 -0
- package/scripts/cm-fix-review-verification.test.mjs +146 -0
- package/scripts/cm-fix-revision-transport.test.mjs +81 -0
- package/scripts/cm-fix-source-correction.test.mjs +296 -0
- package/scripts/cm-fix-test-type-correction.mjs +18 -0
- package/scripts/cm-fix-test-type-correction.test.mjs +123 -0
- package/scripts/cm-fix-test-type-owner.test.mjs +208 -0
- package/scripts/cm-fix-test-type-verification-cost.test.mjs +66 -0
- package/scripts/cm-fix-type-import-correction.test.mjs +95 -0
- package/scripts/cm-fix-verification-diagnostic.test.mjs +200 -0
- package/scripts/cm-fix-verification-recovery.mjs +33 -0
- package/scripts/cm-host-qa-executor.test.mjs +77 -0
- package/scripts/cm-host-replay.test.mjs +176 -0
- package/scripts/cm-install-local-edit-guard.test.mjs +621 -0
- package/scripts/cm-install-manifest.sh +351 -0
- package/scripts/cm-live-evidence.test.mjs +59 -1
- package/scripts/cm-log-event.mjs +61 -10
- package/scripts/cm-log-event.test.mjs +121 -1
- package/scripts/cm-matt-skills.mjs +576 -0
- package/scripts/cm-matt-skills.test.mjs +550 -0
- package/scripts/cm-notify-command.test.mjs +42 -10
- package/scripts/cm-notify.mjs +14 -10
- package/scripts/cm-notify.test.mjs +581 -59
- package/scripts/cm-patrol.mjs +4 -1
- package/scripts/cm-patrol.test.mjs +23 -5
- package/scripts/cm-prd-answer-gaps.test.mjs +2 -2
- package/scripts/cm-prd-completion.test.mjs +56 -13
- package/scripts/cm-prd-design-phase.test.mjs +78 -8
- package/scripts/cm-prd-draft-save.test.mjs +12 -0
- package/scripts/cm-prd-draft.test.mjs +1 -1
- package/scripts/cm-prd-drive.mjs +13 -6
- package/scripts/cm-prd-drive.test.mjs +45 -1
- package/scripts/cm-prd-gate-diagnostic.test.mjs +2 -2
- package/scripts/cm-prd-host.mjs +10 -5
- package/scripts/cm-prd-host.test.mjs +4 -2
- package/scripts/cm-prd-inputs-replaced.test.mjs +1 -1
- package/scripts/cm-prd-review-disposition.test.mjs +124 -8
- package/scripts/cm-prd-revision.test.mjs +1 -1
- package/scripts/cm-prd-self-check-revision.test.mjs +1 -1
- package/scripts/cm-prd-self-check-rules.test.mjs +239 -0
- package/scripts/cm-prd-self-check.test.mjs +105 -5
- package/scripts/cm-prd-summary.test.mjs +24 -3
- package/scripts/cm-prd-task-grouping.test.mjs +6 -6
- package/scripts/cm-prd-tree-digest.test.mjs +74 -0
- package/scripts/cm-refactor-drive.mjs +2 -1
- package/scripts/cm-refactor-drive.test.mjs +9 -0
- package/scripts/cm-release-smoke.sh +1 -1
- package/scripts/cm-skill-hints-autowire.test.mjs +394 -0
- package/scripts/cm-skill-hints-exam.mjs +149 -0
- package/scripts/cm-skill-hints-install.test.mjs +168 -0
- package/scripts/cm-skill-hints.exam.json +706 -0
- package/scripts/cm-skill-hints.json +119 -0
- package/scripts/cm-skill-hints.mjs +669 -0
- package/scripts/cm-skill-hints.test.mjs +831 -0
- package/scripts/cm-skill-judge.mjs +181 -0
- package/scripts/cm-skill-judge.test.mjs +255 -0
- package/scripts/cm-specs-status.test.mjs +4 -2
- package/scripts/cm-start-check.mjs +323 -0
- package/scripts/cm-start-check.test.mjs +406 -0
- package/scripts/cm-task-gate.mjs +150 -29
- package/scripts/cm-task-gate.test.mjs +73 -1
- package/scripts/cm-task-id-grammar.test.mjs +66 -0
- package/scripts/cm-task-scope.test.mjs +308 -0
- package/scripts/cm-upgrade-compat-batch.test.mjs +172 -0
- package/scripts/cm-upgrade-compat.test.mjs +239 -0
- package/scripts/cm-workflow-config.mjs +12 -2
- package/scripts/fixtures/fix-verification-claude.mjs +44 -0
- package/scripts/fixtures/reviewed-integration.mjs +202 -0
- package/scripts/scan-public-safety.py +1 -0
- package/scripts/session-boundary.test.mjs +170 -0
- package/scripts/test-npm-install.py +14 -3
- package/scripts/test-shell-compat.sh +2 -0
- package/scripts/validate-public-repo.py +4 -0
- package/scripts/validate-test-cases.mjs +3 -2
- package/skills/cm-ai/SKILL.md +5 -2
- package/skills/cm-ai/references/N3-execute-task.md +1 -1
- package/skills/cm-ai/references/N4-review.md +2 -1
- package/skills/cm-ai/references/N6-qa-eval.md +3 -1
- package/skills/cm-ai/references/N8-finish.md +22 -0
- package/skills/cm-ai/references/js-host-qa-recovery.md +1 -1
- package/skills/cm-ai/references/js-host-recovery.md +79 -3
- package/skills/cm-ai/references/js-host.md +82 -16
- package/skills/cm-challenge/SKILL.md +65 -0
- package/skills/cm-challenge/evals/README.md +18 -0
- package/skills/cm-challenge/evals/trigger-cases.json +20 -0
- package/skills/cm-challenge/evals/trigger-config.json +28 -0
- package/skills/cm-challenge/references/examples.md +15 -0
- package/skills/cm-check/SKILL.md +5 -0
- package/skills/cm-check/references/js-host.md +2 -0
- package/skills/cm-fix/SKILL.md +12 -3
- package/skills/cm-fix/references/command-correction.md +67 -0
- package/skills/cm-fix/references/isolated-review.md +54 -0
- package/skills/cm-fix/references/js-host.md +62 -2
- package/skills/cm-fix/references/test-type-correction.md +72 -0
- package/skills/cm-fix/references/verification-recovery.md +114 -0
- package/skills/cm-idea/SKILL.md +2 -0
- package/skills/cm-idea/references/js-host.md +2 -0
- package/skills/cm-notify/SKILL.md +2 -0
- package/skills/cm-prd/SKILL.md +14 -9
- package/skills/cm-prd/references/brownfield.md +8 -1
- package/skills/cm-prd/references/change-mode.md +8 -1
- package/skills/cm-prd/references/greenfield.md +4 -0
- package/skills/cm-prd/references/js-change-recovery.md +14 -0
- package/skills/cm-prd/references/js-host.md +4 -2
- package/skills/cm-prd/references/spec-self-check.md +5 -1
- package/skills/cm-refactor/SKILL.md +8 -0
- package/skills/cm-refactor/references/js-host.md +2 -0
- package/skills/cm-test/SKILL.md +4 -0
- package/templates/dashboard/dashboard.html +2 -2
- package/templates/pixel/cm-pixel.html +1 -1
- package/templates/pixel/cm-pixel.sh +1 -1
- package/templates/pixel/dev/template.html +1 -1
- package/templates/statusline/cm-statusline.sh +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {test} from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {spawnSync} from 'node:child_process';
|
|
7
|
+
import {cmAiSessionBoundary,cmFixSessionBoundary,openTasks} from '../runtime/js/session-boundary.mjs';
|
|
8
|
+
import {handoffPath,printHandoff,readHandoff,writeHandoff} from '../runtime/js/session-handoff.mjs';
|
|
9
|
+
|
|
10
|
+
const specs=t=>{const root=fs.mkdtempSync(path.join(os.tmpdir(),'cm-boundary-'));t.after(()=>fs.rmSync(root,{recursive:true,force:true}));
|
|
11
|
+
fs.mkdirSync(path.join(root,'1.slug'));return root;};
|
|
12
|
+
const lines=block=>block.split('\n').slice(1);
|
|
13
|
+
|
|
14
|
+
const write=(root,text)=>fs.writeFileSync(path.join(root,'1.slug','tasks.md'),text);
|
|
15
|
+
const boundary=root=>lines(cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug'}));
|
|
16
|
+
|
|
17
|
+
test('cm-ai run_done with every task done says there is nothing next',t=>{
|
|
18
|
+
const root=specs(t);write(root,'- [x] T-001: done\n- [x] T-002: done\n');
|
|
19
|
+
assert.deepEqual(boundary(root),['会话边界:换新会话。','新会话里运行:无,1.slug 的任务已全部完成','原因:本运行已到 run_done,记录都已落盘,下一项是新单元。']);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('open tasks are listed with their full ids, without naming one as the next executable task',t=>{
|
|
23
|
+
const root=specs(t);write(root,'- [x] T-001: done\n- [ ] T-002a: open\n- [ ] T-OBS: observe\n');
|
|
24
|
+
assert.deepEqual(openTasks(root,'1.slug'),['T-002a','T-OBS']);
|
|
25
|
+
assert.equal(boundary(root)[1],'新会话里运行:$cm-ai(1.slug 仍有未完成任务:T-002a、T-OBS)');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('fenced examples and dropped tasks are not open work',t=>{
|
|
29
|
+
// Fences count under the grammar a taskGrammar-2 approval binds; older approvals keep the legacy parse.
|
|
30
|
+
const root=specs(t);fs.writeFileSync(path.join(root,'.cm-specs-status'),JSON.stringify({status:'approved',taskGrammar:2}));write(root,'- [x] T-001: done\n- [ ] T-002: ~~[DROPPED 不做]~~\n```\n- [ ] T-999: example\n```\n');
|
|
31
|
+
assert.deepEqual(openTasks(root,'1.slug'),[]);
|
|
32
|
+
assert.equal(boundary(root)[1],'新会话里运行:无,1.slug 的任务已全部完成');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('an unreadable, empty or invalid task list is "cannot tell", never "all done"',t=>{
|
|
36
|
+
const root=specs(t);
|
|
37
|
+
assert.equal(openTasks(root,'1.slug'),null);
|
|
38
|
+
assert.match(boundary(root)[1],/无法确定/);
|
|
39
|
+
write(root,'');assert.equal(openTasks(root,'1.slug'),null);assert.match(boundary(root)[1],/无法确定/);
|
|
40
|
+
write(root,'- [ ] T-001: a\n- [x] T-001: duplicate\n');assert.equal(openTasks(root,'1.slug'),null);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('the header keeps both exceptions of the judgement table',()=>{
|
|
44
|
+
const header=cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance').split('\n')[0];
|
|
45
|
+
assert.match(header,/会话边界:继续本会话。/);assert.match(header,/会话边界:留在本会话/);assert.match(header,/删掉「新会话里运行」那一行/);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// The real drivers are wired: cm-ai is also covered end to end in cm-ai-drive.test.mjs
|
|
49
|
+
// (run_done prints the block on stderr); cm-fix has no completion fixture, so the
|
|
50
|
+
// wiring is checked statically here.
|
|
51
|
+
test('both drivers pass their session-boundary callback to the shared core',()=>{
|
|
52
|
+
const read=name=>fs.readFileSync(new URL(`./${name}`,import.meta.url),'utf8');
|
|
53
|
+
assert.match(read('cm-ai-drive.mjs'),/sessionBoundary:result=>cmAiSessionBoundary\(result,\{specsDir:definition\.specsDir,feature:definition\.feature,identity:definition\.identity\}\)/);
|
|
54
|
+
assert.match(read('cm-fix-drive.mjs'),/sessionBoundary:\(result,op\)=>cmFixSessionBoundary\(result,op,\{archive,runId:config\.identity\?\.runId\}\)/);
|
|
55
|
+
// A new run (mode:create) prints the previous handoff before the host starts.
|
|
56
|
+
assert.match(read('cm-ai-drive.mjs'),/if\(plan\.mode==='create'\)printHandoff\(definition\.specsDir\);\n driveHost\(/);
|
|
57
|
+
assert.match(read('cm-fix-drive.mjs'),/if\(plan\.mode==='create'\)printHandoff\(archive\);/);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('no verdict before run_done, for another workflow, or for an unfinished fix',()=>{
|
|
61
|
+
assert.equal(cmAiSessionBoundary({workflow:'cm-ai',state:'fixture_completed'},{}),null);
|
|
62
|
+
assert.equal(cmAiSessionBoundary({workflow:'cm-prd',state:'run_done'},{}),null);
|
|
63
|
+
assert.equal(cmFixSessionBoundary({stage:'completed',completionEligible:false},'advance'),null);
|
|
64
|
+
assert.equal(cmFixSessionBoundary({stage:'regression_required'},'advance'),null);
|
|
65
|
+
assert.equal(cmFixSessionBoundary({stage:'completed',completionEligible:true},'status'),null,'a status query is not the closing boundary');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('a finished cm-fix gets the three lines',()=>{
|
|
69
|
+
assert.deepEqual(lines(cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance')),
|
|
70
|
+
['会话边界:换新会话。','新会话里运行:无(有下一个缺陷时,在新会话里运行 $cm-fix)','原因:本缺陷已收口,记录都已落盘。']);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// The shared driver core prints the block to stderr after a final result,
|
|
74
|
+
// keeps stdout a single JSON result, and prints nothing for other results.
|
|
75
|
+
for(const [name,state,expect] of [['prints the verdict at run_done','run_done',true],['stays silent before run_done','fixture_completed',false]]){
|
|
76
|
+
test(`driver core ${name}`,t=>{
|
|
77
|
+
const root=specs(t),host=path.join(root,'host.mjs'),wrapper=path.join(root,'drive.mjs');
|
|
78
|
+
fs.writeFileSync(path.join(root,'1.slug','tasks.md'),'- [x] T-001: done\n');
|
|
79
|
+
fs.writeFileSync(host,`process.stdout.write(JSON.stringify({type:'host_ready',sessionId:'s'})+'\\n');
|
|
80
|
+
let text='';process.stdin.on('data',chunk=>{text+=chunk;let at;while((at=text.indexOf('\\n'))>=0){const line=text.slice(0,at);text=text.slice(at+1);
|
|
81
|
+
if(!line)continue;const row=JSON.parse(line);if(row.requestId==='drive')process.stdout.write(JSON.stringify({requestId:'drive',result:{workflow:'cm-ai',state:${JSON.stringify(state)}}})+'\\n');}});`);
|
|
82
|
+
fs.writeFileSync(wrapper,`import {driveHost} from ${JSON.stringify(new URL('../runtime/js/cm-ai/drive-core.mjs',import.meta.url).href)};
|
|
83
|
+
import {cmAiSessionBoundary} from ${JSON.stringify(new URL('../runtime/js/session-boundary.mjs',import.meta.url).href)};
|
|
84
|
+
driveHost({host:${JSON.stringify(host)},args:[],cwd:${JSON.stringify(root)},operation:'advance',answers:{},answerFor:()=>null,
|
|
85
|
+
sessionBoundary:result=>cmAiSessionBoundary(result,{specsDir:${JSON.stringify(root)},feature:'1.slug'})});`);
|
|
86
|
+
const run=spawnSync(process.execPath,[wrapper],{encoding:'utf8',timeout:10000});
|
|
87
|
+
assert.equal(run.status,0,run.stderr);
|
|
88
|
+
assert.equal(JSON.parse(run.stdout).result.state,state,'stdout stays one JSON result');
|
|
89
|
+
assert.equal(run.stderr.includes('新会话里运行:无,1.slug 的任务已全部完成'),expect,run.stderr);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Session handoff: written at the closing boundary, printed when the next run is created.
|
|
94
|
+
const withReviews=t=>{const root=specs(t);fs.mkdirSync(path.join(root,'.reviews'));return root;};
|
|
95
|
+
const identity={runId:'run-7',taskId:'T-002',repositoryId:'repo'};
|
|
96
|
+
|
|
97
|
+
test('cm-ai run_done writes the handoff with done, open tasks and the next command, and names it in the verdict',t=>{
|
|
98
|
+
const root=withReviews(t);write(root,'- [x] T-001: done\n- [x] T-002: done\n- [ ] T-003: open\n');
|
|
99
|
+
const block=cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug',identity});
|
|
100
|
+
assert.equal(lines(block)[3],`交接摘要:${handoffPath(root)}(新会话开新运行时驾驶员会先打印它)`);
|
|
101
|
+
const text=fs.readFileSync(handoffPath(root),'utf8');
|
|
102
|
+
assert.match(text,/运行编号:run-7/);assert.match(text,/## 已做\n- 1\.slug T-002:已到 run_done/);
|
|
103
|
+
assert.match(text,/## 待做\n- 1\.slug T-003\n/);assert.match(text,/## 下一条命令\n- \$cm-ai(1\.slug 仍有未完成任务:T-003)/);
|
|
104
|
+
assert.doesNotMatch(text,/repo/,'no identity beyond the run id is written');
|
|
105
|
+
assert.deepEqual(fs.readdirSync(path.join(root,'.reviews')),['session-handoff.md'],'no temporary file is left behind');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('an unreadable task list is written as "cannot tell", never as nothing left',t=>{
|
|
109
|
+
const root=withReviews(t);
|
|
110
|
+
cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug',identity});
|
|
111
|
+
assert.match(fs.readFileSync(handoffPath(root),'utf8'),/## 待做\n- 无法确定/);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('a handoff that cannot be written is reported in the verdict, not swallowed, and the verdict still prints',t=>{
|
|
115
|
+
const root=specs(t);write(root,'- [x] T-001: done\n');
|
|
116
|
+
const block=cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug',identity});
|
|
117
|
+
assert.equal(lines(block)[0],'会话边界:换新会话。');
|
|
118
|
+
assert.match(lines(block)[3],/^交接摘要:未写成(ENOENT)/);
|
|
119
|
+
assert.equal(fs.existsSync(path.join(root,'.reviews')),false,'the records directory is not invented');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('no handoff and no extra line when the caller passes no identity or archive',t=>{
|
|
123
|
+
const root=withReviews(t);write(root,'- [x] T-001: done\n');
|
|
124
|
+
assert.equal(lines(cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug'})).length,3);
|
|
125
|
+
assert.equal(lines(cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance')).length,3);
|
|
126
|
+
assert.equal(fs.existsSync(handoffPath(root)),false);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('a finished cm-fix writes its handoff; an unfinished one or a status query writes nothing',t=>{
|
|
130
|
+
const root=withReviews(t);
|
|
131
|
+
assert.equal(cmFixSessionBoundary({stage:'regression_required'},'advance',{archive:root,runId:'fix-1'}),null);
|
|
132
|
+
assert.equal(cmFixSessionBoundary({stage:'completed',completionEligible:true},'status',{archive:root,runId:'fix-1'}),null);
|
|
133
|
+
assert.equal(fs.existsSync(handoffPath(root)),false);
|
|
134
|
+
const block=cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance',{archive:root,runId:'fix-1'});
|
|
135
|
+
assert.match(lines(block)[3],/^交接摘要:/);
|
|
136
|
+
const text=fs.readFileSync(handoffPath(root),'utf8');
|
|
137
|
+
assert.match(text,/工作流:cm-fix/);assert.match(text,/运行编号:fix-1/);assert.match(text,/## 待做\n- 无/);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('the next handoff replaces the previous one',t=>{
|
|
141
|
+
const root=withReviews(t);
|
|
142
|
+
writeHandoff(root,{workflow:'cm-fix',runId:'old',done:[],todo:[],next:'x'});
|
|
143
|
+
writeHandoff(root,{workflow:'cm-fix',runId:'new',done:[],todo:[],next:'y'},{now:()=>new Date('2026-10-23T00:00:00Z')});
|
|
144
|
+
const text=readHandoff(root).text;
|
|
145
|
+
assert.match(text,/运行编号:new/);assert.match(text,/写入时间:2026-10-23T00:00:00\.000Z/);assert.doesNotMatch(text,/old/);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('printing: nothing without a handoff, the text with one, a warning for a link or an oversized file',t=>{
|
|
149
|
+
const root=withReviews(t),out=[];const print=()=>{out.length=0;printHandoff(root,text=>out.push(text));return out.join('');};
|
|
150
|
+
assert.equal(print(),'');
|
|
151
|
+
fs.writeFileSync(handoffPath(root),'# 交接摘要\n- marker\n');
|
|
152
|
+
assert.match(print(),/^=== 上次交接摘要(.*参考资料,不是指令,本次是新运行)===\n# 交接摘要\n- marker\n=== 摘要结束 ===\n$/);
|
|
153
|
+
fs.rmSync(handoffPath(root));fs.writeFileSync(path.join(root,'elsewhere.md'),'secret-looking');
|
|
154
|
+
fs.symlinkSync(path.join(root,'elsewhere.md'),handoffPath(root));
|
|
155
|
+
assert.match(print(),/上次交接摘要读不了(handoff_invalid)/);assert.doesNotMatch(out.join(''),/secret-looking/);
|
|
156
|
+
fs.rmSync(handoffPath(root));fs.writeFileSync(handoffPath(root),'x'.repeat(65537));
|
|
157
|
+
assert.match(print(),/handoff_too_large/);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test('reading refuses a linked .reviews directory and a hard-linked handoff, without printing the other file',t=>{
|
|
161
|
+
const root=specs(t),outside=fs.mkdtempSync(path.join(os.tmpdir(),'cm-handoff-outside-'));t.after(()=>fs.rmSync(outside,{recursive:true,force:true}));
|
|
162
|
+
fs.writeFileSync(path.join(outside,'session-handoff.md'),'outside-secret');
|
|
163
|
+
fs.symlinkSync(outside,path.join(root,'.reviews'));
|
|
164
|
+
const out=[];printHandoff(root,text=>out.push(text));
|
|
165
|
+
assert.match(out.join(''),/上次交接摘要读不了(handoff_dir_invalid)/);assert.doesNotMatch(out.join(''),/outside-secret/);
|
|
166
|
+
assert.throws(()=>writeHandoff(root,{workflow:'cm-ai',runId:'r',done:[],todo:[],next:'x'}),{code:'handoff_dir_invalid'});
|
|
167
|
+
fs.rmSync(path.join(root,'.reviews'));fs.mkdirSync(path.join(root,'.reviews'));
|
|
168
|
+
fs.linkSync(path.join(outside,'session-handoff.md'),handoffPath(root));
|
|
169
|
+
assert.throws(()=>readHandoff(root),{code:'handoff_invalid'});
|
|
170
|
+
});
|
|
@@ -60,7 +60,16 @@ def main():
|
|
|
60
60
|
# Include spaces to catch unsafe shell/path forwarding.
|
|
61
61
|
unpack = temp / 'npm package'
|
|
62
62
|
unpack.mkdir()
|
|
63
|
-
|
|
63
|
+
# Every npm call uses a disposable cache, logs and config, never the real ~/.npm or ~/.npmrc.
|
|
64
|
+
(temp / 'npmrc').write_text('')
|
|
65
|
+
(temp / 'global-npmrc').write_text('')
|
|
66
|
+
npm_env = {**os.environ, 'npm_config_cache': str(temp / 'npm-cache'),
|
|
67
|
+
'npm_config_logs_dir': str(temp / 'npm-logs'),
|
|
68
|
+
'npm_config_userconfig': str(temp / 'npmrc'),
|
|
69
|
+
'npm_config_globalconfig': str(temp / 'global-npmrc'),
|
|
70
|
+
'npm_config_update_notifier': 'false'}
|
|
71
|
+
info = json.loads(run(['npm', 'pack', '--ignore-scripts', '--json', '--pack-destination', str(temp)],
|
|
72
|
+
env=npm_env))[0]
|
|
64
73
|
archive = temp / info['filename']
|
|
65
74
|
packed_paths = {f['path'] for f in info['files']}
|
|
66
75
|
assert {'.codex-plugin/plugin.json', 'install-codex.sh', 'install.sh', 'install.ps1',
|
|
@@ -75,7 +84,7 @@ def main():
|
|
|
75
84
|
outside = temp / 'unrelated project'
|
|
76
85
|
outside.mkdir()
|
|
77
86
|
help_text = run(['npm', 'exec', '--offline', '--yes', '--cache', str(temp / 'npm-cache'),
|
|
78
|
-
'--package', str(archive), '--', 'cm-workflow', '--help'], cwd=outside)
|
|
87
|
+
'--package', str(archive), '--', 'cm-workflow', '--help'], cwd=outside, env=npm_env)
|
|
79
88
|
assert 'Usage: cm-workflow install' in help_text, help_text
|
|
80
89
|
(outside / 'tasks.md').write_text('T-001 remains pending\n')
|
|
81
90
|
project_before = tree(outside)
|
|
@@ -97,8 +106,10 @@ with pathlib.Path(os.environ['CM_NPM_FIXTURE_CALLS']).open('a') as out:
|
|
|
97
106
|
sys.exit(17 if os.environ.get('CM_NPM_FIXTURE_FAIL') == '1' else 0)
|
|
98
107
|
''')
|
|
99
108
|
fake.chmod(0o755)
|
|
109
|
+
# The relocated installer really runs; the companion-skill download must stay off so
|
|
110
|
+
# nothing reaches the network or the real skills directories (covered offline elsewhere).
|
|
100
111
|
env = {**os.environ, 'PATH': str(bin_dir) + os.pathsep + os.environ['PATH'],
|
|
101
|
-
'CM_NPM_FIXTURE_CALLS': str(temp / 'calls.jsonl')}
|
|
112
|
+
'CM_NPM_FIXTURE_CALLS': str(temp / 'calls.jsonl'), 'CM_MATT_SKILLS_INSTALL': 'off'}
|
|
102
113
|
# The shipped Node entry still chooses the original script and arguments.
|
|
103
114
|
# Its injected subprocess executes only our relocated fixture copy.
|
|
104
115
|
bridge = temp / 'entry-fixture.mjs'
|
|
@@ -7,6 +7,8 @@ TMP_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/cm-shell-compat.XXXXXX")"
|
|
|
7
7
|
trap 'rm -rf "$TMP_ROOT"' EXIT HUP INT TERM
|
|
8
8
|
FAILURES=0
|
|
9
9
|
export CM_WORKFLOW_HOME="$TMP_ROOT/user-config"
|
|
10
|
+
# The companion-skill download is covered offline by cm-matt-skills.test.mjs; installers here stay off the network.
|
|
11
|
+
export CM_MATT_SKILLS_INSTALL=off
|
|
10
12
|
|
|
11
13
|
fail() {
|
|
12
14
|
echo "FAIL: $*" >&2
|
|
@@ -11,6 +11,7 @@ from pathlib import Path
|
|
|
11
11
|
|
|
12
12
|
ROOT = Path(__file__).resolve().parent.parent
|
|
13
13
|
CORE_SKILLS = (
|
|
14
|
+
"cm-challenge",
|
|
14
15
|
"cm-idea",
|
|
15
16
|
"cm-init",
|
|
16
17
|
"cm-prd",
|
|
@@ -101,6 +102,9 @@ REQUIRED = (
|
|
|
101
102
|
"scripts/cm-runtime.test.mjs",
|
|
102
103
|
"scripts/cm-notify.mjs",
|
|
103
104
|
"scripts/cm-notify-command.test.mjs",
|
|
105
|
+
"scripts/cm-autonomy.mjs",
|
|
106
|
+
"scripts/cm-autonomy.test.mjs",
|
|
107
|
+
"runtime/js/autonomy.mjs",
|
|
104
108
|
"runtime/js/notify-send.mjs",
|
|
105
109
|
"scripts/cm-workflow-config.mjs",
|
|
106
110
|
"scripts/cm-workflow-config.test.mjs",
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import {fileURLToPath} from 'node:url';
|
|
6
|
+
import {isTaskId} from '../runtime/js/spec-task-line.mjs';
|
|
6
7
|
|
|
7
8
|
const CASE_ID=/^TC-(\d{3,})$/;
|
|
8
9
|
const FEATURE=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
9
|
-
const REF_IDS={acIds:/^AC-\d{3,}
|
|
10
|
+
const REF_IDS={acIds:/^AC-\d{3,}$/};
|
|
10
11
|
const CASE_FIELDS=new Set(['id','origin','kind','blocking','acIds','taskIds','title','preconditions','steps','expected','cleanup']);
|
|
11
12
|
const STRING_LISTS=['acIds','taskIds','preconditions','steps','expected','cleanup'];
|
|
12
13
|
const pythonRepr=value=>`'${value.replaceAll('\\','\\\\').replaceAll("'","\\'")}'`;
|
|
@@ -18,7 +19,7 @@ function validateStringList(item,field,index,failures){
|
|
|
18
19
|
}
|
|
19
20
|
if(['steps','expected'].includes(field)&&value.length===0)failures.push(`cases[${index}].${field} must not be empty`);
|
|
20
21
|
const pattern=REF_IDS[field];
|
|
21
|
-
if(pattern)for(const entry of value)if(
|
|
22
|
+
if(pattern||field==='taskIds')for(const entry of value)if(field==='taskIds'?!isTaskId(entry):!pattern.test(entry))
|
|
22
23
|
failures.push(`cases[${index}].${field} has invalid id: ${pythonRepr(entry)}`);
|
|
23
24
|
}
|
|
24
25
|
|
package/skills/cm-ai/SKILL.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cm-ai
|
|
3
3
|
description: 用户明确说“规格已确认,开始实现”或要求按已审批 CM specs 开发时使用。新任务默认由 JS workflow 驱动 N1-N8,完成开发、独立审查、QA 与文档同步;模糊点子、未审规格和单独一句“继续”不能触发编码批准。
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash(node ~/.claude/scripts/cm-ai-drive.mjs *)
|
|
6
|
+
- Bash(node ~/.claude/scripts/cm-ai-batch-drive.mjs *)
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
# cm-ai — 自动开发
|
|
@@ -113,7 +116,7 @@ detail 用一句大白话;不直接拼 JSON,避免跨会话格式漂移。
|
|
|
113
116
|
测试/审查/外部回答只写专项凭证,不灌主日志。长步骤和临时资源严格按
|
|
114
117
|
`runtime/logging.md` 配对,禁止用后台心跳制造虚假活跃。
|
|
115
118
|
|
|
116
|
-
**会话边界(省 token):** 单任务运行以 `run_done`
|
|
119
|
+
**会话边界(省 token):** 单任务运行以 `run_done` 收尾时,按 `runtime/model-efficiency.md`「Session boundary」的判断表给出结论;批次只在整批结束后给。驾驶员同时把已做、待做与下一条命令写进 `{SPECS_DIR}/.reviews/session-handoff.md`,结论多一行「交接摘要:…」;新会话建运行(`mode:create`)时驾驶员先打印它,只作参考,不续接旧运行、不带授权。换新会话时,新会话作为新运行的 `--host-context`;单任务运行中途换会话按 `--original-host-context` 规则接手。不得为换会话改写记录、跳过审查或重置授权。
|
|
117
120
|
|
|
118
121
|
**角色路由投影:** N1 用代码项目根读取有效配置;N3 每个实现任务解析 `coder`,N3
|
|
119
122
|
任务检查解析 `tester`,N4 解析 `reviewer`,并在 N6 QA 解析 `tester`。使用:
|
|
@@ -140,4 +143,4 @@ node {CM_WORKFLOW_ROOT}/scripts/cm-workflow-config.mjs \
|
|
|
140
143
|
|
|
141
144
|
**任务状态镜像:** `tasks.md` 是唯一权威任务源。运行时支持任务面板时,可将未完成任务镜像到 Codex/OMX 计划或 Claude 任务清单;N3/N5 同步状态。断点恢复必须由磁盘重建镜像:`[x]` 跳过或标为 completed,`[DROPPED]` 不镜像,不得重复创建条目。
|
|
142
145
|
|
|
143
|
-
**执行策略:** 遵守 `runtime/orchestration.md
|
|
146
|
+
**执行策略:** 遵守 `runtime/orchestration.md`。单代码根默认先用 `cm-ai-batch-plan.mjs` 按已批准 `tasks.md` 生成批次:默认每个任务都在自己的 worktree 里开发、做完按任务顺序合回主目录;无依赖、`- 范围:` 不重叠的任务同组并行。功能最后一个任务、批次最后执行的任务和 `- 设备: 需要` 的任务留在主目录串行;功能有浏览器等交互式验收用例、主目录项目配置文件与当前提交里的不一致(未跟踪或本地改动被藏起来)、或任务可能在中途触发固定检查点 QA(命中工作流登记的关键路径或可能成为连续第 5 个未 QA 任务;生成时用 `--workflow-config` 传入关键路径)时不单独开 worktree(同组并行不受影响);任何任务没写范围或是脚手架功能时整个功能串行。单独进 worktree 的任务照常按固定检查点判定 QA,触发就在它的 worktree 里跑、通过才合回,失败时批次以 `batch_solo_qa_failed` 停下并给出合并分支、`/cm-fix` 修复、新批次继续的出口;只有 2 人及以上同组并行的任务 QA 延后到功能末任务统一跑。项目 `parallel.worktree_all: false` 只保留真正的并行组,`parallel.enabled: false` 不建任何 worktree。
|
|
@@ -98,7 +98,7 @@ node {CM_WORKFLOW_ROOT}/scripts/cm-task-gate.mjs capture-baseline \
|
|
|
98
98
|
若这是全部 feature 的最后一个待完成任务,在定稿 handoff 前调用 `cm-doc-syncer`
|
|
99
99
|
同步项目文档,并按 `../../codebase-context/references/writeback.md` 增量更新业务地图
|
|
100
100
|
(不存在时建最小局部地图,项目指定文档优先);仅修改本任务事先批准的文档范围,
|
|
101
|
-
|
|
101
|
+
缺范围先走规格变更批准(按 `js-host.md` 开头的一次确认,不另问是否走变更),不自动扩 scope。文档与代码一起检查、定稿并交给 N4 审查。
|
|
102
102
|
项目指令仍由主执行者按原权限及 Learning 合同处理,不向开发子 agent 开放受保护目录。
|
|
103
103
|
JS 宿主可通过 `execution.documentationSync` 接入此步骤,写入处于原持久开发调用内;
|
|
104
104
|
重启中的未知调用不得重发。最后任务是否成立必须核对所有 feature,不能只看当前 feature。
|
|
@@ -80,7 +80,8 @@ scope:
|
|
|
80
80
|
|
|
81
81
|
`attempt` 必须等于 `round`,`handoff` 必须指向本轮 N3 的执行证据,
|
|
82
82
|
`handoff_sha256` 必须逐字使用 `check-n4` 的输出。`scope` 必须逐项覆盖 handoff
|
|
83
|
-
里的全部 `changed_files`;正文必须写实际 findings
|
|
83
|
+
里的全部 `changed_files`;正文必须写实际 findings 或明确的「零发现」(门禁认可的全部说法见 `runtime/review.md`)。
|
|
84
|
+
`reviewer` 只原样写一个允许值,模型等说明写进正文;零阻塞结论必须写在正文第一行、顶格、整行只写结论,例如「结论:零阻塞发现。」。手写凭证由审查方完整产出、主执行者原样保存;门禁报格式错时交回审查方重出,不自行改写。宿主按已绑定审查结果生成的凭证不在此列,但同样不得改结论。
|
|
84
85
|
`approved` 必须写 `blocking_findings: 0`;其他 verdict 至少为 1。
|
|
85
86
|
`self-degraded` 必须写 `independent: false`,并用非空 `degraded_reason` 记录所选独立
|
|
86
87
|
通道为何不可用。
|
|
@@ -66,7 +66,9 @@ taskIds 全部是 `[DROPPED]` 任务的用例(blocking 与否)不适用:
|
|
|
66
66
|
|
|
67
67
|
本版本不输出 `docs_only` 或类型定义专属理由;会话自报不能证明这类条件。
|
|
68
68
|
每个任务均写 `qa` 事件,detail 为 `触发:{reason}` / `跳过:{reason}` / `阻塞:{reason}`,不可静默跳过。
|
|
69
|
-
|
|
69
|
+
并行成员(2 人及以上同组开发)沿用原 `parallel_member_deferred` 延后合同,新行同样为 `score: null`;合并后末任务触发 feature QA。
|
|
70
|
+
单独在 worktree 开发的 1 人组成员不适用该延后,按上表固定必跑点判定,触发时在其 worktree 执行,通过后才合并。批次没有 QA 修复出口,
|
|
71
|
+
生成器与宿主用本表规则预先把可能触发的任务留在主目录;预测落空且 QA 失败时批次停在 `batch_solo_qa_failed`(见 docs/js-workflow-control.md「1 人组」)。
|
|
70
72
|
旧整数行继续按原 4–20 范围与状态约束读取;旧日志和旧 METRICS 不改写,已绑定决策不重新裁决。三种 status 的新行均可使用 null,不新增运行协议号。
|
|
71
73
|
|
|
72
74
|
## 触发格式
|
|
@@ -93,6 +93,20 @@ staging/体验版验证。
|
|
|
93
93
|
|
|
94
94
|
**成本落盘(灰度门槛「单任务成本 < 人工工时」的数据源)**:如果当前 Codex/Claude 界面提供 usage 或会话费用,将总费用与总耗时写入 `{SPECS_DIR}/度量汇总.md`(`成本: ${x} / {N} 任务 ≈ ${x/N} 每任务`);无法获得就标注 `成本: 未采集`,不许编造。
|
|
95
95
|
|
|
96
|
+
## 3.5 复盘提示
|
|
97
|
+
|
|
98
|
+
写完 `run_done` 后运行 `node "{CM_WORKFLOW_ROOT}/scripts/cm-matt-skills.mjs" status`(只读,不装)。
|
|
99
|
+
先判命令结果,再判状态,写成总结里的 `🔁 复盘` 行。固定命令指
|
|
100
|
+
`node "{CM_WORKFLOW_ROOT}/scripts/cm-matt-skills.mjs" install`;「输出里的安装命令」指 `recommended skills install` 那一行里的命令,没有这一行就用固定命令。
|
|
101
|
+
1. 命令没跑起来、退出码非 0、或输出里没有当前运行时的 `recommended skills [claude|codex] N/M author versions` 行
|
|
102
|
+
→「无法确认作者版 `retro` 状态;可选安装:{固定命令}」。
|
|
103
|
+
2. 命令正常,再看当前运行时下有没有 `retro:` 状态行:
|
|
104
|
+
- 没有(即已装作者版)→「可运行 `/retro`(Codex `$retro`)看这一轮哪些错该交给脚本拦、哪些该写进指引」;
|
|
105
|
+
- `retro: missing` 或 `retro: same name, different content` →「未装作者版 `retro`;可选安装:{输出里的安装命令}」;
|
|
106
|
+
- `retro: cannot be read` →「无法确认作者版 `retro` 状态;可选安装:{输出里的安装命令}」。
|
|
107
|
+
只提示,不运行 `retro`,不代为安装,不读取作者技能内容;该行不影响完成状态和 `run_done`。
|
|
108
|
+
`runtime/project-learning.md` 已借鉴它「机械性错误交给脚本」的分类,`retro` 是面向整个环境的全量版本。
|
|
109
|
+
|
|
96
110
|
## 4. 输出总结
|
|
97
111
|
|
|
98
112
|
```text
|
|
@@ -103,8 +117,16 @@ staging/体验版验证。
|
|
|
103
117
|
📝 文档同步: 已完成
|
|
104
118
|
🔎 收尾核对: {按原结果附六行报告,或未完成原因/已关闭;不能据此代替 Review/QA}
|
|
105
119
|
🚀 生产发布待决清单: 已编制,等待人工决策
|
|
120
|
+
🔁 复盘: {按 3.5 的结果写一行}
|
|
106
121
|
|
|
107
122
|
各 Feature 摘要:
|
|
108
123
|
- 1.{name}: {N} 个任务 ✅ (发布验证: {staging/体验版已验证 | 未执行/待人工 | 不适用})
|
|
109
124
|
- 2.{name}: {N} 个任务 ✅ (发布验证: {staging/体验版已验证 | 未执行/待人工 | 不适用})
|
|
125
|
+
|
|
126
|
+
会话边界:换新会话。
|
|
127
|
+
新会话里运行:{下一个单任务或 feature 的 $cm-ai 入口;没有下一项时写「无,本轮已全部完成」}
|
|
128
|
+
原因:{一句话,例如「本运行记录已全部落盘,下一项是新单元」}
|
|
110
129
|
```
|
|
130
|
+
|
|
131
|
+
最后三行是会话边界结论,每次都输出,批次只在整批结束后输出。按顺序取首个命中:用户还要在本会话讨论本次结果 → 结论行改为 `会话边界:继续本会话。`;用户拒绝换会话或宿主开不了新会话 → 改为 `会话边界:留在本会话({原因})。`;其余用上面的默认三行。前两种只删「新会话里运行」那一行,保留「原因」行。JS 驾驶员还会多打一行「交接摘要:…」,一并原样放在最后。
|
|
132
|
+
判断表见 `runtime/model-efficiency.md`「Session boundary」。走 JS 驾驶员时,驾驶员在 `run_done` 后把默认三行打印到标准错误输出;默认分支原样放在回复最后,例外分支按上面规则改写。
|
|
@@ -26,7 +26,7 @@ QA 修复子操作使用原已配置 `qaFix:"manual"|"auto"`;先 fix_status
|
|
|
26
26
|
|
|
27
27
|
## 补挂 QA
|
|
28
28
|
|
|
29
|
-
**v2:** 不能靠补挂把冻结的 qa:disabled 改为 qa:run,也不能用 legacy
|
|
29
|
+
**v2:** 不能靠补挂把冻结的 qa:disabled 改为 qa:run,也不能用 legacy 权限绕开策略/配置指纹。没给 `--workflow-config` 的 v2 运行也有 `qa_assess` 判定;本修复前创建的这类运行恢复时按原样打开,仍会停在 `qa_decision_required`,只能按「卡死任务重开」用新 runId 重做。没有可用 QA 配置/执行能力时保留 qa_triggered 或具体准入阻断,报告当前缺口;本轮未提供切换策略的补挂恢复入口。下面一次性附加步骤仅用于 legacy 的原运行。
|
|
30
30
|
|
|
31
31
|
legacy:原无workflow或`qa:null`且任务已为`fixture_completed`时,可在`--mode resume`显式提供
|
|
32
32
|
含QA的`--workflow-config`与`--allow-qa`,一次性附加N6;原definition/scope/requirements/identity、
|
|
@@ -14,8 +14,8 @@ N6 新决定按固定检查点和 `qa.criticalPaths` 登记匹配;`qa_assess`
|
|
|
14
14
|
|
|
15
15
|
| v2 恢复类型 | 取得与携带目标 |
|
|
16
16
|
| --- | --- |
|
|
17
|
-
| 单任务 `develop_redo`、`abandon_review`、`abandon_effect`、`bootstrap_review_recover`、可用的 `reconcile_review` | 先只读 `status`;将原完整 `controlTarget` 放进请求/PLAN 的 `expectedControl` |
|
|
18
|
-
| 单任务规格换绑、QA
|
|
17
|
+
| 单任务 `develop_redo`、`abandon_review`、`abandon_effect`、`bootstrap_review_recover`、`completion_rework`、可用的 `reconcile_review` | 先只读 `status`;将原完整 `controlTarget` 放进请求/PLAN 的 `expectedControl` |
|
|
18
|
+
| 单任务规格换绑、QA 重跑、QA 配置修订、范围追加与一次开发续次 | 将原 `status.launchControlTarget` 保存到普通 JSON 文件;启动加 `--expected-control FILE`,不能使用 wire target 代替 |
|
|
19
19
|
| 批次当前成员的 wire 恢复 | 原批次 `status.controlTarget` 完整对象作为 `expectedControl`;带原 `taskKey`,不自行拼 member |
|
|
20
20
|
| QA 修复子操作 | 先 `fix_status`;使用含 `child` 的完整 target,父 status 不提供 child |
|
|
21
21
|
|
|
@@ -90,12 +90,19 @@ requirements 与树中全部 AGENTS.md 正文)合计超过 2 MiB 或 256 个
|
|
|
90
90
|
|
|
91
91
|
- `blocked/check_answer_missing`、`blocked/check_answer_invalid`(`pendingAction=resume`):开发已交付并写回 Learning,之后的检查或验证预检超时、断开、迟到或答复格式不合格(旧记录 `unknown/call_timeout`、`execution_error`、`invalid_input` 等,最后一次开发调用 `succeeded`)。
|
|
92
92
|
先确认上一次检查命令已停止,再 `--mode resume` 后 `advance`:宿主追加 `develop-recheck` 记录,用新 effect id 只重跑检查、验证预检、handoff 与审查包,沿用原交付的 Learning 输入,不重发开发、不占开发调用与 effect 名额,重新划定检查新建文件。
|
|
93
|
+
同宿主的合法 `develop-recheck`/`complete-recheck` 使用新取消 signal;重查中的用户取消仍写入原 control 记录并终止检查。旧 `unknown/cancelled` 仅在完整 journal 证明 `unknown/call_timeout → develop-recheck → 检查取消`、原开发调用和 Learning 完全未变、没有用户取消/Review/pending/provider 时投影为此检查重查;仍合计最多 2 次,不改旧记录。旧记录没有保存超时后完整代码快照;恢复沿用原 scope、基线及交付身份合同,由当前检查和审查验证当前代码。
|
|
93
94
|
- `blocked/develop_out_of_scope`(`pendingAction=resume`):开发已交付并写回 Learning,但建 handoff 或审查包时发现改动超出任务 scope(旧记录 `unknown/out_of_scope`,不只是检查新建的文件)。reason 列出路径。这些可能是会话越界写的,也可能是你自己的改动:还原或移出代码根(确需改动先走规格变更扩大 scope),再 `--mode resume` 后 `advance`:宿主追加 `develop-recheck`(`code: develop_out_of_scope`),只重跑检查、预检、handoff 与审查包,不重发开发、不占名额,每运行最多 2 次。
|
|
94
95
|
- `blocked/develop_answer_missing`,`pendingAction=develop_redo`:当前会话开发(非受保护、非 provider、非规则 bootstrap)的应答没拿到——超时后代码根已变化或起点无法核对(`unknown/call_timeout`)、会话断开或应答形状错(`unknown/unknown`、旧 `execution_error`)、只回了 `failed` 没有结果(`blocked/failed`)。
|
|
95
96
|
会话可能仍在写文件,宿主看不到,所以 `advance` 不会重发。先确认会话已停止修改代码,再按原协议恢复(legacy 为 `--mode resume --allow-develop-redo`;v2 为上文固定 wire target)启动并发送 `develop_redo`(单行 reason,最多 500 UTF-8 字节,写进 `develop-answer-redo` 记录);之后 status 为 `pendingAction=resume`,`advance` 用新 effect id 重发本轮开发。
|
|
96
97
|
盘上改动保留;审查包始终对照本运行创建时拍下的任务基线(重发时不重拍),所以丢失应答期间写入的内容都会进检查与独立审查。不占调用与 effect 名额,每运行最多 2 次;受保护模式下代码根变化可能是半写入,不走此出口。
|
|
97
98
|
- provider 开发(Codex 直写、Claude 提案由宿主应用)结果不明——`unknown/call_timeout`、`unknown/unknown`、提案未通过本地校验的 `blocked/failed`(`invalid_result`)、启动失败或报告失败的 `blocked/unavailable`——同样显示 `blocked/develop_answer_missing`、`pendingAction=develop_redo`,但只限新版本记了 worker 进程身份(`workerJournal` + `develop-worker`)的 effect。
|
|
98
99
|
发送 `develop_redo` 时宿主按记录核对进程组(含应用提案的子进程);Claude provider 还要代码根仍等于本轮起点(记 `basis`,否则 `develop_redo_root_changed`):已退出(或从未启动)才写 `develop-answer-redo`(带 `worker` 绑定);仍在运行拒绝为 `develop_redo_worker_process_alive`,核对不了拒绝为 `develop_redo_worker_process_unknown`,没记身份拒绝为 `develop_redo_worker_identity_unrecorded`。不带原因的 `blocked` 答复仍是终态,不走此出口。
|
|
100
|
+
provider 开发进程碰到 API 错误时只记类别,不存原始报错:Claude CLI 的合成 assistant 错误消息按错误类别记为 `developer_rate_limited`(`rate_limit`)、
|
|
101
|
+
`developer_server_error`(`server_error`,含 529 过载)、`developer_auth_failed`、`developer_billing_error`、`developer_model_not_found`,其他为 `developer_api_error`;
|
|
102
|
+
Codex 开发进程失败轮次的文字里有 429/Too Many Requests/rate limit 时记为 `developer_rate_limited`,其余仍为 `provider_failed`。终态状态不变(`unknown`),
|
|
103
|
+
所以停点仍是上面的 `develop_answer_missing`/`develop_redo`;结果另带 `failureCode` 和结构化字段 `developFailure`(同一类别)。
|
|
104
|
+
驾驶员**不自动重试**开发限流:重做必须由人带 `--allow-develop-redo` 发送 `develop_redo`(v2 为固定 `expectedControl`),并由宿主核对旧开发进程已退出,
|
|
105
|
+
自动发送等于替人授权。推送立即发出,「你要做」写成「开发进程被限流(429):过一刻钟后回到会话「X」,授权它重做这一轮开发」。
|
|
99
106
|
- `blocked/develop_dispatch_failed`(`pendingAction=resume`):开发请求在派发给会话之前就失败了——宿主自己的角色路由出错(运行日志写不进 `role_log_failed`、工作流角色配置无效 `invalid_workflow_config`),开发调用没有结果、没有派发、没有写盘。
|
|
100
107
|
修好 reason 指出的宿主环境后 `--mode resume` 再 `advance`:宿主追加 `develop-dispatch-retry` 记录,用新 effect id 重发本轮开发,不占名额,每运行最多 2 次。
|
|
101
108
|
每次重发前(含写下记录后宿主退出、恢复再发)都核对代码根仍等于本轮起点(第 1 轮为任务基线,第 2 轮为已审第 1 轮包);起点无法核对或代码根已变,改走上一条 `develop_redo` 确认重发,派发时拒绝为 `develop_dispatch_root_changed`。用满 2 次后同样改走 `develop_redo`。
|
|
@@ -167,6 +174,40 @@ Claude 诊断只做回环请求捕获,`stopped_by_probe` 表示诊断自身终
|
|
|
167
174
|
其他 API 错误 `reviewer_api_error`、进程报告失败 `reviewer_provider_failed`、没有 init 或无法识别的事件
|
|
168
175
|
`reviewer_stream_unrecognized`、没有结论就退出 `reviewer_exited`),记录新的 `failed` 结果并停在
|
|
169
176
|
`pending_review/review_provider_failed`,`reason` 以类别开头并写明先登录还是等待;处理后按超时同样的方式恢复重派。
|
|
177
|
+
结果另带结构化字段 `reviewFailure`(同一类别,如 `reviewer_rate_limited`),驾驶员和提醒按它判断,不解析 `reason` 文字。
|
|
178
|
+
Codex 审查返回 429/Too Many Requests/rate limit 时同样记为 `reviewer_rate_limited`(只记类别,不存原始报错)。
|
|
179
|
+
|
|
180
|
+
**审查被限流时自动等待重试**:单任务驾驶员 `cm-ai-drive.mjs` 的 `advance`、`decision` 和批次驾驶员 `cm-ai-batch-drive.mjs` 的 `advance` 会自动重试(`resume` 只报告状态、不派发审查)。批次的做法见本段末尾。
|
|
181
|
+
单任务驾驶员拿到 `pending_review/review_provider_failed`、`reviewFailure: reviewer_rate_limited`、`pendingAction: resume`
|
|
182
|
+
且结果带 `reviewInvocationId`(失败那次审查调用)时,不打印这次结果、不推送,在 stderr 写一行「审查被限流……后在原运行自动重派审查(第 n/3 次)」。
|
|
183
|
+
开始等待时冻结前置条件:PLAN 文件字节的 SHA-256、`identity`(`repositoryId`/`runId`/`taskId`/`attempt`)、`packageDigest`、`reviewInvocationId`。
|
|
184
|
+
到点先比 PLAN 字节(变了就不发任何操作,打印「状态已变,未自动重试」和原结果,按平常规则判断推送);
|
|
185
|
+
再用同一 PLAN 以 `resume` 模式(create 的 PLAN 自动改为 resume,`originalHostContext` 取 `hostContext`)重跑驾驶员,
|
|
186
|
+
但请求**一律是 `decision`**,带冻结的 `identity`、`packageDigest` 和 `expectedReviewStop:{invocationId}`,而不是原来的 `advance`。
|
|
187
|
+
宿主在持有该运行写锁的同一个处理入口里先核对:同一轮 `identity`、同一审查包、同一次失败的审查调用,且仍停在
|
|
188
|
+
`pending_review/review_provider_failed/reviewer_rate_limited/resume`;任一不符就返回 `outcome: rejected`、`staleRetry: true`
|
|
189
|
+
(`reason` 以「状态已变,未自动重试」开头),不派发任何 effect,驾驶员也不推送;相符才派发这一次审查(与原来的自动重派同一个 effect),
|
|
190
|
+
不继续走通用推进(审查通过后停在 `approved`,由会话发下一步)。重跑缺少冻结前置条件、或读到的 PLAN 字节不同时直接退出 2。
|
|
191
|
+
重试次数只在真的重跑时增加;stdout 只输出重跑的结果,退出码也取重跑的。默认依次等 15、10、5 分钟,最多 3 次、合计 30 分钟(`CM_DRIVE_RATE_LIMIT_DELAYS_MS`
|
|
192
|
+
可写逗号分隔的毫秒数,1–3 项、合计不超过 1800000,否则用默认值)。重跑走的就是本节的自动重派:不算审查轮次,
|
|
193
|
+
不发送 `abandon_review`,不加任何授权参数;同一轮第二次限流按下文停在 `blocked`(`pendingAction: abandon_review`),
|
|
194
|
+
驾驶员不再重试,把结果原样返回并立即推送,动作按真实出口写:要你确认旧审查进程已停后授权 `abandon_review` 再重派;
|
|
195
|
+
次数用完(`review_redispatch_limit`)写成新建运行重做。只有真实出口仍是原运行重派(`pendingAction: resume`)、3 次都用完时,
|
|
196
|
+
才写「已自动重试 n 次仍失败;过半小时后回到会话说继续即可」。PLAN 带 `--supersede*` 参数时不自动重试。
|
|
197
|
+
批次:成员停在这种限流时,批次结果另带 `taskKey`、`reviewInvocationId` 和 `reviewRetryTarget:{taskKey,batchDigest}`
|
|
198
|
+
(`batchDigest` 是批次计划与全部批次日志行的摘要,在持有 `batch.lock` 时算出)。等待后批次驾驶员发批次操作 `retry_review`,
|
|
199
|
+
带 `taskKey`、成员 `identity`、`packageDigest`、`expectedReviewStop:{invocationId}`、`batchDigest`。批次宿主拿到 `batch.lock` 后、
|
|
200
|
+
写入或派发任何东西之前核对:批次没停、批次日志摘要没变、批次当前仍停在这个成员(串行是当前任务;并行组是组里还没 ready/done 的成员,
|
|
201
|
+
与 `abandon_review` 等成员恢复操作同一规则),并行组成员的 worktree 与分支仍在;再打开该成员运行(本进程持有它的写锁),
|
|
202
|
+
把带 `expectedReviewStop` 的 `decision` 转给它,由成员按单任务同样的规则核对并只重派这一次审查。任一不符返回
|
|
203
|
+
`outcome: rejected`、`staleRetry: true`、`reason` 以「状态已变,未自动重试」开头,不派发、不写批次日志;`batch.lock` 被另一个驾驶员占着时同样如此。
|
|
204
|
+
重派后成员停在 `decision` 的结果上(通过就是 `approved`),批次不顺带完成、合并或推进其他成员;结果保留成员自己的
|
|
205
|
+
`state`/`code`/`identity`,但把成员才有的下一步(`complete` 等)改成批次的 `pendingAction: advance`,并带 `guidance`(审查限流已自动重试;
|
|
206
|
+
从批次入口发送 advance 继续)。等待重派期间同一宿主收到 `cancel`:打开成员运行时取消就不派发审查,审查进行中取消就转给成员运行;
|
|
207
|
+
两种都写 `batch_cancel` 并返回 `cancelled`。驾驶员把这个结果交还会话,
|
|
208
|
+
由会话照常再发批次 `advance` 继续(自动接着 advance 会越过「只重派这一次审查」,可能触发完成、QA、合并和下一个任务的开发应答)。
|
|
209
|
+
并行组两个成员都被限流时,批次结果只给出组里第一个停住的成员,驾驶员只重派它;另一个成员留到下一次 `advance` 由批次照常重派。
|
|
210
|
+
等待中的驾驶员被杀时,等待时长再加 `waitMinutes` 后会补发一次提醒;重跑一启动就取消这条补发。
|
|
170
211
|
审查答复违反 verdict 规则(`contradictory_verdict`、`invalid_finding_path`、`missing_material`、`review_package_mismatch`、
|
|
171
212
|
`invalid_finding_severity/id/shape`)时不产生回执,停在 `pending_review/review_verdict_invalid`,`reason` 以该代码开头。
|
|
172
213
|
这两类与传输超时、abandon 共用每轮的无结论重派。工具或上下文越界等仍为 unknown;其中 Claude 审查进程在边界被停(`unexpected_tool_or_content`,
|
|
@@ -203,6 +244,13 @@ worker 已证明审查进程退出、又没有结论的中断,`pendingAction`
|
|
|
203
244
|
| `review_boundary_unverified` | 工具或内容越界后退出,或退出前可能已收到结论 |
|
|
204
245
|
| `review_abandon_budget_exhausted` | 本轮 2 次已用完 |
|
|
205
246
|
|
|
247
|
+
「进程组已停止」的判断(`runtime/js/cm-ai/process-group-exit.mjs`,审查、开发进程和检查/QA 命令共用):对进程组发信号得到 ESRCH 才算没了,
|
|
248
|
+
发送成功说明还有活进程(照旧走 SIGTERM/SIGKILL 清理)。得到 EPERM 时不直接下结论——macOS 上,组长是我们自己那个已退出、
|
|
249
|
+
还没被 Node 回收的子进程(僵尸)时也回 EPERM:先异步等看到这个直接子进程的退出事件(不阻塞事件循环,和后面的重发共用约 1 秒预算),
|
|
250
|
+
看不到就判不明;看到后在剩余预算内每 50 毫秒重发一次,任一次 ESRCH 判已停止、任一次发送成功判有活进程,一直 EPERM 判不明。
|
|
251
|
+
不读进程表、不执行任何外部程序。判不明时各调用方按原来的错误码记:审查进程为 `process_cleanup_unknown`,
|
|
252
|
+
provider 开发进程为 `process_cleanup_failed`,检查/QA 命令为 `cleanup_failed`。开发进程与检查/QA 命令在这一步之前已记下的失败原因(如超时、限流)优先保留;审查进程不同:清理判不明时一律记 `process_cleanup_unknown`,覆盖此前的限流等原因,因为写入方是否已停没有证据时不能按限流去自动重派。
|
|
253
|
+
|
|
206
254
|
外部模型与执行策略的审查不走以上出口:流里有回执就先 `reconcile_review` 对账采纳;没有回执宿主无法证明旧调用已停,`abandon_review`/`abandon_effect` 拒绝为 `external_review_reconciliation_required`,按 status 的 `reviewReconciliation.reason` 向原宿主或 provider 核对。
|
|
207
255
|
|
|
208
256
|
### 已批准规格材料(第 24 步)
|
|
@@ -309,7 +357,7 @@ worker 异常、超时或传输歧义仍是 `unknown`,旧 unknown 历史不自
|
|
|
309
357
|
|
|
310
358
|
## 已审交接后的任务重跑
|
|
311
359
|
|
|
312
|
-
**v2
|
|
360
|
+
**v2:**单任务 supersede 已开放,须带 `--supersede-target FILE`(旧运行 `cm-ai-run.mjs inspect-history` 返回的 `supersedeTarget`),合同见 `docs/cm-control-policy-v2.md`「卡死任务重开」;批次成员仍不支持。旧运行仍有合法恢复入口(QA 恢复、abandon、develop_redo 等)时先用原入口,不为重开手改 tasks。
|
|
313
361
|
|
|
314
362
|
同名 handoff 已被审查回执消费时,新运行在创建 store 和开发前就拒绝 `handoff_exists`,错误的 `reason` 保留恢复提示。QA 配置错误用 [QA 恢复](js-host-qa-recovery.md#qa-配置修订) 的 `--revise-qa-config` 恢复原运行;宿主或环境证据不足用 `--rerun-blocked-qa` 恢复原运行。确需重新开发同一任务时,使用新的 runId 和下列显式授权:
|
|
315
363
|
|
|
@@ -357,3 +405,31 @@ legacy 批次不支持、启动即拒绝的单任务参数:`--revise-qa-config
|
|
|
357
405
|
普通批次没有 `reconcile_review`(只属于外部模型或执行策略运行)。`batch_parallel_member_unresolved` 的出口按真实入口条件写:legacy 只有 supersede 的状态检查(没有在途 effect 的原始 blocked/cancelled/unknown/fixture_completed)和外部运行守卫都会放行时,才写“确认旧写入方已停后取消批次,以该成员 worktree 为代码根、用不加外部模型和执行优化参数的单任务宿主 supersede”;外部模型或执行策略的成员运行仍为原始 `unknown` 或有未对账调用时,守卫会拒绝同一代码根上的新运行,原调用对账也不可用,`reason` 直接说明并要求保留批次与 worktree 交维护者;原始 `pending_review` 或仍有在途 effect 时同样交维护者,不再列出用不上的操作;停在 `develop_redo` 等操作的成员同样返回 `batch_parallel_member_recovery_required`,用上表的一次性授权在原运行里恢复。已写入日志的旧 `batch_member_blocked` 记录照原样回放,不重新判定。
|
|
358
406
|
|
|
359
407
|
资源闭合:批次交接前对 `cleanup_failed` 的 QA 命令资源先由宿主核对进程组已退出并补记 `released`(第 2 批);仍未闭合时返回 `batch_resources_open`,`reason` 列出未释放的资源及原因(进程组仍在、没有记录进程身份、无法核实)。
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
## v2 完成检查失败后返工
|
|
411
|
+
|
|
412
|
+
用户已要求修复失败且必须改动代码时,可在单任务、未受保护的原配置 resume 且 development:conversation 时发送 `completion_rework`,携带固定 status.controlTarget 为 expectedControl 与真实单行 reason。仅 a1 的 completion_checks_changed、未完成任务、有效旧 approved、精确旧包及足够预算允许;其他前提见 docs/cm-control-policy-v2.md。旧 r1 与失败 checkpoint 保留;成功进入 a2 后,发送 advance,等真实 develop 请求到达再改代码,随后 fresh r2 和完成复查。不是 develop_redo,不新增 run、不手改 journal 或回执。旧 complete 环境重查路径保持原样。
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
v2 单任务在 a1 `blocked/develop_checks_not_passed`、尚无 Review/在途 effect 时,可对已确认的具体新增路径显式 `revise_scope`。
|
|
416
|
+
原未受保护会话开发、配置和 QA 保持原值;bootstrap/qaFix disabled。由人工在启动时提供 `--expected-control FILE --revise-scope SCOPE.json --scope-revision-reason REASON`;FILE 保存原 status.launchControlTarget,SCOPE.json 是包含原范围的完整 JSON 数组。只追加一次,原范围不得缩减。
|
|
417
|
+
宿主用原创建 inventory 核对新增既有文件并补齐原字节,新文件要求原基线和当前均不存在;旧业务 diff 保留。成功后 effectiveScope 来自原 journal 的合法追加事件,继续原 run/attempt 的 develop、检查、handoff、fresh Review 与完成复查。详细拒绝及边界见 docs/cm-control-policy-v2.md。
|
|
418
|
+
|
|
419
|
+
### a2 开发预算已不足的一次受控续次
|
|
420
|
+
|
|
421
|
+
用户已明确要求同运行返工时,原 v2 单任务、未受保护的 conversation resume 在启动时提供
|
|
422
|
+
`--expected-control FILE --development-rework --development-rework-reason REASON`;FILE 保存原 status.launchControlTarget。
|
|
423
|
+
仅 a2 的 develop_retry_limit 及紧前真实 develop_checks_not_passed、旧 r1 changes_requested、
|
|
424
|
+
4 calls / 5 effects、未完成且没有 r2/在途/取消等满足 docs/cm-control-policy-v2.md 的严格合同才准入。
|
|
425
|
+
事件绑定原失败、limit、原基线/有效 scope/规格及当前源,不改 scope、不抹去成功重查费用。
|
|
426
|
+
默认 6 calls 保持;只给固定下一开发与 fresh review-2 配对 1 个 effect credit,开发 intent 消费一次许可。
|
|
427
|
+
成功后发送 advance,真实请求到达才能改代码;中断或失败不能取得第二次开发。
|
|
428
|
+
随后新包、fresh r2、完成复查与原 QA 仍必须执行;不改旧 journal、不重新基线、不新 run 或 install。
|
|
429
|
+
|
|
430
|
+
范围追加和一次开发续次均沿 `serve --mode resume` 的启动快照合同,由人工显式开启,原因及时间写入 journal。
|
|
431
|
+
驾驶脚本 PLAN 把参数放入 `permissions`,文件路径相对 PLAN;先发送 `status` 核对,移除已消费的恢复参数后再 `advance`。
|
|
432
|
+
不再用 PLAN.scope / PLAN.reason / PLAN.expectedControl 或 wire 操作触发这两个许可,也不新增 `--allow-*`。
|
|
433
|
+
返工后的合法只重跑检查保留原每运行两次上限;仍不会派第二次开发。
|
|
434
|
+
返工 r2 的 `review-2-retry-N` / `review-2-resume-N`(及组合)保留原无结论重派策略和预算,继续核对独立调用与 fresh 绑定。
|
|
435
|
+
`completion_rework` 同样排除批次和受保护开发;不能把单任务恢复能力当作批次入口。详细命令及边界见 docs/cm-control-policy-v2.md。
|