mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
feat(codex): declare gpt-5.6 context window for Claude Code takeover
- Update Codex OAuth presets to the gpt-5.6 family (haiku -> gpt-5.6-luna) and bump the custom Codex template default model - Inject CLAUDE_CODE_MAX_CONTEXT_TOKENS / CLAUDE_CODE_AUTO_COMPACT_WINDOW (372000, the ChatGPT Codex catalog window with a ~353K effective budget, openai/codex#31860) into effective live settings so Claude Code stops assuming a 200K window and compacts before the upstream rejects the prompt - Gate the injected defaults on every configured model being gpt-5.6*: gpt-5.5's upstream catalog oscillates between 272K and 372K and must not inherit them; explicit user values always win - Strip the injected values on switch-away backfill (mirror-inverse of the injection conditions) so program defaults never harden into per-provider explicit values, and keep both keys out of the shared common-config snippet
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { providerPresets } from "@/config/claudeProviderPresets";
|
||||
import { applyTemplateValues } from "@/utils/providerConfigUtils";
|
||||
|
||||
describe("Kimi For Coding Provider Preset", () => {
|
||||
const kimiForCoding = providerPresets.find(
|
||||
@@ -28,6 +29,47 @@ describe("Kimi For Coding Provider Preset", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Codex Provider Preset", () => {
|
||||
const codex = providerPresets.find((p) => p.name === "Codex");
|
||||
|
||||
it("should include the Codex preset", () => {
|
||||
expect(codex).toBeDefined();
|
||||
});
|
||||
|
||||
it("should override Claude Code's 200K fallback for GPT models", () => {
|
||||
const env = (codex!.settingsConfig as any).env;
|
||||
expect(env).toHaveProperty(
|
||||
"CLAUDE_CODE_MAX_CONTEXT_TOKENS",
|
||||
"${CLAUDE_CODE_MAX_CONTEXT_TOKENS}",
|
||||
);
|
||||
expect(env).toHaveProperty(
|
||||
"CLAUDE_CODE_AUTO_COMPACT_WINDOW",
|
||||
"${CLAUDE_CODE_AUTO_COMPACT_WINDOW}",
|
||||
);
|
||||
});
|
||||
|
||||
it("should expose the Codex-catalog 372K window for both context knobs", () => {
|
||||
const values = codex!.templateValues as any;
|
||||
expect(values?.CLAUDE_CODE_MAX_CONTEXT_TOKENS).toMatchObject({
|
||||
defaultValue: "372000",
|
||||
editorValue: "372000",
|
||||
});
|
||||
expect(values?.CLAUDE_CODE_AUTO_COMPACT_WINDOW).toMatchObject({
|
||||
defaultValue: "372000",
|
||||
editorValue: "372000",
|
||||
});
|
||||
});
|
||||
|
||||
it("should resolve both context placeholders into Claude Code env values", () => {
|
||||
const config = applyTemplateValues(
|
||||
codex!.settingsConfig,
|
||||
codex!.templateValues,
|
||||
) as any;
|
||||
expect(config.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS).toBe("372000");
|
||||
expect(config.env.CLAUDE_CODE_AUTO_COMPACT_WINDOW).toBe("372000");
|
||||
});
|
||||
});
|
||||
|
||||
describe("AWS Bedrock Provider Presets", () => {
|
||||
const bedrockAksk = providerPresets.find(
|
||||
(p) => p.name === "AWS Bedrock (AKSK)",
|
||||
|
||||
Reference in New Issue
Block a user