summaryrefslogtreecommitdiff
path: root/e2e/run.lua
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-08-18 14:18:14 -0600
committert <t@tjp.lol>2026-08-18 14:20:28 -0600
commitcc69a2e431779528578211a5cb3385bb23e076bf (patch)
tree8833171e25bb3dfb71fc4a2e0b8fe583782da764 /e2e/run.lua
parent372ef8ff40991644ec2654c61328f31779f4ad21 (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 'e2e/run.lua')
-rw-r--r--e2e/run.lua34
1 files changed, 33 insertions, 1 deletions
diff --git a/e2e/run.lua b/e2e/run.lua
index c240813..56deda6 100644
--- a/e2e/run.lua
+++ b/e2e/run.lua
@@ -409,6 +409,14 @@ local function meta(needle)
return (needle:gsub('"', '\\"'))
end
+local function json_string(text)
+ return '"' .. tostring(text)
+ :gsub('\\', '\\\\')
+ :gsub('"', '\\"')
+ :gsub('\r', '\\r')
+ :gsub('\n', '\\n') .. '"'
+end
+
local function jsonl_ids(dir)
local ids = {}
for _, name in ipairs(list_dir(dir)) do
@@ -630,6 +638,8 @@ scenario("resume", function()
check_contains("the resumed child kept its id", second, "id: " .. child_id)
local text = read_file(children .. "/" .. child_id .. ".jsonl") or ""
+ check_contains("the resumed child records its owning outer tool call", text,
+ meta('"tool_call_id"'))
local turns = 0
for _, line in ipairs(lines_of(text)) do
if line:find(meta('"subagents"'), 1, true) and line:find(meta('"model":'), 1, true) then
@@ -705,7 +715,29 @@ scenario("sandbox-fanout", function()
#jsonl_ids(assert(child_dir(install, primary_id))), 2)
end)
--- 5. The catalog tool, in all four shapes, against a provider whose reasoning
+-- 5. An inline profile in the dynamic workflow gets a durable marker and
+-- body, so restart replay can show the requested system prompt without
+-- exposing discovered profile prompts.
+scenario("inline-replay-manifest", function()
+ local install = make_install("inline-replay-manifest")
+ local source = "return subagents.workflow(function(ctx, input) return ctx:agent({ agent = 'inline', prompt = 'say INLINE-CHILD' }):await() end)"
+ local script = string.format(
+ 'tool subagents.lua {"prompt":"INLINE-INPUT","source":%s,"agents":[{"name":"inline","system_prompt":"INLINE-SYSTEM"}]}',
+ json_string(source))
+ local out = turn(install, script)
+ check_contains("the inline workflow child completed", out, "INLINE-CHILD")
+
+ local dir = assert(session_dir(install))
+ local primary_id = jsonl_ids(dir)[1]
+ local children = assert(child_dir(install, primary_id))
+ local ids = jsonl_ids(children)
+ check_equal("one inline workflow child persisted", #ids, 1)
+ local text = read_file(children .. "/" .. ids[1] .. ".jsonl") or ""
+ check_contains("the inline manifest is marked", text, meta('"inline":true'))
+ check_contains("the inline system prompt remains durable", text, "INLINE-SYSTEM")
+end)
+
+-- 6. The catalog tool, in all four shapes, against a provider whose reasoning
-- levels come from the protocol rather than models.toml.
scenario("catalog", function()
local install = make_install("catalog")