UAT: CorrectionService.execute_append generates a stub child plan ID without creating a real child plan #3836

Open
opened 2026-04-06 06:51:41 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-correction-append-stub-child-plan
  • Commit Message: fix(correction): wire CorrectionService.execute_append to SubplanService for real child plan creation
  • Milestone: (backlog — no milestone)
  • Parent Epic: #397

Background and Context

CorrectionService.execute_append() in src/cleveragents/application/services/correction_service.py is supposed to spawn a new child plan when an append correction is applied. However, the current implementation only generates a random ULID as the spawned_child_plan_id without actually creating a real child plan via SubplanService or PlanLifecycleService.

Current Behavior

In correction_service.py (lines ~599-612), the append execution:

try:
    child_plan_id = str(ULID())  # ← stub: just generates a random ULID
    new_decision_id = str(ULID())  # ← stub: just generates a random ULID

    result = CorrectionResult(
        correction_id=correction_id,
        status=CorrectionStatus.APPLIED,
        new_decisions=[new_decision_id],
        spawned_child_plan_id=child_plan_id,
    )

No actual child plan is created in the database, no subplan_spawn decision is recorded, and no user_intervention decision is created to inject the correction guidance.

Expected Behavior (from spec)

Per the specification (§ Correction Flow, Append Mode):

  1. A new child plan should be spawned via SubplanService or PlanLifecycleService with the correction guidance as its prompt
  2. A subplan_spawn decision should be recorded in the parent plan's decision tree
  3. A user_intervention decision should be created to inject the correction guidance
  4. The CorrectionAttemptRecord should be persisted to the correction_attempts table via CorrectionAttemptRepository
  5. The spawned child plan ID should be a real plan ID that can be referenced by subsequent commands

Impact

  • agents plan correct <DECISION_ID> --mode append --guidance "..." appears to succeed but creates no real child plan
  • The returned correction_id references a correction that has no real child plan
  • agents plan diff --correction <ID> (once implemented) would find no real changes
  • The correction attempt is not persisted to the database (in-memory only)

Code Location

  • src/cleveragents/application/services/correction_service.pyexecute_append() method, lines ~563-630
  • src/cleveragents/application/services/subplan_service.pySubplanService for real child plan creation
  • src/cleveragents/application/container.pyCorrectionService is wired as a Singleton but without SubplanService or PlanLifecycleService injection

Subtasks

  • Inject SubplanService or PlanLifecycleService into CorrectionService.__init__
  • In execute_append(), call the real subplan spawning API with the correction guidance
  • Record a subplan_spawn decision in the parent plan's decision tree
  • Record a user_intervention decision with the correction guidance
  • Persist the CorrectionAttemptRecord to the database via CorrectionAttemptRepository
  • Update the DI container to wire the new dependencies
  • Add Behave BDD tests verifying a real child plan is created

Definition of Done

  • agents plan correct <DECISION_ID> --mode append --guidance "..." creates a real child plan
  • The child plan ID is a valid ULID that can be retrieved via agents plan status <ID>
  • A subplan_spawn decision is recorded in the parent plan's decision tree
  • A user_intervention decision is recorded with the correction guidance
  • The CorrectionAttemptRecord is persisted to the database
  • Behave unit tests verify real child plan creation
  • nox -e unit_tests passes
  • nox -e typecheck passes

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.


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

## Metadata - **Branch**: `fix/backlog-correction-append-stub-child-plan` - **Commit Message**: `fix(correction): wire CorrectionService.execute_append to SubplanService for real child plan creation` - **Milestone**: *(backlog — no milestone)* - **Parent Epic**: #397 ## Background and Context `CorrectionService.execute_append()` in `src/cleveragents/application/services/correction_service.py` is supposed to spawn a new child plan when an append correction is applied. However, the current implementation only generates a random ULID as the `spawned_child_plan_id` without actually creating a real child plan via `SubplanService` or `PlanLifecycleService`. ## Current Behavior In `correction_service.py` (lines ~599-612), the append execution: ```python try: child_plan_id = str(ULID()) # ← stub: just generates a random ULID new_decision_id = str(ULID()) # ← stub: just generates a random ULID result = CorrectionResult( correction_id=correction_id, status=CorrectionStatus.APPLIED, new_decisions=[new_decision_id], spawned_child_plan_id=child_plan_id, ) ``` No actual child plan is created in the database, no `subplan_spawn` decision is recorded, and no `user_intervention` decision is created to inject the correction guidance. ## Expected Behavior (from spec) Per the specification (§ Correction Flow, Append Mode): 1. A new child plan should be spawned via `SubplanService` or `PlanLifecycleService` with the correction guidance as its prompt 2. A `subplan_spawn` decision should be recorded in the parent plan's decision tree 3. A `user_intervention` decision should be created to inject the correction guidance 4. The `CorrectionAttemptRecord` should be persisted to the `correction_attempts` table via `CorrectionAttemptRepository` 5. The spawned child plan ID should be a real plan ID that can be referenced by subsequent commands ## Impact - `agents plan correct <DECISION_ID> --mode append --guidance "..."` appears to succeed but creates no real child plan - The returned `correction_id` references a correction that has no real child plan - `agents plan diff --correction <ID>` (once implemented) would find no real changes - The correction attempt is not persisted to the database (in-memory only) ## Code Location - `src/cleveragents/application/services/correction_service.py` — `execute_append()` method, lines ~563-630 - `src/cleveragents/application/services/subplan_service.py` — `SubplanService` for real child plan creation - `src/cleveragents/application/container.py` — `CorrectionService` is wired as a `Singleton` but without `SubplanService` or `PlanLifecycleService` injection ## Subtasks - [ ] Inject `SubplanService` or `PlanLifecycleService` into `CorrectionService.__init__` - [ ] In `execute_append()`, call the real subplan spawning API with the correction guidance - [ ] Record a `subplan_spawn` decision in the parent plan's decision tree - [ ] Record a `user_intervention` decision with the correction guidance - [ ] Persist the `CorrectionAttemptRecord` to the database via `CorrectionAttemptRepository` - [ ] Update the DI container to wire the new dependencies - [ ] Add Behave BDD tests verifying a real child plan is created ## Definition of Done - [ ] `agents plan correct <DECISION_ID> --mode append --guidance "..."` creates a real child plan - [ ] The child plan ID is a valid ULID that can be retrieved via `agents plan status <ID>` - [ ] A `subplan_spawn` decision is recorded in the parent plan's decision tree - [ ] A `user_intervention` decision is recorded with the correction guidance - [ ] The `CorrectionAttemptRecord` is persisted to the database - [ ] Behave unit tests verify real child plan creation - [ ] `nox -e unit_tests` passes - [ ] `nox -e typecheck` passes > **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. --- **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.

Blocks
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3836
No description provided.