truncation_policy.limit hardcoded to 10000 limits Codex context - CC Switch
Quick fix
In cc-switch, manually set truncation_policy.limit in cc-switch-model-catalog.json to the model's actual context length as a temporary fix.
Symptom
Section titled “Symptom”truncation_policy.limit 仍是 10000truncation_policy.limit is still 10000
The root cause is that cc-switch's internal template file src-tauri/src/resources/codex_native_responses_template.json lines 24-27 hardcode truncation_policy.limit to 10000. No matter what context length the user configures in the UI role settings, the generated cc-switch-model-catalog.json always resets this value to 10000. Codex uses this file to decide how many tokens to send to the model per request; 10000 tokens is extremely insufficient for modern LLM use, so conversations are truncated after a few rounds. PR #5534 changed truncation_policy.limit to be generated dynamically from context_window, but as of v3.16.5 the fix has not been merged and the issue still exists.
After changing any setting in CC Switch, manually edit cc-switch-model-catalog.json and change truncation_policy.limit from 10000 to the context length actually supported by the model, for example 1000000 for a 1M context.
cc-switch-model-catalog.json "truncation_policy": {"mode": "bytes","limit": 10000"limit": 1000000}
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 9 real issues
- #3510feat(codex): optionally align session history when enabling providers / 启用供应商时可选对齐会话历史
- #158导出配置,导入至新的 mac,发现 DeepSeek 不可用,检查后发现是导出时就不完整
- #3790针对Codex自定义provider的“一次性设备迁移来改写历史 JSONL 会话与 state_5.sqlite 线程表”功能如何使用?
- #4670怎么关掉自动生成instructions?
- #4832codex_native_responses_template.json truncation_policy.limit 預設 10000 導致 Codex 上下文受限
- #2675Hermes: switching provider does NOT update top-level model.default/provider at all
- #6626[Bug] Claude Code 2.1.235 reports zero cache tokens for DeepSeek
- #6992OMO Slim "Import from local" does not read per-agent models from presets.<active> - agent rows empty with recommended-model placeholders
- #4623配置 claude code cli apikey 会导致 vscode 插件claude code for vscode apikey同步
- Why is limit still 10000 in the generated config file after I set a 1M context in the CC Switch UI?
- Because truncation_policy.limit in codex_native_responses_template.json is hardcoded to 10000 and currently does not dynamically follow the context_window set in the UI. PR #5534 provides a fix and is waiting to be merged.
- Does v3.16.5 fix this issue?
- No. Users tested on v3.16.5 and confirmed the issue still exists. cc-switch-model-catalog.json correctly contains max_context_window: 1000000, but truncation_policy.limit is still hardcoded to 10000.
- Do I have to manually change it again every time CC Switch overwrites the settings?
- Yes. That is the current workaround. Whenever any setting is changed in CC Switch, cc-switch-model-catalog.json is overwritten back to limit: 10000 and must be manually edited again.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.