diff options
| author | t <t@tjp.lol> | 2026-08-18 14:18:14 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-08-18 14:20:28 -0600 |
| commit | cc69a2e431779528578211a5cb3385bb23e076bf (patch) | |
| tree | 8833171e25bb3dfb71fc4a2e0b8fe583782da764 /spec/test_luatool.lua | |
| parent | 372ef8ff40991644ec2654c61328f31779f4ad21 (diff) | |
Persist and replay subagent progress across sessions
Record durable child-turn metadata, restore bounded progress cards during
startup replay, and keep settled cards attached to transcript entries. Add
workflow-local Lua profiles and expose discovered agents and workflows in the
session header.
Diffstat (limited to 'spec/test_luatool.lua')
| -rw-r--r-- | spec/test_luatool.lua | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/spec/test_luatool.lua b/spec/test_luatool.lua index 83b4984..65723db 100644 --- a/spec/test_luatool.lua +++ b/spec/test_luatool.lua @@ -11,6 +11,7 @@ local fake = require("spec.fake_ext") local luatool = require("subagents.luatool") +local progress = require("subagents.progress") local function has(text, needle) assert(type(text) == "string", "expected a string, got " .. type(text)) @@ -127,6 +128,74 @@ return { end) end }, + { "inline agent profiles are scoped to one workflow invocation", function() + with_host(function(handle, profiles) + handle.queue_for("local-reviewer", { id = "0198-local", output = "reviewed" }) + local source = [[ + return subagents.workflow(function(ctx, input) + return ctx:agent({ agent = "local-reviewer", prompt = input }):await() + end) + ]] + progress.reset() + local component + progress.claim({ + id = "lua-call", + tool_name = "subagents.lua", + collapsed = true, + set_component = function(_, value) + component = value + return { + invalidate = function() end, + alive = function() return true end, + set_pinned = function() end, + } + end, + }) + progress.bind({ tool_call_id = "lua-call" }) + local text = luatool.handle({ + prompt = "inspect this", + source = source, + agents = { + { + name = "local-reviewer", + description = "One-off reviewer", + system_prompt = "Review only the requested change.", + }, + }, + }, profiles) + + has(text, "reviewed") + local compact = table.concat(component:render(100), "\n") + assert(not compact:find("inspect this", 1, true), compact) + assert(not compact:find("Review only the requested change.", 1, true), compact) + progress.collapse({ collapsed = false }) + local expanded = table.concat(component:render(100), "\n") + has(expanded, "system prompt: Review only the requested change.") + has(expanded, "prompt: inspect this") + assert(#handle.spawns == 1, "the inline profile started one child") + assert(handle.spawns[1].label == "local-reviewer") + local seeded = handle.spawns[1].system_messages + assert(seeded[#seeded].text == "Review only the requested change.") + + local missing = luatool.handle({ prompt = "again", source = source }, profiles) + has(missing, "unknown agent 'local-reviewer'") + assert(#handle.spawns == 1, "the inline profile did not leak into the next workflow") + progress.reset() + end) + end }, + + { "invalid inline profiles fail before running guest source", function() + with_host(function(handle, profiles) + local text = luatool.handle({ + prompt = "x", + source = "error('guest source should not run')", + agents = { { name = "local", system_prompt = "" } }, + }, profiles) + has(text, "agents[1].system_prompt must be a non-empty string") + assert(#handle.spawns == 0) + end) + end }, + { "a fan-out runs end to end and renders one block per child", function() with_host(function(handle, profiles) handle.queue_for("alpha", { id = "0198-a", output = "alpha says hi" }) |
