Bug: namespace prefix confused with provider name when executing a plan #11254

Closed
opened 2026-05-21 17:09:55 +00:00 by CoreRasurae · 0 comments
Member

Metadata

  • Branch: bugfix/m3-namespace-provider-name-collision

Background and Context

When an action YAML references actors using namespace/name format (e.g., strategy_actor: local/strategist), the plan execution flow incorrectly interprets the namespace prefix (local) as a provider name. This causes a ValueError: Unknown provider type: local when trying to execute the plan.

The root cause is that / is used as a separator in two incompatible conventions with no disambiguation:

  1. Provider/model format: openai/gpt-4 — used in actor YAML config files
  2. Namespace/name format: local/strategist — used in action YAML config files for strategy_actor and execution_actor fields

The _parse_actor_name() functions (present in both src/cleveragents/application/services/strategy_resolution.py and src/cleveragents/application/services/llm_actors.py) assume everything containing a / is provider/model. When action YAML uses strategy_actor: local/strategist, the namespace local is mistaken for a provider name.

Steps to Reproduce

  1. Create an action YAML with namespace-prefixed actors:
    name: local/my-action
    description: Test action
    definition_of_done: Done
    strategy_actor: local/my-strategist
    execution_actor: local/my-executor
    
  2. Create an actor YAML with a valid provider:
    name: local/my-strategist
    type: llm
    config:
      actor: openai/gpt-4
    
  3. Register both, create a project, and use the action to create a plan
  4. Attempt agents plan execute <PLAN_ID>

Expected Behavior

The namespace local/strategist should be resolved through the Actor Registry to find the actual actor configuration, which would then provide the correct provider (e.g., openai) and model (e.g., gpt-4).

Actual Behavior

ValueError: Unknown provider type: local is raised.

Technical Details

Root cause chains

_parse_actor_name() — two copies, same bug:

  • src/cleveragents/application/services/strategy_resolution.py:102-133 — splits on /, assumes provider/model
  • src/cleveragents/application/services/llm_actors.py:93-106 — splits on /, hardcodes openai as default

ValueError raised at:

  • src/cleveragents/providers/registry.py:656-660ProviderType("local") fails because local is not a valid provider enum value

Action model stores raw namespace/name values:

  • src/cleveragents/domain/models/core/action.py:373-376strategy_actor field documented as "namespaced name" but not resolved to provider/model
  • src/cleveragents/domain/models/core/action.py:638-644from_config() passes strategy_actor and execution_actor through without resolution

Plan propagates the raw value:

  • src/cleveragents/application/services/plan_lifecycle_service.py:1104-1105plan.strategy_actor = action.strategy_actor (still local/strategist)

All affected call sites:

Call Site File Actor Field Used
StrategyActor._execute_with_llm() strategy_actor.py:454-467 action.strategy_actor
LLMStrategizeActor.execute() llm_actors.py:147-161 action.strategy_actor
LLMExecuteActor.execute() llm_actors.py:376-393 action.execution_actor
SessionWorkflow._resolve_llm() session_workflow.py:383-391 any actor_name

Additionally, validate_namespaced_actor() at src/cleveragents/cli/commands/plan.py:119-137 conflates the two conventions by accepting openai/gpt-4 as a valid namespace/name format in its docstring.

Code flow

1. Action YAML: strategy_actor: local/strategist  (namespace/name)
2. Action.from_config() stores "local/strategist"
3. Plan created with plan.strategy_actor = "local/strategist"
4. agents plan execute <PLAN_ID>
5. StrategyActor._execute_with_llm() reads action.strategy_actor = "local/strategist"
6. _parse_actor_name("local/strategist") splits on "/" -> ("local", "strategist")
7. registry.create_llm(provider_type="local") -> ValueError: Unknown provider type: local

Suggested Fix

The _parse_actor_name() functions need to distinguish between the two / conventions. Approaches:

A) Check if the first segment is a known provider (in ProviderType enum) — if not, treat it as namespace/actor-name and resolve through the Actor Registry to get the actual provider/model

B) Change the action YAML convention to use a different separator for namespace/name (e.g., ::), breaking the ambiguity at the syntax level

Option (A) is preferred as it is backward-compatible and follows the spec, which defines actor references in action YAML as namespaced names.

## Metadata - **Branch**: `bugfix/m3-namespace-provider-name-collision` ## Background and Context When an action YAML references actors using namespace/name format (e.g., `strategy_actor: local/strategist`), the plan execution flow incorrectly interprets the namespace prefix (`local`) as a provider name. This causes a `ValueError: Unknown provider type: local` when trying to execute the plan. The root cause is that `/` is used as a separator in **two incompatible conventions** with no disambiguation: 1. **Provider/model format**: `openai/gpt-4` — used in actor YAML config files 2. **Namespace/name format**: `local/strategist` — used in action YAML config files for `strategy_actor` and `execution_actor` fields The `_parse_actor_name()` functions (present in both `src/cleveragents/application/services/strategy_resolution.py` and `src/cleveragents/application/services/llm_actors.py`) assume **everything** containing a `/` is `provider/model`. When action YAML uses `strategy_actor: local/strategist`, the namespace `local` is mistaken for a provider name. ## Steps to Reproduce 1. Create an action YAML with namespace-prefixed actors: ```yaml name: local/my-action description: Test action definition_of_done: Done strategy_actor: local/my-strategist execution_actor: local/my-executor ``` 2. Create an actor YAML with a valid provider: ```yaml name: local/my-strategist type: llm config: actor: openai/gpt-4 ``` 3. Register both, create a project, and use the action to create a plan 4. Attempt `agents plan execute <PLAN_ID>` ## Expected Behavior The namespace `local/strategist` should be resolved through the Actor Registry to find the actual actor configuration, which would then provide the correct provider (e.g., `openai`) and model (e.g., `gpt-4`). ## Actual Behavior `ValueError: Unknown provider type: local` is raised. ## Technical Details ### Root cause chains **`_parse_actor_name()` — two copies, same bug:** - `src/cleveragents/application/services/strategy_resolution.py:102-133` — splits on `/`, assumes `provider/model` - `src/cleveragents/application/services/llm_actors.py:93-106` — splits on `/`, hardcodes `openai` as default **ValueError raised at:** - `src/cleveragents/providers/registry.py:656-660` — `ProviderType("local")` fails because `local` is not a valid provider enum value **Action model stores raw namespace/name values:** - `src/cleveragents/domain/models/core/action.py:373-376` — `strategy_actor` field documented as "namespaced name" but not resolved to provider/model - `src/cleveragents/domain/models/core/action.py:638-644` — `from_config()` passes `strategy_actor` and `execution_actor` through without resolution **Plan propagates the raw value:** - `src/cleveragents/application/services/plan_lifecycle_service.py:1104-1105` — `plan.strategy_actor = action.strategy_actor` (still `local/strategist`) **All affected call sites:** | Call Site | File | Actor Field Used | |---|---|---| | `StrategyActor._execute_with_llm()` | `strategy_actor.py:454-467` | `action.strategy_actor` | | `LLMStrategizeActor.execute()` | `llm_actors.py:147-161` | `action.strategy_actor` | | `LLMExecuteActor.execute()` | `llm_actors.py:376-393` | `action.execution_actor` | | `SessionWorkflow._resolve_llm()` | `session_workflow.py:383-391` | any actor_name | Additionally, `validate_namespaced_actor()` at `src/cleveragents/cli/commands/plan.py:119-137` conflates the two conventions by accepting `openai/gpt-4` as a valid namespace/name format in its docstring. ### Code flow ``` 1. Action YAML: strategy_actor: local/strategist (namespace/name) 2. Action.from_config() stores "local/strategist" 3. Plan created with plan.strategy_actor = "local/strategist" 4. agents plan execute <PLAN_ID> 5. StrategyActor._execute_with_llm() reads action.strategy_actor = "local/strategist" 6. _parse_actor_name("local/strategist") splits on "/" -> ("local", "strategist") 7. registry.create_llm(provider_type="local") -> ValueError: Unknown provider type: local ``` ## Suggested Fix The `_parse_actor_name()` functions need to distinguish between the two `/` conventions. Approaches: A) Check if the first segment is a known provider (in `ProviderType` enum) — if not, treat it as namespace/actor-name and resolve through the Actor Registry to get the actual provider/model B) Change the action YAML convention to use a different separator for namespace/name (e.g., `::`), breaking the ambiguity at the syntax level Option (A) is preferred as it is backward-compatible and follows the spec, which defines actor references in action YAML as namespaced names.
CoreRasurae added this to the v3.2.0 milestone 2026-05-21 17:09:55 +00:00
CoreRasurae added the
Type
Bug
Priority
Critical
State
Verified
labels 2026-05-21 18:40:18 +00:00
HAL9000 was assigned by CoreRasurae 2026-05-21 18:40:24 +00:00
CoreRasurae removed the
State
Verified
label 2026-05-22 14:47:08 +00:00
CoreRasurae added the
State
In Review
label 2026-05-22 14:48:20 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: cleveragents/cleveragents-core#11254