[GH-ISSUE #452] [Issue]: Caching appears broken #200

Closed
opened 2026-10-20 17:26:10 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @xDanteMD on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/452

Description

DeepSeek's native prefix caching (the cached_tokens metric in API responses) stopped producing cache hits after upgrading from v1.5.7 to v1.5.8. Rolling back to v1.5.7 restores normal cache behavior (~80% cache hit rate on multi-turn conversations).

Steps to Reproduce

  1. Use DeepSeek models (v4-pro, v4-flash, chat) via direct API
  2. Enable debug mode (Settings → Advanced → Debug)
  3. Send 3+ messages in a Roleplay chat
  4. Check server console for [debug] Token usage — cached:

Expected

cached: ~7000-8000 (majority of prompt tokens served from cache on turn 2+)

Actual (v1.5.8)

cached: 0 on every turn, even in brand-new chats with no lorebooks active
Sometimes cached:128 (that SPECIFIC number, if at all, on few attempts)

Confirmed Working

git checkout v1.5.7 — caching immediately returns to normal

Environment

  • Marinara Engine: v1.5.8 (broken), v1.5.7 (working)
  • Model: deepseek-v4-flash (also tested deepseek-v4-pro)
  • Provider: OpenAI-compatible (direct)
  • Mode: Roleplay
  • OS: Windows 10 x64

Notes

  • Issue persists with lorebooks completely disabled
  • Not limited to existing chats; new chats also affected
  • The v1.5.8 diff touches prompt construction (appendReadableAttachmentsToContent, DM command injection, SSE parsing refactor). Suspect a change to message assembly is producing non-deterministic prompt prefixes that invalidate DeepSeek's disk cache.

Logs, screenshots, or video

Additional context

Fresh install of 1.5.8 was reattempted prior to report. OpenCode (Deepseek V4 Pro via API) was used to analyze the application and also wrote this report (Because I'm too dumb to know how all this works, but it spent a good amount of time trying to track down the issue and about 300k tokens)
Confirmed it's not a machine-specific issue enjoying 70M tokens of RP on Deepseek prior to this occurence - worked flawlessly despite chaotic testing in multiple scenarios (lorebooks, agents, pushing buttons), correct caching each time.
Confirmed not Deepseek specific via Platform (my BYOK client as well as OpenCode cached just fine, as well as past reverting to 1.5.7).

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • [] I DID NOT read this template and provide the requested details.
Originally created by @xDanteMD on GitHub (May 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/452 ## Description DeepSeek's native prefix caching (the `cached_tokens` metric in API responses) stopped producing cache hits after upgrading from v1.5.7 to v1.5.8. Rolling back to v1.5.7 restores normal cache behavior (~80% cache hit rate on multi-turn conversations). ## Steps to Reproduce 1. Use DeepSeek models (v4-pro, v4-flash, chat) via direct API 2. Enable debug mode (Settings → Advanced → Debug) 3. Send 3+ messages in a Roleplay chat 4. Check server console for `[debug] Token usage — cached:` ## Expected `cached: ~7000-8000` (majority of prompt tokens served from cache on turn 2+) ## Actual (v1.5.8) `cached: 0` on every turn, even in brand-new chats with no lorebooks active Sometimes cached:128 (that SPECIFIC number, if at all, on few attempts) ## Confirmed Working `git checkout v1.5.7` — caching immediately returns to normal ## Environment - Marinara Engine: v1.5.8 (broken), v1.5.7 (working) - Model: deepseek-v4-flash (also tested deepseek-v4-pro) - Provider: OpenAI-compatible (direct) - Mode: Roleplay - OS: Windows 10 x64 ## Notes - Issue persists with lorebooks completely disabled - Not limited to existing chats; new chats also affected - The v1.5.8 diff touches prompt construction (appendReadableAttachmentsToContent, DM command injection, SSE parsing refactor). Suspect a change to message assembly is producing non-deterministic prompt prefixes that invalidate DeepSeek's disk cache. ## Logs, screenshots, or video <!-- Paste relevant logs and add screenshots when possible --> ## Additional context Fresh install of 1.5.8 was reattempted prior to report. OpenCode (Deepseek V4 Pro via API) was used to analyze the application and also wrote this report (Because I'm too dumb to know how all this works, but it spent a good amount of time trying to track down the issue and about 300k tokens) Confirmed it's not a machine-specific issue enjoying 70M tokens of RP on Deepseek prior to this occurence - worked flawlessly despite chaotic testing in multiple scenarios (lorebooks, agents, pushing buttons), correct caching each time. Confirmed not Deepseek specific via Platform (my BYOK client as well as OpenCode cached just fine, as well as past reverting to 1.5.7). ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:26:10 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@xDanteMD commented on GitHub (May 6, 2026):

https://github.com/deepseek-ai/DeepSeek-V3/issues/1261

Appears to be a known issue and is inconsistent, on their end. Mea culpa.

<!-- gh-comment-id:4384621755 --> @xDanteMD commented on GitHub (May 6, 2026): https://github.com/deepseek-ai/DeepSeek-V3/issues/1261 Appears to be a known issue and is inconsistent, on their end. Mea culpa.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#200
No description provided.