@aibyzero/cm-workflow 0.16.4 → 0.16.6
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 +22 -0
- package/CHANGELOG.md +57 -0
- package/README.md +22 -4
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/VERSION +1 -1
- package/docs/architecture.md +43 -0
- package/docs/execution-optimizations.md +33 -0
- package/docs/external-models.md +114 -0
- package/docs/fixes/.reviews/20260929-bootstrap-unchanged-review-r1.md +7 -0
- package/docs/fixes/.reviews/20260930-develop-package-limit-recovery-r4.md +9 -0
- package/docs/fixes/20260929-bootstrap-rule-refresh-conflict.md +22 -0
- package/docs/fixes/20260929-bootstrap-unchanged-review.md +26 -0
- package/docs/fixes/20260930-develop-package-limit-recovery.md +65 -0
- package/docs/human-correction.md +31 -0
- package/docs/installation.md +48 -7
- package/docs/js-workflow-control.md +293 -33
- package/docs/live-evidence-drivers.md +62 -0
- package/docs/next-steps.md +15 -10
- package/docs/runtime-failover.md +1 -1
- package/docs/untested-branches.md +27 -4
- package/docs/user-guide.md +23 -8
- package/install-codex.sh +28 -11
- package/package.json +1 -1
- package/runtime/js/cm-ai/accepted-fix.mjs +23 -5
- package/runtime/js/cm-ai/bootstrap-feature.mjs +15 -0
- package/runtime/js/cm-ai/claude-review-adapter.mjs +7 -4
- package/runtime/js/cm-ai/claude-review-stream.mjs +12 -0
- package/runtime/js/cm-ai/claude-tool-preview.mjs +4 -4
- package/runtime/js/cm-ai/cm-ai-admission.mjs +115 -41
- package/runtime/js/cm-ai/cm-ai-context-refresh.mjs +3 -2
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +208 -34
- package/runtime/js/cm-ai/cm-ai-learning-handoff-writer.mjs +11 -9
- package/runtime/js/cm-ai/cm-ai-learning-writer.mjs +22 -5
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +181 -57
- package/runtime/js/cm-ai/cm-ai-run-finalizer.mjs +15 -58
- package/runtime/js/cm-ai/codex-config.mjs +3 -2
- package/runtime/js/cm-ai/codex-review-adapter.mjs +56 -17
- package/runtime/js/cm-ai/committed-rule-basis.mjs +76 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +6 -2
- package/runtime/js/cm-ai/diagnostic-reason.mjs +10 -0
- package/runtime/js/cm-ai/drive-bootstrap.mjs +315 -0
- package/runtime/js/cm-ai/drive-core.mjs +47 -9
- package/runtime/js/cm-ai/durable-runner-state.mjs +413 -56
- package/runtime/js/cm-ai/effect-abandon-log.mjs +19 -0
- package/runtime/js/cm-ai/effect-contract.mjs +44 -2
- package/runtime/js/cm-ai/execution-policy.mjs +58 -0
- package/runtime/js/cm-ai/execution-store-limits.mjs +18 -0
- package/runtime/js/cm-ai/execution-store.mjs +6 -4
- package/runtime/js/cm-ai/external-group-models.mjs +53 -0
- package/runtime/js/cm-ai/external-model-launch.mjs +23 -0
- package/runtime/js/cm-ai/external-models.mjs +52 -0
- package/runtime/js/cm-ai/external-run-guard.mjs +96 -0
- package/runtime/js/cm-ai/fix-code-association.mjs +171 -18
- package/runtime/js/cm-ai/host-bootstrap.mjs +126 -29
- package/runtime/js/cm-ai/host-check.mjs +30 -4
- package/runtime/js/cm-ai/host-conversation-execution.mjs +66 -20
- package/runtime/js/cm-ai/host-handoff.mjs +13 -6
- package/runtime/js/cm-ai/host-progress.mjs +80 -0
- package/runtime/js/cm-ai/host-project-execution.mjs +16 -11
- package/runtime/js/cm-ai/host-qa-executor.mjs +23 -9
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +23 -6
- package/runtime/js/cm-ai/host-qa-policy.mjs +16 -7
- package/runtime/js/cm-ai/host-session.mjs +12 -4
- package/runtime/js/cm-ai/host-tool-bridge.mjs +1 -1
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +16 -5
- package/runtime/js/cm-ai/host.mjs +1 -1
- package/runtime/js/cm-ai/knowledge-closeout.mjs +56 -0
- package/runtime/js/cm-ai/launch-mismatch.mjs +42 -0
- package/runtime/js/cm-ai/legacy-model-run-preview.mjs +24 -0
- package/runtime/js/cm-ai/legacy-model-settings.mjs +59 -0
- package/runtime/js/cm-ai/live-evidence.mjs +96 -0
- package/runtime/js/cm-ai/log-rows.mjs +21 -0
- package/runtime/js/cm-ai/model-configuration-file.mjs +63 -0
- package/runtime/js/cm-ai/model_configuration_write.py +214 -0
- package/runtime/js/cm-ai/native-usage-log.mjs +26 -0
- package/runtime/js/cm-ai/operator-guidance.mjs +86 -0
- package/runtime/js/cm-ai/owned-process-cleanup.mjs +22 -0
- package/runtime/js/cm-ai/project-qa-gate.mjs +84 -0
- package/runtime/js/cm-ai/provider-review-observation.mjs +68 -9
- package/runtime/js/cm-ai/provider-usage.mjs +39 -0
- package/runtime/js/cm-ai/qa-config-revision.mjs +44 -10
- package/runtime/js/cm-ai/review-abandon-log.mjs +21 -0
- package/runtime/js/cm-ai/review-package.mjs +438 -31
- package/runtime/js/cm-ai/review-presentation.mjs +45 -0
- package/runtime/js/cm-ai/review-reconciliation.mjs +20 -0
- package/runtime/js/cm-ai/review-runner.mjs +47 -1
- package/runtime/js/cm-ai/reviewed-deliveries.mjs +97 -0
- package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +104 -10
- package/runtime/js/cm-ai/reviewed-evidence-supersession-record.mjs +42 -3
- package/runtime/js/cm-ai/specification-material.mjs +154 -12
- package/runtime/js/cm-ai/status-projection.mjs +93 -0
- package/runtime/js/cm-ai/task-commit.mjs +2 -2
- package/runtime/js/cm-ai/task-runner.mjs +658 -75
- package/runtime/js/cm-ai/tool-preview.mjs +8 -4
- package/runtime/js/cm-ai/worker-claude-developer.mjs +16 -7
- package/runtime/js/cm-ai/worker-claude.mjs +63 -19
- package/runtime/js/cm-ai/worker-codex-developer.mjs +15 -9
- package/runtime/js/cm-ai/worker-codex.mjs +45 -19
- package/runtime/js/cm-fix/cause-evidence.mjs +5 -3
- package/runtime/js/cm-fix/cause-invocation.mjs +6 -3
- package/runtime/js/cm-fix/cause-package.mjs +10 -1
- package/runtime/js/cm-fix/execution.mjs +279 -52
- package/runtime/js/cm-fix/final-review.mjs +18 -10
- package/runtime/js/cm-fix/host-review.mjs +32 -9
- package/runtime/js/cm-fix/host.mjs +6 -1
- package/runtime/js/cm-fix/layout.mjs +1 -1
- package/runtime/js/cm-fix/progress.mjs +5 -0
- package/runtime/js/cm-fix/protected-edits.mjs +15 -4
- package/runtime/js/cm-fix/qa-source.mjs +6 -4
- package/runtime/js/cm-fix/review-reconciliation.mjs +64 -0
- package/runtime/js/cm-prd/analysis.mjs +2 -1
- package/runtime/js/cm-prd/change.mjs +28 -10
- package/runtime/js/cm-prd/draft.mjs +5 -2
- package/runtime/js/cm-prd/response-recovery.mjs +23 -0
- package/runtime/js/cm-prd/review-preparation.mjs +10 -3
- package/runtime/js/cm-prd/review-publication.mjs +27 -15
- package/runtime/js/cm-prd/review-time.mjs +29 -0
- package/runtime/js/cm-prd/self-check.mjs +6 -3
- package/runtime/js/cm-prd/session.mjs +53 -6
- package/runtime/js/cm-prd/summary.mjs +3 -1
- package/runtime/js/cm-prd/validation-reason.mjs +20 -0
- package/runtime/js/cm-security/finalize.mjs +32 -0
- package/runtime/js/spec-task-line.mjs +117 -0
- package/runtime/js/specs-status.mjs +10 -3
- package/runtime/review.md +5 -0
- package/runtime/task-gates.md +6 -0
- package/runtime/workflow-config.md +10 -1
- package/scripts/cm-ai-abandon-effect-position.test.mjs +201 -0
- package/scripts/cm-ai-admission.mjs +18 -11
- package/scripts/cm-ai-admission.test.mjs +65 -1
- package/scripts/cm-ai-batch-drive.mjs +135 -34
- package/scripts/cm-ai-batch-drive.test.mjs +209 -3
- package/scripts/cm-ai-batch-host.mjs +63 -24
- package/scripts/cm-ai-batch-host.test.mjs +2 -1
- package/scripts/cm-ai-batch-run.mjs +101 -34
- package/scripts/cm-ai-batch-run.test.mjs +56 -5
- package/scripts/cm-ai-bootstrap-driver-preflight.test.mjs +45 -0
- package/scripts/cm-ai-bootstrap-flow.test.mjs +159 -0
- package/scripts/cm-ai-bootstrap-merge.test.mjs +162 -0
- package/scripts/cm-ai-bootstrap.test.mjs +174 -89
- package/scripts/cm-ai-conversation-entry-ops.test.mjs +97 -2
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +924 -0
- package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +468 -0
- package/scripts/cm-ai-drive-timeout.test.mjs +17 -0
- package/scripts/cm-ai-drive.mjs +526 -60
- package/scripts/cm-ai-drive.test.mjs +336 -10
- package/scripts/cm-ai-fix-later-delivery.test.mjs +383 -0
- package/scripts/cm-ai-host.mjs +142 -43
- package/scripts/cm-ai-host.test.mjs +232 -12
- package/scripts/cm-ai-launch-diagnostics.test.mjs +142 -0
- package/scripts/cm-ai-multi-root.test.mjs +9 -3
- package/scripts/cm-ai-operator-guidance.test.mjs +94 -0
- package/scripts/cm-ai-progress.test.mjs +521 -0
- package/scripts/cm-ai-project-qa-gate.test.mjs +308 -0
- package/scripts/cm-ai-qa-config-revision.test.mjs +187 -15
- package/scripts/cm-ai-qa-fingerprint-config.test.mjs +157 -0
- package/scripts/cm-ai-qa-fix-cross-session.test.mjs +27 -2
- package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +400 -0
- package/scripts/cm-ai-review-drift-precedence.test.mjs +90 -0
- package/scripts/cm-ai-review-failure.test.mjs +977 -0
- package/scripts/cm-ai-review-timeout-config.test.mjs +29 -7
- package/scripts/cm-ai-review-timeout.test.mjs +199 -4
- package/scripts/cm-ai-run.mjs +206 -62
- package/scripts/cm-ai-run.test.mjs +6 -4
- package/scripts/cm-ai-runner-error-code-regression.test.mjs +219 -0
- package/scripts/cm-ai-selection-guard.test.mjs +100 -0
- package/scripts/cm-ai-session-chain.test.mjs +7 -3
- package/scripts/cm-ai-spec-rebind.test.mjs +481 -0
- package/scripts/cm-ai-supersede.test.mjs +571 -17
- package/scripts/cm-ai-verification-gate.test.mjs +2 -1
- package/scripts/cm-bootstrap-review-recovery.test.mjs +70 -0
- package/scripts/cm-capability-gate.test.mjs +21 -2
- package/scripts/cm-check-drive.test.mjs +2 -1
- package/scripts/cm-check-host.test.mjs +1 -1
- package/scripts/cm-check-runtime.sh +12 -1
- package/scripts/cm-claude-developer-worker.test.mjs +3 -1
- package/scripts/cm-claude-install-layout.test.mjs +26 -0
- package/scripts/cm-claude-probe.test.mjs +10 -2
- package/scripts/cm-claude-review-stream.test.mjs +25 -0
- package/scripts/cm-claude-worker.test.mjs +11 -4
- package/scripts/cm-codex-developer-worker.test.mjs +4 -2
- package/scripts/cm-codex-plugin-metadata.py +83 -0
- package/scripts/cm-codex-plugin-metadata.test.mjs +55 -0
- package/scripts/cm-efficiency-checks.test.mjs +37 -0
- package/scripts/cm-efficiency-diagnostics.test.mjs +74 -0
- package/scripts/cm-efficiency-offline.mjs +35 -0
- package/scripts/cm-efficiency-policy.test.mjs +48 -0
- package/scripts/cm-efficiency-presentation.test.mjs +35 -0
- package/scripts/cm-efficiency-response.test.mjs +117 -0
- package/scripts/cm-efficiency-usage.test.mjs +148 -0
- package/scripts/cm-external-batch-host.test.mjs +157 -0
- package/scripts/cm-external-fix-host.test.mjs +281 -0
- package/scripts/cm-external-fix-reconciliation.test.mjs +105 -0
- package/scripts/cm-external-group-models.test.mjs +60 -0
- package/scripts/cm-external-model-host.test.mjs +180 -0
- package/scripts/cm-external-model-recovery.test.mjs +108 -0
- package/scripts/cm-external-models.test.mjs +89 -0
- package/scripts/cm-external-process-cleanup.test.mjs +71 -0
- package/scripts/cm-external-qa-fix.test.mjs +170 -0
- package/scripts/cm-external-review-reconciliation.test.mjs +314 -0
- package/scripts/cm-failover.mjs +8 -8
- package/scripts/cm-fix-abandon.test.mjs +123 -5
- package/scripts/cm-fix-cause-package.test.mjs +2 -0
- package/scripts/cm-fix-drive.mjs +70 -23
- package/scripts/cm-fix-drive.test.mjs +36 -1
- package/scripts/cm-fix-final-review.test.mjs +11 -6
- package/scripts/cm-fix-host.mjs +24 -14
- package/scripts/cm-fix-protected-edits.test.mjs +12 -0
- package/scripts/cm-fix-rediagnosis.test.mjs +168 -0
- package/scripts/cm-fix-review-budget.test.mjs +147 -0
- package/scripts/cm-fixture-process-cleanup.test.mjs +95 -0
- package/scripts/cm-host-check.test.mjs +6 -3
- package/scripts/cm-host-qa-executor.test.mjs +213 -17
- package/scripts/cm-host-session-diagnostic.test.mjs +10 -0
- package/scripts/cm-interactive-qa-diagnostic.test.mjs +53 -0
- package/scripts/cm-knowledge-closeout.test.mjs +160 -0
- package/scripts/cm-live-evidence.test.mjs +64 -0
- package/scripts/cm-log-event.mjs +25 -2
- package/scripts/cm-log-event.py +15 -0
- package/scripts/cm-log-event.test.mjs +31 -0
- package/scripts/cm-model-setup.mjs +79 -0
- package/scripts/cm-prd-completion.test.mjs +75 -0
- package/scripts/cm-prd-draft.test.mjs +14 -0
- package/scripts/cm-prd-drive.mjs +32 -11
- package/scripts/cm-prd-drive.test.mjs +15 -0
- package/scripts/cm-prd-gate-diagnostic.test.mjs +100 -0
- package/scripts/cm-prd-host.mjs +13 -4
- package/scripts/cm-prd-review-gate.mjs +126 -81
- package/scripts/cm-prd-review-gate.test.mjs +105 -1
- package/scripts/cm-prd-review-preparation.test.mjs +15 -0
- package/scripts/cm-prd-review-publication.test.mjs +6 -0
- package/scripts/cm-prd-self-check.test.mjs +6 -0
- package/scripts/cm-prd-summary.test.mjs +9 -0
- package/scripts/cm-release-smoke.sh +5 -1
- package/scripts/cm-review-dependency-snapshot.test.mjs +15 -0
- package/scripts/cm-review-inventory.test.mjs +253 -1
- package/scripts/cm-runtime-i18n.mjs +15 -4
- package/scripts/cm-runtime-install.mjs +8 -4
- package/scripts/cm-runtime.mjs +116 -23
- package/scripts/cm-runtime.test.mjs +121 -12
- package/scripts/cm-security.test.mjs +32 -0
- package/scripts/cm-spec-manifest.mjs +28 -10
- package/scripts/cm-spec-manifest.test.mjs +8 -4
- package/scripts/cm-spec-task-line.test.mjs +138 -0
- package/scripts/cm-specs-status.test.mjs +12 -1
- package/scripts/cm-task-gate-correction.test.mjs +117 -0
- package/scripts/cm-task-gate.mjs +164 -20
- package/scripts/cm-task-gate.py +2 -1
- package/scripts/cm-test-branch-impact.test.mjs +6 -3
- package/scripts/cm-test-drive.mjs +10 -4
- package/scripts/cm-test-drive.test.mjs +14 -1
- package/scripts/cm-tool-preview-context.test.mjs +12 -0
- package/scripts/cm-usage-report.py +22 -3
- package/scripts/cm-workflow-config.mjs +10 -1
- package/scripts/fixtures/bootstrap-review-runner.mjs +102 -0
- package/scripts/fixtures/claude-review-process.mjs +1 -0
- package/scripts/fixtures/live-evidence-driver.mjs +35 -0
- package/scripts/fixtures/process-cleanup.mjs +101 -0
- package/scripts/test-cm-log-event.py +2 -0
- package/scripts/test-cm-native-usage.py +62 -0
- package/scripts/test-cm-prd-review-gate.py +2 -1
- package/scripts/test-external-model-setup.py +91 -0
- package/scripts/test-model-configuration-write.py +201 -0
- package/scripts/test-npm-install.py +11 -2
- package/scripts/test-scan-public-safety.py +1 -1
- package/scripts/test-spec-manifest.py +16 -8
- package/scripts/test-task-gate.py +2 -2
- package/scripts/test-workflow-config.py +1 -0
- package/scripts/validate-public-repo.py +1 -0
- package/skills/cm-ai/SKILL.md +2 -2
- package/skills/cm-ai/references/N1-init.md +1 -1
- package/skills/cm-ai/references/N8-finish.md +5 -0
- package/skills/cm-ai/references/js-host.md +270 -43
- package/skills/cm-ai/references/knowledge-closeout.md +90 -0
- package/skills/cm-fix/SKILL.md +1 -1
- package/skills/cm-fix/references/js-host.md +52 -3
- package/skills/cm-prd/references/js-change-recovery.md +1 -1
- package/skills/cm-prd/references/js-host.md +6 -0
- package/skills/cm-runtime/SKILL.md +29 -6
- package/skills/cm-security/SKILL.md +4 -2
- package/skills/cm-security/references/scan-contract.md +1 -0
- package/templates/cm-workflow.yml +1 -1
|
@@ -87,7 +87,8 @@ test('the batch driver decides retryability from the shared predicate', async ()
|
|
|
87
87
|
const {default:fs}=await import('node:fs');
|
|
88
88
|
const {developmentRetryable}=await import('../runtime/js/cm-ai/cm-ai-conversation-entry.mjs');
|
|
89
89
|
const source=fs.readFileSync(new URL('./cm-ai-batch-run.mjs',import.meta.url),'utf8');
|
|
90
|
-
assert.match(source,/import \{
|
|
90
|
+
assert.match(source,/import \{[^}]*\bdevelopmentRetryable\b[^}]*\} from '\.\.\/runtime\/js\/cm-ai\/cm-ai-conversation-entry\.mjs'/);
|
|
91
|
+
assert.match(source,/import \{[^}]*\bcompletionRetryable\b[^}]*\} from '\.\.\/runtime\/js\/cm-ai\/cm-ai-conversation-entry\.mjs'/);
|
|
91
92
|
assert.match(source,/\|\|developmentRetryable\(status\)\)await call\('start'\)/);
|
|
92
93
|
assert.equal(/status\.code==='developer_result_invalid'/.test(source),false,
|
|
93
94
|
'batch driver still carries its own copy of the retryable code list');
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import {fixture,open} from './fixtures/bootstrap-review-runner.mjs';
|
|
6
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
7
|
+
import {runnerStatus} from '../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
8
|
+
import {createCmAiConversationEntry} from '../runtime/js/cm-ai/cm-ai-conversation-entry.mjs';
|
|
9
|
+
|
|
10
|
+
const FIXTURE_TIMEOUT_MS=Number(process.env.CM_TEST_FIXTURE_TIMEOUT_MS??60000);
|
|
11
|
+
function rechain(records){
|
|
12
|
+
let previousDigest=null;
|
|
13
|
+
for(const row of records){row.previousDigest=previousDigest;const {digest:old,...body}=row;row.digest=digest(body);previousDigest=row.digest;}
|
|
14
|
+
return records;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
test('legacy unknown bootstrap checkpoint recovers its original package without redispatch',{timeout:FIXTURE_TIMEOUT_MS},async t=>{
|
|
18
|
+
const f=fixture(t);
|
|
19
|
+
let run=open(f,'T-001');await run.effect('develop');await run.effect('review');await run.effect('complete');run.close();
|
|
20
|
+
run=open(f,'T-002');assert.equal((await run.effect('develop')).state,'awaiting_review');
|
|
21
|
+
const calls=[...f.calls],storePath=path.join(f.specsDir,'.reviews','.execution','run-T-002','state.json');
|
|
22
|
+
const saved=run.store.snapshot(),rows=structuredClone(saved.records),originalPackage=rows.at(-1).payload.checkpoint.reviewPackage;
|
|
23
|
+
assert(originalPackage);run.close();
|
|
24
|
+
// Model the exact older checkpoint shape: the developer succeeded and the
|
|
25
|
+
// host retained checks and Learning evidence, but package validation threw.
|
|
26
|
+
const checkpoint=rows.at(-1).payload.checkpoint;
|
|
27
|
+
checkpoint.state='unknown';checkpoint.code='execution_error';checkpoint.reason=null;checkpoint.reviewPackage=null;
|
|
28
|
+
checkpoint.cache.at(-1).result=runnerStatus(checkpoint,rows[0].payload.config);
|
|
29
|
+
rechain(rows);
|
|
30
|
+
const {revision:oldRevision,...body}=saved,legacy={...body,records:rows};
|
|
31
|
+
assert(oldRevision);
|
|
32
|
+
fs.writeFileSync(storePath,JSON.stringify({...legacy,revision:digest(legacy)})+'\n');
|
|
33
|
+
run=open(f,'T-002','resume');
|
|
34
|
+
assert.equal(run.runner.status().state,'unknown');assert.equal(run.runner.status().bootstrapReviewRecovery,true);
|
|
35
|
+
const entry=createCmAiConversationEntry({specsDir:f.specsDir,codeProject:f.codeProject,feature:'0.bootstrap',
|
|
36
|
+
identity:run.definition.identity,runner:run.runner,allowBootstrapReviewRecovery:true});
|
|
37
|
+
const statusBefore=run.store.snapshot();
|
|
38
|
+
const guidance=(await entry.handle({version:1,operation:'status',requestId:'recovery-status',identity:run.definition.identity})).guidance;
|
|
39
|
+
assert.equal(guidance.recoveryOperation,'bootstrap_review_recover');assert.match(guidance.nextStep,/不重新派发开发/);
|
|
40
|
+
assert.equal(guidance.authorizationGranted,false);assert.deepEqual(run.store.snapshot(),statusBefore);
|
|
41
|
+
const recovery=await entry.handle({version:1,operation:'bootstrap_review_recover',requestId:'recover-bootstrap',
|
|
42
|
+
identity:run.definition.identity,reason:'Original package validation rejected an unchanged rule'});
|
|
43
|
+
assert.equal(recovery.outcome,'advanced',JSON.stringify(recovery));
|
|
44
|
+
assert.equal(recovery.pendingAction,'decision');
|
|
45
|
+
const result=run.runner.status();
|
|
46
|
+
assert.equal(result.state,'awaiting_review',JSON.stringify(result));
|
|
47
|
+
assert.equal(result.packageDigest,originalPackage.packageDigest);
|
|
48
|
+
assert.equal(run.store.snapshot().records.at(-1).payload.type,'bootstrap-review-recovered');
|
|
49
|
+
assert.deepEqual(f.calls,calls);run.close();
|
|
50
|
+
run=open(f,'T-002','resume');assert.equal(run.runner.status().state,'awaiting_review');
|
|
51
|
+
assert.equal((await run.effect('review')).state,'approved');
|
|
52
|
+
const completed=await run.effect('complete');assert.equal(completed.state,'fixture_completed',JSON.stringify(completed));run.close();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('instruction bootstrap review material limits never grant a developer redispatch',{timeout:FIXTURE_TIMEOUT_MS},async t=>{
|
|
56
|
+
const f=fixture(t);
|
|
57
|
+
let run=open(f,'T-001');await run.effect('develop');await run.effect('review');await run.effect('complete');run.close();
|
|
58
|
+
run=open(f,'T-002','create',{afterCheck:()=>{
|
|
59
|
+
fs.mkdirSync(path.join(f.codeProject,'notes'),{recursive:true});
|
|
60
|
+
fs.writeFileSync(path.join(f.codeProject,'notes','AGENTS.md'),'x'.repeat(2100*1024));
|
|
61
|
+
}});
|
|
62
|
+
const result=await run.effect('develop');
|
|
63
|
+
assert.equal(result.state,'unknown',JSON.stringify(result));assert.equal(result.code,'limit_exceeded');
|
|
64
|
+
assert.equal(run.runner.status().bootstrapReviewRecovery,undefined);
|
|
65
|
+
const calls=[...f.calls];run.close();
|
|
66
|
+
run=open(f,'T-002','resume');
|
|
67
|
+
const retry=await run.effect('develop','-retry');
|
|
68
|
+
assert.equal(retry.outcome,'rejected');assert.equal(retry.code,'stage_mismatch');
|
|
69
|
+
assert.deepEqual(f.calls,calls);run.close();
|
|
70
|
+
});
|
|
@@ -41,15 +41,22 @@ function fixture(browserCase,{blocking=true,tests=['logic','commands','browser']
|
|
|
41
41
|
fs.writeFileSync(workflow,JSON.stringify({documentationPaths:[],applicableAgentFiles:[],
|
|
42
42
|
qa:{commands:[{id:'unit',command:[process.execPath,'--version'],caseIds:browserCase?[]:['TC-001']}],
|
|
43
43
|
environment:{kind:'web',carrier:'browser',target:'https://example.invalid/fixture',scope:'local'}}}));
|
|
44
|
+
// create requires a bound review configuration; this one grants no review attempt.
|
|
45
|
+
const review=path.join(root,'placeholder-review.json');fs.writeFileSync(review,JSON.stringify({model:'fixture',preflight:{}}));
|
|
44
46
|
return {root,specsDir,codeProject,config,workflow,
|
|
45
47
|
args:['serve','--config',config,'--mode','create','--host-context','gate-fixture','--allow-development',
|
|
46
|
-
'--workflow-config',workflow,'--allow-qa']};
|
|
48
|
+
'--workflow-config',workflow,'--allow-qa','--review-config',review]};
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
const launch=(f,...extra)=>spawnSync(process.execPath,[cli,...f.args,...extra],{encoding:'utf8',timeout:20000,env:{...process.env,NODE_NO_WARNINGS:'1'}});
|
|
50
52
|
function rejected(result,code){
|
|
51
53
|
assert.equal(result.error,undefined);assert.equal(result.status,1,result.stderr);
|
|
52
|
-
|
|
54
|
+
const parsed=JSON.parse(result.stderr);
|
|
55
|
+
assert.equal(parsed.error.code,code);
|
|
56
|
+
if(['browser_capability_required','browser_capability_unavailable'].includes(code))
|
|
57
|
+
assert.match(parsed.error.reason,/--browser-qa available\|unavailable.*interactive QA/);
|
|
58
|
+
else if(code==='invalid_arguments')assert.match(parsed.error.reason,/--browser-qa/);
|
|
59
|
+
else assert.deepEqual(parsed,{error:{code}});
|
|
53
60
|
}
|
|
54
61
|
function started(f,...extra){
|
|
55
62
|
const result=launch(f,...extra);
|
|
@@ -76,6 +83,18 @@ test('the browser gate fires exactly when the approved contract can select a bro
|
|
|
76
83
|
}finally{fs.rmSync(withoutBrowser.root,{recursive:true,force:true});}
|
|
77
84
|
});
|
|
78
85
|
|
|
86
|
+
test('iOS simulator carrier is named in the launch diagnostic',()=>{
|
|
87
|
+
const f=fixture(true);
|
|
88
|
+
try{
|
|
89
|
+
const workflow=JSON.parse(fs.readFileSync(f.workflow,'utf8'));
|
|
90
|
+
workflow.qa.environment={kind:'app',carrier:'ios-simulator',target:'fixture-app',scope:'local'};
|
|
91
|
+
fs.writeFileSync(f.workflow,JSON.stringify(workflow));
|
|
92
|
+
const result=launch(f);
|
|
93
|
+
rejected(result,'browser_capability_required');
|
|
94
|
+
assert.match(JSON.parse(result.stderr).error.reason,/ios-simulator/);
|
|
95
|
+
}finally{fs.rmSync(f.root,{recursive:true,force:true});}
|
|
96
|
+
});
|
|
97
|
+
|
|
79
98
|
test('resume requires a fresh assertion and reopens the run created by available',()=>{
|
|
80
99
|
const f=fixture(true);
|
|
81
100
|
try{
|
|
@@ -12,7 +12,8 @@ function fixture(t,exit=0){
|
|
|
12
12
|
t.after(()=>fs.rmSync(dir,{recursive:true,force:true}));
|
|
13
13
|
for(const file of ['scripts/cm-check-entry.mjs','scripts/cm-check-host.mjs','scripts/cm-check-drive.mjs',
|
|
14
14
|
'scripts/cm-workflow-config.mjs','runtime/js/cm-check/host.mjs','runtime/js/cm-ai/drive-core.mjs',
|
|
15
|
-
'runtime/js/cm-ai/
|
|
15
|
+
'runtime/js/cm-ai/operator-guidance.mjs',
|
|
16
|
+
'runtime/js/cm-ai/host-tool-bridge.mjs','runtime/js/cm-ai/host-session.mjs','runtime/js/cm-ai/diagnostic-reason.mjs','runtime/js/cm-ai/effect-contract.mjs',
|
|
16
17
|
'runtime/js/cm-ai/contracts.mjs','runtime/js/cm-init/draft-inspection.mjs','skills/cm-check/SKILL.md']){
|
|
17
18
|
fs.mkdirSync(path.dirname(path.join(dir,file)),{recursive:true});fs.copyFileSync(path.join(root,file),path.join(dir,file));
|
|
18
19
|
}
|
|
@@ -19,7 +19,7 @@ function fixture(t,exitCode=0){
|
|
|
19
19
|
const dir=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-check-host-'))),project=path.join(dir,'project');fs.mkdirSync(project);
|
|
20
20
|
t.after(()=>fs.rmSync(dir,{recursive:true,force:true}));
|
|
21
21
|
for(const file of ['scripts/cm-check-entry.mjs','scripts/cm-check-host.mjs','scripts/cm-workflow-config.mjs','runtime/js/cm-check/host.mjs',
|
|
22
|
-
'runtime/js/cm-ai/host-tool-bridge.mjs','runtime/js/cm-ai/host-session.mjs','runtime/js/cm-ai/effect-contract.mjs',
|
|
22
|
+
'runtime/js/cm-ai/host-tool-bridge.mjs','runtime/js/cm-ai/host-session.mjs','runtime/js/cm-ai/diagnostic-reason.mjs','runtime/js/cm-ai/effect-contract.mjs',
|
|
23
23
|
'runtime/js/cm-ai/contracts.mjs','runtime/js/cm-init/draft-inspection.mjs','skills/cm-check/SKILL.md']){
|
|
24
24
|
fs.mkdirSync(path.dirname(path.join(dir,file)),{recursive:true});fs.copyFileSync(path.join(root,file),path.join(dir,file));
|
|
25
25
|
}
|
|
@@ -282,7 +282,7 @@ for module in \
|
|
|
282
282
|
cm-ai-learning-handoff-writer.mjs cm-ai-learning-writer.mjs cm-ai-qa-log.mjs \
|
|
283
283
|
cm-ai-run-finalizer.mjs codex-config.mjs codex-review-adapter.mjs contracts.mjs \
|
|
284
284
|
durable-runner-state.mjs effect-contract.mjs execution-store.mjs gate-bridge.mjs \
|
|
285
|
-
host.mjs host-session.mjs index.mjs provider-review-observation.mjs review-package.mjs \
|
|
285
|
+
host.mjs host-session.mjs diagnostic-reason.mjs index.mjs provider-review-observation.mjs review-package.mjs \
|
|
286
286
|
review-result.schema.json review-runner.mjs task-commit-codec.mjs task-commit.mjs \
|
|
287
287
|
task-owner.mjs task-runner.mjs worker-codex.mjs; do
|
|
288
288
|
require_file "runtime/js/cm-ai/$module"
|
|
@@ -310,8 +310,19 @@ require_file "scripts/cm-openai-compatible-call.py"
|
|
|
310
310
|
require_file "scripts/test-cm-openai-compatible-call.py"
|
|
311
311
|
require_file "scripts/cm-task-gate.mjs"
|
|
312
312
|
require_file "scripts/cm-task-gate.test.mjs"
|
|
313
|
+
require_file "scripts/cm-task-gate-correction.test.mjs"
|
|
314
|
+
HUMAN_CORRECTION_DOC="docs/human-correction.md"
|
|
315
|
+
if [ "$MODE" != "plugin" ]; then
|
|
316
|
+
HUMAN_CORRECTION_DOC="cm-workflow/docs/human-correction.md"
|
|
317
|
+
fi
|
|
318
|
+
require_file "$HUMAN_CORRECTION_DOC"
|
|
313
319
|
require_file "scripts/cm-task-gate.py"
|
|
314
320
|
require_file "scripts/test-task-gate.py"
|
|
321
|
+
for correction_command in prepare-human-correction publish-human-correction-review; do
|
|
322
|
+
grep -Fq "$correction_command" "$ROOT/scripts/cm-task-gate.mjs" &&
|
|
323
|
+
grep -Fq "$correction_command" "$ROOT/$HUMAN_CORRECTION_DOC" ||
|
|
324
|
+
fail "human correction command/document pair incomplete: $correction_command"
|
|
325
|
+
done
|
|
315
326
|
require_file "scripts/cm-workflow-config.mjs"
|
|
316
327
|
require_file "scripts/cm-workflow-config.test.mjs"
|
|
317
328
|
# Group 4: user runtimes.yml producers <-> authoritative consumer.
|
|
@@ -9,6 +9,7 @@ import {createProjectExecution} from '../runtime/js/cm-ai/host-project-execution
|
|
|
9
9
|
import {buildClaudeDeveloperPrompt} from '../runtime/js/cm-ai/claude-developer-adapter.mjs';
|
|
10
10
|
import {protectedTextInstructions} from '../runtime/js/cm-ai/host-conversation-execution.mjs';
|
|
11
11
|
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
12
|
+
import {ownerGuardSource} from './fixtures/process-cleanup.mjs';
|
|
12
13
|
|
|
13
14
|
const identity={repositoryId:'proposal-fixture',runId:'proposal-run',taskId:'T-001',attempt:1};
|
|
14
15
|
const proposal={status:'succeeded',value:{outcome:'implemented'},edits:[{path:'target.txt',beforeSha256:null,content:'safe text\n'}]};
|
|
@@ -25,7 +26,8 @@ function fixture(t){
|
|
|
25
26
|
function fakeWorker(cwd,{value=proposal,mode='normal',timeoutMs=3000,noticeEvents=[],noticeAt=1,onNotice,
|
|
26
27
|
resultFields={},toolName='Read',toolResultId='read-1',
|
|
27
28
|
assistantContent=[{type:'text',text:'proposal'}]}={}){
|
|
28
|
-
|
|
29
|
+
// The timeout mode hangs; the guard ends it if this test process dies first.
|
|
30
|
+
const source=`${ownerGuardSource()}let input='';process.stdin.on('data',s=>input+=s);process.stdin.on('end',()=>{
|
|
29
31
|
if(!input.includes('Return {status,value,edits}'))process.exit(9);
|
|
30
32
|
if(${JSON.stringify(mode)}==='timeout'){setInterval(()=>{},1000);return;}
|
|
31
33
|
const session_id='synthetic-claude-developer';
|
|
@@ -0,0 +1,26 @@
|
|
|
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 {fileURLToPath} from 'node:url';
|
|
8
|
+
const source=fileURLToPath(new URL('..',import.meta.url));
|
|
9
|
+
test('real isolated Claude install checks correction docs at its installed layout and refuses a missing document',
|
|
10
|
+
{skip:process.platform==='win32',timeout:180000},t=>{
|
|
11
|
+
const home=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-claude-install-layout-')));
|
|
12
|
+
t.after(()=>fs.rmSync(home,{recursive:true,force:true}));
|
|
13
|
+
const target=path.join(home,'.claude'),env={...process.env,HOME:home,CLAUDE_HOME:target,
|
|
14
|
+
CM_WORKFLOW_HOME:path.join(home,'user'),CM_WORKFLOW_LOG_HOME:path.join(home,'logs')};
|
|
15
|
+
const installed=spawnSync('/bin/bash',[path.join(source,'install.sh'),'--yes'],{cwd:source,env,encoding:'utf8',timeout:120000,maxBuffer:4*1024*1024});
|
|
16
|
+
assert.equal(installed.status,0,installed.stdout+installed.stderr);
|
|
17
|
+
assert.match(installed.stdout,/cm runtime check: PASSED \(claude-compat v/);
|
|
18
|
+
const doc=path.join(target,'cm-workflow/docs/human-correction.md');
|
|
19
|
+
assert.equal(fs.readFileSync(doc,'utf8'),fs.readFileSync(path.join(source,'docs/human-correction.md'),'utf8'));
|
|
20
|
+
assert.equal(fs.existsSync(path.join(target,'docs/human-correction.md')),false);
|
|
21
|
+
fs.unlinkSync(doc);
|
|
22
|
+
const rejected=spawnSync('/bin/bash',[path.join(target,'scripts/cm-check-runtime.sh'),'--project',source],{cwd:source,env,encoding:'utf8',timeout:120000,maxBuffer:4*1024*1024});
|
|
23
|
+
assert.notEqual(rejected.status,0);
|
|
24
|
+
assert.match(rejected.stderr,/missing cm-workflow\/docs\/human-correction\.md/);
|
|
25
|
+
assert.match(rejected.stderr,/human correction command\/document pair incomplete/);
|
|
26
|
+
});
|
|
@@ -8,6 +8,7 @@ import * as zlib from 'node:zlib';
|
|
|
8
8
|
import {spawn,spawnSync} from 'node:child_process';
|
|
9
9
|
import {fileURLToPath} from 'node:url';
|
|
10
10
|
import {buildManifest} from './cm-spec-manifest.mjs';
|
|
11
|
+
import {ownerGuardSource} from './fixtures/process-cleanup.mjs';
|
|
11
12
|
import {previewClaudeTools,claudeProbeSandbox,createClaudeModelMarkerDetector} from '../runtime/js/cm-ai/claude-tool-preview.mjs';
|
|
12
13
|
import {previewPromptTransport,writePreviewPrompt} from '../runtime/js/cm-ai/tool-preview.mjs';
|
|
13
14
|
|
|
@@ -39,7 +40,7 @@ test('fake Claude process stderr marker yields only its reported model',async()=
|
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
|
|
42
|
-
//
|
|
43
|
+
// Darwin fixtures run in the dedicated macOS CI job and were exercised locally.
|
|
43
44
|
// The sink intentionally retains protocol checks, never the decoded body bytes.
|
|
44
45
|
for(const encoding of ['gzip','zstd','br'])test(`Claude probe ${encoding} body reaches only its declared decoder`,
|
|
45
46
|
{skip:process.platform!=='darwin'||(encoding==='zstd'&&typeof zlib.zstdCompressSync!=='function')},async()=>{
|
|
@@ -107,7 +108,7 @@ test('probe accepts at most two compliant requests and validates every request',
|
|
|
107
108
|
for(const [name,requests,passed] of cases)await t.test(name,async()=>{
|
|
108
109
|
// Keep the fixture alive after SIGTERM so the worker's real cleanup captures
|
|
109
110
|
// the entire sequence deterministically, without delaying the probe's abort.
|
|
110
|
-
const source
|
|
111
|
+
const source=`${ownerGuardSource()}process.on('SIGTERM',()=>{});setInterval(()=>{},1000);
|
|
111
112
|
let input='';process.stdin.on('data',s=>input+=s);process.stdin.on('end',async()=>{
|
|
112
113
|
for(const request of ${JSON.stringify(requests)}){
|
|
113
114
|
const response=await fetch(process.env.ANTHROPIC_BASE_URL+'/v1/messages',{method:'POST',
|
|
@@ -191,10 +192,17 @@ test('Claude preflight CLI exits 1 with model_recognized false and leaves normal
|
|
|
191
192
|
assert.ok(run.stdout.trim(),run.stderr);
|
|
192
193
|
const receipt=JSON.parse(run.stdout);
|
|
193
194
|
assert.equal(receipt.preflight.passed,expectedExit===0);
|
|
195
|
+
assert.equal(receipt.timeoutMs,900000);
|
|
194
196
|
assert.equal(receipt.preflight.request_checks.find(check=>Object.hasOwn(check,'model_matches'))?.model_matches,true);
|
|
195
197
|
if(expectedExit===1)assert.deepEqual(receipt.preflight.request_checks.at(-1),
|
|
196
198
|
{model_recognized:false,reported_model:model});
|
|
197
199
|
else assert.equal(receipt.preflight.request_checks.some(check=>Object.hasOwn(check,'model_recognized')),false);
|
|
200
|
+
if(expectedExit===1){
|
|
201
|
+
assert.match(run.stderr,/fixture-unrecognized-model/);
|
|
202
|
+
assert.match(run.stderr,/claude-opus-5/);
|
|
203
|
+
assert.match(run.stderr,/installed Claude CLI/);
|
|
204
|
+
assert.match(run.stderr,/2\.1\.274 \(Claude Code\)/);
|
|
205
|
+
}
|
|
198
206
|
assert.equal(run.stdout.includes('CM-PROBE-001'),false);
|
|
199
207
|
}
|
|
200
208
|
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
@@ -321,3 +321,28 @@ test('exhausted retries do not decide success or suppress provider failure',()=>
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
|
+
|
|
325
|
+
// Claude CLI 2.1.274 reports an API failure as a synthetic assistant message
|
|
326
|
+
// with a string error class. Before any tool call it names a retryable class;
|
|
327
|
+
// anything else keeps the fail-closed unexpected_assistant.
|
|
328
|
+
test('API error classes before any tool call name the reviewer failure',()=>{
|
|
329
|
+
const [init]=transcript();
|
|
330
|
+
const apiError=error=>({type:'assistant',session_id:'fresh-review',parent_tool_use_id:null,error,is_api_error_message:true,
|
|
331
|
+
message:{role:'assistant',content:[{type:'text',text:'API Error'}]}});
|
|
332
|
+
for(const [error,code] of [['authentication_failed','reviewer_auth_failed'],['billing_error','reviewer_billing_error'],
|
|
333
|
+
['rate_limit','reviewer_rate_limited'],['server_error','reviewer_server_error'],['model_not_found','reviewer_model_not_found'],
|
|
334
|
+
['invalid_request','reviewer_api_error'],['__proto__','reviewer_api_error']]){
|
|
335
|
+
const events=[],stream=createClaudeReviewStream(event=>events.push(event));stream.accept(init);
|
|
336
|
+
assert.throws(()=>stream.accept(apiError(error)),{code});
|
|
337
|
+
assert.deepEqual(events.map(event=>event.event),['thread.started','turn.started']);
|
|
338
|
+
assert.throws(()=>stream.finish(),{code:'incomplete_result'});
|
|
339
|
+
}
|
|
340
|
+
for(const messages of [
|
|
341
|
+
[assistant([tool('t1','Bash')]),toolResult('t1',true),apiError('rate_limit')],
|
|
342
|
+
[{...apiError('rate_limit'),parent_tool_use_id:'child'}],
|
|
343
|
+
[apiError({type:'rate_limit'})],
|
|
344
|
+
]){
|
|
345
|
+
const stream=createClaudeReviewStream(()=>{});stream.accept(init);
|
|
346
|
+
assert.throws(()=>messages.forEach(message=>stream.accept(message)),{code:'unexpected_assistant'});
|
|
347
|
+
}
|
|
348
|
+
});
|
|
@@ -6,6 +6,7 @@ import {spawn} from 'node:child_process';
|
|
|
6
6
|
import {createHash} from 'node:crypto';
|
|
7
7
|
import {readFileSync} from 'node:fs';
|
|
8
8
|
import {claudeWorker,claudeReviewArgs,claudeReviewFingerprint,claudePreflightMatches} from '../runtime/js/cm-ai/worker-claude.mjs';
|
|
9
|
+
import {killProcessGroup,ownerGuardSource} from './fixtures/process-cleanup.mjs';
|
|
9
10
|
|
|
10
11
|
const config={cwd:'/tmp',model:'claude-fixture',cli:'never-dispatch-real-cli'};
|
|
11
12
|
const receipt={passed:true,provider:'claude',prompt_transport:'stdin',config_fingerprint:claudeReviewFingerprint(config)};
|
|
@@ -164,14 +165,16 @@ test('failure, timeout, explicit cancellation and missing preflight remain disti
|
|
|
164
165
|
test('timeout kills inherited-pipe descendants, including TERM-ignoring children',
|
|
165
166
|
{skip:process.platform==='win32'},async()=>{
|
|
166
167
|
for (const descendantStdio of ['inherit','ignore']) {
|
|
167
|
-
let descendant;
|
|
168
|
+
let descendant,leader;
|
|
169
|
+
// Both guards watch this test process, never the leader, so a missed group kill still shows.
|
|
170
|
+
const hung=ownerGuardSource()+"process.on('SIGTERM',()=>{});setInterval(()=>{},1000)";
|
|
168
171
|
const worker=claudeWorker({...config,preflight:receipt,timeoutMs:300,
|
|
169
172
|
spawnProcess:(_cli,_args,options)=>{
|
|
170
173
|
const child=spawn(process.execPath,['-e',
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
`${ownerGuardSource()}const {spawn}=require('node:child_process');const c=spawn(process.execPath,['-e',
|
|
175
|
+
${JSON.stringify(hung)}],{stdio:['ignore','${descendantStdio}','${descendantStdio}']});
|
|
173
176
|
process.stderr.write(String(c.pid)+'\\n');setInterval(()=>{},1000);`],options);
|
|
174
|
-
child.stderr.on('data',chunk=>{descendant=Number(String(chunk).trim());});
|
|
177
|
+
leader=child.pid;child.stderr.on('data',chunk=>{descendant=Number(String(chunk).trim());});
|
|
175
178
|
return child;
|
|
176
179
|
}});
|
|
177
180
|
try {
|
|
@@ -180,7 +183,11 @@ test('timeout kills inherited-pipe descendants, including TERM-ignoring children
|
|
|
180
183
|
assert.equal(result.code,'timeout');assert.ok(Date.now()-started<4000);
|
|
181
184
|
assert.ok(Date.now()-started>=1200,'leader close must not cancel group escalation');
|
|
182
185
|
assert.ok(Number.isInteger(descendant));
|
|
186
|
+
const gone=()=>{try{process.kill(descendant,0);return false;}catch(error){return error.code==='ESRCH';}};
|
|
187
|
+
for(const deadline=Date.now()+3000;!gone()&&Date.now()<deadline;)await new Promise(resolve=>setTimeout(resolve,25));
|
|
188
|
+
assert.ok(gone(),'group SIGKILL must reach the TERM-ignoring descendant');
|
|
183
189
|
} finally {
|
|
190
|
+
killProcessGroup(leader);
|
|
184
191
|
if(Number.isInteger(descendant))try{process.kill(descendant,'SIGKILL');}catch{}
|
|
185
192
|
}
|
|
186
193
|
}
|
|
@@ -9,8 +9,10 @@ import {commonArgs} from '../runtime/js/cm-ai/codex-config.mjs';
|
|
|
9
9
|
import {createCodexDeveloperRun} from '../runtime/js/cm-ai/codex-developer-adapter.mjs';
|
|
10
10
|
import {requestFor} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
11
11
|
import {createTaskRunner} from '../runtime/js/cm-ai/task-runner.mjs';
|
|
12
|
+
import {ownerGuardSource} from './fixtures/process-cleanup.mjs';
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
// The hang mode never exits on its own; the guard ends it if this test process dies first.
|
|
15
|
+
const script=`${ownerGuardSource()}let input='';process.stdin.on('data',x=>input+=x);process.stdin.on('end',()=>{
|
|
14
16
|
const emit=x=>process.stdout.write(JSON.stringify(x)+'\\n');
|
|
15
17
|
emit({type:'thread.started',thread_id:'isolated-fixture'});emit({type:'turn.started'});
|
|
16
18
|
if(process.argv[1]==='hang'){setInterval(()=>{},1000);return;}
|
|
@@ -139,7 +141,7 @@ test('cancellation kills a TERM-resistant descendant inheriting output pipes',()
|
|
|
139
141
|
const descendant=`process.on('SIGTERM',()=>{});
|
|
140
142
|
process.stdout.write(JSON.stringify({type:'item.started',item:{type:'command_execution',id:'descendant-ready'}})+'\\n');
|
|
141
143
|
setTimeout(()=>{require('node:fs').writeFileSync('leaked.txt','still running');process.exit(0);},2500);`;
|
|
142
|
-
const parent
|
|
144
|
+
const parent=`${ownerGuardSource()}process.stdin.resume();
|
|
143
145
|
process.stdout.write(JSON.stringify({type:'thread.started',thread_id:'tree'})+'\\n');
|
|
144
146
|
process.stdout.write(JSON.stringify({type:'turn.started'})+'\\n');
|
|
145
147
|
require('node:child_process').spawn(process.execPath,['-e',${JSON.stringify(descendant)}],{stdio:['ignore','inherit','inherit']});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Small metadata fallback for Codex versions without the old optional helpers.
|
|
3
|
+
|
|
4
|
+
Official plugin-creator still owns marketplace registration; Codex CLI validates
|
|
5
|
+
and installs the plugin. This script only reads a marketplace name or updates a
|
|
6
|
+
staged plugin's cache version. It never installs or edits user configuration.
|
|
7
|
+
"""
|
|
8
|
+
import datetime
|
|
9
|
+
import hashlib
|
|
10
|
+
import json
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
import re
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def object_pairs(pairs):
|
|
17
|
+
value = {}
|
|
18
|
+
for key, item in pairs:
|
|
19
|
+
if key in value:
|
|
20
|
+
raise ValueError('duplicate JSON key: ' + key)
|
|
21
|
+
value[key] = item
|
|
22
|
+
return value
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def read_object(file):
|
|
26
|
+
if file.is_symlink() or not file.is_file():
|
|
27
|
+
raise ValueError('metadata must be a regular non-symlink file')
|
|
28
|
+
value = json.loads(file.read_text(encoding='utf-8'), object_pairs_hook=object_pairs)
|
|
29
|
+
if not isinstance(value, dict):
|
|
30
|
+
raise ValueError('metadata must be a JSON object')
|
|
31
|
+
return value
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def main(args):
|
|
35
|
+
if len(args) != 2 or args[0] not in ('marketplace-name', 'initialize-marketplace', 'cache-version'):
|
|
36
|
+
raise ValueError('usage: cm-codex-plugin-metadata.py {marketplace-name|initialize-marketplace|cache-version} PATH')
|
|
37
|
+
operation, raw = args
|
|
38
|
+
if operation == 'initialize-marketplace':
|
|
39
|
+
file = Path(raw)
|
|
40
|
+
marketplace = read_object(file)
|
|
41
|
+
if marketplace.get('name') == '[TODO: marketplace-name]':
|
|
42
|
+
plugins = marketplace.get('plugins')
|
|
43
|
+
if not isinstance(plugins, list) or len(plugins) != 1 or not isinstance(plugins[0], dict) or plugins[0].get('name') != 'cm-workflow':
|
|
44
|
+
raise ValueError('initial marketplace must be the official fresh CM scaffold')
|
|
45
|
+
marketplace['name'] = 'personal'
|
|
46
|
+
interface = marketplace.get('interface')
|
|
47
|
+
if isinstance(interface, dict) and interface.get('displayName') == '[TODO: display-name]':
|
|
48
|
+
interface['displayName'] = 'Personal plugins'
|
|
49
|
+
file.write_text(json.dumps(marketplace, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
|
|
50
|
+
elif not isinstance(marketplace.get('name'), str) or not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_.-]*', marketplace['name']):
|
|
51
|
+
raise ValueError('initial marketplace requires a valid name or official placeholder')
|
|
52
|
+
return
|
|
53
|
+
if operation == 'marketplace-name':
|
|
54
|
+
name = read_object(Path(raw)).get('name')
|
|
55
|
+
if not isinstance(name, str) or not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_.-]*', name):
|
|
56
|
+
raise ValueError('marketplace requires a valid name')
|
|
57
|
+
print(name)
|
|
58
|
+
return
|
|
59
|
+
root = Path(raw)
|
|
60
|
+
if root.is_symlink() or not root.is_dir():
|
|
61
|
+
raise ValueError('stage must be a real directory')
|
|
62
|
+
file = root / '.codex-plugin' / 'plugin.json'
|
|
63
|
+
if file.parent.is_symlink():
|
|
64
|
+
raise ValueError('manifest parent must be a real directory')
|
|
65
|
+
plugin = read_object(file)
|
|
66
|
+
version = (root / 'VERSION').read_text(encoding='utf-8').strip()
|
|
67
|
+
if plugin.get('name') != 'cm-workflow' or not re.fullmatch(r'\d+\.\d+\.\d+', version):
|
|
68
|
+
raise ValueError('cache version requires a CM plugin and base VERSION')
|
|
69
|
+
if plugin.get('version', '').split('+', 1)[0] != version:
|
|
70
|
+
raise ValueError('manifest base version must match VERSION')
|
|
71
|
+
stamp = datetime.datetime.now(datetime.timezone.utc).strftime('%Y%m%d%H%M%S%f')
|
|
72
|
+
fingerprint = hashlib.sha256(file.read_bytes()).hexdigest()[:12]
|
|
73
|
+
plugin['version'] = version + '+codex.' + stamp + '.' + fingerprint
|
|
74
|
+
file.write_text(json.dumps(plugin, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
|
|
75
|
+
print(plugin['version'])
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == '__main__':
|
|
79
|
+
try:
|
|
80
|
+
main(sys.argv[1:])
|
|
81
|
+
except (ValueError, OSError) as error:
|
|
82
|
+
print('ERROR: ' + str(error), file=sys.stderr)
|
|
83
|
+
raise SystemExit(1)
|
|
@@ -0,0 +1,55 @@
|
|
|
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 {fileURLToPath} from 'node:url';
|
|
8
|
+
const script=fileURLToPath(new URL('./cm-codex-plugin-metadata.py',import.meta.url));
|
|
9
|
+
function fixture(t){
|
|
10
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-plugin-metadata-')));
|
|
11
|
+
t.after(()=>fs.rmSync(root,{recursive:true,force:true}));
|
|
12
|
+
const run=(operation,file)=>spawnSync(process.env.CM_PYTHON_BIN||'python3',[script,operation,file],{encoding:'utf8'});
|
|
13
|
+
return {root,run};
|
|
14
|
+
}
|
|
15
|
+
test('metadata fallback reads marketplace identity without rewriting other plugins or user bytes',t=>{
|
|
16
|
+
const {root,run}=fixture(t),file=path.join(root,'marketplace.json');
|
|
17
|
+
const bytes='{"name":"local-personal","plugins":[{"name":"unrelated"}]}\n';fs.writeFileSync(file,bytes);
|
|
18
|
+
const result=run('marketplace-name',file);assert.equal(result.status,0,result.stderr);assert.equal(result.stdout,'local-personal\n');assert.equal(fs.readFileSync(file,'utf8'),bytes);
|
|
19
|
+
for(const value of ['[]','{"name":"bad@name"}','{"name":"good","name":"other"}']){
|
|
20
|
+
fs.writeFileSync(file,value);assert.equal(run('marketplace-name',file).status,1);
|
|
21
|
+
assert.equal(fs.readFileSync(file,'utf8'),value);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
test('cache version fallback keeps manifest contents and source base while yielding distinct build identities',t=>{
|
|
25
|
+
const {root,run}=fixture(t);fs.mkdirSync(path.join(root,'.codex-plugin'));
|
|
26
|
+
const file=path.join(root,'.codex-plugin/plugin.json'),before={name:'cm-workflow',version:'0.16.5',skills:'./skills',interface:{displayName:'CM'}};
|
|
27
|
+
fs.writeFileSync(file,JSON.stringify(before));fs.writeFileSync(path.join(root,'VERSION'),'0.16.5\n');
|
|
28
|
+
const first=run('cache-version',root);assert.equal(first.status,0,first.stderr);
|
|
29
|
+
const after=JSON.parse(fs.readFileSync(file));assert.match(after.version,/^0\.16\.5\+codex\.\d{20}\.[a-f0-9]{12}$/);
|
|
30
|
+
assert.deepEqual({...after,version:before.version},before);assert.equal(fs.readFileSync(path.join(root,'VERSION'),'utf8'),'0.16.5\n');
|
|
31
|
+
const second=run('cache-version',root);assert.equal(second.status,0,second.stderr);assert.notEqual(first.stdout,second.stdout);
|
|
32
|
+
});
|
|
33
|
+
test('metadata fallback rejects unsafe manifests and stages before writing',t=>{
|
|
34
|
+
const {root,run}=fixture(t);fs.mkdirSync(path.join(root,'.codex-plugin'));fs.writeFileSync(path.join(root,'VERSION'),'0.16.5');
|
|
35
|
+
const file=path.join(root,'.codex-plugin/plugin.json');
|
|
36
|
+
for(const data of [{name:'other',version:'0.16.5'},{name:'cm-workflow',version:'0.16.4'}]){
|
|
37
|
+
const bytes=JSON.stringify(data);fs.writeFileSync(file,bytes);assert.equal(run('cache-version',root).status,1);assert.equal(fs.readFileSync(file,'utf8'),bytes);
|
|
38
|
+
}
|
|
39
|
+
const external=path.join(root,'external');fs.writeFileSync(external,'{"name":"cm-workflow","version":"0.16.5"}');
|
|
40
|
+
fs.unlinkSync(file);fs.symlinkSync(external,file);assert.equal(run('cache-version',root).status,1);assert.equal(fs.readFileSync(external,'utf8'),'{"name":"cm-workflow","version":"0.16.5"}');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Uses the same placeholder emitted by the current official creator; installed
|
|
44
|
+
// user names and sibling plugins must not be normalized during an upgrade.
|
|
45
|
+
test('fresh official marketplace placeholder gets a valid personal name while existing identity is preserved',t=>{
|
|
46
|
+
const {root,run}=fixture(t),file=path.join(root,'marketplace.json');
|
|
47
|
+
const seed={name:'[TODO: marketplace-name]',interface:{displayName:'[TODO: display-name]'},plugins:[{name:'cm-workflow',source:{source:'local',path:'./plugins/cm-workflow'}}]};
|
|
48
|
+
fs.writeFileSync(file,JSON.stringify(seed));assert.equal(run('initialize-marketplace',file).status,0);
|
|
49
|
+
assert.equal(run('marketplace-name',file).stdout,'personal\n');
|
|
50
|
+
const initialized=JSON.parse(fs.readFileSync(file));assert.deepEqual(initialized.plugins,seed.plugins);
|
|
51
|
+
const existing=JSON.stringify({name:'existing-personal',plugins:[...seed.plugins,{name:'other'}]});
|
|
52
|
+
fs.writeFileSync(file,existing);assert.equal(run('initialize-marketplace',file).status,0);assert.equal(fs.readFileSync(file,'utf8'),existing);
|
|
53
|
+
seed.plugins.push({name:'other'});const invalid=JSON.stringify(seed);fs.writeFileSync(file,invalid);
|
|
54
|
+
assert.equal(run('initialize-marketplace',file).status,1);assert.equal(fs.readFileSync(file,'utf8'),invalid);
|
|
55
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
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 {createHostCheck} from '../runtime/js/cm-ai/host-check.mjs';
|
|
7
|
+
const identity={repositoryId:'fixture',runId:'efficiency',taskId:'T-001',attempt:1};
|
|
8
|
+
function fixture(t){const cwd=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-efficiency-check-')));t.after(()=>fs.rmSync(cwd,{recursive:true,force:true}));return cwd;}
|
|
9
|
+
const control=()=>({signal:new AbortController().signal});
|
|
10
|
+
const command=[process.execPath,'-e',"require('node:fs').appendFileSync('executions','x');console.log('tests 3\\npass 3\\nfail 0')"];
|
|
11
|
+
test('declared adjacent identical checks share one execution; final acceptance executes again',async t=>{
|
|
12
|
+
const cwd=fixture(t),output=[],progress=[];
|
|
13
|
+
const check=createHostCheck({cwd,reuseDeclared:true,commands:[{id:'tests',command},{id:'ui',command,sameExecutionAs:'tests'}],
|
|
14
|
+
onOutput:value=>{output.push(value.chunk.toString());},onProgress:value=>{progress.push(value);}});
|
|
15
|
+
const rows=await check({identity},control());assert.equal(fs.readFileSync(path.join(cwd,'executions'),'utf8'),'x');
|
|
16
|
+
assert.deepEqual(rows.map(r=>r.id),['tests','ui']);assert(rows.every(r=>r.outcome==='passed'));
|
|
17
|
+
assert.match(rows[1].evidence,/same execution as tests;.*tests 3/);assert.equal(output.length,1);
|
|
18
|
+
assert.equal(progress.filter(p=>p.phase==='start').length,1);
|
|
19
|
+
await check({identity},control());assert.equal(fs.readFileSync(path.join(cwd,'executions'),'utf8'),'xx');
|
|
20
|
+
});
|
|
21
|
+
test('identical commands without explicit alias continue to execute twice',async t=>{
|
|
22
|
+
const cwd=fixture(t),check=createHostCheck({cwd,reuseDeclared:true,commands:[{id:'one',command},{id:'two',command}]});
|
|
23
|
+
await check({identity},control());assert.equal(fs.readFileSync(path.join(cwd,'executions'),'utf8'),'xx');
|
|
24
|
+
});
|
|
25
|
+
test('alias requires opt-in, same command, adjacent source and unique identity',t=>{
|
|
26
|
+
const cwd=fixture(t),base=[{id:'one',command},{id:'two',command,sameExecutionAs:'one'}];
|
|
27
|
+
assert.throws(()=>createHostCheck({cwd,commands:base}),/invalid_input/);
|
|
28
|
+
for(const commands of [[base[1]], [base[0],{...base[1],command:[process.execPath,'--version']}],
|
|
29
|
+
[base[0],{id:'other',command},base[1]], [base[0],{...base[1],id:'one'}]])
|
|
30
|
+
assert.throws(()=>createHostCheck({cwd,reuseDeclared:true,commands}));
|
|
31
|
+
assert(!fs.existsSync(path.join(cwd,'executions')));
|
|
32
|
+
});
|
|
33
|
+
test('failed original command is never recycled into a passed alias',async t=>{
|
|
34
|
+
const cwd=fixture(t),fail=[process.execPath,'-e','process.exit(1)'];
|
|
35
|
+
const check=createHostCheck({cwd,reuseDeclared:true,commands:[{id:'one',command:fail},{id:'two',command:fail,sameExecutionAs:'one'}]});
|
|
36
|
+
const rows=await check({identity},control());assert.equal(rows.length,1);assert.equal(rows[0].outcome,'failed');
|
|
37
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Fault injection only: no real process enumeration, listener or provider call.
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import http from 'node:http';
|
|
8
|
+
import {EventEmitter} from 'node:events';
|
|
9
|
+
import {spawnSync} from 'node:child_process';
|
|
10
|
+
import {main} from './cm-ai-host.mjs';
|
|
11
|
+
import {runLiveDriver} from './fixtures/live-evidence-driver.mjs';
|
|
12
|
+
|
|
13
|
+
function temporary(t){
|
|
14
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-efficiency-diagnostic-')));
|
|
15
|
+
t.after(()=>fs.rmSync(root,{recursive:true,force:true}));return root;
|
|
16
|
+
}
|
|
17
|
+
for(const [systemCode,syscall,address,expected] of [
|
|
18
|
+
['EPERM','listen','127.0.0.1',true],['EACCES','listen','127.0.0.1',true],
|
|
19
|
+
['EPERM','open','127.0.0.1',false],['EPERM','listen','192.0.2.1',false],
|
|
20
|
+
])test(`preflight safe fault diagnostic: ${systemCode}/${syscall}/${address}`,async t=>{
|
|
21
|
+
const root=temporary(t),codeProject=path.join(root,'code'),specsDir=path.join(root,'specs');
|
|
22
|
+
fs.mkdirSync(codeProject);fs.mkdirSync(specsDir);
|
|
23
|
+
const definition=path.join(root,'run.json');fs.writeFileSync(definition,JSON.stringify({version:1,
|
|
24
|
+
codeProject,specsDir,feature:'1.work',identity:{repositoryId:'fixture',runId:'diagnostic-run',taskId:'T-1',attempt:1},
|
|
25
|
+
scope:['target.mjs'],requirements:[]}));
|
|
26
|
+
const savedCreate=http.createServer,savedExists=fs.existsSync,platform=Object.getOwnPropertyDescriptor(process,'platform');
|
|
27
|
+
let listened=0,closed=0,stdout='',stderr='';
|
|
28
|
+
class FailedListener extends EventEmitter{
|
|
29
|
+
listen(port,host){assert.equal(port,0);assert.equal(host,'127.0.0.1');listened++;
|
|
30
|
+
queueMicrotask(()=>this.emit('error',Object.assign(Error('private synthetic error details'),{code:systemCode,syscall,address})));return this;}
|
|
31
|
+
address(){throw Error('worker dispatch must not be reached');}
|
|
32
|
+
closeAllConnections(){}
|
|
33
|
+
close(callback){closed++;callback();}
|
|
34
|
+
}
|
|
35
|
+
try{
|
|
36
|
+
// Model the supported platform without invoking its isolation primitive.
|
|
37
|
+
Object.defineProperty(process,'platform',{...platform,value:'darwin'});
|
|
38
|
+
fs.existsSync=value=>value==='/usr/bin/sandbox-exec'||savedExists(value);
|
|
39
|
+
http.createServer=()=>new FailedListener();
|
|
40
|
+
const status=await main(['preflight','--config',definition,'--review-model','fixture','--runtime','claude'],
|
|
41
|
+
{output:{write:value=>{stdout+=value;}},error:{write:value=>{stderr+=value;}}});
|
|
42
|
+
assert.equal(status,1);assert.equal(stdout,'');assert.equal(listened,1);assert.equal(closed,1);
|
|
43
|
+
const expectedError={code:'host_launch_failed',...(expected?{diagnostic:{operation:'listen',systemCode,address:'loopback'}}:{})};
|
|
44
|
+
assert.deepEqual(JSON.parse(stderr),{error:expectedError});
|
|
45
|
+
assert(!stderr.includes('private synthetic'));assert.equal(savedExists(path.join(specsDir,'.reviews')),false);
|
|
46
|
+
}finally{http.createServer=savedCreate;fs.existsSync=savedExists;Object.defineProperty(process,'platform',platform);}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
for(const mode of ['missing','not-executable','failed-command'])test(`process listing fails closed with bounded diagnostic: ${mode}`,t=>{
|
|
50
|
+
const root=temporary(t),bin=path.join(root,'bin');fs.mkdirSync(bin);
|
|
51
|
+
if(mode==='not-executable')fs.writeFileSync(path.join(bin,'ps'),'synthetic',{mode:0o600});
|
|
52
|
+
if(mode==='failed-command')fs.writeFileSync(path.join(bin,'ps'),`#!${process.execPath}\nprocess.stderr.write('private synthetic process detail');process.exit(7);\n`,{mode:0o700});
|
|
53
|
+
const helper=new URL('./fixtures/process-cleanup.mjs',import.meta.url).href;
|
|
54
|
+
const result=spawnSync(process.execPath,['--input-type=module','-e',`
|
|
55
|
+
import {fixtureProcesses} from ${JSON.stringify(helper)};
|
|
56
|
+
try{fixtureProcesses(${JSON.stringify(root)});process.exitCode=2;}
|
|
57
|
+
catch(error){process.stdout.write(JSON.stringify({code:error.code,diagnostic:error.diagnostic}));}`],
|
|
58
|
+
{encoding:'utf8',env:{...process.env,PATH:bin},timeout:5000});
|
|
59
|
+
assert.equal(result.status,0,result.stderr);
|
|
60
|
+
assert.deepEqual(JSON.parse(result.stdout),{code:'fixture_process_listing_failed',diagnostic:{command:'ps',
|
|
61
|
+
status:mode==='failed-command'?7:null,signal:null,systemCode:mode==='missing'?'ENOENT':mode==='not-executable'?'EACCES':null}});
|
|
62
|
+
assert(!result.stdout.includes('private synthetic'));assert.equal(result.stderr,'');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('live fixture watchdog remains a failure and retains only bounded diagnostics',async t=>{
|
|
66
|
+
const root=temporary(t),driver=path.join(root,'driver.mjs');
|
|
67
|
+
fs.writeFileSync(driver,"process.stdout.write('private synthetic stdout');process.stderr.write('private synthetic stderr');setInterval(()=>{},1000);\n");
|
|
68
|
+
await assert.rejects(runLiveDriver(driver,path.join(root,'plan.json'),'advance',()=>{throw Error('no request expected');},{timeoutMs:700}),error=>{
|
|
69
|
+
assert.equal(error.code,'fixture_driver_timeout');assert.equal(error.diagnostic.timeoutMs,700);
|
|
70
|
+
assert(error.diagnostic.elapsedMs>=700);assert.equal(error.diagnostic.requestCount,0);
|
|
71
|
+
assert(error.diagnostic.stdoutBytes>0);assert(error.diagnostic.stderrBytes>0);
|
|
72
|
+
assert(!JSON.stringify(error).includes('private synthetic'));return true;
|
|
73
|
+
});
|
|
74
|
+
});
|