Bug Description
使用 glm-5 模型执行编码任务时,会话在运行 27 分钟后因上下文长度超限失败,报错前未触发 auto compaction。
Environment
- OS: Linux 6.8.0-90-generic (x64)
- Node.js: v22.22.0
- Qwen Code Version: 0.13.0-preview.1
- Model: glm-5
- Context Window: 202,752 tokens
Reproduction Steps
- 配置并发测试任务,使用 glm-5 模型
- 任务:查看 GitHub issue → 制定计划 → 编码实现 → 提交 PR
- 模型执行任务,进行多轮文件读取和代码编辑
- 运行约 27 分钟后失败
Expected Behavior
上下文使用率增长时,应在达到阈值(默认 70%)时触发 auto compaction,压缩历史对话释放空间。
Actual Behavior
- 上下文使用率增长至 99.7% 未触发 compaction
- API 返回 400 错误:
InternalError.Algo.InvalidParameter: Range of input length should be [1, 202752]
- 任务失败,exit code 1
Token Growth Before Error
最后 5 次 API 调用的 token 使用情况:
| 时间 (UTC) |
Input Tokens |
Output Tokens |
Cached Tokens |
Total Tokens |
| 13:40:33 |
198,375 |
54 |
197,503 |
198,429 |
| 13:40:39 |
199,142 |
54 |
195,199 |
199,196 |
| 13:40:45 |
199,909 |
54 |
199,039 |
199,963 |
| 13:40:50 |
200,676 |
54 |
199,807 |
200,730 |
| 13:40:56 |
201,443 |
54 |
200,575 |
201,497 |
| 13:41:02 |
202,210 |
54 |
198,271 |
202,264 |
| 13:41:03 |
API Error: 400 |
- |
- |
- |
Error Log
[API Error: 400 <400] InternalError.Algo.InvalidParameter: Range of input length should be [1, 202752]
An unexpected critical error occurred:
Error: [API Error: 400 <400] InternalError.Algo.InvalidParameter: Range of input length should be [1, 202752]
at file:///home/ecs-user/.npm-global/lib/node_modules/@qwen-code/qwen-code/cli.js:423666:19
at async main (file:///home/ecs-user/.npm-global/lib/node_modules/@qwen-code/qwen-code/cli.js:477129:5)
Session Information
- Session ID:
5a1b4c17-4471-4f5b-b27d-d3b9edd19287
- Run ID:
99967da7
- Task: Case 8: WebFetch + Write Code + Submit PR
- Model: glm-5
- Started: 2026-03-20T13:13:58 UTC
- Failed: 2026-03-20T13:41:03 UTC
- Duration: ~27 分钟
Additional Context
同样的任务使用 qwen3.5-plus 模型成功完成(21:26:21),未出现此问题。
Bug Description
使用 glm-5 模型执行编码任务时,会话在运行 27 分钟后因上下文长度超限失败,报错前未触发 auto compaction。
Environment
Reproduction Steps
Expected Behavior
上下文使用率增长时,应在达到阈值(默认 70%)时触发 auto compaction,压缩历史对话释放空间。
Actual Behavior
InternalError.Algo.InvalidParameter: Range of input length should be [1, 202752]Token Growth Before Error
最后 5 次 API 调用的 token 使用情况:
Error Log
Session Information
5a1b4c17-4471-4f5b-b27d-d3b9edd1928799967da7Additional Context
同样的任务使用 qwen3.5-plus 模型成功完成(21:26:21),未出现此问题。