UAT: Duplicate StrategyCapabilities class definitions with incompatible fields across ACMS modules #4782

Open
opened 2026-04-08 18:57:10 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: ACMS — StrategyCapabilities, Context Strategy Protocol

Severity: Medium — two incompatible StrategyCapabilities classes exist in the codebase, causing type confusion and making it impossible to use the spec-required StrategyCapabilities fields in the pipeline

What Was Tested

Code-level analysis comparing the StrategyCapabilities definitions across ACMS modules.

Expected Behavior (from spec)

The spec defines a single StrategyCapabilities dataclass at docs/specification.md lines 25660-25673:

@dataclass
class StrategyCapabilities:
    """Declares what a strategy is capable of."""
    uses_text: bool = False
    uses_vector: bool = False
    uses_graph: bool = False
    uses_temporal: bool = False
    uko_levels: list[str] = field(default_factory=list)
    resource_types: list[str] = field(default_factory=list)
    supports_depth_breadth: bool = False
    supports_plan_hierarchy: bool = False
    supports_temporal: bool = False
    quality_score: float = 0.5

Actual Behavior

There are two incompatible StrategyCapabilities classes:

1. src/cleveragents/domain/models/acms/strategy.py (lines 138-186) — Pydantic model, spec-correct:

class StrategyCapabilities(BaseModel, frozen=True):
    uses_text: bool = False
    uses_vector: bool = False
    uses_graph: bool = False
    uses_temporal: bool = False
    uko_levels: tuple[str, ...] = ()
    resource_types: tuple[str, ...] = ()
    supports_depth_breadth: bool = False
    supports_plan_hierarchy: bool = False
    supports_temporal: bool = False
    quality_score: float = 0.5

2. src/cleveragents/application/services/acms_service.py (lines 102-110) — dataclass, different fields:

@dataclass(frozen=True)
class StrategyCapabilities:
    supports_semantic_search: bool = False    # ❌ not in spec
    supports_graph_navigation: bool = False   # ❌ not in spec
    supports_temporal_archaeology: bool = False  # ❌ not in spec
    max_fragments: int | None = None          # ❌ not in spec
    quality_score: float = 1.0               # ❌ wrong default (spec says 0.5)
    # Missing: uses_text, uses_vector, uses_graph, uses_temporal,
    #          uko_levels, resource_types, supports_depth_breadth,
    #          supports_plan_hierarchy

The SpecStrategyAdapter in acms_service.py (lines 319-327) bridges these by mapping:

  • spec_caps.uses_vectorsupports_semantic_search
  • spec_caps.uses_graphsupports_graph_navigation
  • spec_caps.uses_temporalsupports_temporal_archaeology

But this mapping is lossy — uses_text, uko_levels, resource_types, supports_depth_breadth, and supports_plan_hierarchy are all dropped.

Impact

  • The pipeline's StrategyCapabilities is missing 5 of the 10 spec-required fields
  • The quality_score default is 1.0 in the pipeline but 0.5 in the spec — this affects budget allocation
  • The ConfidenceWeightedSelector and ProportionalBudgetAllocator use quality_score from the pipeline's StrategyCapabilities, which may be wrong for strategies using the spec's StrategyCapabilities
  • Code using StrategyCapabilities from acms_service.py cannot access uses_text, uses_vector, etc. — it must use the renamed fields

Code Locations

  • src/cleveragents/application/services/acms_service.py lines 102-110 (wrong definition)
  • src/cleveragents/domain/models/acms/strategy.py lines 138-186 (correct definition)
  • src/cleveragents/application/services/acms_service.py lines 319-327 (lossy bridge)

Fix Required

  1. Remove the StrategyCapabilities dataclass from acms_service.py
  2. Import and use StrategyCapabilities from src/cleveragents/domain/models/acms/strategy.py throughout the pipeline
  3. Update ConfidenceWeightedSelector and ProportionalBudgetAllocator to use the spec field names (uses_text, uses_vector, etc.)
  4. Remove the SpecStrategyAdapter bridge (related to issue #4774)

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area:** ACMS — StrategyCapabilities, Context Strategy Protocol **Severity:** Medium — two incompatible `StrategyCapabilities` classes exist in the codebase, causing type confusion and making it impossible to use the spec-required `StrategyCapabilities` fields in the pipeline ### What Was Tested Code-level analysis comparing the `StrategyCapabilities` definitions across ACMS modules. ### Expected Behavior (from spec) The spec defines a single `StrategyCapabilities` dataclass at `docs/specification.md` lines 25660-25673: ```python @dataclass class StrategyCapabilities: """Declares what a strategy is capable of.""" uses_text: bool = False uses_vector: bool = False uses_graph: bool = False uses_temporal: bool = False uko_levels: list[str] = field(default_factory=list) resource_types: list[str] = field(default_factory=list) supports_depth_breadth: bool = False supports_plan_hierarchy: bool = False supports_temporal: bool = False quality_score: float = 0.5 ``` ### Actual Behavior There are **two incompatible** `StrategyCapabilities` classes: **1. `src/cleveragents/domain/models/acms/strategy.py` (lines 138-186) — Pydantic model, spec-correct:** ```python class StrategyCapabilities(BaseModel, frozen=True): uses_text: bool = False uses_vector: bool = False uses_graph: bool = False uses_temporal: bool = False uko_levels: tuple[str, ...] = () resource_types: tuple[str, ...] = () supports_depth_breadth: bool = False supports_plan_hierarchy: bool = False supports_temporal: bool = False quality_score: float = 0.5 ``` **2. `src/cleveragents/application/services/acms_service.py` (lines 102-110) — dataclass, different fields:** ```python @dataclass(frozen=True) class StrategyCapabilities: supports_semantic_search: bool = False # ❌ not in spec supports_graph_navigation: bool = False # ❌ not in spec supports_temporal_archaeology: bool = False # ❌ not in spec max_fragments: int | None = None # ❌ not in spec quality_score: float = 1.0 # ❌ wrong default (spec says 0.5) # Missing: uses_text, uses_vector, uses_graph, uses_temporal, # uko_levels, resource_types, supports_depth_breadth, # supports_plan_hierarchy ``` The `SpecStrategyAdapter` in `acms_service.py` (lines 319-327) bridges these by mapping: - `spec_caps.uses_vector` → `supports_semantic_search` - `spec_caps.uses_graph` → `supports_graph_navigation` - `spec_caps.uses_temporal` → `supports_temporal_archaeology` But this mapping is lossy — `uses_text`, `uko_levels`, `resource_types`, `supports_depth_breadth`, and `supports_plan_hierarchy` are all dropped. ### Impact - The pipeline's `StrategyCapabilities` is missing 5 of the 10 spec-required fields - The `quality_score` default is `1.0` in the pipeline but `0.5` in the spec — this affects budget allocation - The `ConfidenceWeightedSelector` and `ProportionalBudgetAllocator` use `quality_score` from the pipeline's `StrategyCapabilities`, which may be wrong for strategies using the spec's `StrategyCapabilities` - Code using `StrategyCapabilities` from `acms_service.py` cannot access `uses_text`, `uses_vector`, etc. — it must use the renamed fields ### Code Locations - `src/cleveragents/application/services/acms_service.py` lines 102-110 (wrong definition) - `src/cleveragents/domain/models/acms/strategy.py` lines 138-186 (correct definition) - `src/cleveragents/application/services/acms_service.py` lines 319-327 (lossy bridge) ### Fix Required 1. Remove the `StrategyCapabilities` dataclass from `acms_service.py` 2. Import and use `StrategyCapabilities` from `src/cleveragents/domain/models/acms/strategy.py` throughout the pipeline 3. Update `ConfidenceWeightedSelector` and `ProportionalBudgetAllocator` to use the spec field names (`uses_text`, `uses_vector`, etc.) 4. Remove the `SpecStrategyAdapter` bridge (related to issue #4774) --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium — spec compliance bug identified by UAT testing
  • Story Points: 3 (M) — targeted fix to align implementation with spec
  • MoSCoW: Must Have — spec compliance is required for correct system behavior

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium — spec compliance bug identified by UAT testing - **Story Points**: 3 (M) — targeted fix to align implementation with spec - **MoSCoW**: Must Have — spec compliance is required for correct system behavior --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:04:00 +00:00
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#4782
No description provided.