Repository navigation
[PR] fix: read Codex model_catalog_json so custom-catalog installs stop falling back to 272K (#5243) - #5276
[PR] fix: read Codex model_catalog_json so custom-catalog installs stop falling back to 272K (#5243)#5276ranxianglei wants to merge 2 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7298-pr.5276.c64514eThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5276.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…lling back to 272K (#5246) Codex resolves its live model table from exactly one path, <CODEX_HOME>/models_cache.json. On installs driven by a custom catalog (config.toml `model_catalog_json = ...`) that file does not exist, so bili fell through to the bundled snapshot (no entry) and the flat 272K floor, clamping the effective window far below what codex actually perceives and triggering emergency nudges at ~35% of the real window. - Parse `model_catalog_json` from codex's own config.toml and resolve the live table from that path when set, else models_cache.json (relative paths resolve against CODEX_HOME). - When neither file is readable but config.toml sets `model_context_window`, size from that value capped by the known max_context_window (the bundled entry's max, or the 272K unknown-model ceiling) instead of the flat 272K floor — never budgeting above what codex perceives — and log a warn naming the degraded path. - Name the winning window source (client-report/catalog-json/models-cache/config-context-window/bundled-snapshot/flat-fallback) in the clamp log line instead of the misleading "current client metadata preferred" text. Local codex peers on such installs now get the real perceived window (toward larger, never below codex perception); remote peers, non-codex clients, operator modelContextLimit, min() semantics and output reservation are unchanged. Closes #5246
480d1f0 to
8201c68
Compare
(ai: vllm-qwen/qwen3.8-27b) CI 终态更新(head 收工判定不变:代码审核完成、本地定向全绿(codex-window 三套件 38/38、model-windows+launcher-max-outputs 30/30、launcher 343 过、typecheck 干净);全量红与 #5046 owner 裁决链相关,非本 PR 引入。§7.4 人工合并——建议要么等继承车道收敛后合,要么 owner 明确接受当前继承红直接合(本 PR 触碰面在专属测试里全绿)。 |
(ai: vllm-qwen/qwen3.8-27b) 收工总结(本线程 = GitHub PR #5276 的跟踪 issue):已完成的工作与结论全部在本线程——floor 3(独立审核八问 + 行为变更披露)、floor 8(CI 终态)。一句话结果:代码审核通过、分支已同步最新 master 并推送(head |
|
(ai: sglang-gpu0/qwen3.8-27b) Superseded — 本 PR 的修复已作为 #5305 合入 master。 #5305(同一 issue #5243)今天 06:55 UTC 已合入,merge commit
建议 owner 关闭本 PR(与 #5305 重复),保留分支作审计即可。CI 红分片归因结论(#5046/#5136 继承家族)不受影响。 |
(ai: vllm-qwen/qwen3.8-27b) 核实结论:本 PR 确已被 #5305 取代,建议 owner 关闭(agent 不代关)。 我没有照抄 floor 11,而是独立用 GitHub REST API 复核了一遍,结论全部成立:
已做:给本镜像 issue 打了 未做(owner-only):按 2026-10-23 政策 agent 不关闭任何 issue/PR。请 owner 关闭 GitHub PR #5276 —— 与已合并的 #5305 重复:同一症状(自定义目录安装落到 272K 兜底)、同一机制(读 codex 模型表对齐窗口)、#5305 先合入,后到的 #5276 让位。分支留作审计即可,不用删。关闭后 floor 8/10 归因的那几个继承红分片(#5046/#5136 家族)随单作废,无需再追。 留档的一个行为差异(需 owner 定夺,非本单范围):#5305 在「两个文件都不可读、且 config 设了 判定:代码侧无新增动作,等 owner 关单即收工。 |
(ai: vllm-qwen/qwen3.8-27b) 查重/核实(本轮全部实时查证,不复用旧评论结论)
为什么本轮不做 rebase/force-push
选项
红 CI 备注:镜像缓存快照(2026-10-31)里 3 个 test 分片红的归因见 floor 8(#5046/#5136 继承家族,已备案 #4599),与本 PR diff 无关;若按 A 关闭则无需再追。 标签:既有 bug/codex/pr/scope/wiring/p2/duplicate;本轮新增 结构化八问
收工判定:本轮无代码动作(不 rebase、不 push、不开新 issue); |
(ai: vllm-qwen/qwen3.8-27b) 本轮实时查证(不复用记忆)
结论不变:本 PR 是「已被 #5305 取代、只待 owner 关闭」的重复 PR。rebase 解冲突 = 在两套实现(原值 vs 封顶)之间做设计取舍,超出本车道「small mechanical fixes only」权限;强推只会额外烧一轮全量 CI,而该 PR 的去向是关闭不是合并。选项与推荐沿用 floor 20:A(推荐)owner 直接关闭 #5276(duplicate of #5305);B:关单后另立小后续补封顶语义;C:owner 指定以哪套实现为准后由人主导 rebase。default-if-undecided:按 A 等待关闭(agent 依 2026-10-23 政策不代关)。 七问(本轮)
收工判定:等 owner 拍板(建议 A:关闭 #5276)。在 owner 行动前,本车道每次被唤醒得到的都会是同一个复核结论——关闭 PR 是终止该循环的唯一终态动作。 |
(ai: vllm-qwen/qwen3.8-27b) 本轮查证(实时):#5276 仍 open、未合并、head= 结论不变:本 PR 是已被 #5305 取代、只待关闭的重复 PR;解冲突 = 在两套实现间做设计取舍,超出本车道权限。选项与推荐沿用 floor 20:A(推荐)owner 直接关闭 #5276;B:关单后另立小后续补封顶语义;C:owner 指定实现后由人主导 rebase。default-if-undecided:按 A 等待关闭(agent 不代关)。 七问:① 问题:同一任务被重复派发,而 PR 实际处于 superseded 待关状态,无机械修复可执行。② 原因:触发器按 open+dirty 派单,不识别 superseded/needs-decision 状态。③ 影响:仅内部资源空转,用户面无影响。④ 处理:零代码动作,仅实时复核并留一行式记录。⑤ 回归:不涉及(无 diff、无 push)。⑥ 缓存:不涉及。⑦ 设计方向/新配置:均不涉及。 收工判定:等 owner 拍板(建议 A:关闭 #5276)。另注:连续三次派单结论相同,duplicate 与 needs-decision 标签均未使唤醒停止——若需在 owner 行动前终止该循环,需平台侧调整触发条件(本 agent 无此权限,如实报告)。 |
(ai: vllm-qwen/qwen3.8-27b) 结论与选项不变(floor 20):A(推荐)owner 关闭 #5276(duplicate of #5305);B:关单后另立封顶语义小后续;C:owner 指定实现后由人主导 rebase。default-if-undecided:按 A 等待关闭。 七问:① superseded 待关 PR 被重复派单,无机械修复可执行;② 触发器不识别 superseded/needs-decision 状态;③ 仅内部空转,用户面无影响;④ 本轮零代码动作,仅实时复核;⑤⑥⑦ 回归/缓存/设计配置均不涉及(无 diff、无 push)。 收工判定:等 owner 拍板。连续四次派单结论相同——终止循环需 owner 关单或平台侧调整触发条件。 |
(ai: vllm-qwen/qwen3.8-27b) 结论与选项不变(floor 20):A(推荐)owner 关闭 #5276(duplicate of #5305);B:关单后另立封顶语义小后续;C:owner 指定实现后由人主导 rebase。default-if-undecided:按 A 等待关闭。 七问:① superseded 待关 PR 被重复派单,无机械修复可执行;② 触发器不识别 superseded/needs-decision 状态;③ 仅内部空转,用户面无影响;④ 本轮零代码动作,仅实时复核;⑤⑥⑦ 回归/缓存/设计配置均不涉及(无 diff、无 push)。 收工判定:等 owner 拍板。已连续五次派单、跨 11-11 至 11-12 三天,结论恒定——终止循环需 owner 关单或平台侧调整触发条件。 |
(ai: vllm-qwen/qwen3.8-27b) 结论与选项不变(floor 20):A(推荐)owner 关闭 #5276(duplicate of #5305);B:关单后另立封顶语义小后续;C:owner 指定实现后由人主导 rebase。default-if-undecided:按 A 等待关闭。 七问:① superseded 待关 PR 被重复派单,无机械修复可执行;② 触发器不识别 superseded/needs-decision 状态;③ 仅内部空转,用户面无影响;④ 本轮零代码动作,仅实时复核;⑤⑥⑦ 回归/缓存/设计配置均不涉及(无 diff、无 push)。 收工判定:等 owner 拍板。连续六次派单结论恒定——终止循环需 owner 关单或平台侧调整触发条件。 |
(ai: vllm-qwen/qwen3.8-27b) 结论与选项不变(floor 20):A(推荐)owner 关闭 #5276(duplicate of #5305);B:关单后另立封顶语义小后续;C:owner 指定实现后由人主导 rebase。default-if-undecided:按 A 等待关闭。 七问:① superseded 待关 PR 被重复派单,无机械修复可执行;② 触发器不识别 superseded/needs-decision 状态;③ 仅内部空转,用户面无影响;④ 本轮零代码动作,仅实时复核;⑤⑥⑦ 回归/缓存/设计配置均不涉及(无 diff、无 push)。 收工判定:等 owner 拍板。连续七次派单结论恒定——终止循环需 owner 关单或平台侧调整触发条件。 |
(ai: vllm-qwen/qwen3.8-27b) 结论与选项不变(floor 20):A(推荐)owner 关闭 #5276(duplicate of #5305);B:关单后另立封顶语义小后续;C:owner 指定实现后由人主导 rebase。default-if-undecided:按 A 等待关闭。 七问:① superseded 待关 PR 被重复派单,无机械修复可执行;② 触发器不识别 superseded/needs-decision 状态;③ 仅内部空转,用户面无影响;④ 本轮零代码动作,仅实时复核;⑤⑥⑦ 回归/缓存/设计配置均不涉及(无 diff、无 push)。 收工判定:等 owner 拍板。连续八次派单、跨 11-11 至 11-13 四天,结论恒定——终止循环需 owner 关单或平台侧调整触发条件。 |
Problem
Codex resolves its live model table from exactly one path,
<CODEX_HOME>/models_cache.json. On installs driven by a custom catalog —config.tomlsetsmodel_catalog_json = "/path/to/model-catalog.json"— that cache file never exists, so bili could not find the model, fell through to the bundled snapshot (no entry) and landed on the flatCODEX_FALLBACK_CONTEXT_WINDOW = 272000. The effective window got clamped to 272K while codex actually perceives ~828K (max_context_window 872000 × 95%), so the nudge denominator was ~1/3 of reality and EMERGENCY nudges fired at ~35% of the real window. Root cause confirmed against v0.1.209 source.Two aggravators were also present:
parseCodexTomlnever readmodel_catalog_json, and the user's explicitmodel_context_window = 1050000was discarded because the earlyundefinedreturn bypassed it.Fix
parseCodexTomlnow reads top-levelmodel_catalog_json; the live-table resolver uses that path when set, else<CODEX_HOME>/models_cache.json(relative paths resolve againstCODEX_HOME). Same stat-keyed cache, same parsing/validation.config.tomlsetsmodel_context_window, size from that value capped by the knownmax_context_window(the bundled entry's max, or the 272K unknown-model ceiling) rather than the raw override — so we never budget above what codex perceives — and log awarnnaming the degraded path.client-report/catalog-json/models-cache/config-context-window/bundled-snapshot/flat-fallback) instead of the misleading "current client metadata preferred over bundled fallback".The issue's exact case now computes
min(1050000, 872000) × 95% = 828400— matching the rollout-recorded real window.Behavior change (old → new)
compress.modelContextLimit, themin()semantics, output reservation, and every existing call path — the legacycodexAlignedWindowreturn shape is preserved verbatim via a thin wrapper, so all existing assertions hold byte-for-byte.Config surface
No new bili config knob.
model_catalog_jsonis read from codex's own~/.codex/config.tomlas an input source (bili consumes it, never writes it); noBILI_*env var and no~/.config/billion-context/billion-context.jsonfield is added, so CONFIGURATION.md en/zh need no change.Tests
New targeted coverage in
tests/codex-live-window.test.ts: catalog-path resolution (issue repro → 828400), catalog outranking models_cache.json, config-only fallback capping (not-in-bundled → 258400; bundled-max-1Mgpt-5.4→ 950000; bundled-max-272Kgpt-5.5→ 258400; no override → undefined), and full source-attribution across every rung including non-codex passthrough. 30/30 across the three codex-window files pass locally; typecheck clean on the rebased head. Full-suite verdict deferred to CI.Merge tier
Touches the window/fallback default-value decision path → §7.4 human merge required (not auto-merge eligible).
Closes #5243