Skip to content

backends: specify recorded, host-controlled subagent delegation for managed Pi workers #3668

Open

Description

@schlessera

Out of scope

No implementation of the selected path in this spike; no exemption, allowlist or trusted package for pi-subagents inside the worker; no weakening of the managed extension refusal (unqualifiedResources, packages/ui-backend-pi/src/native-session-runtime.ts:132-136); no change to Claude's subagent handling; no chat-history UI work (#3638, #3636); no live provider in tests.

Context

Managed Pi turns refuse every loaded extension, pi-subagents included (packages/ui-backend-pi/README.md:309-330; loadExtensions doc, packages/ui-backend-pi/src/backend-options.ts:119-127). Before the refusal, the subagent tool was auto-allowed for parity with Claude's Agent tool, and its child agent's tool calls ran inside Pi's child session outside this backend's gate (DEFAULT_PI_ALLOWED_TOOLS, packages/ui-backend-pi/src/tools.ts:203-208). The brief names the tool only when the package is installed (hasPackage, packages/ui-backend-pi/src/session-resources.ts:112-113,235-248). Disabling extensions restores chat but leaves Pi without fan-out.

Claude's subagent tool calls pass through the same PreToolUse/PostToolUse hooks that call inputSafety.begin/result (packages/ui-backend-claude/src/permission-hooks.ts:317-318,695-699). A Pi equivalent must admit each child call against the parent turn's grants and permission policy, and record every child result (and the child's final answer delivered to the parent) before any model receives it, including cancellation, worker death, reload and chat resume.

Upstream: pi-subagents 0.87.0 on npm at the time of filing. Read ROADMAP.md "What binds future work", docs/decisions/session-safety-reviews.md, docs/decisions/provider-history.md and docs/decisions/governed-writable-workers.md before proposing a shape.

Scope

Produce a reviewed design for restoring subagent delegation to ordinary governed and strict Pi workers through a controlled execution path:

  • Compare at least: (A) host-spawned child Pi workers using the same curated toolkit, worker bridge and collector, bound to the parent session/turn; (B) in-worker child sessions, and what would make their calls recordable. Recommend one, with evidence.
  • Specify identity and attribution of child calls, grant/permission inheritance and narrowing, concurrency/fan-out/budget bounds, collector placement for child tool results and the child-to-parent result, provider-history stability for parent and child, and behaviour on cancellation, child or parent death, reload and resume.
  • State the contract surfaces the implementation would add (catalog, wire messages, activity/trace records) and whether any is breaking.
  • File the implementation task(s) under the parent epic with checkable acceptance criteria and a design prompt for any ruling the maintainer must make.

Acceptance criteria

  • A docs/plans/ entry compares the options above against the session-safety, provider-history and governed-worker records, citing source, and recommends one.
  • Every open policy question is listed with options and consequences for a maintainer ruling; recommendation is kept separate from approval.
  • Implementation task(s) are filed with acceptance criteria covering admission, recording, cancellation, reload and resume, keyless loopback tests and named mutations, and linked as Blocked by this spike where they depend on its ruling.
  • Any offline prototype used as evidence is keyless, uses fictional Odysseus inputs and is kept outside automatic product CI unless promoted deliberately.

Verification

bun run check:pr --base origin/main for the docs change. Cite exact upstream package versions verified against the npm registry.

Contract impact

None from the spike itself. The design names the additive or breaking surfaces its implementation would introduce.

Activity

  1. added
    type: spike
    area: backends
    priority: p2
    agent-ready
    security
    on Nov 8, 2026
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

    agent-readyarea: backendspriority: p2securitytype: spike

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions