Skip to content

Long-context prompt cache diagnostics and high miss-token cases 长对话 Prompt Cache 命中率异常日志收集 #25

Description

@Vizards

Important

2026-05-28 Update / 更新

VS Code 1.122.0 includes several important cache-stability improvements for Copilot Chat. Please consider updating to VS Code 1.122.0 or later as soon as possible.
VS Code 1.122.0 已覆盖多项 Copilot Chat 相关的重要缓存稳定性改进。请考虑尽快升级到 VS Code 1.122.0 或更高版本

After updating, please restart VS Code and start a new chat session before comparing cache behavior.
更新后建议重启 VS Code,并新建一轮聊天后再观察缓存表现。

Important

2026-05-18 Update / 更新

If you are still seeing unusually high prompt_cache_miss_tokens,请先尝试下面几步:

  1. Update DeepSeek V4 for Copilot Chat to 0.5.1 or later.
    请先将插件更新到 0.5.1 或更高版本。

  2. If you use Agent mode, try enabling the experimental tool-list stabilization setting:
    如果你使用 Agent 模式,可以尝试开启实验性的工具列表稳定开关:

    {
      "deepseek-copilot.experimental.stabilizeToolList": true
    }

    This may improve cache stability when Copilot/VS Code tools change between turns.
    当 Copilot/VS Code 的工具列表在多轮对话中发生变化时,这可能改善缓存稳定性。
    You may need to restart VS Code to make this new setting visible.
    你可能需要重启 VS Code,才能让这个设置项显示出来。

    This feature is still experimental and may increase input tokens. If it causes unexpected behavior, please turn it off and report it here.
    该功能仍是实验性的,可能增加输入 token;如果出现异常行为,请关闭它并在本 issue 反馈。

If cache misses still spike after trying the above, please continue sharing metadata logs in this issue.
如果完成以上操作后仍然出现缓存命中率骤降,请继续在本 issue 分享 metadata logs。

Please include your extension version, VS Code version, chat mode, and whether the settings above were enabled.
反馈时请尽量注明插件版本、VS Code 版本、聊天模式,以及上面的开关是否已开启。

Note

2026-05-08 Update: Root cause analysis published.
Read the full write-up, solution brainstorming, join the discussion in #56.

This issue (#25) remains open for reporting new cache miss patterns and sharing diagnostic logs.

Background / 背景

Some users have reported unusually high cost in long Copilot Chat Agent conversations with DeepSeek V4 Pro. The common symptom is that prompt_cache_miss_tokens grows unexpectedly, even when the follow-up prompt is very simple.
一些用户反馈在 Copilot Chat Agent 长会话中,即使后续只是问很简单的问题,DeepSeek V4 的 prompt_cache_miss_tokens 也会异常增长,导致费用明显上升。

Symptoms / 典型现象

Please comment here if you observe one or more of the following:
如果你遇到以下任意一种情况,欢迎在本 issue 下补充日志:

  • A long Copilot Chat conversation becomes much more expensive over time.
    Copilot Chat 长会话随着轮次增加,费用明显变高。

  • A simple follow-up prompt still costs noticeably more than expected.
    只是问一个简单的后续问题,也比预期贵很多。

  • DeepSeek dashboard shows rapidly increasing prompt_cache_miss_tokens.
    DeepSeek 控制台显示 prompt_cache_miss_tokens 快速增长。

  • Creating a new Copilot Chat conversation significantly reduces cost.
    新建 Copilot Chat 对话后,费用明显下降。

  • Only a few prompts in an otherwise normal session become unusually expensive.
    整体会话大部分轮次正常,但其中少数几轮 prompt 费用异常高。

How to collect logs / 如何收集日志

Starting from v0.4.0, the normal extension build includes cache diagnostics. No special VSIX needed.
v0.4.0 开始,正式版插件已内置缓存诊断,不需要安装特殊版本。

  1. Install or update to the latest public version. 安装或更新到最新正式版。
  2. Enable metadata diagnostics in VS Code settings. This is the recommended mode for public issue reports because it avoids prompt text and full request bodies. 在 VS Code 设置中启用元数据诊断;这是公开 issue 日志推荐模式,不包含提示词原文和完整请求体:
    { "deepseek-copilot.debugMode": "metadata" }
    If you are using an older build that only has deepseek-copilot.debug, please update first. 如果你使用的旧版本只有 deepseek-copilot.debug,请先更新。
  3. Reload Window or restart VS Code. Reload Window 或重启 VS Code。
  4. Reproduce the issue in the original long conversation if possible. 尽量在原本出现费用异常的长会话里复现。

Recommended reproduction steps / 推荐复现方式

Ask 1-3 lightweight follow-up questions in the original conversation. For example:
在原本的会话中问 1-3 个轻量问题,例如:

Please briefly summarize the latest conclusion based on the current conversation context. Do not read files and do not modify files.

中文:

请基于当前对话上下文,简单总结你刚才的结论。不要读取文件,不要修改文件。

To reduce noise, please try to keep these unchanged during the test:
为了减少干扰,请尽量保持:

  • Do not switch model / 不切换模型
  • Do not switch Thinking Effort / 不切换 Thinking Effort
  • Do not switch between Chat, Ask, and Agent modes / 不切换 Chat、Ask、Agent 模式
  • Do not attach new images or files / 不附加新图片或新文件
  • Do not ask the Agent to scan the whole project / 不让 Agent 扫描整个项目
  • Do not ask the Agent to modify files / 不让 Agent 修改文件

Uploading logs / 上传日志

For metadata logs, run DeepSeek: Show Logs from the Command Palette, then save and upload the full log as a file (preferred over pasting long text).
元数据日志请运行 Command Palette 中的 DeepSeek: Show Logs,将完整日志保存为文件上传(推荐上传文件,不建议直接粘贴长文本)。

Verbose request dumps are only needed if specifically requested. You can open them with DeepSeek: Open Request Dumps Folder, but please do not upload raw verbose dumps publicly without reviewing and sanitizing them first.
只有在被明确要求时才需要提供 verbose 请求 dump。可使用 DeepSeek: Open Request Dumps Folder 打开目录,但请不要在未检查和脱敏的情况下公开上传原始 verbose dump。

If possible, please also mention: 如果方便,也请说明:

  • Model & mode used / 使用的模型和模式(Agent / Ask / Chat)
  • Whether the conversation included images or file attachments / 是否包含图片或文件附件
  • Whether VS Code was restarted or reloaded before the expensive turn / 费用异常前是否重启或 Reload

Privacy / 隐私说明

Metadata diagnostic logs include counts, lengths, hashes, model identifiers, cache statistics, and structural markers. They do not include prompt text or full request bodies.
元数据诊断日志包含计数、长度、hash、模型标识、缓存统计和结构化 marker,不包含提示词原文或完整请求体。

Verbose request dumps may include sensitive prompt text, tool schemas, file snippets, image descriptions, and other request content. Please review and sanitize them before sharing publicly.
Verbose 请求 dump 可能包含敏感提示词文本、工具定义、文件片段、图片描述以及其他请求内容。公开分享前请务必检查并脱敏。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions