From 9b0376ec391c233c4c8f8511da24b3c5fc5bb864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sun, 23 Aug 2026 05:02:45 +0000 Subject: [PATCH] todo: close the spawning endpoint Both modes verified against the live server, not reasoned about. Co-Authored-By: Claude Opus 5 --- ...i-endpoint-for-spawning-an-agent-with-a.md | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/todo/sub-agents/an-api-endpoint-for-spawning-an-agent-with-a.md b/todo/sub-agents/an-api-endpoint-for-spawning-an-agent-with-a.md index 837615f8..48f2f708 100644 --- a/todo/sub-agents/an-api-endpoint-for-spawning-an-agent-with-a.md +++ b/todo/sub-agents/an-api-endpoint-for-spawning-an-agent-with-a.md @@ -1,8 +1,8 @@ --- id: sub-agents/an-api-endpoint-for-spawning-an-agent-with-a -title: "An API endpoint for spawning an agent with a prompt" +title: 'An API endpoint for spawning an agent with a prompt' theme: sub-agents -status: open +status: done created: 2026-08-21 date_source: stated order: 1 @@ -28,7 +28,6 @@ what Officer fixes. optional.** An endpoint that spawns freely is exactly how a weekly limit gets spent by something nobody was watching. - --- **2026-08-21, narrowing this considerably.** The endpoint largely exists: @@ -43,3 +42,28 @@ already respects the window. What is genuinely left is the SURFACE an agent can call — MCP tool or authenticated route — and how output returns to the caller. That is the remaining work on this item; the mechanism underneath it is done. + +--- + +**Closed 2026-08-23.** `POST /api/sub-agents/spawn` — prompt, optional cwd and model, and either the session +key immediately or the result if you ask it to wait. `GET /api/sub-agents/budget` answers whether there is +room without consuming any. + +Verified both modes against the live server rather than reasoned about: the synchronous call returned the +four words the agent was told to say, and the async call returned in milliseconds with the agent's file on +disk five seconds later. + +Three things settled while building it, each worth not re-deriving: + +- **The budget check is a precondition, not a refinement.** It runs before the spawn and refuses 429 naming + the window. `checkBudget()` already existed and was already tested, which is the only reason this was a + short job. +- **`confined`, and true on the day it shipped.** The registry test's own comment records that `chat` sat on + that list for a day before its turns actually ran as the member. This one inherits the mechanism rather + than claiming it — `chatIdentity` off the token, `member: { osUser, home }` to the sidecar — and no path in + the endpoint chooses a directory. +- **`member` is passed explicitly, never omitted.** The field is required-but-may-be-undefined on purpose: + optional let a call site forget it, and forgetting it means a member's agent running as the owner in the + owner's home. + +What it deliberately is not: a queue, a supervisor, or a retry. One call starts one agent.