Repository navigation
[PR] fix: pi /tree recovery respects deliberately-off bili tools — pi-loadout selections survive navigation - #4996
ranxianglei wants to merge 7 commits into
Conversation
The #3542 session_tree re-assert treated every registered-but-inactive bili tool as rewind-dropped and re-activated it. An external loadout manager (pi-loadout) or a manual toggle may keep a registered tool deliberately off; when its session_tree handler ran before bili's, the off selection was resurrected on every navigation (order-dependent). Recovery is now judged against the pre-navigation loadout observed on session_before_tree (pi fires it inside navigateTree before the leaf switch and the _restoreToolsFromTranscript reset), with per-request sampling as fallback for hosts without the event. Only tools that were active before the navigation and are gone after it are recovered; a never-sampled host keeps the original all-registered recovery. Additive-only setter semantics unchanged; no new config surface.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7143-pr.4996.537bc46This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4996.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 全仓 open/closed 检索无其他同修条目。相关历史:#3542(本 PR 收窄的那个 tree 恢复机制,已关)、#3545(已关)、上游 earendil-works/pi#11075(loadout reset 根因,外部项目)。本 PR 是 #4988 唯一的仓内修复。 标签: bug / pi / scope/wiring / p2(pi 车道协议接线缺陷,有绕行、不毁体验——与原始 issue #4988 定级一致)。 开始独立 review(方向/回归/代码/测试有效性/diff 整洁度逐项过)。分支落后 master 140 commits,按 3 楼 merge-guard 通知由专职守卫处理 rebase,本审核不重复操作。结论稍后按八问体例给出。 |
(ai: vllm-qwen/qwen3.8-27b) PR #4996 review 结论(独立复审,未沿用 #4988 作者侧结论): ① 方向关:方向正确。根因独立定位与 PR 描述一致——#3542 的恢复判据是「已注册 vs 当前活跃」对比,隐含假设「注册了的 bili 工具不活跃 = 被 rewind 重置丢了」;当外部 loadout manager(pi-loadout)或手动切换刻意保持 off 时该假设不成立。修法打在判据本身(补「导航前状态」证据),不是症状层拦截,属根治。重置机制本体在 pi core(上游 earendil-works/pi#11075),不在本仓范围,本 PR 只收窄自家补偿面——边界处理正确。 ② 回归关(触碰路径既有行为逐项清点):
③ 代码关:diff 通读完毕(仅 2 文件:src/agent/pi.ts +~47/−3、tests/plugin-agent.test.ts +102)+ 周边上下文。 ④ 测试有效性:不是假测试。harness 的 独立验证记录(不信 PR 正文与作者侧评论,全部自行复核):
结构化八问:
判定:代码层面通过审查,无需修改。合并前置条件:等 merge-guard 完成 rebase 到最新 master、新 head 上全套 CI 绿(当前 0 failed 但 15 pending,且跑的是旧基线结果)。声明的行为变更(旧:任何注册但非活跃的都复活 → 新:只恢复导航前活跃的)已在 PR 正文披露,与我的独立判断一致。 |
(ai: vllm-qwen/qwen3.8-27b) |
|
感谢修复和审查。请继续推进 #4996 合并;这个修复针对 我核查时,最新 head 另外,现有模拟测试未覆盖源分支与目标分支工具选择不同的情况:若源分支启用某工具、目标分支关闭它,bili 在 pi-loadout 之后执行时,可能依据导航前状态重新启用它。请评估这个场景是否符合预期或需要补测。启动时异步注册的竞态也是独立问题,不应视作已由本 PR 修复。 |
…er orders When source and target branches carry different tool selections (active on source, deliberately off on target), bili's local view cannot distinguish a rewind drop from the manager's deliberate off — the outcome is order-dependent. Add two pinned rows (bili-last resurrects / manager-last keeps the target selection) and correct the reassertLoadoutAfterTree doc, which overstated 'survives in either handler order'.
[bot] (ai: vllm-qwen/qwen3.8-27b) 进度汇报(进程曾被强制重启,先交代状态): CI 红的根因已定位并修复。不是测试失败——11 个分片在测试运行前就死了:分支最后一次同步的 master(b08fbf361)之后,#4982 的进程派生套件 已推送 ad53201(PR 分支
本地定向验证:typecheck ✅ build ✅ plugin-agent 81/81 ✅。启动时异步注册竞态不由本 PR 修复——#4988 下已有独立调查结论(缺陷在 pi-loadout 的选择模型),跟踪在那条,不重复立项。 CI 正在新 head 上重跑(static-gates/build/gate/mysql-contract 已过,11 个测试分片运行中),全绿后我发八问收尾。 |
[bot] (ai: vllm-qwen/qwen3.8-27b) CI 已全绿:新 head 结构化八问:
启动时异步注册竞态:确认不由本 PR 修复,保持独立跟踪——#4988 下已有独立调查结论(pi-loadout 0.0.38 的选择模型只记正向条目、无显式 off 的 pending,缺陷在其存储模型,属外部项目,未经批准不向其提交)。不重复立项。 收工判定:修复方向经你确认、CI 全量绿、场景评估闭环(钉住而非掩盖)、竞态归属明确——就绪,等人工合并:#4996 |
[bot] (ai: vllm-qwen/qwen3.8-27b) 新 head 结构化八问:
rerun 结果出来我补终报。 |
Closes #4988
What
The #3542
session_treere-assert treated every registered-but-inactive bili tool as rewind-dropped and re-activated it. An external loadout manager (pi-loadout) or a manual toggle may keep a registered tool deliberately off; when pi-loadout's ownsession_treehandler ran before bili's, the off selection was resurrected on every tree navigation — order-dependent, exactly the repro in the issue.Fix
Recovery is now judged against the pre-navigation loadout:
sampleActiveBili()records which registered bili tools are currently active;session_before_tree— pi fires that event insidenavigateTree()BEFORE the leaf switch and the_restoreToolsFromTranscript()reset (verified against pi-coding-agent 0.83.0 and 1.4.0 source), so the sample IS the pre-navigation loadout;reassertLoadoutAfterTreenow recovers only tools that were active before the navigation and are gone after it. A never-sampled host keeps the original all-registered recovery (pi-native: /tree rewind resets the active tool loadout from the transcript, so bili tools become registered-but-inactive ("Tool compress not found") and the #2708 self-heal cannot see it #3542 behavior preserved on hypothetical old hosts).Consequence: the deliberate off survives in both handler orders — if pi-loadout restores its selection first, bili sees it standing and makes no setter call; if bili runs first, it re-adds only previously-active tools and pi-loadout's later re-application still stands.
Behavior change (intended)
session_treetime was re-activated — including ones the user or another extension had deliberately turned off.Tests (
tests/plugin-agent.test.ts, +4, all green locally, full suite on CI)All five pre-existing #3542 cases stay green (they fire
session_treewithoutsession_before_tree→ legacy fallback path).Boundary notes
/treedeactivates registered tools that the rewound branch never declared; reload() re-activates them earendil-works/pi#11075); this PR only narrows the in-scope compensation so it stops fighting external loadout managers.