A local-first multi-agent app development platform, built on PenguinHarness
Background execution with completion reports, and kill tools
- Date: 2026-08-20
- Type: feature
- Scope:
core,server,web,docs - PR: #376
Added a run_in_background argument to exec_command and run_subagent: the call returns its process_id / subagent_id immediately, and when the task settles its result comes back as a user message injected by the harness — the model no longer needs to poll. Added kill_command and kill_subagent to terminate background sessions, and raised input_command's default empty-poll wait from 5000ms to 120000ms so one poll waits out most builds.
Details
- The completion report opens with a
[background_task_done]marker block (kind, id, status, one-line detail) followed by what ran and the tail of its yet-undelivered output (capped at 4000 characters). The Web App collapses the block into a one-line notice with the report body below it. - Delivery: while a Task is running, the report rides the next turn boundary — a Task whose final reply already streamed continues for one more turn to react to it. While the Session is idle, the server starts a new Task carrying the report; SDK embedders subscribe via
Session.onBackgroundNotice/takeBackgroundNotices, and with no subscriber the report joins the next run's input. kill_commandSIGTERMs the whole process group (SIGKILL after a grace period) and returns the output not yet delivered;kill_subagentaborts the run, denies its pending approvals, and removes the session (an idle one too, freeing its concurrency slot). A killed task sends no completion report — the kill's own result carries the outcome.- User-role
textpayloads gained an optionalsenderfield ("user" | "parent_agent" | "harness" | "server"): subagent prompts written by the parent agent are recorded assender: "parent_agent"in the child's Trace, harness-injected completion reports assender: "harness", and the server's scheduled-task triggers assender: "server". The field is additive — absent means the human user, which is also the correct reading of every Trace written before it existed — so no migration and no compatibility code is involved, and it never reaches the provider wire. - The kernel version advanced (now
2026-08-21); existing agents adopt the new tools and arguments through the settings page's kernel update (user customizations kept), or keep their stored toolset untouched if they never run it. - Fixed the delivery gap for freshly created sessions: the runtime registered the idle-arrival notice listener only on the resume path, so a session created in the same server process never surfaced its completion reports — the chat page sat unrefreshed. Both entry paths now register it, proven by a Playwright end-to-end test (real server, mock LLM: the report banner and the model's follow-up turn appear in an open chat page with no interaction).
- A background subagent now announces itself at launch: its
session_metais forwarded upfront, so the chat page's subagents panel shows the node (and the server registers the child) before any poll; the panel derives a background node's running state from the harness's own notes and settles it when the completion notice, an idle poll, or a kill removes the work. - Fixed background subagents parking forever on their first read-write tool: the child's approvals only resolved through a polling window's sink, which a
run_in_backgroundlaunch never opens — its commands surfaced as hung or aborted. The launch now attaches its own approval callback as a standing sink, the child's abort signal stays fully its own (onlykill_subagent, Session end, or eviction ends it), and its messages stream to the frontend live through the launching Session instead of waiting for the first poll. Failures end in astatus: failedreport like any terminal state. Proven end to end with Playwright (success and failure paths, no interaction after the send). - The completion notice's chat rendering became a collapsible one-liner in the work group's own "Done" summary-bar form — same chrome, title styling and sticky pinning against the scrollport, drawn from one extracted style source (
disclosure-row.tsx, whose row/header/card constants the thinking block, tool cards and work group all reference): collapsed it shows only the outcome ("Background command finished" / "Background task failed"); expanding reveals the handle, exit detail and output tail in the tool cards' output styling. On the Trace page a notice-triggered task stays its own round.