feat: add workflow dry-run observability

This commit is contained in:
john
2026-07-24 22:44:26 +08:00
parent c9ad841543
commit 19706eb3a0
15 changed files with 725 additions and 41 deletions
+18
View File
@@ -443,6 +443,20 @@ test('shadow observer failure cannot fail a Native run and chat runs are not obs
observations += 1;
const error = new Error('shadow unavailable');
error.code = 'SHADOW_UNAVAILABLE';
error.mode = 'shadow';
error.executionPlan = {
version: 'workflow-execution-decision-v1',
candidateEngine: 'native',
effectiveEngine: 'native',
fallbackEngine: 'native',
reason: 'shadow',
candidateReason: 'canary_not_selected',
configVersion: 10,
bucket: 91,
taskType: 'code_task',
dryRun: true,
handoffAllowed: false,
};
throw error;
},
});
@@ -466,6 +480,8 @@ test('shadow observer failure cannot fail a Native run and chat runs are not obs
assert.equal(observations, 1);
const failure = pool.events.find((event) => event.eventType === 'workflow_shadow_failed');
assert.equal(JSON.parse(failure.dataJson).code, 'SHADOW_UNAVAILABLE');
const plan = pool.events.find((event) => event.eventType === 'workflow_execution_planned');
assert.equal(JSON.parse(plan.dataJson).candidateReason, 'canary_not_selected');
});
test('canary dry-run records the candidate decision without changing Native run state', async () => {
@@ -487,6 +503,7 @@ test('canary dry-run records the candidate decision without changing Native run
candidateReason: 'percentage',
configVersion: 9,
bucket: 3,
taskType: 'repo_refactor',
dryRun: true,
handoffAllowed: false,
},
@@ -520,6 +537,7 @@ test('canary dry-run records the candidate decision without changing Native run
candidateReason: 'percentage',
configVersion: 9,
bucket: 3,
taskType: 'repo_refactor',
dryRun: true,
handoffAllowed: false,
});