UAT: ACMSPipeline.assemble() ignores ContextRequest CRP fields — preferred_strategies and required_backends have no effect #3980

Open
opened 2026-04-06 08:14:22 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: bugfix/acms-crp-preferred-strategies-ignored
  • Commit Message: fix(acms): honour CRP preferred_strategies and required_backends in pipeline
  • Milestone: (backlog — no milestone assigned)
  • Parent Epic: #396

Background and Context

The Context Request Protocol (CRP) is the structured vocabulary through which actors declare what information they need, as defined in docs/specification.md. The ContextRequest model (src/cleveragents/domain/models/acms/crp.py) includes two fields intended to influence strategy selection in the ACMS pipeline:

  • preferred_strategies: a list of preferred context strategies the actor wants applied
  • required_backends: a list of required data backends the actor needs consulted

These fields are part of the CRP contract and are expected to influence how ACMSPipeline.assemble() selects and executes context strategies.

Current Behavior

ACMSPipeline.assemble() accepts a request: ContextRequest | None parameter but passes it only to BudgetAllocator.allocate(). The DefaultBudgetAllocator ignores the request parameter entirely. The DefaultStrategySelector.select() never receives the ContextRequest at all — it only receives a plain dict with the strategy name hint.

# In ACMSPipeline.assemble():
allocations = self._budget_allocator.allocate(
    candidates,
    budget.available_tokens,
    request,  # <-- passed here but ignored by DefaultBudgetAllocator
)

The preferred_strategies and required_backends fields are never consulted during strategy selection or execution.

Affected code locations:

  • src/cleveragents/application/services/acms_service.pyACMSPipeline.assemble()
  • src/cleveragents/application/services/acms_service.pyDefaultBudgetAllocator.allocate()
  • src/cleveragents/domain/models/acms/crp.pyContextRequest

Expected Behavior

Per the spec, the ACMS pipeline should use ContextRequest.preferred_strategies to influence which strategies are selected and ContextRequest.required_backends to ensure required backends are consulted. When a ContextRequest is provided:

  1. DefaultStrategySelector.select() (or equivalent) should receive and honour preferred_strategies — preferring those strategies over others when available.
  2. DefaultBudgetAllocator.allocate() should honour required_backends — ensuring allocations cover required backends.

Steps to Reproduce

  1. Create a ContextRequest with preferred_strategies=["recency"]
  2. Call pipeline.assemble(plan_id=..., fragments=..., budget=..., strategy="relevance", request=crp_request)
  3. Observe that the preferred_strategies hint is completely ignored — the relevance strategy is used regardless of the preferred_strategies field

Acceptance Criteria

  • ACMSPipeline.assemble() passes the ContextRequest to the strategy selector so preferred_strategies can influence strategy selection
  • DefaultStrategySelector.select() (or equivalent) honours preferred_strategies when a ContextRequest is provided — preferring listed strategies over others when available
  • DefaultBudgetAllocator.allocate() honours required_backends when a ContextRequest is provided — ensuring required backends receive allocations
  • Existing behaviour is preserved when request=None
  • Unit tests cover the preferred_strategies and required_backends code paths

Subtasks

  • Update ACMSPipeline.assemble() to pass ContextRequest to the strategy selector
  • Update DefaultStrategySelector.select() (or equivalent interface) to accept and honour preferred_strategies from ContextRequest
  • Update DefaultBudgetAllocator.allocate() to honour required_backends from ContextRequest
  • Add unit tests for preferred_strategies influencing strategy selection
  • Add unit tests for required_backends influencing budget allocation
  • Add BDD scenario: CRP preferred_strategies field is respected by the pipeline
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • 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 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.
  • All nox stages pass.
  • Coverage >= 97%.

Backlog note: This issue was discovered during autonomous operation
on milestone v3.4.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `bugfix/acms-crp-preferred-strategies-ignored` - **Commit Message**: `fix(acms): honour CRP preferred_strategies and required_backends in pipeline` - **Milestone**: *(backlog — no milestone assigned)* - **Parent Epic**: #396 ## Background and Context The Context Request Protocol (CRP) is the structured vocabulary through which actors declare what information they need, as defined in `docs/specification.md`. The `ContextRequest` model (`src/cleveragents/domain/models/acms/crp.py`) includes two fields intended to influence strategy selection in the ACMS pipeline: - `preferred_strategies`: a list of preferred context strategies the actor wants applied - `required_backends`: a list of required data backends the actor needs consulted These fields are part of the CRP contract and are expected to influence how `ACMSPipeline.assemble()` selects and executes context strategies. ## Current Behavior `ACMSPipeline.assemble()` accepts a `request: ContextRequest | None` parameter but passes it only to `BudgetAllocator.allocate()`. The `DefaultBudgetAllocator` ignores the `request` parameter entirely. The `DefaultStrategySelector.select()` never receives the `ContextRequest` at all — it only receives a plain `dict` with the strategy name hint. ```python # In ACMSPipeline.assemble(): allocations = self._budget_allocator.allocate( candidates, budget.available_tokens, request, # <-- passed here but ignored by DefaultBudgetAllocator ) ``` The `preferred_strategies` and `required_backends` fields are never consulted during strategy selection or execution. **Affected code locations**: - `src/cleveragents/application/services/acms_service.py` — `ACMSPipeline.assemble()` - `src/cleveragents/application/services/acms_service.py` — `DefaultBudgetAllocator.allocate()` - `src/cleveragents/domain/models/acms/crp.py` — `ContextRequest` ## Expected Behavior Per the spec, the ACMS pipeline should use `ContextRequest.preferred_strategies` to influence which strategies are selected and `ContextRequest.required_backends` to ensure required backends are consulted. When a `ContextRequest` is provided: 1. `DefaultStrategySelector.select()` (or equivalent) should receive and honour `preferred_strategies` — preferring those strategies over others when available. 2. `DefaultBudgetAllocator.allocate()` should honour `required_backends` — ensuring allocations cover required backends. ## Steps to Reproduce 1. Create a `ContextRequest` with `preferred_strategies=["recency"]` 2. Call `pipeline.assemble(plan_id=..., fragments=..., budget=..., strategy="relevance", request=crp_request)` 3. Observe that the `preferred_strategies` hint is completely ignored — the `relevance` strategy is used regardless of the `preferred_strategies` field ## Acceptance Criteria - [ ] `ACMSPipeline.assemble()` passes the `ContextRequest` to the strategy selector so `preferred_strategies` can influence strategy selection - [ ] `DefaultStrategySelector.select()` (or equivalent) honours `preferred_strategies` when a `ContextRequest` is provided — preferring listed strategies over others when available - [ ] `DefaultBudgetAllocator.allocate()` honours `required_backends` when a `ContextRequest` is provided — ensuring required backends receive allocations - [ ] Existing behaviour is preserved when `request=None` - [ ] Unit tests cover the `preferred_strategies` and `required_backends` code paths ## Subtasks - [ ] Update `ACMSPipeline.assemble()` to pass `ContextRequest` to the strategy selector - [ ] Update `DefaultStrategySelector.select()` (or equivalent interface) to accept and honour `preferred_strategies` from `ContextRequest` - [ ] Update `DefaultBudgetAllocator.allocate()` to honour `required_backends` from `ContextRequest` - [ ] Add unit tests for `preferred_strategies` influencing strategy selection - [ ] Add unit tests for `required_backends` influencing budget allocation - [ ] Add BDD scenario: CRP `preferred_strategies` field is respected by the pipeline - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - 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 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. - All nox stages pass. - Coverage >= 97%. --- > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.4.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:24 +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.

Blocks
#396 Epic: ACMS Context Pipeline
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3980
No description provided.