Repository navigation
[PR] fix: recognize Chinese relay overflow wording in the context-overflow detector (#3240) - #3246
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3740-pr.3246.9449b27This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3246.tgz
npm install -g packageInstall instructions are refreshed on each push. |
fd4f6b6 to
bcd039f
Compare
(ai: vllm-qwen/qwen3.8-27b) PR #3246 复审结论(独立审核,非复读 issue)前置动作:分支落后 master 37 个提交(含 #3154 熔断器——它动了 relay.ts,与本 PR 的 util.ts 无文本冲突),已 rebase 到当前 master 并强推本 PR 分支(fd4f6b61c → bcd039f,仅动本 PR 分支,未碰 master)。 验证结果:本地定向 结构化八问
行为变更披露(旧 → 新)旧:中文溢出措辞的 400/413/5xx → 判非溢出 → 透传、不武装、不 refold,会话死循环。 代码与测试质量
判定可合并:方向正确、修在根因层、回归审计 0 处、定向 55/55 + rebase 后 CI 39/39 全绿、行为变更已披露。等你合入即可(合并按规矩留给人)。 |
… this PR ranxianglei#3246 (Closes ranxianglei#3240) predates this PR and is now mergeable:false against master because ranxianglei#3787 landed the 上下文 direction it carried. After ranxianglei#3787 + this PR's (a)-(d), two of its patterns keep unique coverage: the input side named with an EXCEED predicate ('输入长度超出限制' — (c)'s length predicates do not reach it, and extending (c)'s subjects to 超出/超过/超限 would light up throttle phrasings like '请求超出频率限制') and the mixed-language 'prompt 过长'. Both are folded in here so the CJK detector surface lands in one PR; ranxianglei#3246's field-phrasing regression cases (b-c-pi#639) move into tests/cjk-context-overflow.test.ts alongside them.
… this PR ranxianglei#3246 (Closes ranxianglei#3240) predates this PR and is now mergeable:false against master because ranxianglei#3787 landed the 上下文 direction it carried. After ranxianglei#3787 + this PR's (a)-(d), two of its patterns keep unique coverage: the input side named with an EXCEED predicate ('输入长度超出限制' — (c)'s length predicates do not reach it, and extending (c)'s subjects to 超出/超过/超限 would light up throttle phrasings like '请求超出频率限制') and the mixed-language 'prompt 过长'. Both are folded in here so the CJK detector surface lands in one PR; ranxianglei#3246's field-phrasing regression cases (b-c-pi#639) move into tests/cjk-context-overflow.test.ts alongside them.
Closes #3240
背景
b-c-pi#639 迁移至此:pi + 中转站 API 报错后,上下文长度一直算错。在 master 上逐条复核后:
CONTEXT_OVERFLOW_PATTERNS(src/util.ts)全部是英文措辞,中文中转站错误(「上下文长度超出限制」「输入长度超过模型支持的最大上下文」等)一个都不命中 → 使用pi 压缩后就提示prompt is too long #1195 同请求 refold 与 context window problem continues #987 紧急收缩武装都不触发 → 会话每轮原样重发同一个超窗 body、反复吃 400。本 PR 修这个。FALLBACK_LIMIT=150_000在本仓库不存在;bili 的窗口解析链(beta 头 >[Nm]后缀 > 插件报告 > launcher > providers 声明 > 注册表 > 内置表 > 默认 200k)已覆盖声明路径,且 context window problem continues #987 的设计立场是「窗口归声明所有、永不从流量学习」。pi 模型配置或 providers 里声明contextWindow即解决——无代码改动,判定与配置解法详见 issue 回复。改动
src/util.tsCONTEXT_OVERFLOW_PATTERNS:新增 5 条中文溢出措辞,均要求方向词(超出/超过/超限/过长/超长),防止仅提及 上下文/token 的无关 400(鉴权过期、限流、格式错误)误触发自愈。tests/context-overflow.test.ts:新增 3 个回归用例——正例(6 种措辞,全部断言window === undefined,钉住不学错数字)、5xx+中文标记组合(超窗拒答以 5xx 返回时出现探测死循环;外部摘要链路三处静默/上限问题(含文件:行号与本地验证) #2484 门禁同样适用)、反例(5 种非溢出中文错误必须不命中)。行为变更(旧 → 新)
旧:上游返回带中文溢出措辞的 400/413/5xx → 检测器判非溢出 → 原样透传、不武装、不 refold,会话卡死循环。
新:同类措辞 → 判为溢出 → 按 payload 尺寸武装紧急收缩 + 尝试同请求 refold(#1195)。错误正文不带数字时仍学不到精确窗口(遗留项:等报告者补报错原文后按实际格式给
parseOverflowWindow补数字提取,见 issue 评论跟踪)。英文行为不变。验证
本地定向:
tests/context-overflow.test.ts28/28、tests/side-request-isolation.test.ts+tests/issue2484-overflow-and-summary.test.ts27/27、typecheck clean。全量回归交 CI。Config surface: N/A(未增改任何配置字段)。