Skip to content

[Bug]: Prompt-cache reads drop with no tracked cache input change #82939

Description

@galiniliev

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Prompt-cache read tokens can drop sharply on repeated Azure OpenAI Responses turns even when OpenClaw reports no tracked cache input change.

Steps to reproduce

  1. Run repeated same-session OpenClaw agent turns against Azure OpenAI Responses with prompt-cache observability enabled.
  2. Keep the tracked cache inputs unchanged between adjacent calls.
  3. Observe [prompt-cache] cache read dropped ...; no tracked cache input change in the gateway logs.

Expected behavior

When the same session keeps the tracked prompt-cache inputs stable, OpenClaw should keep the OpenAI-compatible request payload prefix stable so cache-read tokens do not sharply drop for an untracked payload-order change.

Actual behavior

Gateway logs show prompt-cache read drops even though the diagnostic reports no tracked cache input change.

OpenClaw version

NOT_ENOUGH_INFO

Operating system

NOT_ENOUGH_INFO

Install method

NOT_ENOUGH_INFO

Model

azure-openai-responses/gpt-5.3-codex

Provider / routing chain

OpenClaw -> Azure OpenAI Responses

Additional provider/model setup details

The observed request route was boundary-aware:openai-responses. Private session, job, and local setup identifiers are omitted.

Logs, screenshots, and evidence

[prompt-cache] cache read dropped 793472 -> 649216 for azure-openai-responses/gpt-5.3-codex via boundary-aware:openai-responses; no tracked cache input change
[prompt-cache] cache read dropped 822400 -> 325888 ...; no tracked cache input change
[prompt-cache] cache read dropped 1228160 -> 414336 ...; no tracked cache input change

Impact and severity

Affected: same-session OpenAI-compatible Responses runs using prompt caching.
Severity: Medium.
Frequency: 44 observed log lines matching prompt-cache in the local evidence bundle.
Consequence: cache efficiency can drop sharply without an actionable tracked-input explanation, increasing latency/cost and hiding the request payload ordering cause from diagnostics.

Additional information

Current code tracked the tool set as sorted names, but OpenAI Responses and Chat Completions payload builders serialized tools in caller order. If the same tool set arrived in a different order, request bytes changed while the prompt-cache diagnostic still reported no tracked cache input change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingimpact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.maintainerMaintainer-authored PR

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions