Auto-sync: 2026-04-18 00:18

This commit is contained in:
2026-04-18 00:18:08 +08:00
parent 7a7a35f726
commit 5ce3ede529
25 changed files with 694 additions and 2 deletions

View File

@@ -0,0 +1,48 @@
---
title: "一次「Context Limit Exceeded」错误排查我以为是小问题结果踩了大坑"
type: source
tags: []
date: 2026-04-10
---
## Source File
- [[raw/微信公众号/养虾日记4 一次「Context Limit Exceeded」错误排查我以为是小问题结果踩了大坑.md]]
## Summary
- 核心主题OpenClaw AI Agent 的 Context Limit 错误排查
- 问题域AI Agent 运维、模型配置问题诊断
- 方法/机制Gateway 日志分析、模型配置层级排查、compaction 机制理解
- 结论/价值:不要默认认为错误信息就是表面意思,两层配置要分清,日志真的有用
## Key Claims
- 「Context limit exceeded」不一定是因为对话太长可能是模型配置本身就有问题
- 全局 compaction 配置和 agent 模型配置是两码事,改全局不行就得往 agent 级别去找
- OpenClaw 这种分布式 agent 系统一个问题可能藏在七八个地方——session、memory、model config、routing rules、compaction 策略
## Key Quotes
> "provider=custom-api-deepseek-reasoner/deepseek-reasoner ctx=16000"
> "estimatedPromptTokens=393 overflowTokens=392 reserveTokens=16384"
> "deepseek-reasoner 的 context window 只有 16K"
## Key Concepts
- [[上下文压缩]]OpenClaw 的 safeguard 模式会预留一半 token 给 compaction
- [[模型配置层级]]Global Config、Agent/Channel Specific Config、环境变量的分层配置
- [[Fallback 机制]]:模型服务不可用时的自动切换逻辑
## Key Entities
- [[OpenClaw]]AI Agent 管理工具,作者使用的自托管系统
- [[MiniMax-M2.7]]作者默认使用的模型200K context window
- [[DeepSeek-Reasoner]]:只有 16K context window 的模型,问题的真正原因
## Connections
- [[养虾日记2让Agent更懂你]] ← related_to ← [[养虾日记3用 Obsidian + Gitea 为 AI 助手构建持久化笔记系统]]
- [[养虾日记4一次「Context Limit Exceeded」错误排查]] ← related_to ← [[养龙虾5天血泪史我的AI Agent为什么总失忆OpenClaw 记忆调试全记录]]
## Contradictions
-
## Lessons Learned
1. 不要默认认为错误信息就是表面意思
2. 两层配置要分清:全局 compaction 配置和 agent 模型配置
3. 日志真的有用
4. 工具/系统越复杂,问题的隐藏路径越深