Skip to content

fix(child-session): align inherited tools with blocked package provenance - #528

Merged
tt-a1i merged 6 commits into
openpi-dev:mainfrom
JS-banana:fix/child-package-tool-inheritance
Sep 12, 2026
Merged

tt-a1i merged 6 commits into
openpi-dev:mainfrom
JS-banana:fix/child-package-tool-inheritance

Conversation

@JS-banana

@JS-banana JS-banana commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Screenshot 2026-09-10 at 15-39-38

Fixes #483. Fixes #493.

With pi-intercom active in the parent, Direct Subagents and Workflow children inherit its tool names even though child resource loading excludes the package. Startup then fails before the first model turn.

This builds on #494 and retains naivezip's original commit/attribution. It incorporates the requested provenance and caller-test changes in a separate reviewable PR, rebased onto main at 5bf2fe2. The original PR remains untouched.

Value

Restore delegation while preserving the parent-only package boundary and unrelated third-party tools, including ordinary tools also named intercom.

Approach

  • Use Pi's ToolInfo provenance and required getAllTools() at both production callers; remove the partial descriptor, optional metadata path, and array shorthand.
  • Share the loaded-resource/package policy between child resources and inherited tools, respecting origin and scope. Resolve local sources through Pi's scoped getInstalledPath(): a nested single-file extension must be checked as a file so its owning manifest can be found above its containing directory.
  • Propagate unverifiable identity errors instead of guessing from path substrings. Preserve offline handling of configured but unloaded packages and the existing OpenPI tool classification guard.
  • Extend the existing real Pi fixture coverage for npm, Git, local directories, nested single files, unrelated same-name tools, and malformed/missing provenance. Exercise ordinary Direct spawn, typed Direct spawn, and Workflow agent() using actual parent package metadata and the existing child-session injection seams.

Validation

On the final rebased head, Node 22.23.1, Bun 1.3.14, Pi SDK 0.85.1:

Tests execute real package loading and shared child preflight; caller tests inject model/session responses. No live provider generation or installed interactive Pi acceptance is claimed. Existing bundle-size and jsdom scroll warnings remain.

Impact

  • User-visible: delegation can start with a blocked package active in the parent.
  • Model-visible tools: inherit only eligible active parent tools; role restrictions can only narrow them. The parent tool surface remains intact.
  • Runtime: retain child package isolation and preflight; missing or unverifiable inherited provenance fails explicitly.
  • Configuration/persistence: no schema or user-settings changes.
  • Compatibility: uses the existing Pi >=0.85.1 tool metadata API; no new dependencies.

naivezip and others added 2 commits September 10, 2026 15:37
…ild inheritance (openpi-dev#483)

pi-intercom is excluded from child sessions via blockedPackageSources to prevent concurrent process.env session cross-wiring (openpi-dev#128). However, when pi-intercom was active in the parent session, inheritedChildToolAllowlist projected its tools into child sessions, causing subagent_spawn and workflow child sessions to fail preflight checks.

Rather than hardcoding foreign tool names into OpenPI's CHILD_EXCLUDED_TOOL_NAMES (which is strictly reserved for OpenPI-owned parent-only tools and enforced by the fail-closed drift guard), dynamically drop tools from blocked packages during child inheritance:

- Inspect tool.sourceInfo in inheritedChildToolAllowlist against blocked child package matchers
- Pass pi.getAllTools() and cwd context from subagents/index.ts and workflows/index.ts
- Preserve CHILD_EXCLUDED_TOOL_NAMES and bidirectional drift guards strictly for OpenPI tools
- Add regression coverage verifying dynamic exclusion of tools from blocked packages while preserving ordinary tools and passing child preflight
@github-actions github-actions Bot added area:workflows Workflow engine, capability, skills, or tests area:subagents Subagent delegation, skills, or tests labels Sep 10, 2026
tt-a1i
tt-a1i previously approved these changes Sep 12, 2026

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 48bc587 after current-main integration. Standards: no remaining actionable blocker identified. Spec: Authoritative Pi tool provenance and one shared blocked-package policy fail closed across Direct and Workflow child acquisition. No P0/P1 found. This supersedes findings against older implementations where stated; merge remains conditional on current required CI and branch protection.

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

仅为现有测试 fixture 提供新增的 Pi provenance 参数,无运行时策略变化。 bun run check 已通过;完整测试已执行或正在串行验证,本机部分测试存在资源竞争超时,最终状态以最新 CI 为准。未发现 P0/P1。此账户推送了修复,仍需另一位维护者满足最后一次推送后的独立批准。

@tt-a1i
tt-a1i merged commit 81bfd34 into openpi-dev:main Sep 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:subagents Subagent delegation, skills, or tests area:workflows Workflow engine, capability, skills, or tests

Projects

None yet

3 participants