subagent_spawn: exponential backoff, structured output; fix stale docs
- Replace 5s/50ms poll with exponential backoff (~25s total) - Output structured KV (session, path, backend, model) like cascade - subagent_generate: remove stale result_path from header, document arg input - Soften 'always use pipeline' to guidance matching actual behavior
This commit is contained in:
parent
bf91cab41c
commit
65f7bc3bd9
|
|
@ -81,7 +81,7 @@ Remaining args: the task prompt (immediate task only — coordination lives in t
|
|||
- `[parent_plan_start]...[parent_plan_end]` — the parent's current plan file contents (if non-empty)
|
||||
|
||||
**Constraints**:
|
||||
- **Always use the pipeline.** Never call `subagent_spawn` without `subagent_generate`.
|
||||
- **Prefer the pipeline.** Use `subagent_generate` → `subagent_spawn` when the subagent needs a custom identity. For simple delegation with no identity requirements, `subagent_spawn` alone with `-agent` or server defaults is fine.
|
||||
- **Identity carries coordination, prompt carries task.** Roster, shared task, and protocol go in the identity. The seed prompt is purely the task.
|
||||
- Subagents do not share memory. Pass context explicitly in the seed prompt.
|
||||
- Peers are known at spawn time. Assign `-name` to each and include the full roster in each identity.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
# description: Generate a JIT subagent config. No args prints the JSON template. With JSON on stdin, creates the config and prints the agent name.
|
||||
# Args: none
|
||||
# Stdin: JSON with structured fields (role, roster, shared_task, protocol, constraints, result_path) or legacy "prompt"
|
||||
# Args: [json] — JSON config as first arg, or piped via stdin
|
||||
# Stdin: JSON with structured fields (role, roster, shared_task, protocol, constraints) or legacy "prompt"
|
||||
# Output: template (no stdin) or agent name
|
||||
set -euo pipefail
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,13 @@ model=${model}"
|
|||
printf '%s\n' "$kv" > "$OLLIE/s/new" || die "failed to create session"
|
||||
|
||||
B="$OLLIE/s/$name"
|
||||
SECONDS=0
|
||||
until [ -d "$B" ] || [ "$SECONDS" -ge 5 ]; do sleep 0.05; done
|
||||
wait=0.1
|
||||
for _ in 1 2 3 4 5 6 7 8; do
|
||||
[ -d "$B" ] && break
|
||||
sleep "$wait"
|
||||
wait=$(awk "BEGIN{printf \"%.2f\", $wait * 2}")
|
||||
done
|
||||
[ -d "$B" ] || die "timeout waiting for session $name"
|
||||
|
||||
printf '%s\n' "$prompt" > "$B/prompt" || die "failed to submit prompt"
|
||||
printf '%s\n' "$B"
|
||||
printf 'session=%s\npath=%s\nbackend=%s\nmodel=%s\n' "$name" "$B" "${backend:-default}" "${model:-default}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue