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.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/test_run.lua b/spec/test_run.lua
index 706faff..e4bb038 100644
--- a/spec/test_run.lua
+++ b/spec/test_run.lua
@@ -254,6 +254,30 @@ return {
end)
end },
+ -- The binding reports a stored record it cannot decode by raising. A
+ -- malformed message is skipped, and nothing here raises out to the tool.
+ { "stored metadata that cannot be decoded is skipped, not raised", function()
+ with_host(function(handle, profiles)
+ local stored = stored_reviewer()
+ for _, message in ipairs(stored) do
+ if message.metadata then
+ message.metadata = nil
+ message.metadata_error = "message_metadata: invalid JSON"
+ end
+ end
+ handle.add_session("0198-child", stored)
+ handle.queue({ output = "second turn" })
+
+ local text = run.handle({ id = "0198-child", prompt = "carry on" }, profiles)
+ assert(not text:find("Error:", 1, true), "a malformed record is not a tool error:\n" .. text)
+ has(text, "second turn")
+ has(text, "agent: ?") -- an unreadable manifest names no agent
+ assert(handle.spawns[1].model == "anthropic:sonnet",
+ "an unreadable stored default falls back to the primary's model, got " ..
+ tostring(handle.spawns[1].model))
+ end)
+ end },
+
{ "a resumed child takes its agent name from the manifest", function()
with_host(function(handle, profiles)
handle.add_session("0198-child", stored_reviewer())