Skip to content

feat: vendor billion-context-pi-subagents in-repo under pi-subagents/ (#2384) - #2386

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-08_pi-subagents-vendor
Oct 8, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-08_pi-subagents-vendor

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #2384

What

Vendors billion-context-pi-subagents INTO THIS REPO under pi-subagents/, same pattern as kernel/ (#2092): own source + own unit suite + own package.json (own version) + own build chain; consumed via "billion-context-pi-subagents": "file:./pi-subagents" devDependency; tsup keeps inlining it via the existing noExternal entry (list unchanged — the component's own build already inlines its typebox peer, so dist stays self-contained). A commit IS the pin; the cross-repo npm publish round-trip is gone.

  • Vendored verbatim from ranxianglei/billion-context-pi-subagents @ master d19481e (src/tests/tsup/tsconfig/LICENSE/READMEs); provenance in pi-subagents/PROVENANCE.md.
  • Root: typebox added to devDependencies (build-time resolution for the component's own tsup build); build/typecheck/test pre-hooks now build pi-subagents/ alongside kernel/.
  • CI: npm --prefix pi-subagents test added to the test job (two-layer rule); NEW pi-subagents-guard job enforces version discipline (src/build-config changes ⇔ pi-subagents/package.json version bump, both directions). Deliberately LIGHTER than kernel-guard: no PR-body declaration / human gate — this is a fast-moving pi-lane extension surface, not load-bearing core compression (the point of billion-context-pi-subagents 直接纳入本项目 像acp-kernel一样 #2384 is reducing dev cost; tighten here first if that assessment changes).
  • Docs: AGENTS.md new "Pi-Subagents Boundary" section + KDD fix: keep system prompt byte-stable for prefix cache #1/feat: persistent + namespaced sessions, multi-tenant session isolation, stream robustness #5 + Build Commands; reference/architecture.md module map; CONFIGURATION.md/zh wording sync ("standalone package" → in-repo component; README link now points at pi-subagents/README.md) — small labeled doc-accuracy fixes entailed by this change.
  • The old repo ranxianglei/billion-context-pi-subagents stays frozen from now on (same policy as acp-kernel post-acp-kernel 并入billion-context并保持相对独立 #2092); nothing touched there in this PR.

Behavior change (flagged per owner policy)

The vendor takes master, not the previously pinned npm 0.1.1: master carries one merged-but-unreleased fix — the settle-gate delegate-notification fix for #2301 (d6d8721, upstream PR #7).

  • OLD (shipped 0.1.1): delegate completion committed an IRREVOCABLE sendUserMessage(followUp) into the host queue on a fixed ~2s trailing timer (cap 10s) regardless of whether the main agent would read the result file itself — a later read could not recall it (the [Bug][Pi] notifyIfRead="skip" still delivers stale follow-ups after the final result was read #2301 stale-follow-up bug).
  • NEW (now bundled): completions stay in the plugin-owned pending list until the host agent_settled boundary, where read/waiter/consumption are re-checked — read ⇒ dropped, unread ⇒ coalesced into ONE message; the misleading log splits into inject-suppressed vs read-after-commit.
  • WHY: this is the intended, owner-approved [Bug][Pi] notifyIfRead="skip" still delivers stale follow-ups after the final result was read #2301 fix that was merged upstream but stranded awaiting an npm release; vendoring lands it directly. Intentional tradeoff (per that issue): worst-case delivery latency while the host is busy moves from ~2s to the next settle.
  • Component version starts at 0.1.2 (source differs from published 0.1.1 ⇒ version discipline).

Incidental lockfile note: npm install also synced a stale lock line for the existing kernel file link (kernel version 0.0.104 → 0.0.105, matching the already-committed kernel/package.json); NO kernel source changed.

Config surface

None — no new config fields / env vars / CLI flags; no default changed.

Verification (targeted locally; global regression delegated to CI)

@ranxianglei
ranxianglei force-pushed the 2026-10-08_pi-subagents-vendor branch from ea3cb0b to d233af6 Compare October 8, 2026 05:12
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 冲突已解决,rebase 完成并推送:ea3cb0b9d → d233af649(分支 2026-10-08_pi-subagents-vendor)。PR 恢复 mergeable: True,CI 已在跑(CI / e2e-fake-codex / e2e-native-dsh)。

结构化八问:

  1. 是什么问题:PR 分支与 master 冲突(merge state dirty),无法合并。这是纯冲突处置,不是新开发。
  2. 什么原因导致的:PR 基于 74cf5246d 创建后,master 前进了 ~100 个提交(v0.1.188 release、feat: stamp the build's git commit into every version display #2345 build-info、release v0.1.188 #2377 kernel 0.0.107 等)。真实文本冲突只有两处:package.json 的 build 脚本行(master 加了 write-build-info.mjs,本 PR 加了 pi-subagents 构建步)和 package-lock.json 的 kernel 版本行(master 0.0.106 vs 分支 0.0.105)。CONFIGURATION.md / zh / reference/architecture.md 自动合并干净,逐行核对过与 PR 原意一致。
  3. 影响范围与严重程度:仅影响该 PR 分支的可合并性;master 与用户侧零影响。严重度:工作流阻塞。
  4. 怎么修复的:rebase 到当前 master(625989406),冲突按「双方意图取并集」解决——build 脚本保留 master 的 write-build-info.mjs 同时加入 pi-subagents 构建步;lockfile 用 npm install --package-lock-only 从树实际状态重新生成(kernel 0.0.107 + pi-subagents 0.1.2 file link)。零内容改动:git diff ea3cb0b9d d233af649 -- pi-subagents/ 为空,组件字节级未变。
  5. 是否有回归问题:rebased head 上定向验证——typecheck 干净;pi-subagents 套件 212/213(watchdog.test.ts 的 "poke resets the idle timer" 是墙钟计时测试,idleMs=200 对 sleep(50)×10,本机高负载下偶发失败、重跑通过;属 vendored 代码既有属性,与本次 rebase 无关);bili 定向测试 tests/pi-subagents-wiring.test.ts + tests/pi-subagent-registry.test.ts 26/26;build 成功,dist 自包含契约保持(billion-context-pi-subagents/typebox 外部 import 为 0,read-after-commit 标记在 dist/agent/pi-native.js,[Bug][Pi] notifyIfRead="skip" still delivers stale follow-ups after the final result was read #2301 修复确认在 bundle 里)。全局回归交给 CI,结果出来我再跟一条。
  6. 是否破坏缓存:不涉及(无代码改动)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:无。

顺带发现(已在本 PR 内修掉):master 自身的 lockfile 落后于 kernel/package.json——lock 记 0.0.106,而 #2377 已把 kernel/package.json 提到 0.0.107(那次提交没同步 lock)。本次重新生成后 lock 与源码一致,合并后此漂移一并消除;无独立行为变化,不值得单独立项。

判定:冲突已清,等 CI 绿即可由 owner 合并。

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-08_pi-subagents-vendor (4cac902)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2574-pr.2386.c2b27fd

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2386.tgz
npm install -g package

Install instructions are refreshed on each push.

…tment as kernel/)

The #1440-P6 gate scans all tracked .ts via the *.ts pathspec but only
excludes kernel/. Vendoring pi-subagents/ (#2384) put the component's own
public API surface (a separately published npm package with its own test
suite and version discipline) under the root-package gate, which flagged
20 of its exports. Exclude it wholesale exactly as kernel/ is excluded;
the component imports nothing from the root src/, so no root symbol loses
its only references.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 跟进:rebase 后的 CI 有一个红——unused-exports job。已定位并修掉,追加 commit 4cac902fc 已推送,现在全部 12 个 workflow 绿,PR 状态 clean,可合并。

结构化八问(针对这个红):

  1. 是什么问题:主 CI 的 unused-exports 门禁(audit: 全仓冗余审计与重构计划——server.ts 解体、客户端矩阵去重、死代码、AGENTS.md 模块图腐化 #1440 P6)对本分支报 20 个未用导出(18 INTERNAL_ONLY + 2 DEAD),全在 pi-subagents/src|tests/ 下(如 delegate-events.ts 的事件类型、log.ts: LogLevel、tests/tmp-path.ts: tmpPath)。
  2. 什么原因导致的:不是 rebase 引入的——原 head ea3cb0b9d 上 CI 一次都没跑过(check-runs total=0),冲突唤醒先于 CI 结果到达。根因:scripts/check-unused-exports.mjs 用 git ls-files ... *.ts 扫描,git pathspec 里无斜杠的 *.ts 匹配任意深度,脚本只显式排除了 kernel/(第 46 行)。本 PR 把 pi-subagents/ 引进树后,组件自己的公开 API surface(独立发布的 npm 包,有自己的测试套件和版本纪律)落进了根包门禁的扫描范围。rebase 前后该脚本与组件代码逐字节一致,结果必然相同。
  3. 影响范围与严重程度:仅阻塞本 PR 合并;master 与用户侧零影响。严重度:工作流阻塞。
  4. 怎么修复的:一行改动——过滤条件加 !f.startsWith("pi-subagents/"),与 kernel/ 完全同等的边界处理(kernel 当年 acp-kernel 并入billion-context并保持相对独立 #2092 vendor 进来就是同样待遇)。选它而不是另外两个方案的原因:①改组件源码去掉 export = 破坏「verbatim from d19481e」provenance 声明 + 触发 Pi-Subagents Boundary 版本 bump;②往 WAIVERS 塞 20 条逐符号豁免 = 污染门禁「唯一漏洞必须逐条可审」的设计。整体豁免才是结构性修法。已验证安全性:pi-subagents 源码只 import node 内置 / @earendil-works/* / typebox / 包内相对路径,不引用任何根包符号,排除后没有根包导出会失去唯一引用(本地跑门禁:clean,3 waived 不变)。
  5. 是否有回归问题:无。门禁对既有扫描面(src/、tests/、scripts/、根级 *.ts)覆盖完全不变;新增排除只作用于此前不存在的目录。本地复跑门禁通过,CI 上 unused-exports 及全部 job 绿。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及——是把既有的「vendored 组件各守边界」模式(kernel 先例)应用到新组件,方向未变。
  8. 是否引入了新的配置:无。

判定:冲突已清、CI 全绿、mergeable_state: clean,等 owner 合并。

@ranxianglei
ranxianglei merged commit 8c62d64 into master Oct 8, 2026
26 checks passed
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.134-master.8c62d64 (rolling master tag).

npm install -g billion-context@0.0.134-master.8c62d64  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

billion-context-pi-subagents 直接纳入本项目 像acp-kernel一样

1 participant