[BUG] ACMSPipeline SpecStrategyAdapter bypasses all backend retrieval — pipeline never queries TextBackend, VectorBackend, GraphBackend, or TemporalBackend #9155

Open
opened 2026-04-14 08:46:59 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: fix(acms): refactor ACMSPipeline to invoke spec strategy assemble() with real backend instances
  • Branch: bugfix/m5-acms-spec-strategy-adapter-bypasses-backend-retrieval

Background and Context

Feature Area: ACMS & Context Management
Spec Reference: ADR-014 (Context Management / ACMS) — "Multiple strategies run in parallel and their results are fused"; spec §25207-25216 (Built-in Strategies); docs/reference/context_strategies.md — "All six built-in strategies now implement real backend-driven retrieval logic (v3.8.0+)"

The ACMSPipeline in src/cleveragents/application/services/acms_service.py wraps all 6 spec-required built-in strategies (simple-keyword, semantic-embedding, breadth-depth-navigator, arce, temporal-archaeology, plan-decision-context) in SpecStrategyAdapter instances. The adapter was introduced as a bridge because the pipeline's assemble(fragments, budget) signature differs from the spec strategy's assemble(request, backends, budget, plan_context) signature.

Expected Behavior

When the ACMSPipeline assembles context using any of the 6 spec-required built-in strategies, each strategy should query its respective backend (TextBackend, VectorBackend, GraphBackend, TemporalBackend) to retrieve context fragments. Per ADR-014, multiple strategies run in parallel and their results are fused.

Actual Behavior

The SpecStrategyAdapter.assemble() method ignores the wrapped strategy's retrieval logic entirely and falls back to pure relevance-based ranking of pre-fetched fragments:

# SpecStrategyAdapter.assemble() in acms_service.py
def assemble(self, fragments, budget):
    # "Since the spec strategy requires backends that are not available
    #  in the pipeline's fragment-ranking phase, this adapter falls back
    #  to relevance-based ranking of the pre-fetched fragments."
    sorted_frags = sorted(fragments, key=lambda f: f.relevance_score, reverse=True)
    return _pack_budget(sorted_frags, budget)

This means no backend is ever queried during pipeline assembly. The strategy_stubs.py implementations of SimpleKeywordStrategy.assemble(), SemanticEmbeddingStrategy.assemble(), BreadthDepthNavigatorStrategy.assemble(), etc. — which contain real TextBackend.search(), VectorBackend.similarity_search(), and GraphBackend.traverse() calls — are never invoked through the pipeline.

Steps to Reproduce:

  1. Instantiate ACMSPipeline() — it registers all 6 spec strategies via SpecStrategyAdapter
  2. Call pipeline.assemble(plan_id=..., fragments=[], budget=..., strategy="simple-keyword")
  3. Observe: no TextBackend.search() is called; fragments are only ranked by relevance score
  4. The pipeline produces identical output regardless of which strategy is selected (all adapters do the same relevance sort)

Root Cause: SpecStrategyAdapter was introduced as a bridge because the pipeline's assemble(fragments, budget) signature differs from the spec strategy's assemble(request, backends, budget, plan_context) signature. The adapter bridges the gap by discarding the backend-driven retrieval and falling back to ranking. The code comment acknowledges this: "When issue #3491 is resolved (protocol consolidation), these adapters can be replaced with direct registrations."

Impact: The ACMS pipeline produces no backend-retrieved context. All context assembly is purely relevance-score sorting of whatever fragments are passed in — backends are never consulted. This makes the entire ACMS retrieval system non-functional.

Acceptance Criteria

  • ACMSPipeline.assemble() invokes each strategy's assemble(request, backends, budget, plan_context) with real backend instances
  • TextBackend.search() is called when simple-keyword strategy is active
  • VectorBackend.similarity_search() is called when semantic-embedding strategy is active
  • GraphBackend.traverse() is called when breadth-depth-navigator strategy is active
  • SpecStrategyAdapter is removed or replaced with a proper bridge that invokes backend retrieval
  • All existing pipeline tests pass
  • New integration tests added and passing

Subtasks

  • Refactor ACMSPipeline to pass ContextRequest and BackendSet to strategy assemble() calls
  • Remove SpecStrategyAdapter or replace it with a proper bridge that invokes backend retrieval
  • Add integration tests verifying each built-in strategy queries its backend during pipeline assembly
  • Update docs/reference/acms.md v1 Known Limitations table to reflect resolution

