fix(child-session): exclude intercom from child tool allowlist (#483) - #494
Open
naivezip wants to merge 1 commit into
Open
fix(child-session): exclude intercom from child tool allowlist (#483)#494naivezip wants to merge 1 commit into
naivezip wants to merge 1 commit into
Conversation
…i-dev#483) pi-intercom is excluded from child sessions via blockedPackageSources to prevent concurrent process.env session cross-wiring, but its tool was not included in CHILD_EXCLUDED_TOOL_NAMES. As a result, inheritedChildToolAllowlist leaked "intercom" into child sessions when active in the parent session, causing subagent_spawn and workflow runs to fail preflight checks. Add "intercom" to CHILD_EXCLUDED_TOOL_NAMES so child allowlists consistently exclude it, update drift guard and tool-surface tests, and add regression coverage for child preflight pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #483.
当
@tt-a1i/openpi与pi-intercom同时启用时,任何subagent_spawn(含不带agent_type的普通子代理)及 Workflow 子会话均在首个模型请求前预检必挂:根因在于:
child-session.ts的blockedPackageSources()已正确将pi-intercom从子会话的配置/资源中剔除(防止process.env会话身份在同进程并发子会话间串号),但CHILD_EXCLUDED_TOOL_NAMES未收录"intercom"。导致inheritedChildToolAllowlist(pi.getActiveTools(), ...)将父会话中激活的intercom漏入子代理的请求工具清单,而子会话未加载该包,最终导致bindChildSessionExtensions()预检抛错、启动中断。Value
修复 OpenPI 与常用跨会话协调扩展
pi-intercom同装时的子会话委托功能,使普通subagent_spawn、指定agent_type的子代理以及 Workflow 均能顺利通过预检并正常执行,同时完整保留#128确立的并发安全隔离边界。Approach
extensions/shared/child-session.ts的CHILD_EXCLUDED_TOOL_NAMES中增加"intercom",使inheritedChildToolAllowlist、effectiveChildToolAllowlist和childToolPolicy始终将intercom排除在子会话工具之外。tests/extensions/shared/child-session.test.ts中的漂移保护测试(drift guard),排除被安全策略屏蔽的第三方包工具,并断言CHILD_EXCLUDED_TOOL_NAMES包含"intercom"。tests/extensions/shared/tool-surface.test.ts,在比较 OpenPI 包工具目录与子会话策略时过滤非 OpenPI 所有的第三方屏蔽工具"intercom"。tests/extensions/subagents/agent-types.test.ts,确保在 agent-type 中声明intercom时正确报告为 parent-only 工具并忽略。tests/extensions/shared/child-session.test.ts中增加回归用例:模拟父会话激活intercom,断言继承与显式 allowlist 均丢弃intercom,且子会话预检正常通过。Validation
node --test --experimental-strip-types tests/extensions/shared/child-session.test.ts:20/20 通过(包含漂移保护、工具继承、及新增的被剔除包工具回归测试)。node --test --experimental-strip-types tests/extensions/shared/tool-surface.test.ts:9/9 通过。node --test --experimental-strip-types tests/extensions/subagents/agent-types.test.ts:22/22 通过。node --test --experimental-strip-types tests/extensions/subagents/index.test.ts:16/16 通过。node --test --experimental-strip-types tests/extensions/subagents/pi-backend.test.ts:5/5 通过。node --test --experimental-strip-types tests/extensions/workflows/runner.test.ts:26/26 通过。node scripts/check-config-contract.mjs:通过(15 个持久化字段契约检查)。node scripts/check-discipline-ledger.mjs:通过(12 行 Discipline Ledger 检查)。npx biome format与npx biome lint --error-on-warnings:通过,无警告或错误。git diff upstream/main..HEAD:确认仅变更与 Issue fix(child-session): pi-intercom 同装时 subagent_spawn 预检必挂——intercom 未进 CHILD_EXCLUDED_TOOL_NAMES #483 相关的 4 个文件(61 行新增,5 行修改)。Impact
pi-intercom时子代理和 Workflow 正常启动,不再报预检错误。intercom工具定义。pi-intercom。blockedPackageSources中被排除包的工具名单过滤。