Skip to content

⚠️ 升级 2026.6.1 后 DeepSeek Prompt Cache 完全失效,一小时烧掉约 $6 #91016

Closed

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%),但损失已无法追回。

Activity

  1. clawsweeper commented on Jun 6, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Close as implemented: the remaining credible root cause was full-resend prompt-prefix byte instability, and current main now fixes that shared LLM-boundary path while the DeepSeek cache-key theory was explicitly ruled out by live verification.

    I found the merged PR that appears to have closed this: #90811: fix(agents): stabilize user-turn serialization across turns to preserve prompt cache.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the shipped LLM-boundary byte-stability fix as the canonical resolution and avoid adding unsupported DeepSeek prompt_cache_key behavior.

    Do we have a high-confidence way to reproduce the issue?

    Yes for the historical regression: the merged cache-stability PR includes live proof and a regression test for current-vs-historical byte drift. Current main no longer exposes the failing source path because the boundary normalization fix is present.

    Is this the best way to solve the issue?

    Yes: the shared LLM-boundary fix is the right layer for full-resend prompt-cache stability, while adding DeepSeek-specific prompt_cache_key support was live-tested and rejected as ineffective.

    Security review:

    Security review: Non-PR issue triage; no patch security review applies.

    AGENTS.md: found and applied where relevant.

    What I checked:

    Likely related people:

    • Marvinthebored: Authored the related report and the merged PR that stabilized user-turn serialization across full-resend transports. (role: merged fix author; confidence: high; commits: 1af55bc6654f, ce520585e2ab; files: src/agents/embedded-agent-runner/run/attempt.llm-boundary.ts, src/agents/embedded-agent-runner/run/attempt.llm-boundary.cache-stability.test.ts)
    • jalehman: Reviewed and merged the cache-stability PR via squash, and the PR history includes follow-up boundary-stamping commits by this contributor. (role: reviewer and integrator; confidence: high; commits: 1af55bc6654f, 61650aa1f68b, 3572122df754; files: src/agents/embedded-agent-runner/run/attempt.ts, src/agents/embedded-agent-runner/run/attempt.llm-boundary.ts)
    • Peetiegonzalez: The PR commit list attributes the initial cache-stability implementation commit to this contributor, and the related report credits the investigation context. (role: prepared-head contributor; confidence: medium; commits: ce520585e2ab; files: src/agents/embedded-agent-runner/run/attempt.llm-boundary.ts, src/gateway/server-methods/agent-timestamp.ts)
    • steipete: Provided the live DeepSeek verification that ruled out prompt_cache_key and kept the issue focused on prefix stability rather than provider metadata. (role: recent verifier; confidence: medium; files: src/llm/providers/openai-completions.ts, extensions/deepseek/models.ts)

    Codex review notes: model internal, reasoning high; reviewed against 44e6caff5401; fix evidence: merged PR #90811, release v2026.6.5-beta.2, commit 1af55bc6654f.

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    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.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for 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.
    on Jun 6, 2026
  3. kingpro1985 commented on Jun 7, 2026

    @kingpro1985

    I saw this while looking at custom model/provider setup issues: "⚠️ 升级 2026.6.1 后 DeepSeek Prompt Cache 完全失效,一小时烧掉约 $6".

    If it helps your testing, CloudGPU exposes a hosted OpenAI-compatible endpoint that can route to GPT, Claude, Gemini, DeepSeek, Kimi and GLM behind one API key.

    Base URL: https://gpuapis.com/api/v1
    Setup guide: https://gpuapis.com/use-cases/deepseek-gemini-claude-api/

    I can share a small test key/credit and a cURL request if you want to verify it in your current client before doing any integration work.

  4. phoebusluckymail-cpu commented on Jun 7, 2026

    @phoebusluckymail-cpu

    5.22升级到6.1版本一样被坑了,缓存命中骤降。

  5. JAVA-LW commented on Jun 9, 2026

    @JAVA-LW

    可以试试套一层1flowbase,手动构建上下文
    https://github.com/taichuy/1flowbase

  6. added
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    on Jun 10, 2026
  7. 10 remaining items

  8. added
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for 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.
    and removed
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    on Jun 13, 2026
  9. xingchen-c commented on Jun 17, 2026

    @xingchen-c

    所以实际上这个问题实际上是还没有被完全修复?目前还不能升级到最新的OpenClaw版本?

  10. Alex-zbz commented on Jun 17, 2026

    @Alex-zbz

    我删除了旧的openclaw,重新下载了新的,使用的一天内,上午缓存命中率可以达到90%以上,下午却开始急剧下降,甚至将一整天的命中比例拉低至50%,消耗巨大。

  11. RavenSS213 commented on Jun 17, 2026

    @RavenSS213
    Author

    目前官方升级文档中并没有明确的说已经修复deepseek缓存命中率,而且6.8我们尝试了升级最新版本也一样token爆燃,重新安装也无效

  12. Yijian-quiet commented on Jun 18, 2026

    @Yijian-quiet

    今天才注意到这个问题。。。。

    指标 五月 六月 (18天) 变化
    日均花费 ¥3.41 ¥41.91 ↑ 12.3x
    综合缓存命中率 98.3% 71.2% ↓ 27个点
    日均 Miss Tokens 1.3M 35.1M ↑ 26x
    日均请求数 558 505 持平
  13. Alex-zhouzi commented on Jun 18, 2026

    @Alex-zhouzi

    没招了,怎么折腾都不行,用不起了

  14. RavenSS213 commented on Jun 18, 2026

    @RavenSS213
    Author

    对于还在关注这个 issue 的朋友们,统一回复一下:

    当前状态: 这个 issue 被 clawsweeper[bot] 自动关闭了(2026-06-06),bot 的判断是"已经在 main 分支实现",但实际的 DeepSeek 缓存问题并没有被真正修复。

    多位用户的实测反馈:

    • @Alex-zbz(6/17):重新下载新版本,上午缓存正常、下午急剧下降,全天命中率被拉到 50%
    • @Yijian-quiet(6/18):日均花费从 ¥3.41 暴涨到 ¥41.91(↑12.3x),综合缓存命中率从 98.3% 跌到 71.2%
    • @xingchen-c(6/17):问题实际未被修复
    • 我自己(RavenSS213,6/17):升级 6.8 后 token 爆燃依旧

    建议: 在 OpenClaw 官方发布说明明确标注 "已修复 DeepSeek 缓存问题" 之前,留在 2026.5.7 是最明智的选择。回退后缓存命中率恢复 97-100%,这是目前唯一稳定可用的版本。

    @maintainers: 这个 issue 需要重新打开。bot 的自动分类在此案例中做出了错误的根因判断——问题不是序列化稳定性,而是 OpenClaw 的边界感知缓存与 DeepSeek 的纯前缀匹配缓存不兼容。请重新评估并考虑针对 DeepSeek 等 non-Anthropic/OpenAI 模型提供备选缓存策略。

  15. RavenSS213 commented on Jun 18, 2026

    @RavenSS213
    Author

    @steipete — 抱歉直接打扰。这条 issue 被 clawsweeper[bot] 自动关闭了,但问题完全没有解决(见上方多位用户的实测数据)。由于仓库设置了 reopen 限制,我们(issue 作者和受影响的用户)无法自行重新打开。

    能否麻烦你帮忙 reopen 这条 issue?你之前在 thread 中的实测已经证明问题仍未修复 — "Direct DeepSeek API test with an 18,010-token repeated prompt" 虽然确认了 DeepSeek 自身缓存可用,但 OpenClaw 的边界感知实现与 DeepSeek 的纯前缀匹配机制之间的不兼容问题仍然存在。

    另外,我想统一回复一下其他关注此 issue 的朋友们:

    在 OpenClaw 官方发布说明明确标注 "已修复 DeepSeek 缓存问题" 之前,留在 2026.5.7 是最明智的选择。 回退后缓存命中率恢复 97-100%,日花费回到正常水平(¥3-5/天)。升级到任何 6.x 版本目前都会导致缓存命中率骤降(实测降至 50-71%),日花费暴涨 10-12 倍。

  16. locked as resolved and limited conversation to collaborators on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify 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: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions