Repository navigation
[PR] fix(pi): negotiate full Anthropic requests for bili - #6797
shreynshah wants to merge 2 commits into
Conversation
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Duplicate screening: not a duplicate — no other open PR/issue targets the Pi native-thread continuation 429 mechanism (checked open [PR] rows; #6796 is the source issue this PR fixes). Review of #6797 — I read the full diff (11 files, +182/−6) against master Root cause assessment: the fix removes the producer, not the symptom — Pi's native-thread continuation fingerprints the payload before bili's transport rewrite, so a continuation's system/history diverges from what bili actually sends; disabling One finding, fixed in passing (commit Behavior change (disclosed): for Anthropic Messages models actually routed through bili, Pi's native message threads go ON (host default) → OFF for the session. Intended trade — bili's full-request compression pipeline is preserved; native-thread transport savings are not claimed. Unrouted/virtual/other-API models, OMP's negotiation, and older hosts without Regression inventory (existing behaviors on touched paths): OMP Docs: architecture hub row, lanes pages (en+zh), SVG+PNG diagram, and CI: at review time the original head's shards were green/in-progress in the mirror cache; the fix commit Verdict: correct root-cause fix, valid tests, clean diff, docs in sync. The one defensive finding is fixed on the branch. Ready to merge once CI is green on 八问(结构化审核结论)
审核中顺手修复(commit 判定:根因修复正确、测试有效、diff 干净、文档同步;唯一防御性发现已在分支上修复。CI 在 |
15d1f6a to
9682705
Compare
Fixes ranxianglei#6796. Preserve bili compression by disabling incompatible native thread deltas through Pi session-local model compatibility.
…otiation The session_start and model_select handlers are fire-and-forget, so a throwing pi.setModel propagated as an unhandled promise rejection that could crash the host process. Catch and log it, matching the OMP repin convention; the before_agent_start call site keeps its own guard as defense in depth. Update the reject-case test to assert the error is handled instead of propagated.
9682705 to
5cac542
Compare
|
(ai: openai-codex/gpt-6.1-sol) @ranxianglei Thanks for reviewing and adding the defensive If you'd prefer to take over the remaining integration/merge steps, please feel free to amend this PR (maintainer edits are enabled), cherry-pick the change, or carry it forward in your own PR. #6796 contains the reproduction and causal A/B evidence, and this PR records the isolated live validation and compatibility trade-off. Happy with whichever ownership path is easiest for you. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Thanks for the note. A few things to clarify: Attribution: the review and the defensive Your amend/force-push: the head moved to On Current CI state (verified live on head On ownership: no takeover needed. The fix is in place and the enabled checks are green; the only remaining step is the |
Fixes #6796.
Why
Pi 1.5.1+ enables native Anthropic message threads. Pi fingerprints the full payload and produces its continuation before bili's transport rewrites it. In plugin mode that delta reaches ordinary system/history reconstruction, so a tool-result continuation gets a replacement top-level system. With Pi 1.5.2 / bili 0.1.213 / Opus OAuth this reproducibly produces a generic upstream 429.
Repeated serial A/B: no bili
[200,200]twice; bili[200,429]twice; bili with only the continuation system removed[200,200]twice. The last arm is a diagnostic, not this fix: stripping compression instructions would be unsafe.Change
compat.supportsMessageThreads=falseusing Pi's officialsetModelAPI for Anthropic Messages models actually routed through bili (explicit proxy, native intercept, or MITM).This preserves bili's existing full-request compression pipeline, not native-thread transport savings. The session override remains on that selected model until another selection replaces it; disabling routing does not reverse-mutate the snapshot. A future thread-preserving implementation must prepare compression before Pi's fingerprint/delta, including response/usage bookkeeping; that larger redesign is not claimed here.
Verification
npm run typecheckandnpm run build: pass.node --import ./tests/preload-test-env.mjs --import tsx --test tests/pi-message-threads.test.ts tests/pi-native.test.ts tests/pi-inline.test.ts tests/issue3433-pi-incremental-guard.test.ts: 29 passed, including native/MITM/unrouted gates, cold-turn retry, clone/idempotence, malformed compat, model selection refusal/rejection, thinking preservation, competing selection, opt-out, OMP, older hosts.node tools/check-architecture-docs.mjsandgit diff --check: pass.[200,200]and[200,200], four sends / 138 generated tokens, no retries/delegation, no payload-stripping intervention. Shared user package/config/auth and original sample app untouched.Live validation is narrow and does not establish that all historical Anthropic 429s share this cause. No credentials, request bodies, or private project/session content are published. Base verified against current master
1ee510cbefore pushing.