Repository navigation
[PR] fix(#4109): negotiated recall — one lane key for raw and routed - #4116
Merged
Merged
Conversation
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4908-pr.4116.f8defe5This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4116.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.716-master.a614d4e # this exact build
npm install -g billion-context@master # always the newest merged build
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(ai: zhipuai-lb/glm-5.3)
Fixes #4109
什么坏了
桌面版 dsh 的路由通道(settings overlay 把模型请求改写成
http://127.0.0.1:PORT/bili/https://api.anthropic.com/...)上,协商式会话召回(#4082/#4094,救无归属重试)从不触发:学习侧和认领侧用了两个不同的 lane key,永远对不上。根因
拦截器对同一条请求给两侧传的 URL 形态不同:
src/agent/native-intercept.ts调state.takeoverGate(routedTarget, …),传的是解包后的上游原始 URL(如https://api.anthropic.com/v1/messages);state.beforeSend(url, init)传的是完整的 overlay URL。recallLaneKey = origin + pathname(src/agent/conversation-recall.ts),两个 key 永不相等 →recallLaneHasEntries(claimKey)恒 false →maybeNegotiatedClaim直接短路。raw 通道两侧拿同一个 URL,所以只有它正常。原测试(tests/dsh-conversation-recall.test.ts)只覆盖 raw 形态(#3617 缺一行)。改了什么
学习侧(
maybeRecallBeforeSend)在算 lane key 前先过同一个routedBiliModelUrl()归一化:overlay URL 折叠回上游 URL,raw URL 原样通过(该函数对 raw 返回 undefined → key = 原始 URL)。不变式:同一逻辑 lane 的 learn key === claim key,raw / routed 两种形态都成立。只在学习侧归一化——认领侧拿到的已是解包一次的目标,再解一次可能重新劈开 key。怎么验证
npm run typecheck干净;node --import tsx --test tests/dsh-conversation-recall.test.ts4/4 绿:新增 routed 正向配对(overlay 学习 → 上游 URL 认领 → 命中并盖章,且lanes === 1)+ 新增跨 lane 负向(不同逻辑 lane 带同样历史 → 拒绝);原有 raw 正向与 fork 负向不变仍绿;tests/conversation-recall.test.ts5/5、tests/native-intercept.test.ts64/64 绿。未跑全量。