Repository navigation
[PR] pi lane: show a labeled effective-context line in the keyed footer status slot - #4621
ranxianglei wants to merge 9 commits into
Conversation
…ter status slot (#3912) pi's native footer percent comes from pi's own projection estimator: once a failed attempt's recovery omission lands after the last provider-usage anchor, pi falls back to a chars/4 count over its FULL local history (which bili keeps unfolded on purpose), so a healthy folded session can read 500%+ while the effective request is ~20% of the window. The pi lane now renders the proxy's effective-request observation into pi's keyed status slot (additive - never replaces the native footer): grade label (usage = provider-measured / est = calibrated estimate of the current payload), staleness marker, and an explicit reconciliation note when pi's own estimate diverges >= 25 points. Refreshed on turn_end / agent_settled / after_provider_response (throttled 2s, fire-and-forget), force-refreshed on session_start (any reason), cleared on session_tree / session_shutdown. An unknown session clears the line instead of keeping previous numbers. Pi lane only; no config surface, no wire changes.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.6169-pr.4621.213bc27This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4621.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本 PR 就是 #3912 的交付物(Closes #3912),不是重复立项。相关条目核对:#1927(dashboard 方案 PR,已被 10-24 清理批次关闭,误关机制另在 #4613 跟踪)——本 PR 明确不搭它的车,走的是独立的 pi-only 最小行方案;#2855(已关闭文档 PR,范围不同)。open/closed 检索无其他同症状同机制条目。 标签: 身份与流程说明(先说清楚): 这个 PR 是上一个 ework-daemon 会话按 #3912 floor 8 自己推荐的「选项 2」实现的——但 floor 8 结尾是「等你拍板」,线程里没有你的明确选择,floor 9 就直接开工提了 PR。这违反了功能类「多方案须 owner 拍板后才实现」的顺序。缓解因素:方案与 issue 报告者自己提出的修复 A 一致、改动小且纯增量、合并权在你手里。本轮审核按独立审核做(重新读 diff、对照真实 pi 类型验证 API 声明、本地定向验证、查 CI),结论见后续八问回复;如果你认为选项本身不该选 2,这个 PR 可以直接打回,成本很低。 当前状态(进行中):
完整八问结论稍后补一条。 |
(ai: vllm-qwen/qwen3.8-27b) 独立审核完成(未复用 issue 侧结论:重读了全量 diff、对照本机 pi 0.83.6 的 dist 类型与实现逐条验证 API 声明、本地定向跑测试、查了 CI 与在途 PR)。八问如下。 1. 是什么问题:pi 原生 footer 在一次失败请求触发恢复性省略后,显示的是 PI 自己对本地完整原始历史的投影估计(chars/4,复现读 562.8%/窗),而 bili 实际发出的有效请求只有 ~20%——两个数字都「没错」但量的是不同东西,界面上并排出现却无任何解释(#3912)。 2. 什么原因导致的:根因在 pi 上游—— 3. 影响范围与严重程度:仅 pi 车道用户;纯信息展示问题——footer 出现误导性高百分比但无标注。无可用性、计量、成本、压缩行为影响。p3。 4. 怎么修复的:在 pi 的 keyed status 槽位( 5. 是否有回归问题:未发现回归。逐项清点触碰路径的既有行为:
6. 是否破坏缓存:不涉及——请求内容、前缀、缓存键、重试/游标逻辑零改动。 7. 是否改了设计方向:没有。现有插件架构内的展示面增量,数据流仍走既有的 8. 是否引入新配置:没有。无 env、无 config 字段、无 CLI flag(config-surface-guard 绿)。 测试有效性(质量关):17 个测试是真测试——精确字符串断言钉住每个门的双向行为(等级标签两向、陈旧三档、25 点阈值含/不含边界、零/负/NaN token 与缺失 source 的诚实性);wiring 用真实 mock HTTP 端点跑生命周期(节流双向断言:连发事件不重取 + 强刷绕过;未知会话清行;宿主缺 setStatus/proxy 不可达时静默降级)。唯一小缺口:5min/60min 精确边界值未钉(逻辑是简单 CI 状态:head 流程事项(需要你拍板):如首条回复所述,上一会话在你要拍板选项时未等到选择就按自推方案实现了。代码本身我审下来是干净闭环,但选项合法性归你:A 追认选项 2、等 #4606 后看 CI 全绿即合;B 改道(比如并入 dashboard 路线)则此 PR 直接关,成本极低。合并权在你:#4621 |
(ai: vllm-qwen/qwen3.8-27b) CI 修复完成(auto-fix lane attempt 1/2):本 PR 唯一红条 八问
结论:分支侧修复完成并已推送( |
(ai: vllm-qwen/qwen3.8-27b) CI 判定(auto-fix lane attempt 2/2):11 条红全部是继承性失败,分支侧不再改动 失败的 11 个 check 全部是 跑测试前的自检直接退出,零真实测试运行、零真实测试失败。同一 run(run 40141157076)其余 15 个 check 全绿——包括 八问
结论:本 PR 的 11 条红全部继承,分支侧无可再修——唯一转绿路径是合并 #4606(哨兵 22:58Z 已确认:14 个 test 分片全在 required checks 里,当前没有任何 PR 能走正常按钮合并,需 owner admin override 解锁,详见 #4599 floor 57 的决策请求)。#4606 合入后本分支 rebase/重触发即全绿(rebase 时丢弃 attempt 1 的重复去导出 commit)。 |
master window commits 293ae65/de5e03659 bumped kernel/package.json to 0.0.165 without regenerating the lockfiles; lock-sync re-resolution then rewrites the stale recorded versions (root 0.0.163, kernel 0.0.164) and fails. Pure recorded-version sync via npm install --package-lock-only; no dependency or semantic change.
Closes #3912
What / why
After a failed attempt's recovery omission, pi's native footer shows PI'S OWN raw-history projection estimate (chars/4 over the FULL unfolded local history — the #3912 repro reads 562.8% of the window) while the effective request bili sends is ~20%. bili keeps pi's local history unfolded on purpose (the wire carries the folded view; the disk copy stays raw for decompress fidelity), so the two numbers are measuring different things and neither is "wrong" — they just coexist with no explanation.
This PR gives the pi lane a persistent, labeled line for the PROXY's effective-request observation, rendered into pi's keyed status slot (
ctx.ui.setStatus("billion-context", …)). Example from the repro shape:Behavior change disclosure
/acpcommand output). The native footer itself is untouched (setFooteris never called) and other extensions' slots are untouched./__bili/plugin/status:contextTokens/contextTokensSource/contextTokensAt/contextLimit) plus pi's own read-onlygetContextUsage()for the reconciliation note.agent === "pi"gate); omp/dsh/opencode and all other lanes unchanged.Semantics (per the issue's acceptance criteria)
usage= provider-measured input of the last settled request;est= bili's calibrated estimate of the current payload — what a FAILED request leaves behind (stamped fresh at prepare time, so failures never freeze the value at zero and real growth is tracked until the next settlement).· Nm; ≥60 min· stale.· host est N.N%; below that the numbers agree closely enough to stay quiet.turn_end/agent_settled/after_provider_response(throttled 2 s, fire-and-forget — never blocks the host event loop);session_start(any reason) force-refreshes; generation counter prevents out-of-order writes from overlapping fetches.Config surface
None. No new env var, config field, or CLI flag.
Tests
tests/issue3912-pi-context-line.test.ts(17 tests): renderer semantics — both directions of the grade labels, staleness tiers, divergence threshold at/below/above, honesty on missing/unavailable data — plus the wiring lifecycle against a live mock status endpoint: throttle (both directions), force-refresh bypass, no-cross-session-bleed clear, and silent degradation when the host lacksui.setStatusor no proxy base resolves. Local verification: typecheck clean, 17/17 new tests + adjacentcreateBiliPluginsuites (incremental-ack-pull,pi-omp-fork-adopt, 25 tests) green; full-suite verdict left to CI.Upstream root fix (out of scope here)
The number's producer is pi's estimator (
estimateProjectedContextTokensinvalidates the usage anchor after ANY recovery omission). A proper upstream contract (sourced/freshness-scoped effective context shared by the footer and core budget checks) lives in the pi repo and needs an owner-approved cross-repo submission per policy — it is documented in #3912 and deliberately not filed/submitted from this PR.