UAT: _cleveragents/plan/execute A2A handler only transitions plan to execute/queued — never runs Strategize or Execute phases #2610

Open
opened 2026-04-03 19:36:28 +00:00 by freemo · 4 comments
Owner

Metadata

  • Branch: fix/a2a-plan-execute-full-lifecycle
  • Commit Message: fix(a2a): wire _cleveragents/plan/execute handler to full PlanExecutor lifecycle
  • Milestone: v3.8.0
  • Parent Epic: #399

Background and Context

The _cleveragents/plan/execute A2A extension method is specified (spec §43206) to map to PlanLifecycle.execute(), which should drive the plan through the full execution lifecycle — including the Strategize and Execute phases. However, the current implementation in src/cleveragents/a2a/facade.py (A2aLocalFacade._handle_plan_execute) only calls svc.execute_plan(plan_id), which merely transitions the plan's state to execute/queued without actually running any processing.

The CLI agents plan execute command correctly invokes PlanExecutor to run both phases. The A2A handler must be brought into parity with the CLI behavior.

Current Behavior

After calling _cleveragents/plan/execute via the A2A facade, the plan is left in execute/queued state. No Strategize or Execute processing occurs. The LLM actors are never invoked. The response returns "status": "execute/queued" rather than the plan's final post-execution state.

Affected codesrc/cleveragents/a2a/facade.py, method A2aLocalFacade._handle_plan_execute:

def _handle_plan_execute(self, params: dict[str, Any]) -> dict[str, Any]:
    svc = self._plan_lifecycle_service
    plan_id = params.get("plan_id", "")
    if svc is None:
        return {"plan_id": plan_id, "status": "queued"}
    if not plan_id:
        raise ValueError("plan_id is required")
    plan = svc.execute_plan(plan_id)  # Only transitions to execute/queued
    return {"plan_id": plan.identity.plan_id, "status": plan.phase.value}
    # Missing: executor.run_strategize() and executor.run_execute()

Expected Behavior

Per spec §43206, _cleveragents/plan/execute must map to PlanLifecycle.execute() and drive the plan through the full execution lifecycle using PlanExecutor (from src/cleveragents/application/services/plan_executor.py), matching the behavior of the CLI agents plan execute command:

  1. Call executor.run_strategize(plan_id) if the plan is in strategize/queued
  2. Call executor.run_execute(plan_id) if the plan is in execute/queued
  3. Return the plan in its final state after execution completes

