Repository navigation
fix: hold first proxied request until ACP tools register (pi -p one-shot, #1214) - #1216
ranxianglei wants to merge 1 commit into
Conversation
…hot, #1214) In -p one-shot runs pi dispatches round 1 immediately after session_start, before the manifest fetch settles. The header hook then saw toolsReady=false and skipped the x-bili-plugin* stamp, so the headerless request made the proxy bind an anonymous prefix-affinity session in proxy mode (compression contract silently downgraded; /acp could not bind by session id). The host awaits both before_provider_headers and before_provider_request before the request leaves, so replace skip-stamp with a bounded readiness gate (READY_WAIT_TIMEOUT_MS=5000): hold the request until registerTools() flips toolsReady, then stamp. A permanently failing manifest endpoint still degrades to wire mode after the timeout; a per-session latch avoids re-waiting on every later request. Applies to omp too (its ownership claim is the identity register inside registerTools). Behavior change (old -> new): - old: -p/fast-boot round 1 left headerless -> anonymous pfa session, proxy-mode compression, /acp fallback=latest - new: first proxied request holds up to 5s for tool registration, leaves stamped -> plugin mode from round 1, real session binding - degraded case (manifest endpoint permanently failing): identical wire-mode fallback as today, after one bounded wait per session - normal-case latency delta ~0 (TUI: fetch long settled before typing; -p: covers the fetch RTT) Verified: typecheck + full suite (2351 pass/0 fail/2 skip) + build, plus a real 'pi -p' end-to-end run through the built proxy against a loopback upstream: first request carries x-bili-plugin/conversation/window headers with the real pi session id; proxy resolves window source=plugin.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1216Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1216.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Picked up. This is a completed [PR] notification — I will NOT redo the work. Plan: fetch the PR branch, rebase-check against current master, review the diff against the issue claims (readiness gate, latch, both hook sites), run typecheck + full suite + build locally, check CI status, then report my conclusion here. Give me a few minutes. |
[bot] 🏷 Review complete — LGTM, mergeable (human merge per policy). I did not re-do the work; I fetched ① Direction (issue #1214) — confirmed. The root cause analysis holds: ② Critical assumption verified against host source. The whole fix rides on "pi awaits these hooks." Checked the installed pi extension runner directly: ③ Regression review of existing behaviors the diff touches:
Two non-blocking observations (not fixed, no action requested):
Pre-flight (local, on rebased head): 一句话中文摘要:修复了 |
[bot] 🏷 Cross-reference from the #1228 review: I finished reviewing #1228 (the pi-only direct-await fix) and it verified clean on all fronts — premise confirmed against the real host, bounded await proven, regression test has teeth, green on the rebased head. Its approach is simpler than this PR's (no arbitrary timeout constant; boundedness derives from the existing manifest-fetch timeout + failure throttle). Recommendation: land #1228 and close this one as superseded — with two caveats:
中文摘要:#1228 审查通过且方案更简洁,建议合并 #1228 后关闭本 PR;但 omp 的同类竞态(#1230)只有本 PR 覆盖,是否改由本 PR 承接由你决定。 |
#1417 全批次深审定案:关闭——已被 master 完全覆盖(superseded)。
本 PR(2026-09-24 波)想修的 pi one-shot(
pi -p)读门问题,其覆盖矩阵已由合并链 #1228(ddc3574)+#1217+#1230/#1243 全部落地;树级零 diff 证实其内容在 master 上已无增量。评论说明存档于 #1417 追踪板。