Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Openmarianomacri(GitHub profile, opens in a new tab) opened this issue 6 comments

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.

  1. 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: https://github.com/pingdotgg/t3code/issues/17564

  2. Still reproducible on pi-subagents 0.83.0 (released 2026-10-26).

    Repro on a Pi thread in T3 Code:

    1. Ask the Pi agent to launch a single pi-subagents child with async: true that counts 1→200, one bash call per number.
    2. The child runs and finishes, but it never appears in T3's subagent UI. The thread shows only the parent's launch tool call.
    3. Steering still works: a message sent to the thread at count 6 was forwarded by the parent with the steer action, and the child stopped at 10 and answered as instructed. The child's session file under ~/.pi/agent/sessions/ confirms it.

    For comparison, the same test with a foreground child: the steer stays queued behind the blocked parent turn and never reaches the child, which counts to 200. That's expected, but it means background is the only steerable mode, and it's also the one T3 doesn't show.

  3. Still reproducible on T3 Code 0.1.5 (desktop app, local server) with pi-subagents 0.84.0 and Pi 1.4.0 on macOS arm64.

    With asyncByDefault: true in the pi-subagents config, a subagent launch that omits async runs in the background. The tool returns Detached right away. The children ran for several minutes and completed. None of them appeared in the Agents panel. The thread's orchestration_v2_projection_subagents table has 0 rows.

    emitSubagentTasks in packages/provider-pi/src/server/adapter.ts still reads only details.results[], and main has not changed this since 0.1.5.

    Workaround: set asyncByDefault: false so launches run in the foreground and render. The parent then waits for each child.


    Produced by Claude Code (Opus 5.5) via t3 triage.

  4. StiensWout(GitHub profile, opens in a new tab)commented

    Note

    🤖 GPT 6.1 Sol responding on behalf of StiensWout

    The maintainer closed our independent #33590 and is retaining our earlier #23786, which covers single, workflow, chain and parallel native Pi subagent lifecycles with regression and runtime evidence. Our new PR preserves additional original-turn, pause/terminal, late-member and bounded-retention cases plus running/incremental/completed client captures. Once a build contains the retained fix, could you retry the reported async launches and close the corresponding issue if rows appear and settle correctly after that fix lands? General extension background-job lifetime from #24187 remains separate.

  5. tanstack-source added labelsbug

  6. thanhpp(GitHub profile, opens in a new tab)commented

    Additional runtime confirmation on T3 Code 0.1.8, Pi 1.5.2, and pi-subagents 0.88.1:

    Two real native async subagent discovery runs were correlated to their T3 parent through provider thread mapping. Both children exited 0. T3 persisted both launches as completed dynamic_tool calls, but the parent had zero orchestration_v2_projection_subagents rows and zero subagent-named events; the run IDs were absent from those child projections/events. The UI was not inspected. Expected: track each native async child through its terminal state; actual: no child projection.

    The installed 0.1.8 executable and checkout bf469bb19669671d0df2efda74ed73867a7137c0 show the same likely seam: async launch returns details.results: [] plus runId/asyncId, but emitSubagentTasks reads only details.results (packages/provider-pi/src/server/adapter.ts:1258-1277,1305-1328). Foreground native results already have projection; the synthetic adapter test covers foreground-shaped results only. Native Pi children are distinct from T3 delegate_task, which uses an app-owned thread path.

    Proposed minimal reproduction (not the exact discovery-run prompts used above): in a T3 Pi session, call subagent({agent: "scout", task: "Return OK.", async: true}), wait for native completion, and compare the child projection with the completed tool call.

    Note

    🤖 AI assistant responding on behalf of thanhpp

  7. Note

    Generated by claude-opus-5-5 RESPONDING ON BEHALF OF SHARAD

    This can be closed: #36599 (75c544a978) fixed this, and it shipped in v0.1.10 (first nightly v0.1.10-nightly.20261114.4682). The Pi adapter now tracks any subagent launch that returns an asyncId and no results, which is the { mode: "single", asyncId, results: [] } frame from the report. It reads the child from pi-subagents' subagent-async widget and shows it as a subagent of the turn that launched it, Running until the widget reports it finished (emitSubagentTasks and updateAsyncRun in packages/provider-pi/src/server/adapter.ts). #36599 only names #17564, so nothing closed this one.

    #39888 (c53ac237a0) merged on 2026-11-20 and is first in v0.1.12-nightly.20261121.5024, with no stable release yet. It fixes the follow-up where a child stayed Running when pi-subagents settled the run one widget update before the child (#39871). That report also shows the single-run case working on 0.1.10: about 120 async children with step:0 keys completed on 2026-11-19, with pi-subagents 0.89.1. I haven't checked the reporter's 0.76.1, and the tracking depends on that widget. The open PR #36361 also says it fixes this issue. It was last updated on 2026-11-13, before #36599 merged.

    The attached script adds a case to packages/provider-pi/src/server/adapter.test.ts, built like the file's own async workflow test. It feeds the adapter the launch frame from the report (mode: "single", asyncId, results: []), then two subagent-async snapshots with the run's one child running and then complete. Before #36599 the adapter emits no subagent and no background work. At #36599 and on current main it emits an "echo" subagent as running and holds background work, then marks the subagent completed and releases it.

    I also ran it in the real app. The only stand-in is a stub pi binary on the server's PATH. It answers T3's RPC commands, and on each prompt it replays an async pi-subagents launch. The subagent tool returns the report's frame, the coordinator turn ends, and the subagent-async widget reports a "reviewer" child running for about 16 seconds, then complete, followed by the report's subagent-notify message. The T3 server, the Pi adapter and the UI are real. Before #36599 the thread shows only the Subagent tool row and goes idle while the child runs. On main a "reviewer" row appears as Running, the thread shows "Waiting · reviewer", and the row turns Completed when the widget says so.

    Before #36599 (4192234c34)main (2770bf3c61)
    Before #36599 (4192234c34)main (2770bf3c61)
    📹 Screen recording📹 Screen recording

    To reproduce, run bash prove-issue-17363.sh from a clean t3code checkout after vp i.

    Result
    PASS  #36599 (75c544a978) is on main: fix(pi): async pi-subagents workflow, chain and parallel members show as subagents (#36599)
    PASS  before #36599 (4192234c34): the async launch and both widget snapshots (running, complete) produce no subagent and no background work
    PASS  #36599 (75c544a978): the same frames produce subagent "echo" running, then completed, and hold background work until it settles
    PASS  main (63fa4c892e): the same frames produce subagent "echo" running, then completed, and hold background work until it settles
    VERDICT: #17363 is fixed on main by #36599

Sign in to join this conversation.