UAT: _cleveragents/plan/tree A2A extension method always returns empty decision tree — decision nodes are never populated #2528

Open
opened 2026-04-03 18:48:34 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/a2a-plan-tree-decision-nodes
  • Commit Message: fix(a2a): populate decision tree in _cleveragents/plan/tree handler
  • Parent Epic: #690

Summary

The _cleveragents/plan/tree A2A extension method in A2aLocalFacade always returns "tree": [] regardless of the plan's actual decision tree state. Even when a plan has been through the Strategize phase and has a populated decision tree, the handler returns an empty list. This makes it impossible for clients to inspect the plan's decision tree via the A2A protocol.

What Was Tested

  • Code analysis of src/cleveragents/a2a/facade.py
  • Specification review of _cleveragents/plan/tree requirements

Expected Behavior (from spec)

Per docs/specification.md (line 66):

_cleveragents/plan/tree — Returns the plan's decision tree

The response should include the actual decision tree nodes for the plan, not an empty list. The decision tree is the core artifact of the Strategize phase and is essential for:

  • Clients inspecting plan decisions
  • The _cleveragents/plan/explain operation (which needs decision IDs from the tree)
  • The _cleveragents/plan/correct operation (which needs decision IDs to target corrections)

Actual Behavior

In src/cleveragents/a2a/facade.py (lines 506-516):

def _handle_plan_tree(self, params: dict[str, Any]) -> dict[str, Any]:
    plan_id = params.get("plan_id", "")
    svc = self._plan_lifecycle_service
    if svc is None or not plan_id:
        return {"plan_id": plan_id, "tree": [], "stub": True}
    plan = svc.get_plan(plan_id)
    return {
        "plan_id": plan_id,
        "decision_root_id": plan.decision_root_id if plan else None,
        "tree": [],  # ← ALWAYS EMPTY — decision nodes never fetched
    }

The handler fetches the plan and extracts decision_root_id, but then returns tree: [] without actually fetching the decision tree nodes. The PlanLifecycleService likely has a method to retrieve decision tree nodes, but it is not called.

Code Location

src/cleveragents/a2a/facade.py lines 506-516: _handle_plan_tree()tree: [] hardcoded

Impact

Any client that calls _cleveragents/plan/tree to inspect a plan's decision tree will always receive an empty list, even for plans that have completed the Strategize phase. This breaks:

  • Plan inspection workflows
  • The _cleveragents/plan/explain operation (needs decision IDs)
  • The _cleveragents/plan/correct operation (needs decision IDs to target)
  • Any UI that visualizes the plan's decision tree

Subtasks

  • Identify the PlanLifecycleService method that retrieves decision tree nodes (e.g., get_decision_tree() or list_decisions())
  • Call that method in _handle_plan_tree() and populate the tree field with actual decision nodes
  • Define the decision node serialization format (id, type, question, chosen_option, confidence, etc.)
  • Add BDD test verifying that _cleveragents/plan/tree returns actual decision nodes after Strategize phase
  • Verify all CI checks pass

Definition of Done

This issue is complete when:

  • _cleveragents/plan/tree returns the actual decision tree nodes for a plan that has completed Strategize
  • Decision nodes include at minimum: id, type, question, chosen_option, confidence, rationale
  • BDD test covers the populated tree case
  • All CI checks pass
  • 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
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done

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

## Metadata - **Branch**: `fix/a2a-plan-tree-decision-nodes` - **Commit Message**: `fix(a2a): populate decision tree in _cleveragents/plan/tree handler` - **Parent Epic**: #690 ## Summary The `_cleveragents/plan/tree` A2A extension method in `A2aLocalFacade` always returns `"tree": []` regardless of the plan's actual decision tree state. Even when a plan has been through the Strategize phase and has a populated decision tree, the handler returns an empty list. This makes it impossible for clients to inspect the plan's decision tree via the A2A protocol. ## What Was Tested - Code analysis of `src/cleveragents/a2a/facade.py` - Specification review of `_cleveragents/plan/tree` requirements ## Expected Behavior (from spec) Per `docs/specification.md` (line 66): > `_cleveragents/plan/tree` — Returns the plan's decision tree The response should include the actual decision tree nodes for the plan, not an empty list. The decision tree is the core artifact of the Strategize phase and is essential for: - Clients inspecting plan decisions - The `_cleveragents/plan/explain` operation (which needs decision IDs from the tree) - The `_cleveragents/plan/correct` operation (which needs decision IDs to target corrections) ## Actual Behavior In `src/cleveragents/a2a/facade.py` (lines 506-516): ```python def _handle_plan_tree(self, params: dict[str, Any]) -> dict[str, Any]: plan_id = params.get("plan_id", "") svc = self._plan_lifecycle_service if svc is None or not plan_id: return {"plan_id": plan_id, "tree": [], "stub": True} plan = svc.get_plan(plan_id) return { "plan_id": plan_id, "decision_root_id": plan.decision_root_id if plan else None, "tree": [], # ← ALWAYS EMPTY — decision nodes never fetched } ``` The handler fetches the plan and extracts `decision_root_id`, but then returns `tree: []` without actually fetching the decision tree nodes. The `PlanLifecycleService` likely has a method to retrieve decision tree nodes, but it is not called. ## Code Location `src/cleveragents/a2a/facade.py` lines 506-516: `_handle_plan_tree()` — `tree: []` hardcoded ## Impact Any client that calls `_cleveragents/plan/tree` to inspect a plan's decision tree will always receive an empty list, even for plans that have completed the Strategize phase. This breaks: - Plan inspection workflows - The `_cleveragents/plan/explain` operation (needs decision IDs) - The `_cleveragents/plan/correct` operation (needs decision IDs to target) - Any UI that visualizes the plan's decision tree ## Subtasks - [ ] Identify the `PlanLifecycleService` method that retrieves decision tree nodes (e.g., `get_decision_tree()` or `list_decisions()`) - [ ] Call that method in `_handle_plan_tree()` and populate the `tree` field with actual decision nodes - [ ] Define the decision node serialization format (id, type, question, chosen_option, confidence, etc.) - [ ] Add BDD test verifying that `_cleveragents/plan/tree` returns actual decision nodes after Strategize phase - [ ] Verify all CI checks pass ## Definition of Done This issue is complete when: - `_cleveragents/plan/tree` returns the actual decision tree nodes for a plan that has completed Strategize - Decision nodes include at minimum: id, type, question, chosen_option, confidence, rationale - BDD test covers the populated tree case - All CI checks pass - 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 - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-03 18:49:15 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have — Spec compliance or quality improvement.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have — Spec compliance or quality improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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#2528
No description provided.