1104ffe0b9
Context compression is intentionally lossy. Deployments that archive transcript evidence to an external durable store before compaction had no way to guarantee the archive actually happened: MemoryManager.on_pre_compress swallows provider failures by design, so a failed archive silently degraded into data loss. This adds an opt-in, provider-agnostic checkpoint contract: - memory_provider: PRE_COMPRESS_CHECKPOINT_API_VERSION = 1; providers opt in by advertising pre_compress_checkpoint_api_version. Version 0 keeps the historical best-effort hook semantics. - memory_manager: supports_pre_compress_checkpoint() capability probe; on_pre_compress(require_checkpoint=True) propagates checkpoint-provider failures and raises when no capable provider completed the checkpoint. - conversation_compression: new compression.checkpoint_required config key (default false, documented in cli-config.yaml.example). When enabled, compaction fails closed with BLOCKED_MISSING_PREREQUISITE (the uncompressed transcript is preserved) unless a checkpoint-capable provider confirms the durable checkpoint. Providers receive normalized direct user/assistant evidence: tool rows, system messages, tool-call wrappers, and prior compaction summaries are filtered host-side into one stable contract. codex_app_server compaction is rejected under the gate because it exposes no truthful pre-compaction transcript boundary. - hermes_state: persistent _compressed_summary column (declarative schema migration via _reconcile_columns) so summary provenance survives process restarts; only the resume model history carries the marker, keeping get_messages_as_conversation on its existing contract. - gateway: the lossy hygiene/auto-compact paths load the memory provider (skip_memory=False) so a required checkpoint also guards those rewrites. The gate arms only on an explicit boolean True (bare-MagicMock agents in existing tests have truthy auto-attributes). Default behavior is unchanged: checkpoint_required=false preserves best-effort semantics for all existing providers. Contract tests, including a restart round-trip of the summary marker, in tests/agent/test_pre_compress_checkpoint_contract.py. Refs #93986