Repository navigation
feat(model-limits): table the GLM-5.3-Flash window, drop GLM-4.7-cc - #262
Merged
Merged
Conversation
The gateway serves zai-org/GLM-5.3-Flash with the same 262144-token window as MiniMax-M3 (a deployment resource cap, not the model's native window), but with no table entry it fell back to the safe 200K default — so every agent CoDev configures for it was told the wrong window. One table entry covers every command: install, config, model, and the launch-time key refresh all write through the four configure.ts writers, and each resolves its numbers from limitsFor. Also refreshes the AGENTS.md section that still described the pre-#259 model-limits shape (explicit per-model triggers, an atob-encoded M3_ID, DEFAULT_LIMITS at 200K/160K) and notes that the table has a twin in codev-code that has to move with it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Its 200000 restated DEFAULT_WINDOW exactly, so limitsFor returns the same
{context: 200000, trigger: 180000} through the default tier and all four
writers emit identical config. The table now carries only the models whose
window differs from the default.
Tests that used the id as a stand-in for a 200K model now use DEFAULT_LIMITS
or an unlisted id, so each still covers the default-window branch it was
written for.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
In
src/lib/model-limits.ts:zai-org/GLM-5.3-Flashat 262,144 tokens, the same window asMiniMax/MiniMax-M3zai-org/GLM-4.7-ccThe table now carries only the models whose window differs from the default.
Why
Without a table entry GLM-5.3-Flash resolved to
DEFAULT_LIMITS(the safe 200K fallback), so every agent CoDev configures for it was told the wrong window — an understated context gauge and auto-compaction firing about 62K tokens early.The GLM-4.7-cc entry's
200000restatedDEFAULT_WINDOWexactly, so removing it changes nothing:limitsForreturns the same{ context: 200000, trigger: 180000 }through the default tier and all four writers emit identical config. The module's own comment already said an entry restating the default is one more thing to keep in sync.One entry covers every command
install,config,model, and the launch-time key refresh all write through the four writers inconfigure.ts, and every one of them resolves its numbers fromlimitsFor— none holds a window constant of its own. So the table entry is the whole change; there is no per-command list of models to keep in sync.What each agent ends up with for GLM-5.3-Flash:
model_context_window/model_auto_compact_token_limitlimit.context/limit.input− globalreserveddeclaredInput's clamp binds, as it does for M3)contextLength/maxTokensCLAUDE_CODE_AUTO_COMPACT_WINDOW/CLAUDE_AUTOCOMPACT_PCT_OVERRIDEAssumption to confirm
The 262,144 window is taken from "configure it like MiniMax-M3" — M3 is capped there by the deployment's resources rather than by the model. If the gateway actually serves GLM-5.3-Flash with a different window, say so and I'll change the one number. Guessing too high is the direction that hurts (a session can run past the real ceiling and 400 mid-chat). It can also be overridden without a release: the moment an admin sets
max_input_tokenson the model in LiteLLM,fetchModelWindowscaches it in auth.json and the remote tier outranks this table.Tests
Several tests used
zai-org/GLM-4.7-ccas a stand-in for "a model on the 200K window". Each now usesDEFAULT_LIMITSor an unlisted id instead, so it still covers the default-window branch it was written for rather than silently retesting the table:model-limits.test.ts— the remote-tier and Claude-ceiling casesconfigure.test.ts— the Claude ceiling, the Codex per-model window, the OpenCode two-models-one-config trigger split, and the Continue per-model windowThe Codex case also gained an unlisted-model assertion, so "pins each model's own window, not a shared constant" still exercises two different windows now that both table entries are 262144.
Also in here
AGENTS.md's "Context windows and auto-compaction" section still described the pre-#259 shape: explicit per-model triggers, anatob-encodedM3_ID, andDEFAULT_LIMITSat 200K/160K. It is the doc that tells the next person how to add a table entry, so it is corrected to the current shape (windows only, uniform 90% trigger, plain ids) and now says that the table has a twin in codev-codepackages/codev-gateway/src/model-limits.tsthat has to move with it.Companion PR
quickbeard/codev-code#350 makes both changes to CoDev Code's own copy of the table (its gateway sign-in configures itself without going through the hub). Land both, or a model gets different windows depending on which flow wrote the config.
Testing
pnpm typecheck— cleanpnpm test— 76 files, 1432 pass / 2 skippedpnpm check— no fixes appliedpnpm build && node dist/index.js --version— 0.5.19🤖 Generated with Claude Code