diff options
Diffstat (limited to 'spec/test_run.lua')
| -rw-r--r-- | spec/test_run.lua | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/spec/test_run.lua b/spec/test_run.lua index 57c6e47..b2c5783 100644 --- a/spec/test_run.lua +++ b/spec/test_run.lua @@ -75,11 +75,15 @@ return { end) end }, - { "both agent and id is refused", function() + { "multiple selectors are refused", function() with_host(function(handle, profiles) local text = run.handle({ agent = "reviewer", id = "0198-x", prompt = "go" }, profiles) has(text, "Error:") - has(text, "not both") + has(text, "exactly one of `agent`") + assert(#handle.spawns == 0) + + text = run.handle({ agent = "reviewer", system_prompt = "Be concise.", prompt = "go" }, profiles) + has(text, "exactly one of `agent`") assert(#handle.spawns == 0) end) end }, @@ -124,6 +128,21 @@ return { end) end }, + { "an inline system prompt starts a child without a profile", function() + with_host(function(handle, profiles) + local text = run.handle({ system_prompt = "Be a focused investigator.", prompt = "Find the cause." }, profiles) + assert(#handle.spawns == 1) + local messages = handle.spawns[1].system_messages + assert(#messages == 2, "expected role and inline prompt") + assert(messages[1].text == spawn.CHILD_ROLE) + assert(messages[2].text == "Be a focused investigator.") + local manifest = messages[2].metadata.subagents + assert(manifest.agent == "subagent", tostring(manifest.agent)) + assert(manifest.inline == true, "inline prompts must remain identifiable on replay") + has(text, "agent: subagent") + end) + end }, + { "subagents.run presents its child prompt only when expanded", function() with_host(function(handle, profiles) handle.queue_for("reviewer", { events = { @@ -171,22 +190,23 @@ return { end) end }, - { "the primary's system context comes first, then the role, then the profile", function() + { "the primary's system context and dialogue are not copied", function() with_host(function(handle, profiles) run.handle({ agent = "reviewer", prompt = "go" }, profiles) local messages = handle.spawns[1].system_messages - assert(#messages == 4, "expected two copied messages plus role and profile, saw " .. #messages) - assert(messages[1].text == "Project context.", tostring(messages[1].text)) - assert(messages[2].text == "House style.", tostring(messages[2].text)) - assert(messages[3].text == spawn.CHILD_ROLE, "the child role follows the primary's context") - assert(messages[4].text == "You are a reviewer.\n", "the profile body is last") - assert(messages[1].metadata == nil, "copied context carries no manifest") + assert(#messages == 2, "expected only role and profile messages, saw " .. #messages) + assert(messages[1].text == spawn.CHILD_ROLE, "the child role is first") + assert(messages[2].text == "You are a reviewer.\n", "the profile defines the child context") + for _, message in ipairs(messages) do + assert(message.text ~= "Primary core prompt.", "the primary system prompt must not reach the child") + assert(message.text ~= "Project context.", "primary system additions must not be copied") + end end, { primary_messages = { - { role = "system", text = "Project context." }, + { role = "system", text = "Primary core prompt." }, { role = "user", text = "the parent dialogue is never copied" }, { role = "assistant", text = "nor this" }, - { role = "system", text = "House style." }, + { role = "system", text = "Project context." }, }, }) end }, |
