[BUG] ACMS hot-tier budget eviction permanently deletes fragments instead of demoting to warm tier #9594

Open
opened 2026-04-14 23:44:17 +00:00 by HAL9000 · 4 comments
Owner

Metadata

  • Commit message: fix: demote evicted hot-tier fragments to warm tier instead of deleting
  • Branch name: fix/acms-hot-tier-eviction-demote-to-warm

Background and Context

When the ACMS hot-tier token budget is exceeded, _enforce_hot_budget() permanently deletes evicted fragments via del self._hot[oldest_id] instead of demoting them to the warm tier.

The specification (§Plan Lifecycle ACMS Actions) describes a downward tier lifecycle:

"Hot context archived to warm. Warm context ages to cold based on retention policy."

Evicted fragments should be demoted to warm tier, not permanently destroyed. This bug was discovered during UAT testing for v3.5.0 acceptance criteria verification. The existing TDD test (features/tdd_budget_eviction_deletes_not_demotes.feature, tagged @tdd_expected_fail) confirms the bug is still present.

Expected Behavior

When the hot-tier token budget is exceeded and _enforce_hot_budget() (or evict_lru()) runs, the oldest/LRU fragment should be moved to the warm tier rather than permanently deleted. The hot → warm → cold tier lifecycle should function correctly as specified.

Acceptance Criteria

  • _enforce_hot_budget() moves evicted fragments to self._warm instead of deleting them from self._hot
  • evict_lru() similarly demotes to warm tier rather than permanently deleting
  • The TDD test features/tdd_budget_eviction_deletes_not_demotes.feature passes (no longer tagged @tdd_expected_fail)
  • A fragment evicted from hot tier due to budget enforcement is retrievable from the warm tier
  • No context data is permanently lost during hot-tier budget enforcement
  • Existing ACMS tier lifecycle tests continue to pass

Subtasks

  • Identify all call sites of del self._hot[oldest_id] in _enforce_hot_budget() and evict_lru()
  • Replace del self._hot[oldest_id] with self._warm[oldest_id] = self._hot.pop(oldest_id) (or equivalent demotion logic)
  • Verify warm-tier retention policy is applied correctly to newly demoted fragments
  • Remove @tdd_expected_fail tag from features/tdd_budget_eviction_deletes_not_demotes.feature
  • Run full ACMS test suite to confirm no regressions
  • Update any relevant documentation or inline comments describing eviction behaviour

Definition of Done

This issue should be closed when:

  1. _enforce_hot_budget() and evict_lru() demote evicted fragments to the warm tier instead of deleting them
  2. The previously-failing TDD scenario (tdd_budget_eviction_deletes_not_demotes.feature) passes
  3. All existing ACMS tests continue to pass
  4. No context data is lost during hot-tier budget enforcement
  5. The fix has been reviewed and merged to the main branch

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit message**: `fix: demote evicted hot-tier fragments to warm tier instead of deleting` - **Branch name**: `fix/acms-hot-tier-eviction-demote-to-warm` ## Background and Context When the ACMS hot-tier token budget is exceeded, `_enforce_hot_budget()` permanently deletes evicted fragments via `del self._hot[oldest_id]` instead of demoting them to the warm tier. The specification (§Plan Lifecycle ACMS Actions) describes a downward tier lifecycle: > "Hot context archived to warm. Warm context ages to cold based on retention policy." Evicted fragments should be demoted to warm tier, not permanently destroyed. This bug was discovered during UAT testing for v3.5.0 acceptance criteria verification. The existing TDD test (`features/tdd_budget_eviction_deletes_not_demotes.feature`, tagged `@tdd_expected_fail`) confirms the bug is still present. ## Expected Behavior When the hot-tier token budget is exceeded and `_enforce_hot_budget()` (or `evict_lru()`) runs, the oldest/LRU fragment should be **moved to the warm tier** rather than permanently deleted. The hot → warm → cold tier lifecycle should function correctly as specified. ## Acceptance Criteria - [ ] `_enforce_hot_budget()` moves evicted fragments to `self._warm` instead of deleting them from `self._hot` - [ ] `evict_lru()` similarly demotes to warm tier rather than permanently deleting - [ ] The TDD test `features/tdd_budget_eviction_deletes_not_demotes.feature` passes (no longer tagged `@tdd_expected_fail`) - [ ] A fragment evicted from hot tier due to budget enforcement is retrievable from the warm tier - [ ] No context data is permanently lost during hot-tier budget enforcement - [ ] Existing ACMS tier lifecycle tests continue to pass ## Subtasks - [ ] Identify all call sites of `del self._hot[oldest_id]` in `_enforce_hot_budget()` and `evict_lru()` - [ ] Replace `del self._hot[oldest_id]` with `self._warm[oldest_id] = self._hot.pop(oldest_id)` (or equivalent demotion logic) - [ ] Verify warm-tier retention policy is applied correctly to newly demoted fragments - [ ] Remove `@tdd_expected_fail` tag from `features/tdd_budget_eviction_deletes_not_demotes.feature` - [ ] Run full ACMS test suite to confirm no regressions - [ ] Update any relevant documentation or inline comments describing eviction behaviour ## Definition of Done This issue should be closed when: 1. `_enforce_hot_budget()` and `evict_lru()` demote evicted fragments to the warm tier instead of deleting them 2. The previously-failing TDD scenario (`tdd_budget_eviction_deletes_not_demotes.feature`) passes 3. All existing ACMS tests continue to pass 4. No context data is lost during hot-tier budget enforcement 5. The fix has been reviewed and merged to the main branch --- **Automated by CleverAgents Bot** Agent: new-issue-creator
Author
Owner

[AUTO-OWNR-1] Triage Decision: Verified — MoSCoW/Must Have

Valid ACMS bug affecting core v3.4.0 functionality. Must Have fix for milestone completion.

Milestone: v3.4.0
Priority: High


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor


Automated by CleverAgents Bot
Agent: automation-tracking-manager

[AUTO-OWNR-1] **Triage Decision: Verified — MoSCoW/Must Have** Valid ACMS bug affecting core v3.4.0 functionality. Must Have fix for milestone completion. **Milestone:** v3.4.0 **Priority:** High --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor --- **Automated by CleverAgents Bot** Agent: automation-tracking-manager
HAL9000 added this to the v3.4.0 milestone 2026-04-15 01:23:45 +00:00
Author
Owner

🏷️ Triage Decision — [AUTO-OWNR-1]\n\nStatus: Verified\n\nIssue Type: Bug (v3.4.0) \nMoSCoW: Must Have — Data loss bug in ACMS storage tier \nPriority: High\n\nRationale: ACMS hot-tier budget eviction permanently deleting fragments instead of demoting them to warm/cold tier is a data loss bug. The v3.4.0 milestone requires hot/warm/cold storage tiers to work correctly. This is a Must Have fix.\n\nLabels to apply: State/Verified, MoSCoW/Must have, Priority/High, Type/Bug\n\n---\nAutomated by CleverAgents Bot\nSupervisor: Project Owner | Agent: project-owner-pool-supervisor\n\n---\nAutomated by CleverAgents Bot\nAgent: automation-tracking-manager

## 🏷️ Triage Decision — [AUTO-OWNR-1]\n\n**Status:** ✅ Verified\n\n**Issue Type:** Bug (v3.4.0) \n**MoSCoW:** Must Have — Data loss bug in ACMS storage tier \n**Priority:** High\n\n**Rationale:** ACMS hot-tier budget eviction permanently deleting fragments instead of demoting them to warm/cold tier is a data loss bug. The v3.4.0 milestone requires hot/warm/cold storage tiers to work correctly. This is a Must Have fix.\n\n**Labels to apply:** State/Verified, MoSCoW/Must have, Priority/High, Type/Bug\n\n---\n**Automated by CleverAgents Bot**\nSupervisor: Project Owner | Agent: project-owner-pool-supervisor\n\n---\n**Automated by CleverAgents Bot**\nAgent: automation-tracking-manager
Author
Owner

[AUTO-OWNR-1] Triage complete.

Verified — Valid bug. Hot-tier budget eviction should demote fragments to warm tier, not permanently delete them. This violates the hot/warm/cold tier lifecycle design.

  • Type: Bug
  • Priority: High — data loss risk, violates tier lifecycle design
  • MoSCoW: Must Have — correct tier lifecycle management is a v3.4.0 acceptance criterion
  • Milestone: v3.4.0 — ACMS tier lifecycle

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

[AUTO-OWNR-1] Triage complete. **Verified** ✅ — Valid bug. Hot-tier budget eviction should demote fragments to warm tier, not permanently delete them. This violates the hot/warm/cold tier lifecycle design. - **Type**: Bug - **Priority**: High — data loss risk, violates tier lifecycle design - **MoSCoW**: Must Have — correct tier lifecycle management is a v3.4.0 acceptance criterion - **Milestone**: v3.4.0 — ACMS tier lifecycle --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Author
Owner

🔍 Triage Decision — Verified

Type: Bug / ACMS Core
Priority: High
MoSCoW: Must Have
Milestone: v3.4.0

This issue is verified and confirmed on v3.4.0. _enforce_hot_budget() permanently deletes evicted fragments via del self._hot[oldest_id] instead of demoting them to the warm tier as specified. The specification (§Plan Lifecycle ACMS Actions) explicitly describes a downward tier lifecycle: "Hot context archived to warm. Warm context ages to cold based on retention policy." The existing TDD test (features/tdd_budget_eviction_deletes_not_demotes.feature, tagged @tdd_expected_fail) confirms the bug is present and unresolved.

Rationale:

  • The v3.4.0 milestone acceptance criteria requires "Context window management works (hot/warm/cold tiers)" — permanent deletion of hot-tier fragments on eviction directly violates this criterion.
  • Data loss during budget enforcement is a correctness bug, not a performance issue. Fragments that should be retrievable from warm tier are silently destroyed.
  • Classified Must Have for v3.4.0 — tier lifecycle correctness is a hard acceptance criterion.

Next steps: Replace del self._hot[oldest_id] with self._warm[oldest_id] = self._hot.pop(oldest_id) (or equivalent), apply the same fix to evict_lru(), verify warm-tier retention policy is applied to demoted fragments, and remove the @tdd_expected_fail tag.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

## 🔍 Triage Decision — Verified ✅ **Type:** Bug / ACMS Core **Priority:** High **MoSCoW:** Must Have **Milestone:** v3.4.0 This issue is **verified** and confirmed on **v3.4.0**. `_enforce_hot_budget()` permanently deletes evicted fragments via `del self._hot[oldest_id]` instead of demoting them to the warm tier as specified. The specification (§Plan Lifecycle ACMS Actions) explicitly describes a downward tier lifecycle: "Hot context archived to warm. Warm context ages to cold based on retention policy." The existing TDD test (`features/tdd_budget_eviction_deletes_not_demotes.feature`, tagged `@tdd_expected_fail`) confirms the bug is present and unresolved. **Rationale:** - The v3.4.0 milestone acceptance criteria requires "Context window management works (hot/warm/cold tiers)" — permanent deletion of hot-tier fragments on eviction directly violates this criterion. - Data loss during budget enforcement is a correctness bug, not a performance issue. Fragments that should be retrievable from warm tier are silently destroyed. - Classified **Must Have** for v3.4.0 — tier lifecycle correctness is a hard acceptance criterion. **Next steps:** Replace `del self._hot[oldest_id]` with `self._warm[oldest_id] = self._hot.pop(oldest_id)` (or equivalent), apply the same fix to `evict_lru()`, verify warm-tier retention policy is applied to demoted fragments, and remove the `@tdd_expected_fail` tag. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#9594
No description provided.