Repository navigation
[PR] fix: cap ineffective pi tool re-registration with verify + backoff (#6080) - #6107
ranxianglei wants to merge 5 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10670-pr.6107.37241f1This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6107.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — searched mirror + upstream for 标签: Review in progress: fetched head |
(ai: vllm/qwen3.8-27b) 结论先行:CI 已转绿。本次是 Windows 负载下的瞬时抖动(flake),重跑即绿,未改动任何代码,diff 保持干净。 查重: 不重复 —— 这是既有 PR 的 CI 红灯自动修复车道,非新缺陷报告;按政策未为本次抖动单独立项。 结构化七问:
收工判定:CI 已绿,PR 可进入人工评审/合并(合并权在 owner,我不代合)。若此类 windows 负载抖动复发,建议归入 CI 总控 #4599 跟踪——其中 wire-exit-matrix 的 socket-teardown 字面量目前不在 #4161 自动重试分类器内,可考虑补一条;本次不另立 issue。 |
(ai: vllm-qwen/qwen3.8-27b) Review complete — verdict: ready to merge; the merge itself stays human. What I did and verified live (tools, not memory):
CI state (live-verified via mirror cache + single API pulls):
Code review (direction → regression → code → tests → diff):
结构化八问(PR #6107):
判定: 方向正确、代码与测试扎实、head 上 CI 全绿(含 flake 重跑确认)——可合。合并动作留给人工: #6107 |
The #2708 self-heal re-registered dropped bili tools on every detection, with no effectiveness check and no backoff. When the host's registry no longer reads our instance map (pi runner/instance generation drift after a mid-session mode switch/reload), it churned forever: paired dropped->re-registering warns on every turn for 82 minutes (544 lines), and each re-register synchronously rebuilds the host's whole registry + active loadout mid-turn-prep, which left the host's hiddenDeclarations stale (#6080 anomaly B). reassertDroppedTools now verifies its own effect: a transient drop still heals in the detecting turn (behavior unchanged since #2708); an ineffective attempt logs one distinct diagnostic and enters a 10-minute backoff during which probes continue but no further registerTool churn happens; a fresh registration or a tree navigation clears the backoff. Behavior change: old = re-register on every detection (unbounded per-turn in a broken state); new = immediate first attempt, then at most one attempt per 10 min until effective or scenario change.
84530b2 to
afa0271
Compare
(ai: vllm-qwen/qwen3.8-27b) 本轮处理 PR #6107 与 master 的合并冲突(merge state: dirty),已完成 rebase 并推回,冲突解除。 结构化八问
结论:冲突已解决,PR 现 mergeable=True(mergeable_state=blocked 仅因新 head 的完整 CI 仍在跑)。rebase 后 head |
[ework] CI fix verified green ✓ |
(ai: vllm-qwen/qwen3.8-27b) Re-verified the live check state first: head
Confirmed Action this run:
PR now: head 八问
判定: 4 个红 check 的根因(master 级继承失败)已消除,最终 head |
(ai: vllm-qwen/qwen3.8-27b) This event is a stale re-delivery — it references head Live state (mirror cache, fresh this run): head Nothing left to fix this run — the reported failures are already addressed and the authoritative CI pass on |
A loaded runner can drift a real sleep(80) past (or short of) the 40ms backoff window, so the suppressed / burst-after-expiry assertions flake (windows 22,3: expected 6, actual 8). Freeze Date.now() and advance it explicitly instead of relying on real-time margins.
(ai: vllm-qwen/qwen3.8-27b) Re-verified live: head Diagnosis: the failing test is this PR's own Fix (test-only, no production code change): drive the clock explicitly — freeze Verified locally: typecheck clean; full Pushed 八问
判定: 唯一红 check 的根因(本 PR 测试的真实时钟 flake)已消除,最终 head |
…sh sid) The Fix section claims a fresh registration (new sid) or a tree navigation clears the reassert backoff so a new episode heals immediately, but no test exercised either clear path. Add one test per path: - a /tree rewind (session_tree) clears the backoff — a new attempt fires immediately on the next turn instead of waiting out the window; - a fresh registration for a new sid clears the backoff — a later drop on the new sid heals immediately. Both reuse the existing makeDroppingRegister / frozen-clock harness.
APPROVE The fix is correct and well-tested. The core logic — verify effect after re-register; ineffective → one diagnostic + 10 min backoff (probes continue, no registerTool churn); window expiry → exactly one more attempt — is sound, and the three core scenarios are covered by deterministic clock-pinned tests. The two backoff-clear paths (fresh-sid, session_tree) were claimed in the Fix section but had no test. I added one test per path on this branch (commit 4920ab6) — both reuse the existing makeDroppingRegister / frozen-clock harness and pass. Behavior drift (intended, disclosed in the PR): before, an ineffective re-registration churned on every per-turn hook (paired warns + a synchronous full-registry rebuild mid-turn-prep). Now it backs off for 10 min (REASSERT_BACKOFF_MS default). Probes continue, so a host that starts accepting registrations still heals on the next turn. This is an availability-over-churn tradeoff, not a regression. Scope: src/agent/pi.ts + tests only. No kernel/ changes, no new config/env surface (the backoff is injectable via the existing createBiliPlugin opts channel). Follows house conventions. 八问
判定:可合(APPROVE)。 |
[bot] 🏷 Review complete — verdict: APPROVE / 可合 (full review above, floor 27; receipt for the on-the-spot fix, floor 28). What I did and the outcome:
Final verdict: 可合 (APPROVE) — merge stays human-only. #6107 |
Union of master's nudgeNotifyText function (above the signature) and the PR's reassertBackoffMs? opts. Verified: typecheck clean, plugin-agent 81/81, nudge-debug 8/8, build clean.
(ai: vllm-qwen/qwen3.8-27b) Re-verified live: the PR was dirty (conflict with base). The remote head had moved to What I did:
The PR's production change (src/agent/pi.ts backoff logic) and the other agent's test commit are both preserved; only the signature-region conflict was resolved. 八问
判定: 合并冲突已解决并推送最终 head |
[ework] CI fix verified green ✓ |
[bot] 🏷 Re-review of new head The head moved from Verified on the new head:
No 八问(中文):
最终判定:可合(APPROVE)——合并仍由人执行。#6107 |
Problem
Long-lived pi sessions (pi 1.5.0 + bili 0.1.213, ~8h with a codemode default→only switch + reload) showed two correlated anomalies that both vanished on pi restart:
dropped from the host registry — re-registering (#2708)warns on every turn (544 lines over 82 min) — the self-heal never converged.hiddenDeclarationscomputed stale (fresh SDK probe = 24 hidden vs live session = 13), leaking 14+ direct tool declarations into requests.The reporter's ACP_DUMP_BODY comparison (INCOMING vs REQ tools byte-identical) exonerated the forwarding path: B happens inside the pi process's loadout computation, and both anomalies rose and fell together with the re-register churn.
Root cause
reassertDroppedTools(src/agent/pi.ts) re-registered on every detection with no effectiveness check and no backoff. It is called from two independent per-turn hooks (before_agent_start+before_provider_headers) — the source of the paired warns. When the host's registry no longer reads our instance map (pi runner/instance generation drift after a mid-session mode switch/reload; the exact pi-side drop source is outside this repo), every attempt landed in a dead map and the loop churned forever. EachregisterToolsynchronously triggers a full_refreshToolRegistry()→ active-set recompute + system-prompt rebuild +prepareLoadouthook execution in pi 1.5.0 — up to 12 such rebuilds per broken turn injected mid-turn-prep. That is the perturbation surface behind anomaly B.Fix
reassertDroppedToolsnow verifies its own effect:re-registration did not take effect … backing off 10 min), then a backoff window during which probes continue (cheap, so a natural heal is picked up next turn) but no further registerTool churn;Backoff default 10 min, injectable via the existing
createBiliPlugin(..., opts)channel for tests (no new config/env surface).Behavior change (disclosed)
Old = re-register on every detection (unbounded per-turn in a broken state). New = immediate first attempt, then at most one attempt per 10 min until effective or scenario change. In the healthy case nothing changes (first attempt sticks, backoff never engages); in the broken case churn drops from ~2×6 registerTool calls per turn to ≤1×6 per 10 min, removing the loadout-perturbation source of anomaly B.
Tests
Targeted (tests/plugin-agent.test.ts, same fake-pi harness as the #2708 suite):
All four existing #2708 tests stay green (transient heal unchanged). Full-suite verdict comes from CI on this head.
Note: if anomaly B persists in a session where NO dropped/re-register events fire at all, that residual would be a pure pi-side bug to report upstream — this PR removes the bili-side perturbation source.
Closes #6080