fix(openclaw): sync Doubao context window to 262144

The OpenClaw DouBaoSeed preset hard-coded contextWindow 128000 while the
Codex preset/catalog uses 262144 for the same model, giving OpenClaw users
a too-small window that could compress or truncate long context early.
Align to 262144 and add a cross-preset consistency test asserting the
OpenClaw and Codex Doubao context windows stay equal, so neither side can
drift again.
This commit is contained in:
Jason
2026-06-28 23:38:19 +08:00
parent 7f83feb222
commit d916b4e12d
2 changed files with 35 additions and 1 deletions
+1 -1
View File
@@ -230,7 +230,7 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [
{
id: "doubao-seed-2-1-pro-260628",
name: "DouBao Seed 2.1 Pro",
contextWindow: 128000,
contextWindow: 262144,
cost: { input: 0.84, output: 4.2 },
},
],
+34
View File
@@ -0,0 +1,34 @@
import { describe, expect, it } from "vitest";
import { codexProviderPresets } from "@/config/codexProviderPresets";
import { openclawProviderPresets } from "@/config/openclawProviderPresets";
// 回归:同一个 doubao 模型在 Codex catalog 与 OpenClaw settingsConfig 里都声明了
// contextWindow,二者必须一致。曾出现 OpenClaw 写成 128000、Codex 写成 262144 的
// 漂移,导致 OpenClaw 用户拿到过小的上下文窗口、长上下文提前压缩/截断。
describe("DouBaoSeed preset consistency across apps", () => {
const DOUBAO_MODEL_ID = "doubao-seed-2-1-pro-260628";
const EXPECTED_CONTEXT_WINDOW = 262144;
it("keeps the doubao context window in sync between OpenClaw and Codex", () => {
const codexPreset = codexProviderPresets.find(
(item) => item.name === "DouBaoSeed",
);
const codexModel = (codexPreset?.modelCatalog ?? []).find(
(model) => model.model === DOUBAO_MODEL_ID,
);
expect(codexModel, "Codex DouBaoSeed catalog model").toBeDefined();
expect(codexModel?.contextWindow).toBe(EXPECTED_CONTEXT_WINDOW);
const openclawPreset = openclawProviderPresets.find(
(item) => item.name === "DouBaoSeed",
);
const openclawModel = (openclawPreset?.settingsConfig.models ?? []).find(
(model) => model.id === DOUBAO_MODEL_ID,
);
expect(openclawModel, "OpenClaw DouBaoSeed model").toBeDefined();
expect(openclawModel?.contextWindow).toBe(EXPECTED_CONTEXT_WINDOW);
// 任一侧单独改动都会破坏这条等式 —— 这是真正防漂移的断言。
expect(openclawModel?.contextWindow).toBe(codexModel?.contextWindow);
});
});