[BUG] Decision correction with selective subtree recomputation not implemented #10012

Closed
opened 2026-04-16 12:20:21 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: feat(decomposition): implement selective subtree recomputation for decision correction
  • Branch: feature/m6-decision-correction-subtree

Background and Context

The v3.5.0 milestone (M6: Autonomy Hardening) specification requires that the hierarchical decomposition system supports "decision correction with selective subtree recomputation." This means when a plan decision is found to be incorrect, only the affected subtree of the plan hierarchy should be recomputed, not the entire plan. This is a critical efficiency feature for large-scale autonomous task execution.

Expected Behavior

Per the v3.5.0 specification:

  • When a plan decision is found to be incorrect (e.g., wrong clustering strategy, incorrect dependency ordering), the system should identify the subtree affected by that decision
  • Only the affected subtree should be recomputed, not the entire plan hierarchy
  • The rest of the plan tree should remain intact and unaffected
  • This selective recomputation should be significantly faster than full plan regeneration for large hierarchies

Current Behavior

Code inspection of the DecompositionService (src/cleveragents/application/services/decomposition_service.py) and related services reveals no implementation of decision correction or selective subtree recomputation. The system can decompose plans into hierarchical subplans and execute them, but there is no mechanism to:

  1. Detect that a decision in the plan tree was incorrect
  2. Identify the affected subtree rooted at the incorrect decision node
  3. Recompute only that subtree while preserving the rest of the plan hierarchy

Searches for "decision_correction", "selective_recomputation", "recompute_subtree", and related terms in the codebase return no results.

Acceptance Criteria

  • A CorrectionService or equivalent mechanism exists that can identify the subtree rooted at a given decision node
  • Given a plan hierarchy and a node ID, the system can recompute only the subtree below that node
  • The rest of the plan hierarchy is preserved unchanged during selective recomputation
  • BDD scenarios exist covering: correct decision identified, subtree recomputed, sibling branches unaffected
  • nox passes with coverage >= 97% including the new correction scenarios

Subtasks

  • Design CorrectionService interface with recompute_subtree(node_id, config) method
  • Implement subtree identification using DecompositionNode.parent_id / children_ids
  • Implement selective recomputation that preserves sibling branches
  • Add DecisionCorrectionResult model to track what was recomputed vs preserved
  • Tests (Behave): Add scenarios for selective subtree recomputation
  • Tests (Behave): Add scenarios verifying sibling branches are unaffected
  • 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, followed by a blank line, then additional lines providing relevant details about the implementation.
  • 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.

Supporting Information

  • Spec reference: v3.5.0 milestone (M6: Autonomy Hardening) - "Decision correction recomputes only affected subtree"
  • Related files: src/cleveragents/application/services/decomposition_service.py, src/cleveragents/application/services/decomposition_models.py
  • The DecompositionNode model has parent_id and children_ids fields that could support subtree identification, but no correction logic uses them

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `feat(decomposition): implement selective subtree recomputation for decision correction` - **Branch**: `feature/m6-decision-correction-subtree` ## Background and Context The v3.5.0 milestone (M6: Autonomy Hardening) specification requires that the hierarchical decomposition system supports "decision correction with selective subtree recomputation." This means when a plan decision is found to be incorrect, only the affected subtree of the plan hierarchy should be recomputed, not the entire plan. This is a critical efficiency feature for large-scale autonomous task execution. ## Expected Behavior Per the v3.5.0 specification: - When a plan decision is found to be incorrect (e.g., wrong clustering strategy, incorrect dependency ordering), the system should identify the subtree affected by that decision - Only the affected subtree should be recomputed, not the entire plan hierarchy - The rest of the plan tree should remain intact and unaffected - This selective recomputation should be significantly faster than full plan regeneration for large hierarchies ### Current Behavior Code inspection of the `DecompositionService` (`src/cleveragents/application/services/decomposition_service.py`) and related services reveals no implementation of decision correction or selective subtree recomputation. The system can decompose plans into hierarchical subplans and execute them, but there is no mechanism to: 1. Detect that a decision in the plan tree was incorrect 2. Identify the affected subtree rooted at the incorrect decision node 3. Recompute only that subtree while preserving the rest of the plan hierarchy Searches for "decision_correction", "selective_recomputation", "recompute_subtree", and related terms in the codebase return no results. ## Acceptance Criteria - [ ] A `CorrectionService` or equivalent mechanism exists that can identify the subtree rooted at a given decision node - [ ] Given a plan hierarchy and a node ID, the system can recompute only the subtree below that node - [ ] The rest of the plan hierarchy is preserved unchanged during selective recomputation - [ ] BDD scenarios exist covering: correct decision identified, subtree recomputed, sibling branches unaffected - [ ] `nox` passes with coverage >= 97% including the new correction scenarios ## Subtasks - [ ] Design `CorrectionService` interface with `recompute_subtree(node_id, config)` method - [ ] Implement subtree identification using `DecompositionNode.parent_id` / `children_ids` - [ ] Implement selective recomputation that preserves sibling branches - [ ] Add `DecisionCorrectionResult` model to track what was recomputed vs preserved - [ ] Tests (Behave): Add scenarios for selective subtree recomputation - [ ] Tests (Behave): Add scenarios verifying sibling branches are unaffected - [ ] 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, followed by a blank line, then additional lines providing relevant details about the implementation. - 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. ### Supporting Information - Spec reference: v3.5.0 milestone (M6: Autonomy Hardening) - "Decision correction recomputes only affected subtree" - Related files: `src/cleveragents/application/services/decomposition_service.py`, `src/cleveragents/application/services/decomposition_models.py` - The `DecompositionNode` model has `parent_id` and `children_ids` fields that could support subtree identification, but no correction logic uses them --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
Author
Owner

Implementation Attempt - Tier 1: Haiku - Success

Implemented selective subtree recomputation for decision correction in the decomposition domain.

What was done:

  • Added DecisionCorrectionResult model to decomposition_models.py to track which nodes were recomputed vs preserved
  • Added recompute_subtree(node_id, existing_result, config) method to DecompositionService that:
    • Identifies the subtree rooted at the given node using BFS over DecompositionNode.children_ids
    • Recomputes only that subtree while preserving sibling branches and ancestor nodes
    • Returns a DecisionCorrectionResult with recomputed_nodes, preserved_nodes, and metrics
  • Added BDD feature file features/decomposition_decision_correction.feature with 9 scenarios
  • Added step definitions in features/steps/decomposition_decision_correction_steps.py

Quality gate status: lint ✓, typecheck ✓, unit_tests ✓ (9 scenarios, 49 steps)

PR: #10771 - #10771


Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-worker

**Implementation Attempt** - Tier 1: Haiku - Success Implemented selective subtree recomputation for decision correction in the decomposition domain. **What was done:** - Added `DecisionCorrectionResult` model to `decomposition_models.py` to track which nodes were recomputed vs preserved - Added `recompute_subtree(node_id, existing_result, config)` method to `DecompositionService` that: - Identifies the subtree rooted at the given node using BFS over `DecompositionNode.children_ids` - Recomputes only that subtree while preserving sibling branches and ancestor nodes - Returns a `DecisionCorrectionResult` with recomputed_nodes, preserved_nodes, and metrics - Added BDD feature file `features/decomposition_decision_correction.feature` with 9 scenarios - Added step definitions in `features/steps/decomposition_decision_correction_steps.py` **Quality gate status:** lint ✓, typecheck ✓, unit_tests ✓ (9 scenarios, 49 steps) **PR:** #10771 - https://git.cleverthis.com/cleveragents/cleveragents-core/pulls/10771 --- **Automated by CleverAgents Bot** Supervisor: Implementation Pool | Agent: implementation-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.

Dependencies

No dependencies set.

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