Skip to content

Muse Spark 1.2 intermittent prompt cache miss on Zen Go #45867

Closed as not planned

Description

@ricklee0411

Description

We observed an unexpected prompt cache miss on the Zen Go Responses API.

Endpoint:
https://opencode.ai/zen/go/v1/responses

Model:
muse-spark-1.2-contributor

Timestamp:
2026-08-28 06:47:05.310 GMT
2026-08-28 14:47:05.310 Asia/Shanghai

x-opencode-session / prompt_cache_key:
137:web_chat:f745dfe9-23f6-4ab9-bb2c-eb95e49d8de7

Upstream response ID:
resp_6a912ee9cd9eadb49d7543a0

Client request ID:
07bdc822-35df-4eb2-bab9-e19497ee96a1

Cache sequence:

  • Previous request: 22,756 prompt tokens, 22,193 cached tokens
  • Affected request: 23,167 prompt tokens, 0 cached tokens
  • Next request: 30,682 prompt tokens, 23,153 cached tokens

The affected request preserved the previous request byte-identically
and only appended two input items. Tool definitions and model parameters
were unchanged.

Another independent session using the same model also changed from
26,161 cached tokens to 0 at 2026-08-28 06:47:13 GMT.

Could you check:

  1. Which upstream provider and route handled these requests?
  2. Whether the provider changed between the previous, affected, and next requests?
  3. Whether stickyProvider is enabled for muse-spark-1.2-contributor?
  4. Whether x-opencode-session was received and used as the sticky routing key?
  5. Whether the miss was caused by cache eviction, provider failover, or routing pool changes?

Plugins

requests were sent through the Zen HTTP API via LiteLLM

OpenCode version

not using the OpenCode client

Steps to reproduce

Send consecutive Responses API requests with the same x-opencode-session and an unchanged prefix, then inspect usage.prompt_tokens_details.cached_tokens. The failure is intermittent.

Screenshot and/or share link

No response

Operating System

server-side Zen API issue

Terminal

server-side Zen API issue

Activity

  1. github-actions commented on Aug 28, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • OpenCode version is empty (_No response_). Please provide the version you are using.
    • Steps to reproduce is empty. Even for backend/routing investigations, please describe how to observe or trigger the behavior (e.g., what prompt pattern, model, or session setup reliably causes the cache miss).
    • Operating System is empty. Please fill it in even if the issue appears server-side.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. ricklee0411 commented on Aug 28, 2026

    @ricklee0411
    Author

    Possibly related to #35402, which reports intermittent cold-cache rerouting for another Zen model despite stable request prefixes.

  3. github-actions commented on Aug 28, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! The report now includes all the necessary details and looks good. We appreciate you providing the session IDs, token counts, and reproduction steps.

  4. ricklee0411 commented on Aug 28, 2026

    @ricklee0411
    Author

    Session:
    137:web_chat:ddaa1f1b-3f93-4ad3-b109-be80b152e4ee

    The same LiteLLM deployment was used for all 16 requests:
    d8354a69-2986-4f0a-9885-9fb09bf6257f

    Three unexpected cache misses occurred:

    Time GMT LiteLLM call ID Upstream response ID Prompt tokens Cached tokens
    06:47:13.366 2f12e4c0-02bc-4e96-839e-19c2b1b28592 resp_6a912ef2c15872334bbc4abe 27,463 0
    06:51:00.724 c9ce9719-854f-4351-b64f-5eb8aaf10f18 resp_6a912fd5c7421bb8b0304efc 28,536 0
    06:52:41.141 ea0549be-a4fd-40ab-a32b-a4da733d5893 resp_6a91303919ff590a64654611 29,052 0

    For every miss:

    • The existing input prefix was byte-identical.
    • Only two new input items were appended.
    • Tools, request parameters, deployment and session metadata were unchanged.
    • No retries or LiteLLM fallback occurred.
    • The next request returned to a normal cache hit.
    • The request was billed at the full uncached input price.

    The misses occurred 63.5s, 64.0s and 64.8s after the previous
    response completed. Other requests with similar gaps still hit the cache,
    so this does not appear to be a simple fixed cache TTL.

  5. ricklee0411 commented on Aug 28, 2026

    @ricklee0411
    Author

    Added a second session with three confirmed full-billing cache misses; prefixes, tools, deployment, session metadata, and request parameters remained unchanged.

  6. rhaenni commented on Sep 3, 2026

    @rhaenni

    Same symptom, observed from the OpenCode client (not LiteLLM) — so this also affects the vanilla client path.

    Client: OpenCode TUI v1.18.27
    Model: muse-spark-1.3-contributor via opencode-go (Zen Go)
    Session: ses_f98bb8516ffeLqZ6LUmJQ0elIg

    9 full/partial cache misses in ~11 minutes (13:19:27–13:30:41 GMT) during a single
    agent session, all mid tool-loop while only appending tool results (psql/grep/read — no
    user message, no todo update, no parameter change). 4 of them were billed at full uncached
    input price ($0.0104–$0.0132/request vs $0.0003–$0.0005 baseline, ~110–150k input tokens each).

    Time GMT Prompt tokens Cached tokens Billed uncached
    13:19:27 102,542 1,393 101,149
    13:20:12 103,791 7,857 95,934
    13:20:45 104,150 241 103,909
    13:21:10 107,934 7,857 100,077
    13:22:12 110,984 7,857 103,127 ($0.0104)
    13:24:49 113,298 7,857 105,441 ($0.0106)
    13:26:34 125,691 177 125,514 ($0.0132)
    13:27:31 130,563 1,393 129,170 ($0.0130)
    13:30:41 147,947 177 147,770

    Evidence the client is not changing the prefix:

    • Between misses, cache reads grow in lockstep with prompt growth for 10–15 consecutive
      requests (e.g. 130,545 → 131,761 → 132,593 → 133,809 → 135,025 → 135,729 → 136,113 →
      … → 144,241), i.e. the serialized conversation is byte-identical and append-only.
    • A todowrite mid-streak was followed by an immediate full cache hit (rules out todo
      injection as the cause). Tool-output pruning occurred exactly once in the whole session.
    • Not a TTL effect: misses occurred 11–32s after the previous response, while other
      requests with 54–61s gaps still hit.
    • After every miss, the next request returns to a full hit (e.g. miss with 241 cached at
      13:20:45 → 104,113 cached 5s later) — consistent with a routing hop to a differently-warmed
      upstream, re-writing the cache there, then sticking again.

    Most telling detail: cached_tokens on the miss requests snaps to a small set of exact
    recurring values — {177, 241, 1393, 2353, 6193, 7857} — with the same values repeating
    exactly across 20 minutes (7857 ×5). These look like fixed structural boundaries of the
    prompt (tool definitions / system prompt) that are warm on the upstream, while the
    per-session conversation tail is not. That points at cache partitioning across upstream
    replicas/tiers rather than eviction or client-side prefix changes.

    Same questions as the OP, plus:

    1. Is sticky routing per x-opencode-session enabled for muse-spark-1.3-contributor?
    2. Do the recurring cached-token boundaries (177 / 1393 / 7857) correspond to system+tools
      prefix tiers shared across sessions?
  7. neriousy commented on Oct 21, 2026

    @neriousy
    Member

    Thanks for the detailed request IDs and timestamps. Muse Spark prompt caching on Go has been fixed since this was reported, so these intermittent full-price misses shouldn't happen anymore. Closing because there's been no activity for a while. If you still see cache misses on Muse Spark with an unchanged prefix, comment here with the time, session ID and request IDs from the console logs and we'll reopen it.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions