48 lines
2.3 KiB
Markdown
48 lines
2.3 KiB
Markdown
---
|
||
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. 工具/系统越复杂,问题的隐藏路径越深 |