Skip to content

Show nested planner and subagent progress in the chat transcript #13

Description

@sansari

Problem

When Pi delegates work to the planner or another subagent, PiNative renders the parent subagent tool call using the generic fallback:

Working through the next step

That line can remain unchanged for the duration of a long planning or review task. It does not tell the user that a planner is running or show the useful work steps visible in Pi's own subagent presentation.

This is not caused by chat Markdown formatting. The fallback predates that work; the newer use of specialized agents makes the limitation more visible.

Why this happens

PiNative currently recognizes only a small set of top-level tool names when producing activity summaries (read, write, edit, bash, and update_changelog). subagent therefore falls through to the generic status.

Pi's RPC stream already exposes richer live data on tool_execution_update.partialResult.details. For a subagent invocation, those details can include:

  • Mode: single, parallel, or chain
  • Agent name and delegated task
  • Per-agent running/completed/failed state
  • Child assistant messages and tool calls
  • Step numbers for chained work
  • Usage and model metadata

PiNative currently extracts only text from partialResult.content and discards the structured details payload.

Desired experience

A delegated planning task should immediately identify what is happening and then show concise, safe progress as the child agent works. Example summaries:

  • Planning the requested change
  • Planner is reviewing the project structure
  • Planner is reading PiConversationView.swift
  • Planner is searching for activity-group handling
  • Planner completed the implementation plan

Parallel and chained delegation should communicate aggregate and per-task state without flooding the transcript, for example:

  • 1/3 delegated reviews complete, 2 running
  • Step 2 of 3: reviewing the proposed implementation

Requirements

  • PiNative should recognize subagent tool calls and identify the delegated agent or mode instead of showing the generic fallback.
  • While a subagent is running, PiNative should consume structured RPC progress updates and surface recent, meaningful child work steps.
  • Single, parallel, and chained subagent invocations should have clear running, completed, and failed states.
  • Nested progress summaries should preserve source event ordering and update from authoritative RPC events, without polling or timing-based correctness.
  • User-facing summaries should not expose raw prompts, tool arguments, command output, hidden reasoning, secrets, or other technical payloads by default.
  • Progress should remain concise and visually consistent with existing activity groups rather than reproducing a terminal transcript.
  • Captured nested summaries should survive navigation and relaunch through PiNative's transcript persistence when they were observed live.
  • Hydration should degrade gracefully when a persisted Pi session contains only the final subagent result and no structured historical details.
  • Existing non-subagent activity summaries should continue to behave as they do today.

Implementation considerations

Likely work includes:

  1. Introduce a typed, Codable representation for nested/delegated activity, with backward-compatible decoding for existing cached transcripts.
  2. Parse tool_execution_update.partialResult.details.results[].messages for subagent calls.
  3. Derive privacy-safe summaries from child tool-call names and selected safe fields, reusing the existing summary vocabulary where appropriate.
  4. Update the matching parent tool by toolCallId as cumulative partial results arrive.
  5. Model single, parallel, and chain progress without losing event order.
  6. Render a compact recent-step view with polished completed and failure states.
  7. Preserve a sensible generic fallback for unknown or malformed subagent payloads and for session hydration without details.

The subagent implementation emits cumulative partial results, so PiNative can replace the stored nested state on each update rather than attempting to infer deltas.

Test expectations

  • Unit tests for parsing representative single, parallel, and chained partialResult.details payloads.
  • Unit tests for malformed/missing details and backward-compatible transcript decoding.
  • Tests proving summaries omit sensitive/raw nested content.
  • Lifecycle tests showing ordered updates, completion, failure, navigation, and persistence behavior.
  • UI coverage for a deterministic delegated-work fixture showing multiple visible progress steps and terminal state.
  • Live verification with a real planner/subagent invocation, because fixture-only coverage cannot prove the current Pi extension payload remains compatible.

Non-goals

  • Rendering hidden model reasoning.
  • Showing raw child tool arguments or output in the default transcript.
  • Building a full terminal-style nested transcript.
  • Folding this work into the chat Markdown formatting issue (Improve chat message formatting #10).

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions