fix(acms): harden hot/warm/cold tier service reliability #11238

Merged
HAL9000 merged 2 commits from pr-fix/9663-hot-warm-cold-tier-reliability into master 2026-05-28 21:31:23 +00:00

2 Commits

Author SHA1 Message Date
HAL9000 0fee675807 fix(context_tiers): guard cold→warm promotion against immediate eviction
CI / push-validation (pull_request) Successful in 19s
CI / helm (pull_request) Successful in 36s
CI / lint (pull_request) Successful in 47s
CI / build (pull_request) Successful in 45s
CI / quality (pull_request) Successful in 48s
CI / security (pull_request) Successful in 1m19s
CI / typecheck (pull_request) Successful in 1m28s
CI / integration_tests (pull_request) Successful in 2m56s
CI / unit_tests (pull_request) Successful in 6m8s
CI / docker (pull_request) Successful in 1m34s
CI / coverage (pull_request) Successful in 12m57s
CI / status-check (pull_request) Successful in 3s
Mirror the warm→hot budget-fallback pattern for the cold→warm promotion
path in ContextTierService.promote(). When _enforce_warm_capacity()
evicts the just-promoted fragment (because its last_accessed timestamp
predates all existing warm entries), restore it with _touch() so it
carries a current timestamp and is not immediately re-evicted.

Without this guard the fragment is silently lost from all stores while
the caller receives a stale handle with tier=WARM — identical to the
data-loss scenario the hot-budget fallback was introduced to prevent.

ISSUES CLOSED: #9663
2026-05-28 16:53:52 -04:00
HAL9000 68fa0479c0 fix(acms): harden hot/warm/cold tier service reliability
CI / push-validation (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 33s
CI / helm (pull_request) Successful in 33s
CI / build (pull_request) Successful in 33s
CI / typecheck (pull_request) Successful in 58s
CI / quality (pull_request) Successful in 59s
CI / security (pull_request) Successful in 1m14s
CI / integration_tests (pull_request) Successful in 3m51s
CI / unit_tests (pull_request) Successful in 4m32s
CI / docker (pull_request) Successful in 1m25s
CI / coverage (pull_request) Successful in 11m9s
CI / status-check (pull_request) Successful in 3s
- Remove unused conflicting _DEFAULT_* constants that conflicted with
  canonical defaults in context_tier_settings.py (which serves as the
  sole source of truth for budget/setting defaults).

- Add _enforce_warm_capacity() to enforce max_decisions_warm limit on
  warm tier after cold→warm promotion and hot-budget-fallback restore,
  preventing silent over-capacity data accumulation.

- Return deep copies (model_copy) from get_all_fragments() and
  get_hot_fragments() to prevent callers from mutating internal fragment
  state while the service holds its RLock under concurrent plan execution.

- Rename _COLD_SUMMARY_MAX_CHARS → _default_summarisation_max_chars for
  consistent snake_case naming throughout the module.

Fixes: PR #9663
2026-05-28 15:50:46 -04:00