Definition of Done

  • ACMSPipeline.assemble() invokes each strategy's assemble(request, backends, budget, plan_context) with real backend instances
  • TextBackend.search() is called when simple-keyword strategy is active
  • VectorBackend.similarity_search() is called when semantic-embedding strategy is active
  • GraphBackend.traverse() is called when breadth-depth-navigator strategy is active
  • All existing pipeline tests pass
  • New integration tests added and passing
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `fix(acms): refactor ACMSPipeline to invoke spec strategy assemble() with real backend instances` - **Branch**: `bugfix/m5-acms-spec-strategy-adapter-bypasses-backend-retrieval` ## Background and Context **Feature Area**: ACMS & Context Management **Spec Reference**: ADR-014 (Context Management / ACMS) — "Multiple strategies run in parallel and their results are fused"; spec §25207-25216 (Built-in Strategies); `docs/reference/context_strategies.md` — "All six built-in strategies now implement real backend-driven retrieval logic (v3.8.0+)" The `ACMSPipeline` in `src/cleveragents/application/services/acms_service.py` wraps all 6 spec-required built-in strategies (`simple-keyword`, `semantic-embedding`, `breadth-depth-navigator`, `arce`, `temporal-archaeology`, `plan-decision-context`) in `SpecStrategyAdapter` instances. The adapter was introduced as a bridge because the pipeline's `assemble(fragments, budget)` signature differs from the spec strategy's `assemble(request, backends, budget, plan_context)` signature. ## Expected Behavior When the `ACMSPipeline` assembles context using any of the 6 spec-required built-in strategies, each strategy should query its respective backend (TextBackend, VectorBackend, GraphBackend, TemporalBackend) to retrieve context fragments. Per ADR-014, multiple strategies run in parallel and their results are fused. ## Actual Behavior The `SpecStrategyAdapter.assemble()` method **ignores the wrapped strategy's retrieval logic entirely** and falls back to pure relevance-based ranking of pre-fetched fragments: ```python # SpecStrategyAdapter.assemble() in acms_service.py def assemble(self, fragments, budget): # "Since the spec strategy requires backends that are not available # in the pipeline's fragment-ranking phase, this adapter falls back # to relevance-based ranking of the pre-fetched fragments." sorted_frags = sorted(fragments, key=lambda f: f.relevance_score, reverse=True) return _pack_budget(sorted_frags, budget) ``` This means no backend is ever queried during pipeline assembly. The `strategy_stubs.py` implementations of `SimpleKeywordStrategy.assemble()`, `SemanticEmbeddingStrategy.assemble()`, `BreadthDepthNavigatorStrategy.assemble()`, etc. — which contain real `TextBackend.search()`, `VectorBackend.similarity_search()`, and `GraphBackend.traverse()` calls — are **never invoked** through the pipeline. **Steps to Reproduce**: 1. Instantiate `ACMSPipeline()` — it registers all 6 spec strategies via `SpecStrategyAdapter` 2. Call `pipeline.assemble(plan_id=..., fragments=[], budget=..., strategy="simple-keyword")` 3. Observe: no `TextBackend.search()` is called; fragments are only ranked by relevance score 4. The pipeline produces identical output regardless of which strategy is selected (all adapters do the same relevance sort) **Root Cause**: `SpecStrategyAdapter` was introduced as a bridge because the pipeline's `assemble(fragments, budget)` signature differs from the spec strategy's `assemble(request, backends, budget, plan_context)` signature. The adapter bridges the gap by discarding the backend-driven retrieval and falling back to ranking. The code comment acknowledges this: "When issue #3491 is resolved (protocol consolidation), these adapters can be replaced with direct registrations." **Impact**: The ACMS pipeline produces no backend-retrieved context. All context assembly is purely relevance-score sorting of whatever fragments are passed in — backends are never consulted. This makes the entire ACMS retrieval system non-functional. ## Acceptance Criteria - [ ] `ACMSPipeline.assemble()` invokes each strategy's `assemble(request, backends, budget, plan_context)` with real backend instances - [ ] `TextBackend.search()` is called when `simple-keyword` strategy is active - [ ] `VectorBackend.similarity_search()` is called when `semantic-embedding` strategy is active - [ ] `GraphBackend.traverse()` is called when `breadth-depth-navigator` strategy is active - [ ] `SpecStrategyAdapter` is removed or replaced with a proper bridge that invokes backend retrieval - [ ] All existing pipeline tests pass - [ ] New integration tests added and passing ## Subtasks - [ ] Refactor `ACMSPipeline` to pass `ContextRequest` and `BackendSet` to strategy `assemble()` calls - [ ] Remove `SpecStrategyAdapter` or replace it with a proper bridge that invokes backend retrieval - [ ] Add integration tests verifying each built-in strategy queries its backend during pipeline assembly - [ ] Update `docs/reference/acms.md` v1 Known Limitations table to reflect resolution ## Definition of Done - [ ] `ACMSPipeline.assemble()` invokes each strategy's `assemble(request, backends, budget, plan_context)` with real backend instances - [ ] `TextBackend.search()` is called when `simple-keyword` strategy is active - [ ] `VectorBackend.similarity_search()` is called when `semantic-embedding` strategy is active - [ ] `GraphBackend.traverse()` is called when `breadth-depth-navigator` strategy is active - [ ] All existing pipeline tests pass - [ ] New integration tests added and passing - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - [ ] The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - [ ] The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
HAL9000 added this to the v3.4.0 milestone 2026-04-14 09:27:12 +00:00
Author
Owner

Triage: Verified [AUTO-OWNR-1]

CRITICAL BUG: ACMSPipeline SpecStrategyAdapter bypasses ALL backend retrieval — the pipeline never queries TextBackend, VectorBackend, GraphBackend, or TemporalBackend. This means the entire ACMS context assembly pipeline is non-functional — it never retrieves any context from any backend.

Assigning to v3.4.0 (ACMS v1 + Context Scaling) as this is the core ACMS pipeline. Priority Critical — the ACMS pipeline is completely broken; no context is ever retrieved from backends.

MoSCoW: Must Have — the ACMS pipeline cannot be considered functional without backend retrieval working. This is a blocking defect for the v3.4.0 milestone.


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

✅ **Triage: Verified** [AUTO-OWNR-1] **CRITICAL BUG**: `ACMSPipeline SpecStrategyAdapter` bypasses ALL backend retrieval — the pipeline never queries `TextBackend`, `VectorBackend`, `GraphBackend`, or `TemporalBackend`. This means the entire ACMS context assembly pipeline is non-functional — it never retrieves any context from any backend. Assigning to **v3.4.0** (ACMS v1 + Context Scaling) as this is the core ACMS pipeline. Priority **Critical** — the ACMS pipeline is completely broken; no context is ever retrieved from backends. MoSCoW: **Must Have** — the ACMS pipeline cannot be considered functional without backend retrieval working. This is a blocking defect for the v3.4.0 milestone. --- **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#9155
No description provided.