Silent and Costly: Characterizing and Detecting Prompt-Caching Mis-Integration in LLM Agents
Organizations: Wake Forest University Winston-Salem, USA · Griffith University Gold Coast, Australia · Nanyang Technological University Singapore · University of New South Wales Sydney, Australia ·
Abstract
Large language model (LLM) services process massive volumes of user requests, resulting in substantial inference costs. To reduce both cost and latency, providers have introduced prompt caching. However, correctly integrating prompt caching is non-trivial due to heterogeneous provider-specific APIs and continuously evolving caching semantics. To understand prompt-caching mis-integration in downstream applications, we conduct the first empirical study of 120 prompt-caching-related pull requests from 10 popular open-source agent systems. Our findings show that prompt-caching mis-integrations arise in both request-side misconfiguration and read-side usage miscount. More importantly, most mis-integrations fail silently without causing observable runtime failures. Motivated by these findings, we design CACHELINT, which models a prompt-caching mis-integration as an invocation site together with the preconditions required for correct cache integration. CACHELINT locates caching invocation sites with CodeQL and discharges each precondition either against a dated provider capability oracle or with an LLM guard check. CACHELINT achieves 0.71 precision and 0.78 recall in identifying the 120 labeled mis-integrations across the 10 studied agent systems. Our evaluation further demonstrates the effectiveness of CACHELINT in real-world settings, identifying 32 mis-integrations across 571 agent projects with 0.86 precision. These findings have received 21 developer confirmations and led to 18 upstream fixes, including one in Anthropic's official SDK.
Figures & tables
| Project | #Star | #PR | #PC |
|---|---|---|---|
| OpenClaw [ 23 ] | |||
| Hermes-Agent [ 24 ] | |||
| AutoGPT [ 25 ] | |||
| OpenCode [ 26 ] | |||
| LobeHub [ 27 ] | |||
| OpenHands [ 28 ] |
| Type | Root cause | # | % | Description | Symptom | Fixing strategy |
| Request side 97 (81%) | Provider compatibility | 47 | 39 | |||
| Model-name gating | 37 | 31 | A hardcoded model-name check guards caching; a new model fails it. | Silent | Capability lookup | |
| Incompatible marker | 10 | 8 | The cache marker’s format is one the provider rejects. | Crash | Marker guard | |
| Prefix stability | 41 | 34 | ||||
| Prefix reassembly | 15 | 13 | Each call rebuilds the prefix in a different order, breaking the byte-exact match. | Silent | Cache-boundary fix | |
| Volatile value | 13 | 11 | A per-request value (timestamp, UUID) is embedded in the cached prefix. | Silent | Cache-boundary fix |
| Configuration | TP | FP | Precision |
|---|---|---|---|
| CacheLint (full) | 32 | 5 | 0.86 |
| w/o guard check | 18 | 41 | 0.31 |
| w/o oracle | 17 | 349 | 0.05 |
LLM Agent Reliability
Large language model (LLM) agent reliability concerns dependable, safe, and verifiable behavior across tools, multi-step tasks, and changing environments.
See all 832 papers