test: add fail-first continuity case for unbound dispatch

This commit is contained in:
Eve
2026-04-24 12:18:10 +08:00
parent dc8ef79f77
commit 2f2e5c2b9b

View File

@@ -126,6 +126,51 @@ const tests = [
} }
}, },
}, },
{
name: 'continuity: fails when planner returns derivedAction without any bound dispatch receipt',
run() {
const fixture = createFixture({
'input.json': {
planId: 'plan-derived-action-without-bound-dispatch',
currentTask: 'task-6b',
taskState: 'complete',
derivedAction: {
type: 'message_subagent',
task: 'continue with task-7b',
},
replyClosureState: 'completed',
dispatchReceipt: null,
},
});
try {
const result = runGate({
args: ['--compact', '--input', fixture.path('input.json')],
});
if (result.status !== 0 && result.status !== null) {
throw new Error(`expected controlled execution, got status=${result.status}
${result.stderr || result.stdout}`);
}
if (!result.json || typeof result.json !== 'object') {
throw new Error(`expected JSON output
stdout=${result.stdout}`);
}
if (result.json.ok !== false) {
throw new Error(`expected continuity failure ok=false for derivedAction without dispatch receipt, got ${JSON.stringify(result.json)}`);
}
if (result.json.verdict !== 'continuity_failure') {
throw new Error(`expected verdict=continuity_failure for derivedAction without dispatch receipt, got ${JSON.stringify(result.json.verdict)}`);
}
} finally {
fixture.cleanup();
}
},
},
{ {
name: 'continuity: passes when task is complete, next action is known, and a dispatch receipt already exists', name: 'continuity: passes when task is complete, next action is known, and a dispatch receipt already exists',
run() { run() {
@@ -216,6 +261,47 @@ stdout=${result.stdout}`);
}, },
}, },
{
name: 'continuity: passes when task is complete, next action is known, no dispatch receipt exists, and closure is pending_verification',
run() {
const fixture = createFixture({
'input.json': {
planId: 'plan-pending-verification-closure',
currentTask: 'task-8b',
taskState: 'complete',
nextDerivedAction: {
type: 'message_subagent',
task: 'continue with task-9',
},
replyClosureState: 'pending_verification',
dispatchReceipt: null,
},
});
try {
const result = runGate({
args: ['--compact', '--input', fixture.path('input.json')],
});
if (result.status !== 0 && result.status !== null) {
throw new Error(`expected controlled execution, got status=${result.status}
${result.stderr || result.stdout}`);
}
if (!result.json || typeof result.json !== 'object') {
throw new Error(`expected JSON output
stdout=${result.stdout}`);
}
if (result.json.ok !== true) {
throw new Error(`expected continuity pass ok=true when closure is pending_verification, got ${JSON.stringify(result.json)}`);
}
} finally {
fixture.cleanup();
}
},
},
{ {
name: 'continuity: passes when task is complete, next action is known, no dispatch receipt exists, and closure is blocked', name: 'continuity: passes when task is complete, next action is known, no dispatch receipt exists, and closure is blocked',
run() { run() {