From eeec38bff69dcfcbbd3de96c7cbadc3e826de940 Mon Sep 17 00:00:00 2001 From: Eve Date: Fri, 24 Apr 2026 11:56:05 +0800 Subject: [PATCH] test: allow approved plan step with dispatch receipt --- .../test_approved_plan_continuity_gate.mjs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/scripts/test_approved_plan_continuity_gate.mjs b/scripts/test_approved_plan_continuity_gate.mjs index d828900..593fc54 100644 --- a/scripts/test_approved_plan_continuity_gate.mjs +++ b/scripts/test_approved_plan_continuity_gate.mjs @@ -126,6 +126,54 @@ const tests = [ } }, }, + { + name: 'continuity: passes when task is complete, next action is known, and a dispatch receipt already exists', + run() { + const fixture = createFixture({ + 'input.json': { + planId: 'plan-existing-dispatch', + currentTask: 'task-6', + taskState: 'complete', + nextDerivedAction: { + type: 'message_subagent', + task: 'continue with task-7', + }, + replyClosureState: 'completed', + dispatchReceipt: { + planId: 'plan-existing-dispatch', + currentTask: 'task-6', + nextDerivedAction: { + type: 'message_subagent', + task: 'continue with task-7', + }, + dispatchedAt: '2026-04-24T11:55:00+08:00', + }, + }, + }); + + 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 dispatch receipt exists, got ${JSON.stringify(result.json)}`); + } + } finally { + fixture.cleanup(); + } + }, + }, ]; const results = [];