Per-session SHA-256 fingerprint of the cache hot zone (system / tools /
first 3 messages) with structured-log emission on drift. Detector is
read-only: never mutates request bytes, preserves the Phase A
passthrough invariant. Surfaces invisible cache busts (system prompt
edited mid-session, tools reshuffled, early message changed) without
rewriting them.
* crates/headroom-proxy/src/cache_stabilization/drift_detector.rs:
StructuralHash (system, tools, early_messages digests),
compute_structural_hash, observe_drift, derive_session_key,
DriftState (LRU bounded to 1000 sessions in production).
* Session keys derive from Authorization / x-api-key / client IP /
(IP, user-agent). Bearer tokens and API keys are SHA-256 hashed
before they ever reach the log line; the raw secret is never logged.
* Wired into forward_http after the body is buffered, before the
compression dispatcher runs. Skips paths whose wire shape is not
Anthropic / OpenAI Chat / OpenAI Responses.
* AppState gains drift_state: DriftState. Bedrock unit-test
literal-construction sites updated.
* 14 unit tests + 1 integration test covering first-request,
no-drift, per-dimension drift, multi-dim drift, LRU eviction,
non-mutation invariant, and bearer-token-never-logged.
Adds lru = "0.12" and promotes sha2 = "0.10" to a normal dependency
on headroom-proxy.