Acceptance Criteria

  • _handle_plan_execute uses PlanExecutor to run the full lifecycle (Strategize and/or Execute phases as appropriate for the plan's current phase)
  • The handler returns the plan's final state after all applicable phases have completed
  • Behavior is identical to the CLI agents plan execute command
  • The svc is None guard path is updated or removed as appropriate
  • No regression in existing A2A facade tests

Supporting Information

  • Spec §43206 (A2A Extension Methods → Service Mapping table): _cleveragents/plan/executePlanLifecycle.execute()
  • CLI reference: agents plan execute <PLAN_ID> (spec §12918)
  • Fix must use PlanExecutor from src/cleveragents/application/services/plan_executor.py
  • Discovered during UAT testing of the A2A server interface

Subtasks

  • Investigate PlanExecutor.run_strategize() and PlanExecutor.run_execute() signatures and injection pattern used by the CLI command handler
  • Refactor A2aLocalFacade._handle_plan_execute to inject and use PlanExecutor for full lifecycle execution
  • Handle phase-conditional logic: run run_strategize if in strategize/queued, run run_execute if in execute/queued, run both sequentially if starting from strategize/queued
  • Update A2aLocalFacade.__init__ or factory to wire PlanExecutor dependency
  • Tests (Behave): Add/update BDD scenarios covering the full A2A plan execute lifecycle (Strategize phase, Execute phase, combined flow)
  • Tests (Robot): Add/update integration test asserting _cleveragents/plan/execute drives plan to a terminal state
  • 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 (fix(a2a): wire _cleveragents/plan/execute handler to full PlanExecutor lifecycle), followed by a blank line, then additional lines providing relevant implementation details.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (fix/a2a-plan-execute-full-lifecycle).
  • 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%.

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

## Metadata - **Branch**: `fix/a2a-plan-execute-full-lifecycle` - **Commit Message**: `fix(a2a): wire _cleveragents/plan/execute handler to full PlanExecutor lifecycle` - **Milestone**: v3.8.0 - **Parent Epic**: #399 ## Background and Context The `_cleveragents/plan/execute` A2A extension method is specified (spec §43206) to map to `PlanLifecycle.execute()`, which should drive the plan through the full execution lifecycle — including the Strategize and Execute phases. However, the current implementation in `src/cleveragents/a2a/facade.py` (`A2aLocalFacade._handle_plan_execute`) only calls `svc.execute_plan(plan_id)`, which merely transitions the plan's state to `execute/queued` without actually running any processing. The CLI `agents plan execute` command correctly invokes `PlanExecutor` to run both phases. The A2A handler must be brought into parity with the CLI behavior. ## Current Behavior After calling `_cleveragents/plan/execute` via the A2A facade, the plan is left in `execute/queued` state. No Strategize or Execute processing occurs. The LLM actors are never invoked. The response returns `"status": "execute/queued"` rather than the plan's final post-execution state. **Affected code** — `src/cleveragents/a2a/facade.py`, method `A2aLocalFacade._handle_plan_execute`: ```python def _handle_plan_execute(self, params: dict[str, Any]) -> dict[str, Any]: svc = self._plan_lifecycle_service plan_id = params.get("plan_id", "") if svc is None: return {"plan_id": plan_id, "status": "queued"} if not plan_id: raise ValueError("plan_id is required") plan = svc.execute_plan(plan_id) # Only transitions to execute/queued return {"plan_id": plan.identity.plan_id, "status": plan.phase.value} # Missing: executor.run_strategize() and executor.run_execute() ``` ## Expected Behavior Per spec §43206, `_cleveragents/plan/execute` must map to `PlanLifecycle.execute()` and drive the plan through the full execution lifecycle using `PlanExecutor` (from `src/cleveragents/application/services/plan_executor.py`), matching the behavior of the CLI `agents plan execute` command: 1. Call `executor.run_strategize(plan_id)` if the plan is in `strategize/queued` 2. Call `executor.run_execute(plan_id)` if the plan is in `execute/queued` 3. Return the plan in its final state after execution completes ## Acceptance Criteria - [ ] `_handle_plan_execute` uses `PlanExecutor` to run the full lifecycle (Strategize and/or Execute phases as appropriate for the plan's current phase) - [ ] The handler returns the plan's final state after all applicable phases have completed - [ ] Behavior is identical to the CLI `agents plan execute` command - [ ] The `svc is None` guard path is updated or removed as appropriate - [ ] No regression in existing A2A facade tests ## Supporting Information - Spec §43206 (A2A Extension Methods → Service Mapping table): `_cleveragents/plan/execute` → `PlanLifecycle.execute()` - CLI reference: `agents plan execute <PLAN_ID>` (spec §12918) - Fix must use `PlanExecutor` from `src/cleveragents/application/services/plan_executor.py` - Discovered during UAT testing of the A2A server interface ## Subtasks - [ ] Investigate `PlanExecutor.run_strategize()` and `PlanExecutor.run_execute()` signatures and injection pattern used by the CLI command handler - [ ] Refactor `A2aLocalFacade._handle_plan_execute` to inject and use `PlanExecutor` for full lifecycle execution - [ ] Handle phase-conditional logic: run `run_strategize` if in `strategize/queued`, run `run_execute` if in `execute/queued`, run both sequentially if starting from `strategize/queued` - [ ] Update `A2aLocalFacade.__init__` or factory to wire `PlanExecutor` dependency - [ ] Tests (Behave): Add/update BDD scenarios covering the full A2A plan execute lifecycle (Strategize phase, Execute phase, combined flow) - [ ] Tests (Robot): Add/update integration test asserting `_cleveragents/plan/execute` drives plan to a terminal state - [ ] 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 (`fix(a2a): wire _cleveragents/plan/execute handler to full PlanExecutor lifecycle`), followed by a blank line, then additional lines providing relevant implementation details. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`fix/a2a-plan-execute-full-lifecycle`). - 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%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-03 19:37:56 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — the A2A plan/execute handler is fundamentally broken; it queues but never executes, making the A2A interface non-functional for plan execution
  • Milestone: v3.8.0 (M9: Server Implementation)
  • MoSCoW: Should Have — spec §43206 explicitly maps _cleveragents/plan/execute to PlanLifecycle.execute(). The CLI works correctly but the A2A interface does not, creating a parity gap. This is a "SHOULD" for server mode functionality.
  • Parent Epic: #399

Note: All development work is currently blocked by #2597 (CI quality gates broken on master). This issue will be ready for implementation once master is green.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — the A2A plan/execute handler is fundamentally broken; it queues but never executes, making the A2A interface non-functional for plan execution - **Milestone**: v3.8.0 (M9: Server Implementation) - **MoSCoW**: Should Have — spec §43206 explicitly maps `_cleveragents/plan/execute` to `PlanLifecycle.execute()`. The CLI works correctly but the A2A interface does not, creating a parity gap. This is a "SHOULD" for server mode functionality. - **Parent Epic**: #399 **Note:** All development work is currently blocked by #2597 (CI quality gates broken on master). This issue will be ready for implementation once master is green. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Issue triaged by project owner:

  • State: Verified — Plan execute handler only transitions to execute/queued without running Strategize or Execute phases. Valid bug with clear spec reference.
  • Existing Priority/High and MoSCoW/Should Have labels are appropriate.
  • Parent Epic: #933 (A2A Protocol Compliance) — needs Epic link verification.

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

Issue triaged by project owner: - **State**: Verified — Plan execute handler only transitions to `execute/queued` without running Strategize or Execute phases. Valid bug with clear spec reference. - Existing Priority/High and MoSCoW/Should Have labels are appropriate. - **Parent Epic**: #933 (A2A Protocol Compliance) — needs Epic link verification. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Starting implementation on branch fix/a2a-plan-execute-full-lifecycle.

Analysis complete. The bug is confirmed in src/cleveragents/a2a/facade.py method A2aLocalFacade._handle_plan_execute. The current implementation only calls svc.execute_plan(plan_id) which transitions the plan to execute/queued state but never invokes PlanExecutor.run_strategize() or PlanExecutor.run_execute().

Fix plan:

  1. Add plan_executor as an injectable service in A2aLocalFacade
  2. Refactor _handle_plan_execute to mirror the CLI's phase-conditional logic:
    • If strategize/queued or strategize/processing → run run_strategize() first
    • If strategize/complete → call execute_plan() to transition, then run run_execute()
    • If execute/queued → run run_execute() directly
  3. Return the plan's final state after all phases complete
  4. Add BDD tests covering the full lifecycle scenarios

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

Starting implementation on branch `fix/a2a-plan-execute-full-lifecycle`. **Analysis complete.** The bug is confirmed in `src/cleveragents/a2a/facade.py` method `A2aLocalFacade._handle_plan_execute`. The current implementation only calls `svc.execute_plan(plan_id)` which transitions the plan to `execute/queued` state but never invokes `PlanExecutor.run_strategize()` or `PlanExecutor.run_execute()`. **Fix plan:** 1. Add `plan_executor` as an injectable service in `A2aLocalFacade` 2. Refactor `_handle_plan_execute` to mirror the CLI's phase-conditional logic: - If `strategize/queued` or `strategize/processing` → run `run_strategize()` first - If `strategize/complete` → call `execute_plan()` to transition, then run `run_execute()` - If `execute/queued` → run `run_execute()` directly 3. Return the plan's final state after all phases complete 4. Add BDD tests covering the full lifecycle scenarios --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
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
#399 Epic: Post-MVP Server & Clients
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2610
No description provided.