Skip to content

v2.9.1

Choose a tag to compare

@edxeth edxeth released this 14 Sep 21:10
· 8 commits to main since this release

Install:

pi install git:github.com/edxeth/pi-subagents@v2.9.1

Or latest:

pi install git:github.com/edxeth/pi-subagents

⚠️ Breaking Changes

Background launches now ignore auto-exit: false

Refs: 4434c117

A background launch starts the child as its own process, with no pane. Background mode applies to:

  • background: true or mode: background in the agent frontmatter
  • llm-as-a-verifier agents
  • launches where the parent has no UI or no mux

These launches now always use automatic completion. Automatic completion closes the child by itself after the child finishes its task. If an agent file sets auto-exit: false, the launch ignores that value, and the agent catalog shows a warning for that agent. A background session that stores the old autoExit: false value is corrected when you resume it. Interactive pane children keep the auto-exit value from the agent file.

🐛 Bug Fixes

Background subagents exit after the task and no longer loop on subagent_done

Refs: 4434c117

This entry fixes issue #27. A background child runs Pi in print mode. Print mode starts Pi with the -p flag. Pi exits by itself after it processes all prompts. In print mode, ctx.shutdown() does nothing. A child with manual completion closes itself with the subagent_done tool.

Such a child called subagent_done and received "Shutting down subagent session." The tool result then fed one more model turn. Some models stopped after that extra turn. Other models called the tool again and again. One run in issue #27 called subagent_done 12 times in 37 seconds. Each extra turn spent tokens while the parent waited.

A background launch now runs the child with automatic completion. The child does not receive the subagent_done tool. The task prompt tells the child to finish on its own and to end with a summary message. Pi exits when the turn completes. The forced value reaches the child environment (PI_SUBAGENT_AUTO_EXIT=1), the launch metadata, and resume handling. A session stored under the old behavior works correctly after you resume it.

Parent panes report outstanding delegated work to Herdr

Refs: 38dd5557

Herdr saw a parent pane as idle while its children still ran. Herdr also saw a pane as idle when child reports sat unread in the queue. The extension now counts the outstanding delegated work of the session. Outstanding delegated work means running children plus queued subagent_result and subagent_ping reports that the parent model still needs to read. The extension publishes this count to Herdr as pane metadata under the source pi-subagents:work-v1 (token pi_subagents_work_v1). It writes the count at each model and tool boundary, so a batch that ends while children run still leaves correct state behind.

The count renews with a heartbeat every 10 seconds while work is outstanding. The value expires after 30 seconds. The token holds a SHA-256 fingerprint of the session path, a count, and an expiry time. This keeps values below the Herdr limit of 80 characters, even for long session paths. At shutdown, the extension clears the value.

The reporting turns on only inside the Herdr pane that owns the session, with HERDR_ENV=1 and a Herdr server at protocol 22 or newer. A failed write does not stop Pi or any child launch. The extension retries a failed write once per heartbeat. If the retry fails too, the value expires. Sessions without Herdr and sessions without a UI skip the reporting. An older Herdr server still works for launches, but it does not receive the work metadata.