UAT: ACMSPipeline does not load custom strategies from TOML config — context.strategies.custom entries are discovered but never instantiated #5514

Open
opened 2026-04-09 07:10:09 +00:00 by HAL9000 · 0 comments
Owner

Summary

The spec defines a TOML configuration key [context.strategies.custom] that allows users to register custom context strategies via Python module paths. The ACMSPipeline._discover_context_extensions() method queries the PluginManager for context.* extension points but only logs them — it never actually loads or registers the custom strategy classes.

What Was Tested

Code-level analysis of:

  • src/cleveragents/application/services/acms_service.pyACMSPipeline._discover_context_extensions() and __init__()
  • docs/reference/context_strategies.md — Configuration section

Expected Behavior (from spec)

Per docs/reference/context_strategies.md:

[context.strategies.custom]
"my-strategy" = "my_package.strategies:MyStrategy"

Custom strategies registered in this TOML section should be automatically loaded and available for use via pipeline.assemble(strategy="my-strategy", ...).

Actual Behavior

ACMSPipeline._discover_context_extensions():

def _discover_context_extensions(self) -> None:
    if self._plugin_manager is None:
        return
    context_eps = [
        ep
        for ep in self._plugin_manager.list_extension_points()
        if ep.name.startswith("context.")
    ]
    if context_eps:
        self._logger.info(
            "context_extensions_discovered",
            count=len(context_eps),
            names=[ep.name for ep in context_eps],
        )
    # ⚠️ No actual loading or registration happens here

The method only logs discovered extension points. There is no code to:

  1. Import the Python class from the module path
  2. Instantiate the class
  3. Call self.register_strategy(name, instance) to make it available

The register_strategy() method exists and works correctly — it's just never called from the extension discovery path.

Code Location

src/cleveragents/application/services/acms_service.pyACMSPipeline._discover_context_extensions() method.

Steps to Reproduce

  1. Configure a custom strategy in TOML:
    [context.strategies.custom]
    "my-strategy" = "my_package.strategies:MyStrategy"
    
  2. Create an ACMSPipeline with a PluginManager that has this extension point registered
  3. Call pipeline.assemble(strategy="my-strategy", ...)
  4. Observe ValueError: Unknown strategy 'my-strategy'

Suggested Fix

In _discover_context_extensions(), after discovering extension points, load and register each custom strategy:

for ep in context_eps:
    if ep.name.startswith("context.strategy."):
        strategy_name = ep.name[len("context.strategy."):]
        strategy_cls = ep.load()  # Import the class
        self.register_strategy(strategy_name, strategy_cls())

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

## Summary The spec defines a TOML configuration key `[context.strategies.custom]` that allows users to register custom context strategies via Python module paths. The `ACMSPipeline._discover_context_extensions()` method queries the `PluginManager` for `context.*` extension points but **only logs them** — it never actually loads or registers the custom strategy classes. ## What Was Tested Code-level analysis of: - `src/cleveragents/application/services/acms_service.py` — `ACMSPipeline._discover_context_extensions()` and `__init__()` - `docs/reference/context_strategies.md` — Configuration section ## Expected Behavior (from spec) Per `docs/reference/context_strategies.md`: ```toml [context.strategies.custom] "my-strategy" = "my_package.strategies:MyStrategy" ``` Custom strategies registered in this TOML section should be automatically loaded and available for use via `pipeline.assemble(strategy="my-strategy", ...)`. ## Actual Behavior `ACMSPipeline._discover_context_extensions()`: ```python def _discover_context_extensions(self) -> None: if self._plugin_manager is None: return context_eps = [ ep for ep in self._plugin_manager.list_extension_points() if ep.name.startswith("context.") ] if context_eps: self._logger.info( "context_extensions_discovered", count=len(context_eps), names=[ep.name for ep in context_eps], ) # ⚠️ No actual loading or registration happens here ``` The method only logs discovered extension points. There is no code to: 1. Import the Python class from the module path 2. Instantiate the class 3. Call `self.register_strategy(name, instance)` to make it available The `register_strategy()` method exists and works correctly — it's just never called from the extension discovery path. ## Code Location `src/cleveragents/application/services/acms_service.py` — `ACMSPipeline._discover_context_extensions()` method. ## Steps to Reproduce 1. Configure a custom strategy in TOML: ```toml [context.strategies.custom] "my-strategy" = "my_package.strategies:MyStrategy" ``` 2. Create an `ACMSPipeline` with a `PluginManager` that has this extension point registered 3. Call `pipeline.assemble(strategy="my-strategy", ...)` 4. Observe `ValueError: Unknown strategy 'my-strategy'` ## Suggested Fix In `_discover_context_extensions()`, after discovering extension points, load and register each custom strategy: ```python for ep in context_eps: if ep.name.startswith("context.strategy."): strategy_name = ep.name[len("context.strategy."):] strategy_cls = ep.load() # Import the class self.register_strategy(strategy_name, strategy_cls()) ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
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#5514
No description provided.