UAT: _run_estimation() always uses EstimationStubActor instead of dispatching to the configured actor registry #3975

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

Metadata

  • Branch: fix/estimation-real-actor-dispatch
  • Commit Message: fix(plan-lifecycle): dispatch estimation to actor registry instead of hardcoded stub
  • Milestone: None (Backlog)
  • Parent Epic: #890

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


Bug Report

Feature Area: Estimation and Planning Intelligence
Severity: High — the estimation actor configuration is silently ignored at runtime
Found by: UAT tester (code-level analysis)


Background and Context

The spec defines an Estimation Actor as a configurable actor (set via --estimation-actor flag or action.estimation_actor YAML field) that analyzes plan complexity and produces an EstimationResult with cost, time, risk, and step estimates. The spec states:

"When enabled, a specialized estimation actor analyzes: the strategy produced by the Strategize phase..."

The Plan domain model correctly stores estimation_actor: str | None and estimation_result: EstimationResult | None. The use_action() method in PlanLifecycleService correctly resolves the estimation actor via a 4-level fallback chain (plan > action > global config).

Current Behavior

In PlanLifecycleService._run_estimation() (line 340-384 of src/cleveragents/application/services/plan_lifecycle_service.py), the implementation always instantiates EstimationStubActor regardless of what actor is configured on the plan:

# TODO: Replace EstimationStubActor with real actor dispatch
# via actor registry
stub = EstimationStubActor()
result = stub.estimate(plan.identity.plan_id)

The EstimationStubActor.estimate() method (in plan_executor.py) always returns:

EstimationResult(summary="Estimation skipped (stub actor)")

This means:

  1. Any actor configured via --estimation-actor openai/gpt-4 is completely ignored
  2. The estimation_result stored on the plan is always a placeholder with no real data
  3. Users who configure an estimation actor get no actual estimation intelligence
  4. The PLAN_ESTIMATION_COMPLETE event is emitted with a stub summary, misleading consumers

Expected Behavior (per spec)

When plan.estimation_actor is set to a real actor name (e.g., openai/gpt-4), the lifecycle service should:

  1. Resolve the actor from the Actor Registry
  2. Invoke the actor with the plan's description, definition of done, and decision tree
  3. Parse the actor's response into an EstimationResult with real cost/time/risk estimates
  4. Store the result on the plan

Steps to Reproduce

  1. Create an action with estimation_actor: openai/gpt-4
  2. Use the action: agents plan use my-action my-project
  3. Execute the plan: agents plan execute <PLAN_ID>
  4. Check the estimation result: agents plan status <PLAN_ID> --format json | jq .estimation
  5. Observe: {"summary": "Estimation skipped (stub actor)"} — no real estimation

Code Location

  • File: src/cleveragents/application/services/plan_lifecycle_service.py
  • Method: _run_estimation() (lines ~322-384)
  • TODO comment: Line 343: # TODO: Replace EstimationStubActor with real actor dispatch

Subtasks

  • Implement real actor dispatch in _run_estimation() using the Actor Registry
  • Resolve the actor by name from plan.estimation_actor via unit_of_work.transaction()
  • Invoke the actor with plan context (description, definition_of_done, decision tree)
  • Parse the actor response into EstimationResult fields
  • Remove the EstimationStubActor usage from _run_estimation() (keep the class for testing)
  • Add unit tests (Behave feature file) for real actor dispatch path
  • Update integration tests to cover the estimation actor invocation

Definition of Done

  • _run_estimation() dispatches to the configured actor from the Actor Registry
  • EstimationStubActor is only used in tests, not in production code paths
  • A plan with estimation_actor set produces a real EstimationResult after execute_plan()
  • All existing estimation tests continue to pass
  • New tests cover the real actor dispatch path
  • PR merged and issue closed
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/estimation-real-actor-dispatch` - **Commit Message**: `fix(plan-lifecycle): dispatch estimation to actor registry instead of hardcoded stub` - **Milestone**: None (Backlog) - **Parent Epic**: #890 > **Backlog note:** This issue was discovered during autonomous operation > on milestone <M>. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- ## Bug Report **Feature Area:** Estimation and Planning Intelligence **Severity:** High — the estimation actor configuration is silently ignored at runtime **Found by:** UAT tester (code-level analysis) --- ## Background and Context The spec defines an **Estimation Actor** as a configurable actor (set via `--estimation-actor` flag or `action.estimation_actor` YAML field) that analyzes plan complexity and produces an `EstimationResult` with cost, time, risk, and step estimates. The spec states: > "When enabled, a specialized estimation actor analyzes: the strategy produced by the Strategize phase..." The `Plan` domain model correctly stores `estimation_actor: str | None` and `estimation_result: EstimationResult | None`. The `use_action()` method in `PlanLifecycleService` correctly resolves the estimation actor via a 4-level fallback chain (plan > action > global config). ## Current Behavior In `PlanLifecycleService._run_estimation()` (line 340-384 of `src/cleveragents/application/services/plan_lifecycle_service.py`), the implementation **always** instantiates `EstimationStubActor` regardless of what actor is configured on the plan: ```python # TODO: Replace EstimationStubActor with real actor dispatch # via actor registry stub = EstimationStubActor() result = stub.estimate(plan.identity.plan_id) ``` The `EstimationStubActor.estimate()` method (in `plan_executor.py`) always returns: ```python EstimationResult(summary="Estimation skipped (stub actor)") ``` This means: 1. Any actor configured via `--estimation-actor openai/gpt-4` is **completely ignored** 2. The `estimation_result` stored on the plan is always a placeholder with no real data 3. Users who configure an estimation actor get no actual estimation intelligence 4. The `PLAN_ESTIMATION_COMPLETE` event is emitted with a stub summary, misleading consumers ## Expected Behavior (per spec) When `plan.estimation_actor` is set to a real actor name (e.g., `openai/gpt-4`), the lifecycle service should: 1. Resolve the actor from the Actor Registry 2. Invoke the actor with the plan's description, definition of done, and decision tree 3. Parse the actor's response into an `EstimationResult` with real cost/time/risk estimates 4. Store the result on the plan ## Steps to Reproduce 1. Create an action with `estimation_actor: openai/gpt-4` 2. Use the action: `agents plan use my-action my-project` 3. Execute the plan: `agents plan execute <PLAN_ID>` 4. Check the estimation result: `agents plan status <PLAN_ID> --format json | jq .estimation` 5. Observe: `{"summary": "Estimation skipped (stub actor)"}` — no real estimation ## Code Location - **File**: `src/cleveragents/application/services/plan_lifecycle_service.py` - **Method**: `_run_estimation()` (lines ~322-384) - **TODO comment**: Line 343: `# TODO: Replace EstimationStubActor with real actor dispatch` ## Subtasks - [ ] Implement real actor dispatch in `_run_estimation()` using the Actor Registry - [ ] Resolve the actor by name from `plan.estimation_actor` via `unit_of_work.transaction()` - [ ] Invoke the actor with plan context (description, definition_of_done, decision tree) - [ ] Parse the actor response into `EstimationResult` fields - [ ] Remove the `EstimationStubActor` usage from `_run_estimation()` (keep the class for testing) - [ ] Add unit tests (Behave feature file) for real actor dispatch path - [ ] Update integration tests to cover the estimation actor invocation ## Definition of Done - [ ] `_run_estimation()` dispatches to the configured actor from the Actor Registry - [ ] `EstimationStubActor` is only used in tests, not in production code paths - [ ] A plan with `estimation_actor` set produces a real `EstimationResult` after `execute_plan()` - [ ] All existing estimation tests continue to pass - [ ] New tests cover the real actor dispatch path - [ ] PR merged and issue closed - All nox stages pass - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
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.

Reference
cleveragents/cleveragents-core#3975
No description provided.