@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
|
@@ -5,6 +5,9 @@ import {findCmAiQaDecision,inspectCmAiQaDecision,inspectCmAiQaResult,recordCmAiQ
|
|
|
5
5
|
latestCmAiQaRun,recordCmAiQaRun,inspectCmAiQaRecovery,inspectCmAiQaConfigurationRecovery,timedOutQaDecision,
|
|
6
6
|
replacesTimedOutQaDecision,validEnvironmentFailureReason} from './cm-ai-qa-log.mjs';
|
|
7
7
|
import {recordCmAiRunDone} from './cm-ai-run-finalizer.mjs';
|
|
8
|
+
import {releaseVerifiedQaResources} from './qa-resource-release.mjs';
|
|
9
|
+
import {QA_MAX_ROUNDS} from './qa-round-budget.mjs';
|
|
10
|
+
import {qaRoundDeadlineMs} from './host-qa-executor.mjs';
|
|
8
11
|
import {projectHostResult} from './host-progress.mjs';
|
|
9
12
|
import {operatorGuidance} from './operator-guidance.mjs';
|
|
10
13
|
import {outstandingFeatureQa,describeOutstandingQa} from './project-qa-gate.mjs';
|
|
@@ -28,15 +31,23 @@ const retryReview=reviewRetryable;
|
|
|
28
31
|
// batch driver decides retryability from the same predicate instead of keeping a
|
|
29
32
|
// second copy of the code list that silently drifts.
|
|
30
33
|
export const developmentRetryable=status=>status.state==='blocked'
|
|
31
|
-
&&['developer_result_invalid','verification_precheck_failed','check_output_out_of_scope','develop_checks_not_passed','develop_unchanged_after_review','develop_empty_changes','develop_requirement_missing','develop_package_too_large','bootstrap_verification_failed'
|
|
34
|
+
&&['developer_result_invalid','verification_precheck_failed','check_output_out_of_scope','develop_checks_not_passed','develop_unchanged_after_review','develop_empty_changes','develop_requirement_missing','develop_package_too_large','bootstrap_verification_failed','develop_call_timeout','develop_answer_invalid',
|
|
35
|
+
'check_answer_missing','check_answer_invalid','develop_out_of_scope','develop_answer_missing','develop_dispatch_failed','develop_interrupted',
|
|
36
|
+
// Q16/Q17: only documentation_sync is asked again (durable-runner-state.mjs DOCUMENTATION_SYNC_CODES).
|
|
37
|
+
'documentation_sync_answer_missing','documentation_sync_answer_invalid','documentation_sync_answer_blocked','documentation_sync_out_of_scope','documentation_sync_interrupted'].includes(status.code)
|
|
38
|
+
// Shown before the operator confirmed the session stopped: not yet redoable.
|
|
39
|
+
&&status.developRedoRequired!==true;
|
|
32
40
|
const retryDeveloper=developmentRetryable;
|
|
33
41
|
export const completionRetryable=status=>status.state==='blocked'
|
|
34
|
-
&&['completion_checks_changed','completion_package_changed'].includes(status.code)
|
|
42
|
+
&&['completion_checks_changed','completion_package_changed','complete_recheck_failed','complete_commit_interrupted'].includes(status.code)
|
|
35
43
|
&&status.retryReady!==false;
|
|
36
44
|
const pendingAction=status=>status.state==='awaiting_spec_approval'?'spec_approval':
|
|
37
45
|
// The runner reports spec_drift over any state whose next effect would be refused.
|
|
38
46
|
status.code==='spec_drift'?(status.specificationRebind==='available'?'spec_rebind':'none'):
|
|
39
47
|
status.bootstrapReviewRecovery===true?'bootstrap_review_recover':
|
|
48
|
+
status.developRedoRequired===true?'develop_redo':
|
|
49
|
+
// V5: the round's second no-result redispatch needs the operator's stop confirmation.
|
|
50
|
+
status.reviewRedispatchStopRequired===true?'abandon_review':
|
|
40
51
|
status.reviewReconciliation?.available?'reconcile_review':
|
|
41
52
|
status.state==='changes_requested'||retryDeveloper(status)||retryReview(status)?'resume':
|
|
42
53
|
status.state==='awaiting_review'?'decision':status.state==='unknown'
|
|
@@ -60,6 +71,10 @@ const summary=(operation,status,outcome)=>freeze({version:1,workflow:'cm-ai',ope
|
|
|
60
71
|
requestDigest:digest(operation),identity:status.identity,outcome,state:status.state,code:status.code??null,
|
|
61
72
|
packageDigest:status.packageDigest??null,pendingAction:pendingAction(status),
|
|
62
73
|
...(status.reviewReconciliation?{reviewReconciliation:status.reviewReconciliation}:{}),
|
|
74
|
+
...(status.developRedoRequired===true?{developRedoRequired:true}:{}),
|
|
75
|
+
...(status.documentationSyncPending===true?{documentationSyncPending:true}:{}),
|
|
76
|
+
...(status.reviewRedispatchStopRequired===true?{reviewRedispatchStopRequired:true}:{}),
|
|
77
|
+
...(typeof status.reviewAbandonRefusal==='string'?{reviewAbandonRefusal:status.reviewAbandonRefusal}:{}),
|
|
63
78
|
...(typeof status.reason==='string'?{reason:status.reason}:{}),
|
|
64
79
|
...(status.code==='handoff_exists'?{reason:REVIEWED_HANDOFF_HINT}:{}),
|
|
65
80
|
...(status.state==='blocked'&&status.calls?.at(-1)?.blockedReason!==undefined
|
|
@@ -82,11 +97,11 @@ function readOperation(raw) {
|
|
|
82
97
|
const operation=json(raw),keys=['version','operation','requestId','identity'];
|
|
83
98
|
if(['decision','complete','qa','qa_result','context_refresh','finish','run_finalize'].includes(operation?.operation))keys.push('packageDigest');
|
|
84
99
|
if(['qa_result','context_refresh','finish','run_finalize'].includes(operation?.operation))keys.push('testRunId');
|
|
85
|
-
if(['abandon_review','abandon_effect','bootstrap_review_recover'].includes(operation?.operation))keys.push('reason');
|
|
100
|
+
if(['abandon_review','abandon_effect','bootstrap_review_recover','develop_redo'].includes(operation?.operation))keys.push('reason');
|
|
86
101
|
if(operation?.operation==='reconcile_review')keys.push('invocationId');
|
|
87
102
|
shape(operation,keys);
|
|
88
103
|
if(operation?.operation==='reconcile_review')id(operation.invocationId);
|
|
89
|
-
need(operation.version===1&&['advance','start','status','decision','complete','qa','qa_result','context_refresh','finish','run_finalize','cancel','resume','reconcile_review','abandon_review','abandon_effect','bootstrap_review_recover']
|
|
104
|
+
need(operation.version===1&&['advance','start','status','decision','complete','qa','qa_result','context_refresh','finish','run_finalize','cancel','resume','reconcile_review','abandon_review','abandon_effect','bootstrap_review_recover','develop_redo']
|
|
90
105
|
.includes(operation.operation));
|
|
91
106
|
id(operation.requestId);validIdentity(operation.identity);
|
|
92
107
|
if(operation.operation==='abandon_review')need(typeof operation.reason==='string'
|
|
@@ -95,6 +110,9 @@ function readOperation(raw) {
|
|
|
95
110
|
if(operation.operation==='abandon_effect')need(typeof operation.reason==='string'
|
|
96
111
|
&&operation.reason.trim().length>0&&Buffer.byteLength(operation.reason,'utf8')<=500
|
|
97
112
|
&&!/[\r\n\0]/.test(operation.reason),'effect_abandon_reason_required');
|
|
113
|
+
if(operation.operation==='develop_redo')need(typeof operation.reason==='string'
|
|
114
|
+
&&operation.reason.trim().length>0&&Buffer.byteLength(operation.reason,'utf8')<=500
|
|
115
|
+
&&!/[\r\n\0]/.test(operation.reason),'develop_redo_reason_required');
|
|
98
116
|
if(operation.operation==='bootstrap_review_recover')need(typeof operation.reason==='string'
|
|
99
117
|
&&operation.reason.trim().length>0&&Buffer.byteLength(operation.reason,'utf8')<=500
|
|
100
118
|
&&!/[\r\n\0]/.test(operation.reason),'bootstrap_review_recovery_reason_required');
|
|
@@ -117,13 +135,7 @@ const rejected=(identity,error)=>{
|
|
|
117
135
|
outcome:'rejected',state:null,code,packageDigest:null,pendingAction:'none'});
|
|
118
136
|
};
|
|
119
137
|
|
|
120
|
-
|
|
121
|
-
if(decision?.status==='denied'){
|
|
122
|
-
shape(decision,['status','code']);need(decision.code==='permission_denied','invalid_host_decision');return 'denied';
|
|
123
|
-
}
|
|
124
|
-
shape(decision,['status']);need(decision.status==='approved','invalid_host_decision');
|
|
125
|
-
need(status.packageDigest!==null,'stale_decision');return 'approved';
|
|
126
|
-
}
|
|
138
|
+
|
|
127
139
|
|
|
128
140
|
function effectSummary(operation,result,runner,identity) {
|
|
129
141
|
if(result?.outcome==='rejected'){
|
|
@@ -136,6 +148,11 @@ function effectSummary(operation,result,runner,identity) {
|
|
|
136
148
|
boundStatus(runner.status(),next);
|
|
137
149
|
return summary(operation,boundStatus(result,next),'advanced');
|
|
138
150
|
}
|
|
151
|
+
// A rejected current-session answer is checkpointed blocked/failed; the
|
|
152
|
+
// runner's status shows it as the retryable develop_answer_invalid block.
|
|
153
|
+
if(result?.state==='blocked'&&['failed','unavailable'].includes(result.code)){
|
|
154
|
+
const current=runner.status();if(['develop_answer_invalid','develop_answer_missing'].includes(current.code))result=current;
|
|
155
|
+
}
|
|
139
156
|
return summary(operation,boundStatus(result,identity),result?.code==='handoff_exists'?'blocked':'advanced');
|
|
140
157
|
}
|
|
141
158
|
|
|
@@ -176,8 +193,6 @@ function validateDocumentationResult(result,status,refresh,policy=null) {
|
|
|
176
193
|
|
|
177
194
|
export function createCmAiConversationEntry(options) {
|
|
178
195
|
const optionKeys=['specsDir','codeProject','feature','identity','runner'];
|
|
179
|
-
if(options&&Object.hasOwn(options,'hostDecision'))optionKeys.push('hostDecision');
|
|
180
|
-
if(options&&Object.hasOwn(options,'hostDecisionProvider'))optionKeys.push('hostDecisionProvider');
|
|
181
196
|
if(options&&Object.hasOwn(options,'developmentAttempt'))optionKeys.push('developmentAttempt');
|
|
182
197
|
if(options&&Object.hasOwn(options,'qaDecision'))optionKeys.push('qaDecision');
|
|
183
198
|
if(options&&Object.hasOwn(options,'qaDecisionProvider'))optionKeys.push('qaDecisionProvider');
|
|
@@ -195,6 +210,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
195
210
|
if(options&&Object.hasOwn(options,'allowAbandonReview'))optionKeys.push('allowAbandonReview');
|
|
196
211
|
if(options&&Object.hasOwn(options,'allowAbandonEffect'))optionKeys.push('allowAbandonEffect');
|
|
197
212
|
if(options&&Object.hasOwn(options,'allowBootstrapReviewRecovery'))optionKeys.push('allowBootstrapReviewRecovery');
|
|
213
|
+
if(options&&Object.hasOwn(options,'allowDevelopRedo'))optionKeys.push('allowDevelopRedo');
|
|
198
214
|
if(options&&Object.hasOwn(options,'holdRevision'))optionKeys.push('holdRevision');
|
|
199
215
|
if(options&&Object.hasOwn(options,'featureSelection'))optionKeys.push('featureSelection');
|
|
200
216
|
shape(options,optionKeys);
|
|
@@ -205,8 +221,11 @@ export function createCmAiConversationEntry(options) {
|
|
|
205
221
|
const ownerIdentity=json(options.identity);validIdentity(ownerIdentity);
|
|
206
222
|
const runner=options.runner;
|
|
207
223
|
const runnerKeys=['executeEffect','status','cancel','run'];
|
|
224
|
+
if(runner&&Object.hasOwn(runner,'qaChangedFiles'))runnerKeys.push('qaChangedFiles');
|
|
208
225
|
if(runner&&Object.hasOwn(runner,'verificationBlocks'))runnerKeys.push('verificationBlocks');
|
|
209
226
|
if(runner&&Object.hasOwn(runner,'completionBlocks'))runnerKeys.push('completionBlocks');
|
|
227
|
+
if(runner&&Object.hasOwn(runner,'reviewEffectIds'))runnerKeys.push('reviewEffectIds');
|
|
228
|
+
if(runner&&Object.hasOwn(runner,'recheckLearningInput'))runnerKeys.push('recheckLearningInput');
|
|
210
229
|
if(runner&&Object.hasOwn(runner,'attachLearningEvidence'))runnerKeys.push('attachLearningEvidence');
|
|
211
230
|
if(runner&&Object.hasOwn(runner,'inspectFixAssociation'))runnerKeys.push('inspectFixAssociation');
|
|
212
231
|
if(runner&&Object.hasOwn(runner,'acceptCompletedFix'))runnerKeys.push('acceptCompletedFix');
|
|
@@ -218,10 +237,16 @@ export function createCmAiConversationEntry(options) {
|
|
|
218
237
|
if(runner&&Object.hasOwn(runner,'reconcileReview'))runnerKeys.push('reconcileReview');
|
|
219
238
|
if(runner&&Object.hasOwn(runner,'abandonEffect'))runnerKeys.push('abandonEffect');
|
|
220
239
|
if(runner&&Object.hasOwn(runner,'recoverBootstrapReview'))runnerKeys.push('recoverBootstrapReview');
|
|
240
|
+
if(runner&&Object.hasOwn(runner,'redoDevelop'))runnerKeys.push('redoDevelop');
|
|
241
|
+
if(runner&&Object.hasOwn(runner,'recoverCommit'))runnerKeys.push('recoverCommit');
|
|
242
|
+
if(runner&&Object.hasOwn(runner,'interruptions'))runnerKeys.push('interruptions');
|
|
221
243
|
if(runner&&Object.hasOwn(runner,'inspectBootstrapAdmission'))runnerKeys.push('inspectBootstrapAdmission');
|
|
222
244
|
shape(runner,runnerKeys);
|
|
245
|
+
if(Object.hasOwn(runner,'qaChangedFiles'))need(typeof runner.qaChangedFiles==='function');
|
|
223
246
|
for(const name of ['executeEffect','status','cancel','run'])need(typeof runner[name]==='function');
|
|
224
247
|
if(Object.hasOwn(runner,'completionBlocks'))need(typeof runner.completionBlocks==='function');
|
|
248
|
+
if(Object.hasOwn(runner,'reviewEffectIds'))need(typeof runner.reviewEffectIds==='function');
|
|
249
|
+
if(Object.hasOwn(runner,'recheckLearningInput'))need(typeof runner.recheckLearningInput==='function');
|
|
225
250
|
if(Object.hasOwn(runner,'attachLearningEvidence'))need(typeof runner.attachLearningEvidence==='function');
|
|
226
251
|
if(Object.hasOwn(runner,'inspectFixAssociation'))need(typeof runner.inspectFixAssociation==='function');
|
|
227
252
|
if(Object.hasOwn(runner,'acceptCompletedFix'))need(typeof runner.acceptCompletedFix==='function');
|
|
@@ -231,6 +256,9 @@ export function createCmAiConversationEntry(options) {
|
|
|
231
256
|
if(Object.hasOwn(runner,'reconcileReview'))need(typeof runner.reconcileReview==='function');
|
|
232
257
|
if(Object.hasOwn(runner,'abandonEffect'))need(typeof runner.abandonEffect==='function');
|
|
233
258
|
if(Object.hasOwn(runner,'recoverBootstrapReview'))need(typeof runner.recoverBootstrapReview==='function');
|
|
259
|
+
if(Object.hasOwn(runner,'redoDevelop'))need(typeof runner.redoDevelop==='function');
|
|
260
|
+
if(Object.hasOwn(runner,'recoverCommit'))need(typeof runner.recoverCommit==='function');
|
|
261
|
+
if(Object.hasOwn(runner,'interruptions'))need(typeof runner.interruptions==='function');
|
|
234
262
|
if(Object.hasOwn(runner,'inspectBootstrapAdmission'))need(typeof runner.inspectBootstrapAdmission==='function');
|
|
235
263
|
need(options.allowAbandonReview===undefined||typeof options.allowAbandonReview==='boolean','invalid_input');
|
|
236
264
|
let abandonPermission=options.allowAbandonReview===true;
|
|
@@ -238,15 +266,9 @@ export function createCmAiConversationEntry(options) {
|
|
|
238
266
|
let abandonEffectPermission=options.allowAbandonEffect===true;
|
|
239
267
|
need(options.allowBootstrapReviewRecovery===undefined||typeof options.allowBootstrapReviewRecovery==='boolean','invalid_input');
|
|
240
268
|
let bootstrapReviewRecoveryPermission=options.allowBootstrapReviewRecovery===true;
|
|
269
|
+
need(options.allowDevelopRedo===undefined||typeof options.allowDevelopRedo==='boolean','invalid_input');
|
|
270
|
+
let developRedoPermission=options.allowDevelopRedo===true;
|
|
241
271
|
|
|
242
|
-
const hostDecision=Object.hasOwn(options,'hostDecision')?json(options.hostDecision):null;
|
|
243
|
-
let hostDecisionProvider=null,pendingReviewDecision=null;
|
|
244
|
-
if(Object.hasOwn(options,'hostDecisionProvider')){
|
|
245
|
-
shape(options.hostDecisionProvider,['decide','timeoutMs']);
|
|
246
|
-
const {decide,timeoutMs}=options.hostDecisionProvider;
|
|
247
|
-
need(typeof decide==='function'&&Number.isInteger(timeoutMs)&&timeoutMs>=1&&timeoutMs<=60000);
|
|
248
|
-
need(hostDecision===null);hostDecisionProvider={decide,timeoutMs};
|
|
249
|
-
}
|
|
250
272
|
const qaDecision=Object.hasOwn(options,'qaDecision')?json(options.qaDecision):null;
|
|
251
273
|
const qaProvider=options.qaDecisionProvider??null;
|
|
252
274
|
if(qaProvider!==null){
|
|
@@ -258,6 +280,12 @@ export function createCmAiConversationEntry(options) {
|
|
|
258
280
|
const decideQa=qaProvider?.decide,qaTimeout=qaProvider?.timeoutMs;
|
|
259
281
|
let pendingQa=null;
|
|
260
282
|
let qaExecutor=null,pendingExecution=null,cancellationEpoch=0;
|
|
283
|
+
// Q13: a scan failure (no log yet) leaves resources as they are; the writer still refuses closure.
|
|
284
|
+
const releaseQaResources=identity=>{
|
|
285
|
+
try{return releaseVerifiedQaResources({specsDir:options.specsDir,codeProject:options.codeProject,runId:identity.runId,
|
|
286
|
+
...(Object.hasOwn(options,'qaLogHome')?{logHome:options.qaLogHome}:{})});}
|
|
287
|
+
catch(error){if(error?.code==='qa_resource_release_failed')throw error;return {released:[],open:[]};}
|
|
288
|
+
};
|
|
261
289
|
const inFlightHandles=new Set();
|
|
262
290
|
let rerunUnknownQa=options.rerunUnknownQa??false;need(typeof rerunUnknownQa==='boolean');
|
|
263
291
|
let rerunBlockedQa=options.rerunBlockedQa??false;need(typeof rerunBlockedQa==='boolean');
|
|
@@ -351,7 +379,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
351
379
|
need(sameTask(identity,ownerIdentity)&&identity.attempt>=ownerIdentity.attempt,'identity_mismatch');
|
|
352
380
|
// Stable run-definition identity can query/control or resume the current
|
|
353
381
|
// attempt. Package-bound mutations must name the current attempt exactly.
|
|
354
|
-
const stableControl=['status','cancel','advance','resume','reconcile_review','abandon_review','abandon_effect','bootstrap_review_recover'].includes(operation.operation)
|
|
382
|
+
const stableControl=['status','cancel','advance','resume','reconcile_review','abandon_review','abandon_effect','bootstrap_review_recover','develop_redo'].includes(operation.operation)
|
|
355
383
|
&&sameIdentity(operation.identity,ownerIdentity);
|
|
356
384
|
need(sameIdentity(operation.identity,identity)||stableControl,'identity_mismatch');
|
|
357
385
|
if(operation.operation==='advance'){
|
|
@@ -390,6 +418,8 @@ export function createCmAiConversationEntry(options) {
|
|
|
390
418
|
notCancelled();
|
|
391
419
|
need(pendingExecution===null,'qa_execution_pending');
|
|
392
420
|
const binding={specsDir:options.specsDir,feature:options.feature,identity:result.identity,packageDigest:result.packageDigest};
|
|
421
|
+
// Q13: close cleanup_failed command resources whose process group is proven gone.
|
|
422
|
+
releaseQaResources(result.identity);
|
|
393
423
|
let previous,recovery=null,configurationRecovery=false,incompleteReport=false,timedOutCall=false;
|
|
394
424
|
const timedOutRecovery=()=>inspectCmAiQaRecovery(binding,{timedOut:true,requestTimeoutMs:qaExecutor.requestTimeoutMs??null,
|
|
395
425
|
attestation:rerunUnknownQa?qaEnvironmentFailure:null});
|
|
@@ -446,7 +476,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
446
476
|
// Later rounds require an accepted completed repair or explicit
|
|
447
477
|
// evidence recovery/configuration revision. Unknown execution stops.
|
|
448
478
|
const qaRound=recovery?recovery.qaRound+(rerunBlockedQa||configurationRecovery||timedOutCall?1:0):(repaired?accepted.qaRound+1:1);
|
|
449
|
-
need(qaRound>=1&&qaRound<=
|
|
479
|
+
need(qaRound>=1&&qaRound<=QA_MAX_ROUNDS,'qa_round_invalid');
|
|
450
480
|
testRunId=`qa-${digest(recovery?{...binding,previousTestRunId:recovery.testRunId}:
|
|
451
481
|
repaired?{...binding,qaRound,repair:accepted.evidenceDigest}:binding).slice(0,48)}`;
|
|
452
482
|
const invocation={...binding,codeProject:options.codeProject,testRunId,mode:qaExecutor.mode,caseCount:qaExecutor.caseCount,
|
|
@@ -472,7 +502,8 @@ export function createCmAiConversationEntry(options) {
|
|
|
472
502
|
const interrupted=new Promise((_,reject)=>{
|
|
473
503
|
controller.signal.addEventListener('abort',()=>reject(Object.assign(new Error('QA interrupted'),
|
|
474
504
|
{code:timedOut?'qa_execution_timeout':'cancelled'})),{once:true});
|
|
475
|
-
|
|
505
|
+
// Q12: the round deadline scales with the frozen plan.
|
|
506
|
+
timer=setTimeout(()=>{timedOut=true;controller.abort();},qaRoundDeadlineMs(qaExecutor));
|
|
476
507
|
});
|
|
477
508
|
const executed=await Promise.race([Promise.resolve().then(()=>{
|
|
478
509
|
notCancelled();
|
|
@@ -521,10 +552,9 @@ export function createCmAiConversationEntry(options) {
|
|
|
521
552
|
return summary(operation,status,'reported');
|
|
522
553
|
}
|
|
523
554
|
if(operation.operation==='cancel'){
|
|
524
|
-
const interrupted=inFlightHandles.size>0||
|
|
555
|
+
const interrupted=inFlightHandles.size>0||pendingQa!==null
|
|
525
556
|
||pendingExecution!==null||pendingDocumentation!==null;
|
|
526
557
|
cancellationEpoch++;
|
|
527
|
-
pendingReviewDecision?.abort();
|
|
528
558
|
pendingQa?.abort();
|
|
529
559
|
pendingExecution?.abort();
|
|
530
560
|
pendingDocumentation?.abort();
|
|
@@ -543,7 +573,8 @@ export function createCmAiConversationEntry(options) {
|
|
|
543
573
|
abandonPermission=false;
|
|
544
574
|
const result=runner.abandonReview?.({allowed:true,reason:operation.reason})
|
|
545
575
|
??{outcome:'rejected',code:'review_abandon_unavailable'};
|
|
546
|
-
if(result.outcome==='rejected')return summary(operation,{...runner.status(),code:result.code
|
|
576
|
+
if(result.outcome==='rejected')return summary(operation,{...runner.status(),code:result.code,
|
|
577
|
+
...(typeof result.reason==='string'?{reason:result.reason}:{})},'rejected');
|
|
547
578
|
return summary(operation,boundStatus(result,identity),'abandoned');
|
|
548
579
|
}
|
|
549
580
|
if(operation.operation==='abandon_effect'){
|
|
@@ -554,7 +585,18 @@ export function createCmAiConversationEntry(options) {
|
|
|
554
585
|
??{outcome:'rejected',code:'effect_abandon_unavailable'};
|
|
555
586
|
if(result.outcome==='rejected')return summary(operation,{...runner.status(),code:result.code,
|
|
556
587
|
...(result.reason?{reason:result.reason}:{})},'rejected');
|
|
557
|
-
|
|
588
|
+
// V8: an interrupted step continues in the run (recorded); a void ends it.
|
|
589
|
+
return summary(operation,boundStatus(result,identity),result.code==='effect_abandoned'?'abandoned':'recorded');
|
|
590
|
+
}
|
|
591
|
+
if(operation.operation==='develop_redo'){
|
|
592
|
+
if(!developRedoPermission)return summary(operation,{...runner.status(),
|
|
593
|
+
code:'develop_redo_authorization_required'},'rejected');
|
|
594
|
+
developRedoPermission=false;
|
|
595
|
+
const result=runner.redoDevelop?.({allowed:true,reason:operation.reason})
|
|
596
|
+
??{outcome:'rejected',code:'develop_redo_unavailable'};
|
|
597
|
+
if(result.outcome==='rejected')return summary(operation,{...runner.status(),code:result.code,
|
|
598
|
+
...(result.reason?{reason:result.reason}:{})},'rejected');
|
|
599
|
+
return summary(operation,boundStatus(result,identity),'recorded');
|
|
558
600
|
}
|
|
559
601
|
if(operation.operation==='bootstrap_review_recover'){
|
|
560
602
|
if(!bootstrapReviewRecoveryPermission)return summary(operation,{...runner.status(),
|
|
@@ -570,40 +612,20 @@ export function createCmAiConversationEntry(options) {
|
|
|
570
612
|
const status=boundStatus(runner.status(),identity);
|
|
571
613
|
need(status.packageDigest===operation.packageDigest,'stale_decision');
|
|
572
614
|
if(status.code==='review_package_changed')return summary(operation,status,'rejected');
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
{code:timedOut?'review_decision_timeout':'cancelled'})),{once:true});
|
|
586
|
-
timer=setTimeout(()=>{timedOut=true;controller.abort();},hostDecisionProvider.timeoutMs);
|
|
587
|
-
});
|
|
588
|
-
const binding=freeze(json({specsDir:options.specsDir,codeProject:options.codeProject,feature:options.feature,
|
|
589
|
-
identity,packageDigest:operation.packageDigest}));
|
|
590
|
-
decision=json(await Promise.race([Promise.resolve().then(()=>{
|
|
591
|
-
need(!controller.signal.aborted,'cancelled');return hostDecisionProvider.decide(binding,controller.signal);
|
|
592
|
-
}),interrupted]));
|
|
593
|
-
need(!controller.signal.aborted,'cancelled');
|
|
594
|
-
const current=boundStatus(runner.status(),identity);
|
|
595
|
-
need(current.state===status.state&¤t.code===status.code
|
|
596
|
-
&¤t.packageDigest===operation.packageDigest,'stale_decision');
|
|
597
|
-
need(!current.cancellationRequested&&!current.cancelAfterCommit,'cancelled');
|
|
598
|
-
}finally{clearTimeout(timer);pendingReviewDecision=null;}
|
|
615
|
+
// Dispatch only a review-ready package. Completed or outstanding invocations
|
|
616
|
+
// remain runner-owned and cannot be reopened by a decision message.
|
|
617
|
+
if(!(status.state==='awaiting_review'&&status.code===null)&&!retryReview(status))return summary(operation,status,'reported');
|
|
618
|
+
need(!status.cancellationRequested&&!status.cancelAfterCommit,'cancelled');
|
|
619
|
+
const resumed=runner.interruptions?.('review')??0,roundIds=runner.reviewEffectIds?.();
|
|
620
|
+
const idFor=n=>`review-${identity.attempt}${n?`-retry-${n}`:''}${resumed?`-resume-${resumed}`:''}`;
|
|
621
|
+
let retries=0;
|
|
622
|
+
if(retryReview(status)){
|
|
623
|
+
retries=Math.max(Array.isArray(roundIds)?roundIds.length:0,
|
|
624
|
+
status.calls.filter(call=>call.channel==='host-review'&&['failed','abandoned'].includes(call.terminal)
|
|
625
|
+
&&call.contextId===status.reviewInvocation?.registration?.binding.logicalContextId).length);
|
|
626
|
+
if(Array.isArray(roundIds))while(roundIds.includes(idFor(retries)))retries++;
|
|
599
627
|
}
|
|
600
|
-
|
|
601
|
-
if(validateHostDecision(decision,status)==='denied')
|
|
602
|
-
return summary(operation,{...status,code:'permission_denied'},'denied');
|
|
603
|
-
const retries=retryReview(status)?status.calls.filter(call=>call.channel==='host-authorized'
|
|
604
|
-
&&['failed','abandoned'].includes(call.terminal)
|
|
605
|
-
&&call.contextId===status.reviewInvocation.registration.grant.logicalContextId).length:0;
|
|
606
|
-
const effectId=`review-${identity.attempt}${retries?`-retry-${retries}`:''}`;
|
|
628
|
+
const effectId=idFor(retries);
|
|
607
629
|
const result=await runner.executeEffect({version:1,id:effectId,identity,kind:'review'});
|
|
608
630
|
return effectSummary(operation,result,runner,identity);
|
|
609
631
|
}
|
|
@@ -614,8 +636,13 @@ export function createCmAiConversationEntry(options) {
|
|
|
614
636
|
if(status.code==='completion_package_changed'&&status.retryReady===false)return summary(operation,status,'rejected');
|
|
615
637
|
const correction=correctionSummary(operation,status);if(correction)return correction;
|
|
616
638
|
need(['approved','fixture_completed'].includes(status.state)||completionRetryable(status),'completion_not_ready');
|
|
617
|
-
|
|
618
|
-
|
|
639
|
+
// A45: finish the interrupted task commit from its journaled plan only.
|
|
640
|
+
if(status.code==='complete_commit_interrupted'){
|
|
641
|
+
const recovered=runner.recoverCommit?.()??{outcome:'rejected',code:'commit_recovery_unavailable'};
|
|
642
|
+
return effectSummary(operation,recovered,runner,identity);
|
|
643
|
+
}
|
|
644
|
+
const retries=runner.completionBlocks?.()??0,resumed=runner.interruptions?.('complete')??0;
|
|
645
|
+
const effectId=`complete-${identity.attempt}${retries?`-retry-${retries}`:''}${resumed?`-resume-${resumed}`:''}`;
|
|
619
646
|
const result=await runner.executeEffect({version:1,id:effectId,identity,kind:'complete'});
|
|
620
647
|
return effectSummary(operation,result,runner,identity);
|
|
621
648
|
}
|
|
@@ -651,6 +678,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
651
678
|
decision=json(await Promise.race([
|
|
652
679
|
Promise.resolve().then(()=>{need(!controller.signal.aborted,'cancelled');
|
|
653
680
|
return decideQa(freeze({...binding,codeProject:options.codeProject,
|
|
681
|
+
changedFiles:runner.qaChangedFiles?.(operation.packageDigest)??{paths:[],source:'unavailable'},
|
|
654
682
|
...(previousDecisionId===null?{}:{previousDecisionId})}),controller.signal);}),interrupted]));
|
|
655
683
|
need(!controller.signal.aborted,'cancelled');
|
|
656
684
|
const current=boundStatus(runner.status(),identity);
|
|
@@ -665,7 +693,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
665
693
|
return summary(operation,{...status,code:admission.reason},'awaiting');
|
|
666
694
|
const feature=admission.features.find(item=>item.name===options.feature);
|
|
667
695
|
need(feature,'qa_policy_unavailable');
|
|
668
|
-
// N6 feature completion is a mandatory trigger, regardless of
|
|
696
|
+
// N6 feature completion is a mandatory trigger, regardless of registered paths.
|
|
669
697
|
// Ask for the proper bound decision; do not synthesize authorization.
|
|
670
698
|
if(feature.pending===0)return summary(operation,{...status,code:'qa_mandatory_required'},'awaiting');
|
|
671
699
|
}
|
|
@@ -758,6 +786,10 @@ export function createCmAiConversationEntry(options) {
|
|
|
758
786
|
return freeze({...summary(operation,{...status,code:'documentation_sync_blocked'},'blocked'),
|
|
759
787
|
...closeoutSummary(knowledgeCloseout,documentation)});
|
|
760
788
|
const finalQa=projectQaSummary(operation,status,options);if(finalQa)return finalQa;
|
|
789
|
+
const resources=releaseQaResources(identity);
|
|
790
|
+
if(resources.open.length)return summary(operation,{...status,code:'qa_resources_open',
|
|
791
|
+
reason:`qa_resources_open: 以下运行资源仍未释放(写入器会拒绝 run_done):${resources.open.slice(0,10).map(item=>`${item.resourceId}(${item.verdict})`).join('、')}。`
|
|
792
|
+
+'宿主只在运行日志记有该命令进程组身份且核对进程组已退出时补记释放;先结束残留进程后重发 run_finalize,记录里没有进程身份的旧资源需人工处理。'},'blocked');
|
|
761
793
|
const input={specsDir:options.specsDir,codeProject:options.codeProject,feature:options.feature,identity,
|
|
762
794
|
packageDigest:operation.packageDigest,contextDigest:refresh.contextDigest,
|
|
763
795
|
documentationSyncId:documentation.syncId};
|
|
@@ -784,7 +816,10 @@ export function createCmAiConversationEntry(options) {
|
|
|
784
816
|
// the review that asked for it, before any develop intent, and say so.
|
|
785
817
|
if(options.holdRevision===true&&status.state==='changes_requested')
|
|
786
818
|
return summary(operation,{...status,code:'revision_answer_required'},'awaiting');
|
|
787
|
-
|
|
819
|
+
// A re-check (check_answer_*) re-runs the checks of the delivery already made:
|
|
820
|
+
// it binds that delivery's Learning input, never a freshly read one (its
|
|
821
|
+
// writeback may already have changed AGENTS.md).
|
|
822
|
+
const learningInput=runner.recheckLearningInput?.()??inspectCmAiTaskLearningInput({specsDir:options.specsDir,codeProject:options.codeProject,
|
|
788
823
|
feature:options.feature,identity,applicableAgentFiles:applicableAgentFiles??[],
|
|
789
824
|
...(options.featureSelection===undefined?{}:{featureSelection:options.featureSelection})},
|
|
790
825
|
{admission:runner.inspectBootstrapAdmission?.()??null,parallelSelection:options.parallelSelection??null});
|
|
@@ -794,8 +829,8 @@ export function createCmAiConversationEntry(options) {
|
|
|
794
829
|
&&call.failureResult?.code==='invalid_result'&&call.failureResult.retryable===true).length;
|
|
795
830
|
// Both kinds of local rejection need a fresh effect id: an invalid developer
|
|
796
831
|
// result, and one the host gate blocked before the review package existed.
|
|
797
|
-
const retries=rejectedValues+(runner.verificationBlocks?.()??0);
|
|
798
|
-
const effectId=`develop-${identity.attempt}${retries?`-retry-${retries}`:''}`;
|
|
832
|
+
const retries=rejectedValues+(runner.verificationBlocks?.()??0),resumed=runner.interruptions?.('develop')??0;
|
|
833
|
+
const effectId=`develop-${identity.attempt}${retries?`-retry-${retries}`:''}${resumed?`-resume-${resumed}`:''}`;
|
|
799
834
|
const result=await runner.executeEffect({version:1,id:effectId,identity,kind:'develop',learningInput});
|
|
800
835
|
return effectSummary(operation,result,runner,identity);
|
|
801
836
|
}
|
|
@@ -803,7 +838,7 @@ export function createCmAiConversationEntry(options) {
|
|
|
803
838
|
let token=null,operation=null;const epoch=cancellationEpoch;
|
|
804
839
|
try{
|
|
805
840
|
operation=readOperation(raw);
|
|
806
|
-
if(!['status','cancel','reconcile_review','abandon_review','abandon_effect','bootstrap_review_recover'].includes(operation.operation)){
|
|
841
|
+
if(!['status','cancel','reconcile_review','abandon_review','abandon_effect','bootstrap_review_recover','develop_redo'].includes(operation.operation)){
|
|
807
842
|
token=Symbol(operation.operation);inFlightHandles.add(token);
|
|
808
843
|
}
|
|
809
844
|
const routed=await route(operation);
|