fix(read-lifecycle): persist STALE Read originals in the CCR store

ContentRouter.transform instantiated ReadLifecycleManager with
compression_store=kwargs.get("compression_store"), but no caller ever
sets that kwarg. self.store was therefore always None, so STALE/SUPERSEDED
Read markers were emitted with a SHA-256 hash but the original content
was never stored — headroom_retrieve(hash) 404'd on every Read marker,
breaking the CCR contract for the common Claude Code flow (read a file,
edit it, then want the prior content back).

Fall back to get_compression_store() when no store is explicitly injected,
matching how SmartCrusher, Kompress, and the search/log/diff/code
compressors already resolve theirs. The kwargs injection point is kept so
explicit overrides still work.
This commit is contained in:
Kiryu Tsukimiya 2026-06-27 13:34:19 +09:00
parent c632023cc1
commit dde424783f
No known key found for this signature in database

View file

@ -2417,11 +2417,12 @@ class ContentRouter(Transform):
"""
# Pre-process: Read lifecycle management (stale/superseded detection)
if self.config.read_lifecycle.enabled:
from ..cache.compression_store import get_compression_store
from .read_lifecycle import ReadLifecycleManager
lifecycle_mgr = ReadLifecycleManager(
self.config.read_lifecycle,
compression_store=kwargs.get("compression_store"),
compression_store=kwargs.get("compression_store") or get_compression_store(),
)
lifecycle_result = lifecycle_mgr.apply(
messages,