REQ-INFER-017: Prompt-prefix KV reuse never serves a stale or desynchronised cache

← Requirements

What it requires

  1. Given resident and incoming token sequences, Then warm_keep_cut reuses the common prefix, caps at len-1, and returns 0 on degenerate inputs, no shared prefix, or an occupancy mismatch.
  2. Given a multi-turn agent loop, Then per-turn prefill tokens do not grow with history.
  3. Given a hybrid model, Then kv_pos_max stays below input + max_tokens (no desync).
  4. Given the prompt cache, Then keys are content-addressed, LRU order is respected, lookup updates recency, an oversize entry is refused, and zero max_bytes disables caching.
tier
NOT_RUN

Where it lives

  • src/inference5

See it on the map

How it is met

implemented bytestsresultentropic_inference_activateentropic_inference_deactivateentropic_inference_destroyentropic_inference_loadentropic_inference_unloadentropic_create_inference_backend yields a destroyable handleabsententropic_inference_activate happy and failure pathsabsententropic_inference_activate rejects NULL handleabsententropic_inference_complete returns serialized resultabsententropic_inference_count_tokens delegates to backend when loadedabsententropic_inference_deactivate increments the counterabsententropic_inference_deactivate rejects NULL handleabsententropic_inference_destroy with nullptr is a no-opabsententropic_inference_generate catches backend exceptionsabsententropic_inference_generate returns error_code on backend failureabsententropic_inference_generate returns serialized JSON resultabsententropic_inference_generate_streaming fires the token callbackabsententropic_inference_generate_streaming respects cancel flagabsententropic_inference_generate_with_cancel aborts mid-decode when flag setabsententropic_inference_generate_with_cancel completes when not cancelledabsententropic_inference_generate_with_cancel honors a NULL cancel pointerabsententropic_inference_load catches exceptions and returns LOAD_FAILEDabsententropic_inference_load forwards successabsententropic_inference_load parses ModelConfig JSON fieldsabsententropic_inference_load rejects NULL handleabsententropic_inference_load returns LOAD_FAILED on backend failureabsententropic_inference_state returns the backend's state enumabsententropic_inference_unload increments the counterabsententropic_inference_unload rejects NULL handleabsentinference C ABI: exception paths + parse_params field sweepabsent

Show on the map

Implemented by

Tests (25)

Reached through calls

25 tests: 25 absent

testresultlinked byimplementers exercisedcalls away
inference C ABI: exception paths + parse_params field sweepabsentinferred4 of 5: entropic_inference_activate, entropic_inference_deactivate, entropic_inference_load, entropic_inference_unload1
entropic_inference_deactivate increments the counterabsentinferred3 of 5: entropic_inference_activate, entropic_inference_deactivate, entropic_inference_load1
entropic_inference_activate happy and failure pathsabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_complete returns serialized resultabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate catches backend exceptionsabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate returns error_code on backend failureabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate returns serialized JSON resultabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate_streaming fires the token callbackabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate_streaming respects cancel flagabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate_with_cancel aborts mid-decode when flag setabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate_with_cancel completes when not cancelledabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_generate_with_cancel honors a NULL cancel pointerabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_state returns the backend's state enumabsentinferred2 of 5: entropic_inference_activate, entropic_inference_load1
entropic_inference_unload increments the counterabsentinferred2 of 5: entropic_inference_load, entropic_inference_unload1
entropic_create_inference_backend yields a destroyable handleabsentinferred1 of 5: entropic_inference_destroy1
entropic_inference_activate rejects NULL handleabsentinferred1 of 5: entropic_inference_activate1
entropic_inference_count_tokens delegates to backend when loadedabsentinferred1 of 5: entropic_inference_load1
entropic_inference_deactivate rejects NULL handleabsentinferred1 of 5: entropic_inference_deactivate1
entropic_inference_destroy with nullptr is a no-opabsentinferred1 of 5: entropic_inference_destroy1
entropic_inference_load catches exceptions and returns LOAD_FAILEDabsentinferred1 of 5: entropic_inference_load1
entropic_inference_load forwards successabsentinferred1 of 5: entropic_inference_load1
entropic_inference_load parses ModelConfig JSON fieldsabsentinferred1 of 5: entropic_inference_load1
entropic_inference_load rejects NULL handleabsentinferred1 of 5: entropic_inference_load1
entropic_inference_load returns LOAD_FAILED on backend failureabsentinferred1 of 5: entropic_inference_load1
entropic_inference_unload rejects NULL handleabsentinferred1 of 5: entropic_inference_unload1