From cff363f7c7519a5660d1278d10a92eba746c8e45 Mon Sep 17 00:00:00 2001 From: Eve Date: Fri, 24 Apr 2026 11:58:49 +0800 Subject: [PATCH] test: add blocked closure continuity case --- .../test_approved_plan_continuity_gate.mjs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/scripts/test_approved_plan_continuity_gate.mjs b/scripts/test_approved_plan_continuity_gate.mjs index 3e714e5..24409b2 100644 --- a/scripts/test_approved_plan_continuity_gate.mjs +++ b/scripts/test_approved_plan_continuity_gate.mjs @@ -215,6 +215,47 @@ stdout=${result.stdout}`); } }, }, + + { + name: 'continuity: passes when task is complete, next action is known, no dispatch receipt exists, and closure is blocked', + run() { + const fixture = createFixture({ + 'input.json': { + planId: 'plan-blocked-closure', + currentTask: 'task-9', + taskState: 'complete', + nextDerivedAction: { + type: 'message_subagent', + task: 'continue with task-10', + }, + replyClosureState: 'blocked', + 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 blocked, got ${JSON.stringify(result.json)}`); + } + } finally { + fixture.cleanup(); + } + }, + }, ]; const results = [];