From 94e3fd8358bbdb5d6ed81aed475fab7fc73e2097 Mon Sep 17 00:00:00 2001 From: t Date: Tue, 18 Aug 2026 16:37:31 -0600 Subject: Fix workflow progress pin lifecycle --- spec/test_init.lua | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'spec/test_init.lua') diff --git a/spec/test_init.lua b/spec/test_init.lua index 2d5e7d1..97f0eba 100644 --- a/spec/test_init.lua +++ b/spec/test_init.lua @@ -175,9 +175,24 @@ return { "the result restores the component's transcript position") local claimed, pins = nil, {} + handle.emit("tool_call_complete", { + id = "replayed-call", + tool_name = "subagents.workflow", + set_component = function(_, component) + claimed = component + return { + invalidate = function() end, + alive = function() return true end, + set_pinned = function(_, value) pins[#pins + 1] = value end, + } + end, + }) + assert(#pins == 0, "a workflow restored during startup stays in transcript order") + + handle.emit("turn_start", {}) handle.emit("tool_call_complete", { id = "call-1", - tool_name = "subagents.run", + tool_name = "subagents.workflow", set_component = function(_, component) claimed = component return { @@ -189,9 +204,13 @@ return { }) assert(type(claimed) == "table" and type(claimed.render) == "function", "the entry is given a component that renders the cards") - assert(pins[1] == true, "the progress component pins after claim") - handle.emit("tool_result", { id = "call-1", tool_name = "subagents.run" }) - assert(pins[2] == false, "the matching result unpins it") + assert(pins[1] == true, "the live progress component pins after claim") + local output = handle.tools_by_name["subagents.workflow"].handler( + { prompt = "", steps = {} }, { tool_call_id = "call-1" }) + assert(type(output) == "string", "the workflow handler returned its result") + assert(pins[2] == false, "handler completion unpins before the next model action") + handle.emit("tool_result", { id = "call-1", tool_name = "subagents.workflow" }) + assert(#pins == 2, "the later host result is an inert fallback") local foreign handle.emit("tool_call_complete", { -- cgit v1.3