Skip to content

[Bug]: Async pi-subagents runs never show in the subagent UI on Pi threads #17363

Description

@marianomacri

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server. The Pi provider adapter (packages/provider-pi/src/server/adapter.ts), observed in the desktop app.

Steps to reproduce

  1. Install the pi-subagents extension for Pi and start a Pi thread in T3 Code.
  2. Ask the agent to call the subagent tool for one agent with async: true, for example { "agent": "reviewer", "task": "Review the diff", "async": true }.
  3. Watch the Agents panel and the thread timeline while the child runs and after it finishes.

Expected behavior

The async child shows as a running subagent of the run that launched it, the way Claude background agents do and the way pi-subagents' synchronous mode already does. It settles as completed or failed when pi-subagents reports that the child finished.

Actual behavior

Nothing appears in the subagent UI. The subagent tool row turns completed as soon as the launch returns, while the child keeps running. In the thread where I hit this, a review child ran for about four minutes with no sign in T3 Code that anything was running or that it finished.

The adapter's subagent support (emitSubagentTasks in adapter.ts) reads only result.details.results[], the shape of Pi's synchronous example extension. pi-subagents' async mode reports differently:

  • At launch, the subagent tool returns details = { mode: "single", asyncId, asyncDir, results: [] }, so the adapter emits no subagent.
  • When the child finishes, pi-subagents sends a custom message with customType: "subagent-notify". Its details.runs lists each run's agent and status, and its text names each run's directory. The message arrives between turns, before the wake turn starts, and handleSessionEvent ignores non-assistant message_end events.

Impact

Minor bug or occasional failure

Version or commit

Observed on desktop 0.0.46-nightly.20261008.2833. The same code is on main at d81afa0a6.

Environment

macOS 27.0, Pi 1.1.0 (@earendil-works/pi-coding-agent), pi-subagents 0.76.1, Pi provider with openai-codex/gpt-6.1-sol as the parent model.

Logs or stack traces

# Inbound `pi --mode rpc` frames, in order, from a live run with only pi-subagents loaded.
# T3 Code's Pi replay recorder normalized ids and paths. "..." marks trimmed fields.
{"type":"tool_execution_end","toolName":"subagent","isError":false,"result":{"content":[{"type":"text","text":"Run fan-out: 1/64 used, 63 remaining\nAsync: echo [00000000-0000-4000-8000-000000000005]\n\nThe async run is deta ..."}],"details":{"mode":"single","runId":"00000000-0000-4000-8000-000000000005","results":[],"asyncId":"00000000-0000-4000-8000-000000000005","asyncDir":"/tmp/pi-rec-tmp/pi-subagents-uid-501/async-subagent-runs/00000000-0000-4000-8000-000000000005","...":"..."}}}
{"type":"agent_settled","aborted":false}
{"type":"message_end","message":{"role":"custom","customType":"subagent-notify","content":"Background task completed: **echo**\n\necho:\nECHO_DONE\n\nRetention-managed async directory: /tmp/pi-rec-tmp/pi-subagents-uid-501/async-subagent-runs/00000000-0000-4000-8000-000000000005\n\n...","display":false,"details":{"runs":[{"agent":"echo","status":"completed"}]}}}
{"type":"agent_start"}

Workaround

Ask the agent for subagent({ action: "status" }), or read the run's result from pi-subagents' async directory. Once the wake turn runs (#15589, fixed by #17214), the parent model also sees the result, but T3 Code's subagent UI still shows nothing.

I have a fix with a recorded replay fixture and will link the PR here.

Activity

  1. kushaldotdev commented on Oct 9, 2026

    @kushaldotdev

    Additional confirmation, and one scope note.

    With #17214 merged (the first nightly after the merge is 0.0.46-nightly.20261008.2849), the wake no longer kills the Pi session, but the runs are still invisible: the adapter continues to require the synchronous shape (toolName === "subagent" plus details.results[] with agent and task), while an async launch returns

    details: { mode: "single", runId, toolCallId, asyncId, asyncDir, results: [] }
    

    so emitSubagentTasks returns without emitting anything (pi-subagents 0.76.1, src/runs/foreground/subagent-executor.js).

    Also worth tracking separately: workflow, chain and parallel launches are outside #17393's scope, so they will still show nothing after it lands. Filed as a follow-up with the widget-snapshot data source that already carries that tree: #17564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions