From beb8a3d0eec66a872ebff98a441191c88b50e35b Mon Sep 17 00:00:00 2001 From: minhn4 Date: Mon, 7 Sep 2026 09:16:04 +0700 Subject: [PATCH 1/2] feat(gateway): give GLM-5.3-Flash its served 262144 window 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: the context gauge understated the window and auto-compaction fired ~62K tokens early. Trigger is the uniform 90% (235930); as with M3 that target plus the 40000 reserve exceeds the window, so declaredInput's clamp pins limit.input at the window and the effective trigger is 222144. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 6 ++++++ packages/codev-gateway/src/model-limits.ts | 9 +++++---- .../codev-gateway/test/config-block.test.ts | 18 ++++++++++-------- .../codev-gateway/test/model-limits.test.ts | 1 + 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df3a32108..384002d3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,12 @@ file is the human-readable summary of what changed and why. ### Gateway +- **GLM-5.3-Flash gets its served window** — the model is served with the same + 262,144-token window as MiniMax-M3, so it now has its own entry in the + built-in table instead of falling back to the safe 200K default. Signing in + (or re-running a configure flow) writes it the same context gauge and + compaction trigger the other large model gets; already-written configs are + not rewritten. - **The SSO provider is now AIGW** — signing in with SSO writes the gateway provider as `aigw`, shown as "AIGW" in the model picker, replacing the previous identity. Existing installs keep working: the old provider id stays diff --git a/packages/codev-gateway/src/model-limits.ts b/packages/codev-gateway/src/model-limits.ts index 2bca0e9ab..b7515bf55 100644 --- a/packages/codev-gateway/src/model-limits.ts +++ b/packages/codev-gateway/src/model-limits.ts @@ -32,13 +32,14 @@ export const COMPACT_RESERVED = 40000 export const COMPACT_PCT = 90 // Known gateway models' context windows, keyed by the exact id `/v1/models` -// reports. M3's window is capped at 262144 on the current deployment (the -// model supports more, the gateway's resources don't). The 200K sibling is -// deliberately absent: DEFAULT_WINDOW already describes it, and an entry -// restating the default is one more thing to keep in sync. +// reports. M3's and GLM-5.3-Flash's windows are capped at 262144 on the current +// deployment (the models support more, the gateway's resources don't). M3's +// 200K sibling is deliberately absent: DEFAULT_WINDOW already describes it, and +// an entry restating the default is one more thing to keep in sync. const TABLE: Record = { "MiniMax/MiniMax-M3": 262144, "zai-org/GLM-4.7-cc": 200000, + "zai-org/GLM-5.3-Flash": 262144, } // Unrecognized models are treated as 200K-class: it matches the smaller of the diff --git a/packages/codev-gateway/test/config-block.test.ts b/packages/codev-gateway/test/config-block.test.ts index ef5bf4b2c..11a9c3cc7 100644 --- a/packages/codev-gateway/test/config-block.test.ts +++ b/packages/codev-gateway/test/config-block.test.ts @@ -72,16 +72,18 @@ describe("buildGatewayConfig", () => { }) }) - // The per-model table: M3's 262144-token window (capped by the deployment, + // The per-model table: the 262144-token window (capped by the deployment, // not the model). Its 90% trigger + the 40000 reserve exceeds the window, // so declaredInput's clamp pins input at the window itself. - test("writes the table window for the known model", () => { - const config = buildGatewayConfig({ baseUrl: "https://gw.test", model: "MiniMax/MiniMax-M3" }) - expect(config.provider.aigw.models["MiniMax/MiniMax-M3"].limit).toEqual({ - context: 262144, - input: 262144, - output: 65536, - }) + test("writes the table window for the known models", () => { + for (const id of ["MiniMax/MiniMax-M3", "zai-org/GLM-5.3-Flash"]) { + const config = buildGatewayConfig({ baseUrl: "https://gw.test", model: id }) + expect(config.provider.aigw.models[id].limit).toEqual({ + context: 262144, + input: 262144, + output: 65536, + }) + } }) // Without the declaration a custom-provider model resolves to text-only and diff --git a/packages/codev-gateway/test/model-limits.test.ts b/packages/codev-gateway/test/model-limits.test.ts index 85cd146e7..8280a4107 100644 --- a/packages/codev-gateway/test/model-limits.test.ts +++ b/packages/codev-gateway/test/model-limits.test.ts @@ -37,6 +37,7 @@ describe("limitsFor", () => { // Triggers are always 90% of the window, whatever its source. expect(limitsFor("MiniMax/MiniMax-M3")).toEqual({ context: 262144, trigger: 235930 }) expect(limitsFor("zai-org/GLM-4.7-cc")).toEqual({ context: 200000, trigger: 180000 }) + expect(limitsFor("zai-org/GLM-5.3-Flash")).toEqual({ context: 262144, trigger: 235930 }) expect(limitsFor("anything/else")).toEqual(DEFAULT_LIMITS) expect(DEFAULT_LIMITS).toEqual({ context: 200000, trigger: 180000 }) }) From 289a667b3000e2258e30501d9a1aeb628d8ca3ed Mon Sep 17 00:00:00 2001 From: minhn4 Date: Mon, 7 Sep 2026 09:37:39 +0700 Subject: [PATCH 2/2] feat(gateway): drop the GLM-4.7-cc window entry Its 200000 restated DEFAULT_WINDOW exactly, so limitsFor returns the same {context: 200000, trigger: 180000} through the default tier and every config block is written byte-identically. The table now carries only the models whose window differs from the default. Co-Authored-By: Claude Opus 5 (1M context) --- packages/codev-gateway/src/model-limits.ts | 8 ++++---- packages/codev-gateway/test/model-limits.test.ts | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/codev-gateway/src/model-limits.ts b/packages/codev-gateway/src/model-limits.ts index b7515bf55..30d8c244d 100644 --- a/packages/codev-gateway/src/model-limits.ts +++ b/packages/codev-gateway/src/model-limits.ts @@ -33,12 +33,12 @@ export const COMPACT_PCT = 90 // Known gateway models' context windows, keyed by the exact id `/v1/models` // reports. M3's and GLM-5.3-Flash's windows are capped at 262144 on the current -// deployment (the models support more, the gateway's resources don't). M3's -// 200K sibling is deliberately absent: DEFAULT_WINDOW already describes it, and -// an entry restating the default is one more thing to keep in sync. +// deployment (the models support more, the gateway's resources don't). Models +// served at the 200K default are deliberately absent: DEFAULT_WINDOW already +// describes them, and an entry restating the default is one more thing to keep +// in sync. const TABLE: Record = { "MiniMax/MiniMax-M3": 262144, - "zai-org/GLM-4.7-cc": 200000, "zai-org/GLM-5.3-Flash": 262144, } diff --git a/packages/codev-gateway/test/model-limits.test.ts b/packages/codev-gateway/test/model-limits.test.ts index 8280a4107..0e17302fa 100644 --- a/packages/codev-gateway/test/model-limits.test.ts +++ b/packages/codev-gateway/test/model-limits.test.ts @@ -36,7 +36,6 @@ describe("limitsFor", () => { test("resolves the table's known models and defaults the rest", () => { // Triggers are always 90% of the window, whatever its source. expect(limitsFor("MiniMax/MiniMax-M3")).toEqual({ context: 262144, trigger: 235930 }) - expect(limitsFor("zai-org/GLM-4.7-cc")).toEqual({ context: 200000, trigger: 180000 }) expect(limitsFor("zai-org/GLM-5.3-Flash")).toEqual({ context: 262144, trigger: 235930 }) expect(limitsFor("anything/else")).toEqual(DEFAULT_LIMITS) expect(DEFAULT_LIMITS).toEqual({ context: 200000, trigger: 180000 })