Skip to content

Subagent and Workflow child preflight fails when pi-intercom is active in the parent #493

Description

@thimpeng

问题 / Problem

同时启用 OpenPI 和 pi-intercom 后,OpenPI 原生 Subagent 与 Workflow child 会在首次模型请求前失败:

Child tool preflight failed: requested tool "intercom" is unavailable after child extensions initialized.

这会使所有继承父会话工具面的 child 无法启动。更换 explorerreviewer 等内置 agent type,或不指定 agent type,结果相同。

Related to #455.

复现 / Reproduction

  1. 在 Pi 中安装并启用当前版本的 @tt-a1i/openpipi-intercom
  2. 重启或 reload,使父会话同时具有 OpenPI 的 Subagent/Workflow 工具和 intercom 工具。
  3. 调用一个普通的 subagent_spawn,或运行包含 agent() 的 Workflow。
  4. Child 在模型调用前被 preflight 拒绝。

复现版本:

  • Pi 0.85.1
  • @tt-a1i/openpi 0.8.1
  • pi-intercom 0.13.0
  • Node.js 26.0.0

预期行为 / Expected behavior

  • OpenPI child 可以正常启动。
  • intercom 不进入并发的 in-process child。
  • 父会话中的 intercom 保持可用。

实际行为 / Actual behavior

OpenPI 把父会话当前启用的 intercom 加入 child 请求工具列表,但 child resource loading 又按设计移除了 pi-intercom。扩展绑定后的工具检查因此把 intercom 判为缺失并终止启动。未发生模型请求。

初步定位 / Analysis

当前 extensions/shared/child-session.ts 中:

  1. blockedPackageSources()createEphemeralChildSettings() 会从 child settings 移除 pi-intercom。源码注释说明,这是为了避免多个并发 in-process child 通过共享 process.env 串接 session identity。这一安全边界是合理的。
  2. inheritedChildToolAllowlist(pi.getActiveTools(), roleTools) 继承父会话的 active tools。
  3. effectiveChildToolAllowlist() 只过滤 CHILD_EXCLUDED_TOOL_NAMESintercom 不在其中,因此仍留在 requested tools。
  4. bindChildSessionExtensions() 随后发现 child registry 没有 intercom,触发上述 preflight error。

Direct Subagent 与 Workflow 共用这组 helper,因此两条路径都会受影响。

建议的最小修复 / Suggested minimal fix

在从父会话投影 child tools 时,把 intercom 作为 child-ineligible tool 过滤掉,同时继续从 child resources 中排除 pi-intercom,并保持父会话工具不变。资源排除与 requested-tool preflight 最好共享同一 child-ineligible policy,避免“扩展按设计移除,但工具仍被声明为必需”的不一致。

建议增加两个回归测试:

  • 父会话启用 intercom 时,Direct Subagent 能启动,child 中无 intercom,父会话仍保留该工具。
  • 相同条件下,Workflow agent() 能启动并保持相同边界。

隐私说明 / Privacy

此报告未包含凭据、用户目录、项目路径、项目名称、session ID、会话内容、Provider/模型身份或私有日志。

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions