DeepSeek V4 1M 上下文在 Codex agent 下实际只有 256K
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: 散修院院长
**客户端版本**: 0.1.27
---
## 现象
在 Cindy 中使用 Codex agent 并选择 DeepSeek V4 Flash(或 V4 Pro)时,模型声明支持 1M(1048576 tokens)上下文,但实际生效的上下文窗口只有约 256K(258400 tokens)。
## 复现步骤
1. 在 Cindy 中选择 DeepSeek V4 Flash 模型,使用 Codex agent 开一个新会话。
2. 查看会话 rollout 文件中 `task_started` 事件,`model_context_window` 为 `258400`(约 256K),而非 DeepSeek 的 1M。
## 根因定位(本地日志证据)
- Cindy 侧模型目录 `Cache/model-catalog/*.json` 中 `deepseek/deepseek-v4-flash` 与 `deepseek/deepseek-v4-pro` 均声明 `contextWindow: 1048576`(1M),配置正确。
- 但 Codex 引擎侧的 `codex-home/models_cache.json` 只有 8 个 OpenAI GPT 模型条目(窗口 272000×7 + 128000×1),**完全没有 deepseek 条目**。
- 因此 Codex 对未知模型 ID `deepseek-v4-flash` 套用了 GPT 默认窗口:272000 × 95% = 258400。
## 期望行为
Codex agent 使用 DeepSeek V4 Flash / V4 Pro 时应读到真实的 1M 上下文窗口(1048576),而不是回退到 GPT 默认的 256K。建议在接入层把 DeepSeek 模型的 `contextWindow` 元数据同步给 Codex 引擎(models_cache / 模型路由层补上 deepseek 条目)。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26100)
**界面语言**: zh-CN
Contributor guide
Research direction
Start by tracing the model metadata flow from Cache/model-catalog/*.json through the Codex model routing layer and codex-home/models_cache.json. Verify how unknown DeepSeek model IDs receive their context window, then confirm that DeepSeek V4 Flash and V4 Pro produce task_started events with model_context_window set to 1048576 rather than 258400.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100