summaryrefslogtreecommitdiff
path: root/subagents/spawn.lua
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-08-17 23:35:36 -0600
committert <t@tjp.lol>2026-08-18 00:40:46 -0600
commit372ef8ff40991644ec2654c61328f31779f4ad21 (patch)
tree9bc69a578995e14f154202badcdbe0021a39c467 /subagents/spawn.lua
parent7f8fdd8e868fb5fad71eacdf0c4fd0a97fe9c6ee (diff)
Validation-pass fixes; DESIGN.md describes the shipped seam
jobs: a child whose wake pipe cannot be armed is refused up front instead of started into a state nothing can wake (the luv-less drain loop survives only for hosts without a loop); a closing child keeps its concurrency slot and its id's exclusivity until the pump actually exits, so teardown can no longer over-admit new children or let two turns share one session file. Resume-metadata reads honor the plain-error contract on a malformed store. workflow: the built-in schema subset validator is the only validator — the jsonschema probe made behavior depend on an undeclared rock (see rockspec: that dependency is deliberately rejected); dead exports and the unreachable half of the structured-output guard are gone, keeping the empty-arguments provider case. DESIGN.md's seam sections now describe the shipped division: binding-level async jobs and tool control, host-level resolve_model/ExtHost/turn events/ component handles, rock-level policy; protocol bodies run to completion on the loop thread and cannot yield, cancellation is scoped to the stream that opened it, and a child's compaction leaves protocol sessions alone.
Diffstat (limited to 'subagents/spawn.lua')
-rw-r--r--subagents/spawn.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/subagents/spawn.lua b/subagents/spawn.lua
index a83e442..b355d9a 100644
--- a/subagents/spawn.lua
+++ b/subagents/spawn.lua
@@ -230,8 +230,8 @@ local function read_stored(conv)
local manifest
for index = 1, #messages do
if messages[index].role == "system" then
- local metadata = conv:message_metadata(index)
- if type(metadata) == "table" then
+ local got, metadata = try(conv.message_metadata, conv, index)
+ if got and type(metadata) == "table" then
manifest = metadata
break
end
@@ -241,8 +241,8 @@ local function read_stored(conv)
local defaults = {}
for index = #messages, 1, -1 do
if messages[index].role == "user" then
- local metadata = conv:message_metadata(index)
- local mine = type(metadata) == "table" and metadata.subagents or nil
+ local got, metadata = try(conv.message_metadata, conv, index)
+ local mine = got and type(metadata) == "table" and metadata.subagents or nil
if type(mine) == "table" then
defaults.model = nonempty(mine.model)
defaults.reasoning = nonempty(mine.reasoning)
@@ -488,9 +488,7 @@ function M.spawn(spec)
end
local handle, start_err = jobs.start {
- label = spec.label,
id = id,
- one_shot = one_shot,
build = function(wake_fd)
local job, err = agent:run_async {
prompt = spec.prompt,