summaryrefslogtreecommitdiff
path: root/spec/test_init.lua
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-08-18 16:37:31 -0600
committert <t@tjp.lol>2026-08-18 16:37:40 -0600
commit94e3fd8358bbdb5d6ed81aed475fab7fc73e2097 (patch)
treeb028540f25e1818fefe51cb4c05a4c2cd4e5708d /spec/test_init.lua
parentcc69a2e431779528578211a5cb3385bb23e076bf (diff)
Fix workflow progress pin lifecycle
Diffstat (limited to 'spec/test_init.lua')
-rw-r--r--spec/test_init.lua27
1 files changed, 23 insertions, 4 deletions
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
@@ -176,8 +176,23 @@ return {
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", {