UAT: agents plan correct does not increment plan.attempt — spec safety guarantee violated #4914

Open
opened 2026-04-08 20:19:24 +00:00 by HAL9000 · 2 comments
Owner

Bug Report

Feature Area: Correction Model — Correction Safety Guarantees / Plan Attempt Tracking
Severity: Medium (spec safety guarantee not enforced)
Found by: UAT tester, code analysis
Spec reference: docs/specification.md §Correction Safety (line ~28953)


What Was Tested

The agents plan correct command was analyzed to verify that it increments plan.attempt as required by the spec's safety guarantees.

Expected Behavior (from spec)

The spec defines explicit safety guarantees for corrections:

Corrections always:

  • Create a new attempt revision (increment plan.attempt)
  • Preserve old artifacts for diff/compare
  • Run execute in sandbox again
  • Require apply gating again
  • Never modify already-applied changes
  • Warn about irreversible side effects before proceeding
  • Reject correction of decisions whose affected subtree includes applied child plans

The spec's agents plan correct output also shows Attempt: 2 in the Correction panel, confirming the attempt counter is incremented and displayed.

The v3_plans table has an attempt column (integer, default 1) that tracks the current attempt number.

Actual Behavior

The CorrectionService.execute_revert() and execute_append() methods (lines 411–640 of correction_service.py) do not increment plan.attempt. The correction flow:

  1. Creates a CorrectionRequest
  2. Analyzes impact
  3. Executes revert/append
  4. Returns CorrectionResult

At no point does the service call PlanLifecycleService or any repository to increment the plan's attempt counter.

The correct_decision CLI command (lines 3114–3351 of plan.py) also does not increment plan.attempt before or after executing the correction.

The LifecyclePlanModel in models.py has attempt = Column(Integer, nullable=False, default=1) but it is only incremented during plan retry flows, not during corrections.

Code Location

  • src/cleveragents/application/services/correction_service.py, lines 411–640 (no plan.attempt increment)
  • src/cleveragents/cli/commands/plan.py, lines 3114–3351 (no plan.attempt increment)
  • src/cleveragents/infrastructure/database/models.py, line 640 (attempt column exists but unused by correction)

Impact

  • The spec's safety guarantee "Create a new attempt revision (increment plan.attempt)" is not enforced
  • The Attempt: 2 field shown in the spec's agents plan correct output is never populated correctly
  • Users cannot track how many correction attempts have been made on a plan
  • The attempt counter is always 1 regardless of how many corrections have been applied

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

## Bug Report **Feature Area:** Correction Model — Correction Safety Guarantees / Plan Attempt Tracking **Severity:** Medium (spec safety guarantee not enforced) **Found by:** UAT tester, code analysis **Spec reference:** `docs/specification.md` §Correction Safety (line ~28953) --- ### What Was Tested The `agents plan correct` command was analyzed to verify that it increments `plan.attempt` as required by the spec's safety guarantees. ### Expected Behavior (from spec) The spec defines explicit safety guarantees for corrections: > **Corrections always:** > - [x] Create a new attempt revision (increment `plan.attempt`) > - [x] Preserve old artifacts for diff/compare > - [x] Run execute in sandbox again > - [x] Require apply gating again > - [x] Never modify already-applied changes > - [x] Warn about irreversible side effects before proceeding > - [x] Reject correction of decisions whose affected subtree includes applied child plans The spec's `agents plan correct` output also shows `Attempt: 2` in the Correction panel, confirming the attempt counter is incremented and displayed. The `v3_plans` table has an `attempt` column (integer, default 1) that tracks the current attempt number. ### Actual Behavior The `CorrectionService.execute_revert()` and `execute_append()` methods (lines 411–640 of `correction_service.py`) do **not** increment `plan.attempt`. The correction flow: 1. Creates a `CorrectionRequest` 2. Analyzes impact 3. Executes revert/append 4. Returns `CorrectionResult` At no point does the service call `PlanLifecycleService` or any repository to increment the plan's `attempt` counter. The `correct_decision` CLI command (lines 3114–3351 of `plan.py`) also does not increment `plan.attempt` before or after executing the correction. The `LifecyclePlanModel` in `models.py` has `attempt = Column(Integer, nullable=False, default=1)` but it is only incremented during plan retry flows, not during corrections. ### Code Location - `src/cleveragents/application/services/correction_service.py`, lines 411–640 (no `plan.attempt` increment) - `src/cleveragents/cli/commands/plan.py`, lines 3114–3351 (no `plan.attempt` increment) - `src/cleveragents/infrastructure/database/models.py`, line 640 (`attempt` column exists but unused by correction) ### Impact - The spec's safety guarantee "Create a new attempt revision (increment `plan.attempt`)" is not enforced - The `Attempt: 2` field shown in the spec's `agents plan correct` output is never populated correctly - Users cannot track how many correction attempts have been made on a plan - The attempt counter is always 1 regardless of how many corrections have been applied --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.3.0 milestone 2026-04-08 23:00:09 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium — spec safety guarantee "Create a new attempt revision (increment plan.attempt)" is not enforced; users cannot track correction attempts
  • Milestone: v3.3.0 — Corrections + Subplans + Checkpoints milestone; this is a correction safety guarantee bug
  • Story Points: 3 — M — requires adding plan.attempt increment in CorrectionService.execute_revert() and execute_append(), plus CLI display update
  • MoSCoW: Should Have — spec explicitly lists this as a safety guarantee; important for audit trail but doesn't block corrections from executing
  • Parent Epic: Correction Model epic (v3.3.0)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium — spec safety guarantee "Create a new attempt revision (increment `plan.attempt`)" is not enforced; users cannot track correction attempts - **Milestone**: v3.3.0 — Corrections + Subplans + Checkpoints milestone; this is a correction safety guarantee bug - **Story Points**: 3 — M — requires adding `plan.attempt` increment in `CorrectionService.execute_revert()` and `execute_append()`, plus CLI display update - **MoSCoW**: Should Have — spec explicitly lists this as a safety guarantee; important for audit trail but doesn't block corrections from executing - **Parent Epic**: Correction Model epic (v3.3.0) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
Author
Owner

Label compliance fix applied:

  • Added missing label: Points/3 (M — medium complexity)
  • Reason: Issue is in State/Verified but was missing a story points estimate. Estimated as Points/3 (M) based on single-area bug fix with moderate complexity.

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing label: `Points/3` (M — medium complexity) - Reason: Issue is in `State/Verified` but was missing a story points estimate. Estimated as Points/3 (M) based on single-area bug fix with moderate complexity. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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#4914
No description provided.