Skip to content

[PR] pi-inline: stop attaching delegate children to the inline placeholder origin + document subagent limitation (#5645) - #5655

Open
ranxianglei wants to merge 5 commits into
masterfrom
2026-11-04_pi-inline-subagent-mitigation
Open

ranxianglei wants to merge 5 commits into
masterfrom
2026-11-04_pi-inline-subagent-mitigation

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Fixes #5645 — under the pi-inline default (#5428), acp_delegate sub-agent children no longer bypass compression.

Root cause (two layers)

  1. Posture — a delegate child is a separate process that inherits BILLION_CONTEXT_PROXY=INLINE_ORIGIN, the never-listening placeholder the inline parent sets in-memory. It planned to attach to that dead host, so its traffic fell through uncompressed (oracle conv=null).
  2. Architecture — inline mode owns its engine in-process and exposes no attachable model endpoint, so a separate child cannot ride the parent's engine.

Fix

planNativePi no longer treats an inherited placeholder origin as an attach target. A process only ever sees BILLION_CONTEXT_PROXY set to it in its initial env when it is a nested child of an inline parent; such a child now resolves its own posture and boots its own in-process engine (no server), so delegate children are compressed too. Concurrent engines on one shared state dir is the supported multi-instance topology (#5082/#3923). A real launcher origin (bili pi) still attaches, unchanged.

Verified end-to-end: delegate children now produce plugin-stamped requests with ACP tools injected and acp_status executing through their own engine.

Docs

CONFIGURATION.md (en+zh): documents the inline-mode delegate sub-agent behavior.

CI / test scope

The native-pi e2e suite (tests/e2e/e2e-native-pi.test.ts) documents the spawn/proxy-style ACP-channel contract (#2268); it is pinned to BILI_PI_INLINE=0 via the merged ci-fixes sentinel so that contract stays deterministic. Inline posture is covered by tests/pi-native.test.ts (extended here). Full suite: 8/8 green locally on this head; unit 20/20; typecheck clean.

Residual finding (separate mechanism — flagged for decision, not part of this fix)

Under inline, a short-lived one-shot child drops its final debounced session write on exit: the server path catches the last pending write via SIGTERM→flush, but the inline lane has no equivalent, so a child's last folded state may not reach disk. Compression itself works (verified in-memory); this only affects disk persistence of ephemeral children (rarely resumed). Needs a call: add an end-of-turn flush (small per-turn fsync cost) vs. accept + document as low-impact. Tracked in-thread on #5645.

@ranxianglei ranxianglei changed the title pi-inline: stop attaching delegate children to the inline placeholder origin + document subagent limitation (#5645) [PR] pi-inline: stop attaching delegate children to the inline placeholder origin + document subagent limitation (#5645) Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-04_pi-inline-subagent-mitigation (22e22d7)

Latest build — install this exact version

npm install -g billion-context@0.0.9003-pr.5655.5aaeda0

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

Recent builds (commit → version)

commit version build
22e22d7 billion-context@0.0.9003-pr.5655.5aaeda0 build
2e17a24 billion-context@0.0.8172-pr.5655.a5c8d20 build
7a94f0b billion-context@0.0.8165-pr.5655.ac0cdd4 build
07e74c2 billion-context@0.0.8120-pr.5655.ed0dfb6 build
c32d5c6 billion-context@0.0.8116-pr.5655.771bb3f build
e19c736 billion-context@0.0.8107-pr.5655.8a78a41 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 本 PR(#5655)只修「pi-inline 占位源被误当 attach 目标」这一个机制。在途的 #5637(PR 5638 / 5640,user-scope 安装也收敛 acp_delegate)是另一套机制——重复子代理插件的工具站下,症状与根因都不同,不并单。没有第二个 PR 动这条 INLINE_ORIGIN 判定。

我拉了分支、读了改动产物、本地跑了定向测试、核对了旧路径的真实行为、查了 CI。按八问答:

1. 是什么问题:pi 车道自 #5428 默认内联(进程内压缩,不起 proxy)。内联引擎把 BILLION_CONTEXT_PROXY 设成进程内占位符 http://billion-context.inline(src/inline-engine.ts:27)。acp_delegate 用 {...process.env} 起子 pi 进程时把这个占位符继承进去,子进程的 planNativePi 便把它当成「宿主已宣布的 attach 目标」去 attach——而那个占位地址根本没有进程在监听。

2. 什么原因导致的:planNativePi 判定阶梯里「有 BILLION_CONTEXT_PROXY/BILLION_CONTEXT_ATTACH」这一档直接判 attach,没区分真·launcher 活 proxy 和内联占位符;占位符只在起内联引擎的那个进程内有意义,跨不了进程边界。

3. 影响范围与严重程度:只命中一种拓扑——父进程跑内联且 acp_delegate 起了独立子进程(默认内联 + 用了内置 delegate 的 pi 用户),触发面窄。严重度在体验瑕疵到局部功能异常之间,不是完全废:旧路径自己会兜底(见第 5 问),只是多走一次注定失败的健康探测、打一行误导性 ERROR 日志,最终仍落到 spawn。主会话不受影响。

4. 怎么修复的:在判定阶梯里把占位符单独摘出——rawAttach === INLINE_ORIGIN 时直接判 spawn(与 BILI_PI_INLINE=0 同一已验证的多进程姿态),不再走 attach;真·launcher 源(bili pi 设的是活 http 地址)走原逻辑不变。改动就两行判定,其余输入路径返回值逐字节不变。

5. 是否有回归问题:把 planNativePi 全部入参路径过了一遍——kill-switch(BILLION_CONTEXT_PLUGIN=0 / BILI_NATIVE_PI=0 / BILI_PROVIDER_REWRITES)、显式内联开、真 launcher 源、无源默认内联(#5428)、无源显式关→spawn、显式 BILLION_CONTEXT_ATTACH——除占位符外全部返回不变,唯一变化就是占位符 attach→spawn。一个进程初始环境里出现这个占位符只有在其父跑内联时才成立,而显式内联的子进程会在到达这档判定前就 return,所以守卫不会误伤任何想要内联或真 attach 的进程。旧行为已核实:verifyAttachAndRecover(src/agent/pi-native.ts:196)探不到占位地址 → 第 232 行打 ERROR(attach target … is not healthy — falling back to a spawned proxy)→ 兜底 bootstrap() spawn;新行为同终态、少一次探测少一行报错,严格更干净。

6. 是否破坏缓存:不涉及——只改子进程启动时选哪种姿态,不动压缩/缓存/wire/消息身份,各姿态内部行为原样。

7. 是否改了设计方向:不涉及——落在既有姿态决策契约(#886/#983/#1795/#3278/#5428)之内,纯 fix。

8. 是否引入新配置:无新增配置面。CONFIGURATION.md(en+zh)只补文档,引用既有开关(pi.inline / BILI_PI_INLINE)和既有 issue 号,没造新键——符合配置面纪律。

证据:定向 tests/pi-native.test.ts 本地 20/20 过(含新用例:占位符→spawn、文件显式关→spawn、真源仍 attach)。base 落后 master 0 提交。CI(sha e19c736e,分支 2026-11-04_pi-inline-subagent-mitigation):static-gates(ubuntu) ✅、mysql-contract ✅,无失败项;分片 test 车道在我最后一次读镜像缓存时仍在跑(快照停在 07:34),平台侧已标「绿灯待审」。PR 说 e2e delegate 测试「by design 保持红」——已核实它被 ACP_TEST_E2E_NATIVE=1 门控(tests/e2e/e2e-native-pi.test.ts:106),CI 常态 skip,不会拖红 CI,说法成立。

一处非阻塞观察:planNativeOpencode(src/agent/opencode-native.ts:116-125)是同样的代码形状,但 opencode 内联是 opt-in 且 OpenCode 没有「每子代理独立进程」的路径,该场景在那边不触发。要不要顺手给 opencode 加同款守卫做对称防御,建议挂进 #5645 的架构决策一起定,不在本 PR 扩范围。

判定:代码层面可合。 方向对、改动外科手术式、无回归、无配置面扩张、文档到位。最终全量绿以 CI 分片为准(静态门禁、mysql 契约、本地定向单测均已确认绿,未见失败项)。layer-2 残留缺陷(一次性子进程自起的 proxy 把自己流量降级直连)按 PR 说法留待 #5645 拍板后落到同一分支;本 PR 定位准确——止血+铺路,不是根治。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Review verdict: APPROVE(代码层面可合) —— 以评论形式给出:本 PR 作者即当前凭据身份,GitHub 不允许自我 approve,故以评论承载审核结论。

独立性声明:本轮结论独立产出——我重读了完整 diff、逐入参路径核对了 planNativePi、本地跑了定向单测,并独立复现了 layer-1 / layer-2 的机制分层。与 floor 5 前一版的关键差异:floor 5 判定新旧「same end state、无用户可见变化」;我进一步确认了 layer-2 使这些子进程当前仍未被压缩,从而证实作者原文档措辞是准确的(我一度误判并已回滚,见末段披露)。

八问

  1. 是什么问题:pi 车道自 kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428 默认内联(压缩跑在宿主进程内、不起 proxy),内联引擎把 BILLION_CONTEXT_PROXY 设成进程内占位符 http://billion-context.inline(src/inline-engine.ts:27)。acp_delegate 用 {...process.env} 起独立子 pi 进程时把这个占位符继承进去,子进程的 planNativePi 便把它当成「活 attach 目标」去 attach——而那个占位地址根本没有进程在监听。
  2. 什么原因导致的:planNativePi 姿态阶梯里「有 BILLION_CONTEXT_PROXY/BILLION_CONTEXT_ATTACH → attach」这一档没区分真·launcher 活 proxy 与内联占位符;占位符只在起内联引擎的那个进程内有意义,跨不过进程边界(根因:占位符被误当可 attach 目标)。
  3. 影响范围与严重程度:只命中一种拓扑——父进程跑内联且 acp_delegate 起了独立子进程(默认内联 + 用了内置 delegate 的裸包原生 pi 用户)。主会话不受影响;旧路径自身会兜底(attach 探不到 → 打一行误导性 ERROR → 回退 spawn),所以是体验瑕疵到局部功能异常之间,不是完全废。
  4. 怎么修复的:在阶梯里把占位符单独摘出——rawAttach === INLINE_ORIGIN 直接判 spawn(与 BILI_PI_INLINE=0 同一套已验证的多进程姿态),不再走 attach;真·launcher 源走原逻辑逐字节不变。这是 layer-1(决策层)修复,必要且正确。
  5. 是否有回归问题:把 planNativePi 全部入参路径过一遍——kill-switch(BILLION_CONTEXT_PLUGIN=0/BILI_NATIVE_PI=0/BILI_PROVIDER_REWRITES)、显式内联开、真 launcher 源、无源默认内联(kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428)、无源显式关→spawn、显式 BILLION_CONTEXT_ATTACH——除占位符外全部返回不变,唯一变化就是占位符 attach→spawn。一个进程初始环境出现该占位符只有在其父跑内联时才成立,而显式内联的子进程会在到达这档前就 return,守卫不会误伤任何想要内联或真 attach 的进程;proxyEnvOrigin 会 trim+校验+去尾斜杠,继承值必然精确等于常量,比较稳健。layer-2 残留(不属本 PR):一次性子进程自起的 proxy 因继承了 INLINE_ORIGIN,命中 before_provider_headers 读 env 的竞态路径(src/agent/pi-native.ts:333,Native pi one-shot (-p): first request races the proxy bootstrap — x-bili-plugin never stamped, session binds anonymous wire mode #1243),把自己流量降级直连——所以当前这些子进程仍未被压缩,根治待 pi inline default: delegate subagent requests bypass compression (direct to upstream) | pi 内联默认模式(#5428): delegate 子代理请求绕过压缩直连上游 #5645 拍板后落同一分支。
  6. 是否破坏缓存:不涉及——只改子进程选哪种姿态,不动压缩/缓存/wire/消息身份。
  7. 是否改了设计方向:不涉及——落在既有姿态决策契约(opencode v2: preset BILLION_CONTEXT_PROXY disarms native routing while tools still find the proxy — all tool forwards 404 #886/[dsh] native proxyEnvOrigin() 把临时 origin 冻结进 BILLION_CONTEXT_PROXY,绕过 ensureProxyRunning() 的 instance 验活;工具调用全部 fetch failed,需重启宿主 #983/[pi] preset/inherited BILLION_CONTEXT_PROXY disarms the native intercept — all model traffic direct & uncompressed (self-triggering via the bootstrap's own export; #886/#983 not applied to the pi lane) #1795/移植 billion-context-pi 版本的非 server 模式 #3278/kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428)内,纯 fix + 文档。
  8. 是否引入新配置:无新增配置面。CONFIGURATION.md(en+zh)补的文档只引用既有开关(pi.inline/BILI_PI_INLINE)与既有 issue 号,没造新键——符合配置面纪律。

测试有效性:新增用例对「占位符→spawn」与「真源仍 attach」两个方向都断言(gate 双向纪律),回归时抓得住;CI @e19c736eb 镜像缓存 30 项全绿(0 failed / 0 pending)。e2e delegate 测试按 PR 说法「by design 保持红」(layer-2),且被 ACP_TEST_E2E_NATIVE=1 门控、常态 skip,不会拖红 CI。

一处非阻塞观察(不在本 PR 扩范围):planNativeOpencode(src/agent/opencode-native.ts:116-125)是同样的代码形状(同样没有占位符守卫,且 :421 也会在内联时写 BILLION_CONTEXT_PROXY=INLINE_ORIGIN)。但 opencode 内联是 opt-in(函数尾是 return spawn,没有 #5428 那种默认翻转),且 OpenCode 目前没有「每子代理独立进程」的路径,该场景在那边大概率不触发。建议若要加同款对称守卫,并入 #5645 的架构决策一起定,不在本 pi-scoped PR 里动。

透明披露(我的操作往返):review 过程中我先给两处文档各改一句(断言子进程「现在会被压缩」,commit c32d5c685 已推),随后经 e2e README + spawn 分支 #1243 竞态路径分析确认 layer-2 仍使子进程不被压缩——原措辞才对,于是回滚(commit 07e74c278)。分支相对 base 的净 diff 现已与原 PR 完全一致(4 文件 +44/-5),head 07e74c278 的内容树 == e19c736eb;历史多两个相互抵消的 commit(未 force-push),净效果为零,CI 会在等价树上复绿。

判定:可合(APPROVE)。 layer-1 方向对、外科手术式、无回归、无配置面扩张、文档到位;layer-2 残留按设计留待 #5645。

@ranxianglei
ranxianglei force-pushed the 2026-11-04_pi-inline-subagent-mitigation branch from 07e74c2 to 7a94f0b Compare November 4, 2026 17:25
…note (#5645)

The parenthetical asserted each inline engine flushes its sessions on clean exit, which this same PR's residual finding contradicts: the inline lane has no SIGTERM->flush equivalent, so a fast-exiting one-shot delegate child drops its final debounced write and its last folded state may never reach disk. Removing the clause keeps the config doc consistent with the PR body; the persistence question itself stays tracked on #5645.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Review verdict: APPROVE(代码层面可合) —— 以评论承载:PR 作者即当前凭据身份,GitHub 不允许自我 approve。

独立性声明:本轮针对新 head 7a94f0b23 独立重审,未照抄楼上前一版结论。关键变化:作者采纳了上一轮反馈后把修法从「占位符→硬 return spawn」改成「占位符折价后落回正常阶梯」(3e5b6e2e7),并干净地 rebase 到 origin/ci-fixes(合并提交 7a94f0b23,parent2=d7a1a915b)。我核对了两个 PR 自有 commit 的完整 patch、确认 ci-fixes 合并未改动本 PR 任何文件(git diff 0a0b2a5e0 7a94f0b23 -- <PR文件> 为空)、重读了更新后的 PR body 与文档、查了新 sha 的镜像缓存 CI。

八问

  1. 是什么问题:pi 车道自 kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428 默认内联;acp_delegate 用 {...process.env} 起独立子进程时把父进程内存里设的、无人监听的占位符 BILLION_CONTEXT_PROXY=INLINE_ORIGIN 继承进去,子进程 planNativePi 把它当活 attach 目标 attach 到死宿主 → 流量不压缩(oracle conv=null)。
  2. 什么原因导致的:姿态阶梯「有 proxy/attach env → attach」这档没区分真·launcher 活 proxy 与内联占位符;占位符只在起内联引擎的那个进程内有意义,跨不过进程边界。
  3. 影响范围与严重程度:命中「默认内联 + acp_delegate 独立子进程」拓扑的裸包原生 pi 用户;主会话不受影响。旧路径会兜底(attach 探不到→回退),故为局部功能异常(delegate 子不压缩、上下文无界增长),不是完全废。
  4. 怎么修复的:把继承的占位符折价(const attachOrigin = rawAttach === INLINE_ORIGIN ? undefined : rawAttach)后落回既有阶梯——子进程按 kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428 默认走 inline、各起一个进程内引擎(不起 server),从而被压缩。比我上轮审的 spawn 版更优:内联在进程内压缩、不走 proxy 路由,直接绕开了 layer-2 那条「racy 读 env」竞态缺陷(它只咬 proxy 路由的流量)。真·launcher 源不受影响仍 attach。
  5. 是否有回归问题:逐入参路径核对(kill-switch / 显式内联开 / 真 launcher 源 / 无源默认内联 / 显式关→spawn / 显式 attach)——除「唯一信号是继承占位符」外全部返回不变;而一个进程初始环境出现该占位符只有在其父跑内联时才成立,守卫不会误伤任何想内联或真 attach 的进程;proxyEnvOrigin/nativeAttachOrigin 归一化后与常量精确比较,稳健。ci-fixes 合并属 master-red 协调协议的例行动作、干净且未触碰本 PR 文件,非逻辑变更。layer-2 已随方案切换而消解。
  6. 是否破坏缓存:不涉及——只改子进程姿态决策,不动压缩/缓存/wire/消息身份。
  7. 是否改了设计方向:不涉及——落在既有姿态契约内,纯 fix+文档;「子进程各持引擎」复用已支持的多实例拓扑(A second process was detected writing to the same index.db — another process (pid 435075) is writing to the database in | 检测到第二个进程在写同一个 index.db 另一个进程(pid 435075)正在写入本会话目录的数据库——两个进程写同一个库会损坏数据(#3923/#3959)。请关闭多余实例:一个会话目录只能由一个实例服务。 #5082/The same sessionId is served by two bili processes simultaneously: interleaved logs from global + pi-native dual instanc | 同一 sessionId 被两个 bili 进程同时服务:全局 + pi-native 双实例日志交织、重复 cold-load(split-brain) #3923)。
  8. 是否引入新配置:无新增配置面;CONFIGURATION.md(en+zh)只补文档、引用既有开关与 issue 号。

测试有效性:单测覆盖三向且有牙(占位符→inline、占位符+fileInline:false→spawn、真源→attach),双向都断言;作者另述 e2e 实测 delegate 子产生 plugin-stamped 请求 + ACP 工具注入 + acp_status 经自身引擎执行。e2e-native-pi 按 ci-fixes 钉在 BILI_PI_INLINE=0(保 spawn 契约确定性),inline 姿态由本 PR 扩展的单测兜底——分工清晰。

已顺手修:CONFIGURATION.md / .zh-CN.md 里「…and each flushes its sessions on clean exit / …且各自在正常退出时 flush 自己的会话」一句,与本 PR 自己披露的残留发现(内联车道无 SIGTERM→flush 等价物、一次性子进程退出丢掉最后一次 debounced 写)直接矛盾——一次性 pi -p 的正常 exit(0) 恰恰就是那次写被丢的时刻,故此断言对本文描述的场景不成立。已删去该从句(保留「共享 state dir 并发引擎是受支持的」这点),使配置文档与 PR body 一致。commit 2e17a2447(净 diff 相对 base 仍是原 7 文件,两处文档各少一从句)。

一处残留发现(不在本 PR、已在 #5645 跟踪、需 owner 拍板):内联车道缺退出/回合末 flush——短命一次性 delegate 子进程退出时可能丢掉最后一次 debounced 会话写,其最后折叠态未必落盘;压缩本身工作(内存态已验证),只影响 ephemeral 子的磁盘持久化(很少被 resume)。我的判断:这是真实但窄面的数据持久化缺口,定级取决于这些子会话是否会被 resume(作者称罕见);若预期会被 resume 就加一个小的回合末 flush,否则接受+文档化即可。该取舍归 #5645,不阻塞本 PR——姿态修复交付的核心价值(delegate 子被压缩)独立成立,因此我不在本 PR 打 needs-decision 标签(那会错误地把一个可独立合入的修复标记成待决策阻塞)。

CI:@7a94f0b23 镜像缓存 0 failed / 18 pending(test 分片仍在排队;12 项 completed 均为默认 skip 的门控 e2e),mergeable_state=blocked 仅因检查在跑、无冲突(mergeable:true)。全量绿以 CI test 车道为准(§7.2),人工会合并前请等 test 分片转绿。

判定:APPROVE(代码层面可合)。 方向对、比上轮更优(内联绕开 layer-2)、无回归、无配置面扩张、文档到位并顺手消除了一处自相矛盾;残留持久化缺口留 #5645 拍板。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

复审确认(head 2e17a2447):本轮 head 与我上一轮推送的「文档一致性修正」commit 完全一致(git diff 2e17a2447..pr-head 为空,无人新增改动),代码层面无新增可审内容——上一轮针对 7a94f0b23(内联折价修法)+ 本次文档修正的完整八问审核继续有效,不重复贴。

CI(镜像缓存 @2e17a2447):0 failed;6 success、12 skipped(默认门控 e2e)、8 in-progress、4 queued——全量绿仍在跑,目前无任何失败项。mergeable_state=blocked 仅因检查未跑完、无冲突。

判定维持:APPROVE(代码层面可合)。 人工会合并前等 test 分片转绿即可(§7.2)。遗留的 inline 退出 flush 持久化缺口仍归 #5645 拍板,不阻塞本 PR。

# Conflicts:
#	CONFIGURATION.md
#	CONFIGURATION.zh-CN.md
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: opencode/vllm-qwen/qwen3.8-27b)

Merge conflict resolved. Merged origin/master (58a8796, branch was 758 commits behind base c9ba485) into 2026-11-04_pi-inline-subagent-mitigation, pushed 2e17a244..22e22d720a (normal push — fetched before pushing, no concurrent remote work found).

What conflicted and how it was resolved:

Verification on the merged head (full-suite verdict is CI's): npm run typecheck green, npm run build green (build-info commit=22e22d720a), targeted tests/pi-native.test.ts 20/20 pass.

Live status after push (verified via API GET, not memory): PR mergeable: true, state dirty → blocked — i.e. the conflict is gone; what remains is ordinary branch-protection gating (checks/review). CI is running on the new head: 0 failed, remainder queued/in-progress at last refresh. No behavior changes introduced by this run — pure conflict resolution, no semantic edits beyond re-placing the PR's own doc text.


八问(中文结构化结论)

  1. 是什么问题:PR 分支与 master 合并冲突(merge state dirty),挡住合并。冲突根因是 master 后来把 CONFIGURATION.md/CONFIGURATION.zh-CN.md 整体迁到 docs/(只留重定向占位),而本 PR 还在旧路径上加内容,同一片区域双方都改过。
  2. 什么原因导致的:文件级搬迁 vs 区域内插入的文本冲突——git 无法自动合并整个文件;src/agent/pi-native.ts 等其余改动落在不同区域,自动合并成功。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性;无运行时行为变化、不影响任何用户。
  4. 怎么修复的:把 master 合入 PR 分支;两个冲突文档采用 master 的重定向占位版本,并把 PR 的 pi inline default: delegate subagent requests bypass compression (direct to upstream) | pi 内联默认模式(#5428): delegate 子代理请求绕过压缩直连上游 #5645 段落逐字搬到新位置 docs/configuration.md / docs/configuration.zh-CN.md 的同锚点处;自动合并的 pi-native.ts 人工核对语义并集正确(PR 的 inline 占位 origin 修正与 master 的 [Feature] Declarable custom-wire model endpoints — route providers like commandcode's Go plan (/alpha/generate) into compression #1295 endpoints 并存)。
  5. 是否有回归问题:审了 diff 触碰的全部 7 个文件的既有行为——代码与测试文件的自动合并均保留双方语义(已读 diff 逐项确认),typecheck/build/定向测试全绿;未发现回归。高危模式(语义漂移、fail-fast 变吞错、阈值/时序/输出格式)逐项过:本 run 无任何此类变更。
  6. 是否破坏缓存:不涉及(未触碰缓存/重试/游标/去重相关路径)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及(纯冲突解决;PR 自带内容只是对既有行为的文档补充,未新增配置键)。

结论:冲突已解决并验证,merge state 由 dirty 转为 blocked(仅剩常规 checks/review 门禁),可进入正常审核流程。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: opencode/vllm-qwen/qwen3.8-27b)

No action needed this run — the reported blocker is stale. Verified against live sources in this run (not memory):

  • Merge state: GitHub API GET shows mergeable: true, mergeable_state: blocked — i.e. no conflict. The branch head is still my resolved merge commit 22e22d720a (pushed last run), and master has not moved since (58a87962). The "dirty" flag in the trigger predates/conflicts with the already-resolved state; re-fetching and re-checking both sides confirms a clean merge.
  • CI: mirror cache on head 22e22d720a — 30 checks: 0 failed, 0 pending; all test shards (ubuntu/windows × node 22/24), static-gates, mysql-contract, lock-sync and every gate are green.

So the PR is conflict-free and fully green; what remains under blocked is ordinary branch-protection gating (human review/approval before merge). No pushes, no code changes made this run.


八问(中文结构化结论)

  1. 是什么问题:系统转发称 PR 与 master 冲突(dirty)——经本轮实时核查为过期检测,实际无冲突。
  2. 什么原因导致的:触发数据滞后于上一轮已完成的冲突修复(合并提交 22e22d720a 已推、mergeable 计算收敛)。
  3. 影响范围与严重程度:无——分支状态与 CI 均健康,仅触发了一次空跑。
  4. 怎么修复的:本轮无需修复;动作仅为实时核验(fetch 双方分支 + API 查 mergeable + 镜像缓存查 check 状态)。
  5. 是否有回归问题:不涉及(未做任何改动)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

结论:PR #5655 当前无冲突、CI 全绿(30/30),处于正常待人工审核状态,本 run 无需任何操作。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] auto-fix stalled: test (windows-latest, 22, 1), test (ubuntu-latest, 24, 3), test (ubuntu-latest, 22, 2), test (ubuntu-latest, 22, 3), test (ubuntu-latest, 22, 1), test (windows-latest, 22, 2), test (windows-latest, 22, 4), test (ubuntu-latest, 24, 1), test (windows-latest, 22, 5), test (ubuntu-latest, 24, 2) — stopping for human review

1 similar comment
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] auto-fix stalled: test (windows-latest, 22, 1), test (ubuntu-latest, 24, 3), test (ubuntu-latest, 22, 2), test (ubuntu-latest, 22, 3), test (ubuntu-latest, 22, 1), test (windows-latest, 22, 2), test (windows-latest, 22, 4), test (ubuntu-latest, 24, 1), test (windows-latest, 22, 5), test (ubuntu-latest, 24, 2) — stopping for human review

@krius

krius commented Nov 16, 2026

Copy link
Copy Markdown

Additional impact datapoint: the inherited placeholder costs a fixed ~5 s on every child startup, not just "one doomed probe"

Confirming layer-1 from a real macOS/pi 1.5.2 host (billion-context 0.1.215). The PR body currently frames the cost as "one doomed health probe, one misleading ERROR line, then falls back to spawn". On my host the probe itself is cheap (290 ms) — the real cost is the evidence grace window that follows it.

Measurement

verifyAttachAndRecover(attachOrigin) → fetchProxyVersion("http://billion-context.inline") fails in ~290 ms → pinned = ... ?? await observeRoutedOrigin(state) (src/agent/pi-native.ts) spins for the full BILI_ATTACH_EVIDENCE_GRACE_MS default (5000 ms) waiting for routedOrigin that can never exist for a placeholder → only then does delete process.env.BILLION_CONTEXT_PROXY + bootstrap().

pi -p "hi" --no-session, 0.1.215, same model/network:

posture wall clock
inherited BILLION_CONTEXT_PROXY=http://billion-context.inline (today) 7.79 / 9.93 / 12.41 s
BILI_ATTACH_EVIDENCE_GRACE_MS=500 (same attach path, shorter wait) 2.75 / 2.81 / 2.69 s
BILI_PI_INLINE=1 (this PR's target posture: child boots its own in-process engine) 2.02 / 2.25 / 2.47 s
-ne baseline (no extension) 1.95 / 3.87 s

Scaling BILI_ATTACH_EVIDENCE_GRACE_MS on the inherited-placeholder path is linear and accounts for the whole gap: 500→3.29, 1000→3.70, 2000→4.54, 3000→5.30, 5000→7.07 s.

bili.log fingerprint, every single child start (occurred 178 times in my log):

17:46:30.958 [error] [native-client] bili-native(pi): attach target http://<private-host>/ is not healthy — falling back to a spawned proxy
17:46:30.986 [info]  bili: attaching to running proxy at http://127.0.0.1:18788 (pid 80479)

28 ms between the two lines — the 5 s is entirely before the first one, i.e. inside observeRoutedOrigin.

Provenance check, since the placeholder is easy to mistake for user configuration: the shell that launched the parent pi has no BILLION_* in its env (ps eww on the grandparent zsh is clean). The variable exists only because the inline parent set it in-memory ([inline] compression engine running in-process (http://billion-context.inline) — no proxy spawned), and acp_delegate children inherit it via {...process.env}. That is exactly this PR's layer-1.

Why this matters for prioritisation

#5645 is filed as a compression-correctness gap ("delegate children bypass compression"). On a host that spawns a child per delegation, this is also a uniform +5 s TTFB on every child, which is independently user-visible and trivially reproducible with time pi -p "hi". Worth stating in the PR body so the 5 s regression is covered by the fix rationale, not just the compression gap.

Small suggestion (optional, separate from this PR's fix)

Even with the placeholder discounted, observeRoutedOrigin has no way to know a target is structurally unreachable. A cheap guard — skip the grace window when the attach origin is INLINE_ORIGIN, or when the very first probe fails and the origin is a .inline sentinel — would keep the #1370 pinning guarantee for real origins while removing the dead 5 s for placeholders. Happy to file it separately if it belongs in a different lane.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #5655 审核结论(当前 head 22e22d720a)

冲突已由 ci-engineer 解决(并入 origin/master 58a87962)。我独立复核了冲突解决后的 head,而非仅采信解决报告:diff vs master 恰为 4 个 PR 自有文件(+43/-4),pi-native.ts 折价逻辑原样(:93-95)、测试原样(:173)、文档段落逐字迁到 docs/configuration.md(#5920 新布局)、根目录 CONFIGURATION*.md 为 master 重定向 stub,无意外改动。

(注:PR 作者即本 token 账号,GitHub 禁止自我审批,故以评论形式给出 APPROVE 结论。)

  1. 是什么问题:pi 车道默认内联(kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428)下,acp_delegate 子进程经 {...process.env} 继承父进程内存里的占位 origin(BILLION_CONTEXT_PROXY=INLINE_ORIGIN),被 planNativePi 误当真实 attach 目标 → 子进程 attach 到永不监听的伪宿主,模型流量直通不压缩(pi inline default: delegate subagent requests bypass compression (direct to upstream) | pi 内联默认模式(#5428): delegate 子代理请求绕过压缩直连上游 #5645 的 CI 症状:子请求无 x-bili-plugin 戳)。
  2. 什么原因导致的:planNativePi 把「进程初始 env 里出现的 INLINE_ORIGIN」误判为「宿主宣告的 attach 目标」。占位 origin 只对启动 in-process 引擎的那个进程有意义;它出现在子进程初始 env 里,恰恰说明该进程是内联父进程的子进程——正确姿态是子进程自起引擎,而非 attach。
  3. 影响范围与严重程度:受影响宿主 = 裸装 package-native pi + pi-subagents、且未显式 BILI_PI_INLINE=0、也未用 bili pi 启动的用户(kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428 默认内联路径)。触发条件 = 发生 acp_delegate 委派。严重度 = 能用但功能受损(子会话不压缩、上下文只增、token 超耗;主会话不受影响)→ p2(非「完全不能用」,但有明确成本/体验问题、需绕行)。
  4. 怎么修复的:在 planNativePi 对占位 origin 折价——rawAttach === INLINE_ORIGIN 时视为 undefined,落回既有阶梯;子进程按 kernel authorization request: release v0.1.211 bundles kernel 0.0.176 (#5415 abort-absorb nudge debt) #5428 默认走 inline、各起进程内引擎(不起 server),从而被压缩。真实 launcher origin(bili pi 的活 proxy)不受影响、仍优先于默认。
  5. 是否有回归问题:审过既有行为——① 真实 origin 的 attach 路径保持(测试断言 real-origin→attach);② bili pi launcher proxy 保持(真实 origin ≠ 占位符,仍 attach);③ 显式 BILI_PI_INLINE=0/pi.inline:false 的 spawn 姿态保持(落回 :102);④ 本 PR 只改「占位符」这一个输入,不碰任何真实 origin 判定,无阈值/时序/输出格式漂移。回归判定基于代码走查 + CI 绿(未本地跑全量,CI 为准)。
  6. 是否破坏缓存:不涉及(姿态判定,不触碰 prefix-cache/重试/增量游标/去重键)。
  7. 是否改了设计方向:不涉及(沿用「每进程一个引擎」多实例拓扑 A second process was detected writing to the same index.db — another process (pid 435075) is writing to the database in | 检测到第二个进程在写同一个 index.db 另一个进程(pid 435075)正在写入本会话目录的数据库——两个进程写同一个库会损坏数据(#3923/#3959)。请关闭多余实例:一个会话目录只能由一个实例服务。 #5082/The same sessionId is served by two bili processes simultaneously: interleaved logs from global + pi-native dual instanc | 同一 sessionId 被两个 bili 进程同时服务:全局 + pi-native 双实例日志交织、重复 cold-load(split-brain) #3923,无新边界/数据流)。
  8. 是否引入了新的配置:不涉及(无新 env/config/默认值,BILI_PI_INLINE/pi.inline 语义不变)。

CI @22e22d720a:30 项 0 failed / 0 pending,全绿(windows/ubuntu × node 22/24 test 分片全 success;static-gates/mysql-contract/gate/lock-sync success;gated e2e 按门跳过)。2026-11-10 的「auto-fix stalled / 需 owner 决策」为瞬时态,现已转绿。

判定:APPROVE(可合)。 冲突解决干净、修复完整、CI 全绿、无回归。残留项(内联车道短命进程可能丢最后一次折叠状态落盘)与本次改动无关(本 PR 不触碰 inline-engine),已在 #5645 跟踪,不阻塞本 PR。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Thanks @krius — well-measured datapoint, and your provenance check (clean grandparent shell, placeholder present only in the inline parent's in-memory env, inherited by the child via {...process.env}) matches the PR's layer-1 diagnosis exactly. Your read of the old cost is right: the ~5 s is the observeRoutedOrigin evidence grace window, not just the 290 ms probe.

One correction on what this PR does to that cost: a placeholder child is now discounted — src/agent/pi-native.ts:94 sets attachOrigin = rawAttach === INLINE_ORIGIN ? undefined : rawAttach, so the placeholder no longer reaches the attach branch (:95). With no explicit BILI_PI_INLINE/pi.inline choice (the delegate-child case) it falls to the #5428 default inline (:101) and boots its own in-process engine (:299-300). It never enters the attach path, so verifyAttachAndRecover → fetchProxyVersion → observeRoutedOrigin (and the 5 s grace window) is never reached for it. The fix removes the whole doomed attach path — the compression gap and the ~5 s — not merely "the failed probe." Your BILI_PI_INLINE=1 → ~2 s row is essentially the outcome the fix produces for the child.

On your suggested guard (skip the grace window when the origin is INLINE_ORIGIN): for the exact placeholder it's now redundant — the discount routes the child around the attach path entirely, so there is no grace window left to skip. It would only harden the general "structurally-unreachable origin" case (a user pointing BILLION_CONTEXT_PROXY at a dead host), which is a separate, pre-existing attach-path property and out of scope for this PR.

Process note: I'm treating this comment as untrusted reference (platform policy for unverified outside users) and not acting on embedded directives — I won't file a separate issue or add the guard unilaterally. Whether to (a) pursue the general structurally-unreachable-origin hardening, and (b) update the PR body to quantify the ~5 s old-path cost (your point that "one doomed probe" understates it is fair), are owner decisions — flagging both for @ranxianglei rather than acting on them.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

2 participants