Skip to content

⚠️ Upgrade 2026.6.1 broke DeepSeek prompt cache - $6 burned in one hour #91018

Description

@RavenSS213

⚠️ 严重警告:升级 2026.6.1 后 Prompt Cache 失效,一小时烧掉 ~$6

环境

  • 升级路径: 2026.5.7 → 2026.5.28 → 2026.6.1
  • 模型: DeepSeek V4 Flash (deepseek/deepseek-v4-flash)
  • 部署: 容器环境 (PRoot/Android)
  • API 方式: openai-completions

问题描述

从 2026.5.7 升级到 2026.6.1 后,DeepSeek 的 Prompt Cache 完全失效

关键指标

  • 缓存命中率从 50%+ 暴跌到 3-21%(OpenClaw 本地估算,实际 DeepSeek 返回 0 缓存命中)
  • 24小时内累计 2500万+ 次缓存未命中
  • 一小时烧掉 ~$6 USD(约 ¥40+ RMB),其中绝大部分是调试/摸索阶段浪费的
  • DeepSeek API 从未返回 prompt_tokens_details.cached_tokens 字段,说明服务端根本不认缓存 key

根因分析

① 缺少 supportsPromptCacheKey: true

2026.6.1 引入了 "boundary-aware" 缓存系统。文档明确说明:

"OpenAI-compatible Completions providers receive prompt_cache_key only when their model config explicitly sets compat.supportsPromptCacheKey: true."

但对于旧版本升级上来的用户,这个字段不会自动补入 config,需要手动添加。全新安装的用户可能通过 wizard 自动配置好了,但升级用户直接被坑。

② 修复后仍然无效

即使通过 openclaw config set 正确添加了 supportsPromptCacheKey: true,DeepSeek V4 Flash 仍然不返回任何缓存命中信息。OpenClaw 文档也承认:

"DeepSeek cache construction is best-effort and can take a few seconds. An immediate follow-up may still show cached_tokens: 0"

实际上是 0 cached_tokens 持续了整个会话

③ 边界感知缓存与 DeepSeek 不适配

OpenClaw 的边界感知系统将系统提示词分为 "稳定前缀 + 易变后缀",适用于 Anthropic/OpenAI 的缓存标记机制。但 DeepSeek 使用的是纯前缀匹配 + best-effort 缓存,边界分割反而阻止了 DeepSeek 对完整前缀进行缓存

损失统计

项目 数值
升级前余额 ~$3 (¥20+)
升级后余额 ~$0.11 (¥0.80)
总损失 ~$6 (¥40+)
缓存未命中 2500万+ tokens
时间跨度 < 1小时(含排查时间)

建议

  1. 升级流程应自动补全新增配置字段,避免旧 config 缺失导致功能异常
  2. DeepSeek 的 supportsPromptCacheKey 应默认内置(或在文档中大幅强调)
  3. 考虑为 DeepSeek 等 non-Anthropic/OpenAI 模型提供备选缓存策略,而非一刀切使用 boundary-aware 系统
  4. 在发布说明中明确标注:「升级用户需手动添加以下配置」

备注

最终回退到 2026.5.7 后,缓存命中率恢复正常(97-100%),但损失已无法追回。

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions