summaryrefslogtreecommitdiff
path: root/spec/test_run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/test_run.lua')
-rw-r--r--spec/test_run.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/test_run.lua b/spec/test_run.lua
index e4bb038..57c6e47 100644
--- a/spec/test_run.lua
+++ b/spec/test_run.lua
@@ -10,6 +10,7 @@
-- machine's real ~/.config out of the run.
local fake = require("spec.fake_ext")
+local progress = require("subagents.progress")
local run = require("subagents.run")
local spawn = require("subagents.spawn")
@@ -123,6 +124,53 @@ return {
end)
end },
+ { "subagents.run presents its child prompt only when expanded", function()
+ with_host(function(handle, profiles)
+ handle.queue_for("reviewer", { events = {
+ { type = "block_start", block_type = "text", index = 0 },
+ { type = "content_delta", index = 0, delta = "checking auth\n" },
+ { type = "block_start", block_type = "tool_use", index = 1 },
+ { type = "tool_details", index = 1, id = "tool-1", name = "std__read" },
+ { type = "block_complete", block_type = "tool_use", index = 1,
+ id = "tool-1", name = "std__read", text = '{"path":"auth.lua"}' },
+ { type = "tool_dispatch_result", tool_results = {
+ { tool_use_id = "tool-1", output = "file contents", is_error = false },
+ } },
+ } })
+ progress.reset()
+ local component
+ progress.claim({
+ id = "run-call",
+ tool_name = "subagents.run",
+ 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 = "run-call" })
+
+ run.handle({ agent = "reviewer", prompt = "Review the auth change." }, profiles)
+ local compact = table.concat(component:render(100), "\n")
+ assert(not compact:find("Review the auth change.", 1, true), compact)
+
+ progress.collapse({ collapsed = false })
+ local expanded = table.concat(component:render(100), "\n")
+ has(expanded, "prompt: Review the auth change.")
+ has(expanded, "checking auth")
+ has(expanded, "std.read [tool-1]")
+ has(expanded, 'input: {"path":"auth.lua"}')
+ has(expanded, "result [tool-1]: file contents")
+ assert(not expanded:find("system prompt:", 1, true),
+ "a discovered profile system prompt is not presentation metadata:\n" .. expanded)
+ progress.reset()
+ end)
+ end },
+
{ "the primary's system context comes first, then the role, then the profile", function()
with_host(function(handle, profiles)
run.handle({ agent = "reviewer", prompt = "go" }, profiles)