UAT: A2A _cleveragents/plan/execute idempotency check misses terminal plan states — raises instead of acknowledging #6625

Open
opened 2026-04-09 22:24:54 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: A2A Protocol — A2A Facade plan execute idempotency

Spec Reference

docs/reference/a2a.md — Extension Methods, Plan Operations:

_cleveragents/plan/execute | PlanLifecycle.execute() | plan_id

The spec requires the execute handler to be idempotent (per the PR #5998 fix referenced in the assignment).

Expected Behavior

When _cleveragents/plan/execute is called on a plan that has already been executed or is in any terminal/post-execute state, the handler should acknowledge idempotently without raising an error.

Actual Behavior

The _handle_plan_execute method only checks for "execute" and "apply" phases:

def _handle_plan_execute(self, params: dict[str, Any]) -> dict[str, Any]:
    ...
    plan = svc.get_plan(plan_id)
    if plan.phase.value in ("execute", "apply"):
        return {"plan_id": plan.identity.plan_id, "status": plan.phase.value}
    plan = svc.execute_plan(plan_id)
    return {"plan_id": plan.identity.plan_id, "status": plan.phase.value}

Missing terminal states: If a plan is in "cancelled", "error", "applied", or other post-execute states, calling execute again will attempt svc.execute_plan(plan_id), which will raise InvalidPhaseTransitionError (a BusinessRuleViolation). This gets mapped to error code -32004 and returned as an error response.

Code Location

src/cleveragents/a2a/facade.py, _handle_plan_execute() method

Expected Fix

The idempotency check should cover all states where re-executing would be invalid:

# States where execute has already been called or plan is terminal
_ALREADY_EXECUTED_STATES = {"execute", "apply", "applied", "cancelled", "error", "failed"}

if plan.phase.value in _ALREADY_EXECUTED_STATES:
    return {"plan_id": plan.identity.plan_id, "status": plan.phase.value}

Impact

  • Calling execute on a cancelled or errored plan returns an error response instead of an idempotent acknowledgment
  • This breaks retry logic that expects idempotent behavior from the execute endpoint
  • The PR #5998 fix was incomplete — it only handled the "already executing" case, not the "already terminal" case

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

## Bug Report **Feature Area:** A2A Protocol — A2A Facade plan execute idempotency ### Spec Reference `docs/reference/a2a.md` — Extension Methods, Plan Operations: > `_cleveragents/plan/execute` | `PlanLifecycle.execute()` | `plan_id` The spec requires the execute handler to be idempotent (per the PR #5998 fix referenced in the assignment). ### Expected Behavior When `_cleveragents/plan/execute` is called on a plan that has already been executed or is in any terminal/post-execute state, the handler should acknowledge idempotently without raising an error. ### Actual Behavior The `_handle_plan_execute` method only checks for `"execute"` and `"apply"` phases: ```python def _handle_plan_execute(self, params: dict[str, Any]) -> dict[str, Any]: ... plan = svc.get_plan(plan_id) if plan.phase.value in ("execute", "apply"): return {"plan_id": plan.identity.plan_id, "status": plan.phase.value} plan = svc.execute_plan(plan_id) return {"plan_id": plan.identity.plan_id, "status": plan.phase.value} ``` **Missing terminal states**: If a plan is in `"cancelled"`, `"error"`, `"applied"`, or other post-execute states, calling `execute` again will attempt `svc.execute_plan(plan_id)`, which will raise `InvalidPhaseTransitionError` (a `BusinessRuleViolation`). This gets mapped to error code `-32004` and returned as an error response. ### Code Location `src/cleveragents/a2a/facade.py`, `_handle_plan_execute()` method ### Expected Fix The idempotency check should cover all states where re-executing would be invalid: ```python # States where execute has already been called or plan is terminal _ALREADY_EXECUTED_STATES = {"execute", "apply", "applied", "cancelled", "error", "failed"} if plan.phase.value in _ALREADY_EXECUTED_STATES: return {"plan_id": plan.identity.plan_id, "status": plan.phase.value} ``` ### Impact - Calling `execute` on a cancelled or errored plan returns an error response instead of an idempotent acknowledgment - This breaks retry logic that expects idempotent behavior from the execute endpoint - The PR #5998 fix was incomplete — it only handled the "already executing" case, not the "already terminal" case --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-09 22:34:47 +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.

Dependencies

No dependencies set.

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