Repository navigation
fix: size codex unknown-model windows from live CODEX_HOME for local peers (#2593) - #2600
ranxianglei wants to merge 1 commit into
Conversation
0df7963 to
1f35dbc
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2812-pr.2600.16d6920This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2600.tgz
npm install -g packageInstall instructions are refreshed on each push. |
973a5da to
173f47a
Compare
冲突已解决并推送,PR 现已可合并(仅剩 CI + 人工合并)。下面是独立复核结论。 做了什么:① 拉分支按两种压缩模式做了回归审查;② 解决与 master 的合并冲突并推送;③ 顺带清理一处作者遗留的死 import。 八问:
透明说明(必须讲):
判定:冲突已清(GitHub 侧 |
…peers (#2593) A codex NEW model missing from the release-time bundled snapshot clamped to the 272K unknown-model floor even though the running codex perceives its real (often larger) window, under-clamping long sessions into unnecessary preflight compression / 502. Existing plugin/runtime/launcher reports hit the same stale table too. For a LOCAL codex peer (loopback) with no fresher report, align to this proxy's own CODEX_HOME (models_cache.json + base config.toml): total = base override ? min(override, max_context_window) : resolved window, x effective percent. Remote peers keep the bundled snapshot + 272K fallback (a remote host's cache is not this client's). Explicit compress.modelContextLimit, min() semantics and the output reservation are unchanged; no-match / empty source falls back to the bundled table. Closes #2593
173f47a to
64a6a1f
Compare
Summary
Fixes #2593 — a Codex NEW model missing from bili's release-time bundled model table was clamped to the 272K unknown-model fallback even though the running Codex perceives its real (often larger) window, under-clamping long sessions into unnecessary preflight compression and 502s. Existing plugin/runtime/launcher window reports were re-limited by the same stale table.
Root cause
codexWindowForModel()(src/codex-models.ts) resolved a model's perceived window from the bundled snapshot only (src/codex-models-snapshot.json, fetched at release time) plus the 272K floor. It never consulted Codex's own live cache, so any slug not yet in the snapshot fell to 272K regardless of what this Codex actually runs.Fix
For a LOCAL Codex peer (loopback) with no fresher report, align to this proxy's own
CODEX_HOME(read-only):models_cache.json+ baseconfig.toml, mirroring Codex's budget math:Remote peers keep the bundled snapshot + 272K fallback — a remote host's cache is not this client's real config.
Verification (the issue's exact scenario)
With
models_cache.json=context_window=373000, max_context_window=872000, effective_context_window_percent=95and baseconfig.toml=model_context_window=1048576:Verified end-to-end against a real temp
CODEX_HOME(disk-load path), not just injected fixtures.Behavior change (disclosed)
The effective window for a local loopback Codex peer can now be higher than before (toward Codex's true perception) when the live cache matches the model and no fresher report exists. It never drops below Codex's perception; an absent/empty/no-match source falls back to the bundled table (unchanged); remote peers are unchanged; explicit
compress.modelContextLimit,min()semantics, and the output reservation are all untouched.Scope notes
CODEX_HOMEconvention already used byclient-config.tsplus loopback detection.Tests
tests/codex-models.test.ts: 9 new cases (exact repro, no-override, clamp-down-to-max, raise-up-to-max, no-max override, absent-from-cache fallback, null source, match discipline, re-inject/reset). All 19 pass; typecheck + build green.Closes #2593