UAT: agents plan correct does not warn about irreversible side effects or reject corrections with applied child plans #5089

Open
opened 2026-04-09 00:59:39 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: Sandbox and Checkpoint / Correction Model
Tested By: UAT worker (uat-pool-1), feature area: Sandbox and Checkpoint
Severity: High (safety guarantees violated — corrections can proceed without warning about irreversible effects)


What Was Tested

The agents plan correct command was analyzed to verify it enforces the correction safety guarantees defined in the specification (§Correction Safety, lines 28951–28964).

Expected Behavior (from spec)

The spec defines the following correction safety guarantees (§Correction Safety, lines 28953–28964):

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

Additionally, the spec (§Mid-Execute Correction, line 28822) states:

If non-rollbackable resources exist, the user is warned and must confirm. If downstream decisions triggered tools with irreversible side_effects, the user is warned that external effects cannot be undone.

Actual Behavior (from code)

The correct_decision function in src/cleveragents/cli/commands/plan.py (lines 3115–3351):

  1. No irreversible side effects warning: The command only shows a generic confirmation prompt "Proceed with correction?" — it does NOT check for non-rollbackable resources or tools with irreversible side_effects

  2. No applied child plan rejection: The CorrectionService.execute_revert() does NOT check whether any affected child plans are already applied. The spec requires rejecting the correction in this case.

The CorrectionService.analyze_impact() computes affected_child_plans=[] (always empty — see src/cleveragents/application/services/correction_service.py line ~280) and never queries the actual child plan states.

Code Location

  • src/cleveragents/cli/commands/plan.py, correct_decision() function (lines 3115–3351) — missing side effects warning
  • src/cleveragents/application/services/correction_service.py, analyze_impact() method — affected_child_plans always empty
  • src/cleveragents/application/services/correction_service.py, execute_revert() method — no applied child plan check

Steps to Reproduce

Scenario 1 — Irreversible side effects not warned:

  1. Execute a plan that uses tools with side_effects: ["external_api_call"]
  2. Run agents plan correct <DECISION_ID> --mode revert --guidance "..."
  3. Expected: Warning "This correction affects decisions that triggered irreversible external API calls. These effects cannot be undone. Proceed?"
  4. Actual: Generic "Proceed with correction?" prompt with no mention of irreversible effects

Scenario 2 — Applied child plan not rejected:

  1. Execute a plan that spawns a child plan
  2. Apply the child plan (agents plan apply <CHILD_PLAN_ID>)
  3. Run agents plan correct <PARENT_DECISION_ID> --mode revert --guidance "..." targeting a decision that spawned the now-applied child plan
  4. Expected: Error "Cannot correct: affected subtree includes applied child plan <CHILD_PLAN_ID>. Correct the child plan independently or use --mode=append."
  5. Actual: Correction proceeds, potentially creating an inconsistent state

Impact

  • Safety: Users can accidentally proceed with corrections that have irreversible external effects without being warned
  • Data integrity: Corrections can proceed even when applied child plans block safe reversion, violating the spec's "Never modify already-applied changes" guarantee
  • Spec compliance: Two of the seven correction safety guarantees are not implemented

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

## Bug Report **Feature Area**: Sandbox and Checkpoint / Correction Model **Tested By**: UAT worker (uat-pool-1), feature area: Sandbox and Checkpoint **Severity**: High (safety guarantees violated — corrections can proceed without warning about irreversible effects) --- ## What Was Tested The `agents plan correct` command was analyzed to verify it enforces the correction safety guarantees defined in the specification (§Correction Safety, lines 28951–28964). ## Expected Behavior (from spec) The spec defines the following correction safety guarantees (§Correction Safety, lines 28953–28964): > 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** Additionally, the spec (§Mid-Execute Correction, line 28822) states: > If non-rollbackable resources exist, the user is warned and must confirm. If downstream decisions triggered tools with irreversible `side_effects`, the user is warned that external effects cannot be undone. ## Actual Behavior (from code) The `correct_decision` function in `src/cleveragents/cli/commands/plan.py` (lines 3115–3351): 1. **No irreversible side effects warning**: The command only shows a generic confirmation prompt "Proceed with correction?" — it does NOT check for non-rollbackable resources or tools with irreversible `side_effects` 2. **No applied child plan rejection**: The `CorrectionService.execute_revert()` does NOT check whether any affected child plans are already applied. The spec requires rejecting the correction in this case. The `CorrectionService.analyze_impact()` computes `affected_child_plans=[]` (always empty — see `src/cleveragents/application/services/correction_service.py` line ~280) and never queries the actual child plan states. ## Code Location - `src/cleveragents/cli/commands/plan.py`, `correct_decision()` function (lines 3115–3351) — missing side effects warning - `src/cleveragents/application/services/correction_service.py`, `analyze_impact()` method — `affected_child_plans` always empty - `src/cleveragents/application/services/correction_service.py`, `execute_revert()` method — no applied child plan check ## Steps to Reproduce **Scenario 1 — Irreversible side effects not warned:** 1. Execute a plan that uses tools with `side_effects: ["external_api_call"]` 2. Run `agents plan correct <DECISION_ID> --mode revert --guidance "..."` 3. Expected: Warning "This correction affects decisions that triggered irreversible external API calls. These effects cannot be undone. Proceed?" 4. Actual: Generic "Proceed with correction?" prompt with no mention of irreversible effects **Scenario 2 — Applied child plan not rejected:** 1. Execute a plan that spawns a child plan 2. Apply the child plan (`agents plan apply <CHILD_PLAN_ID>`) 3. Run `agents plan correct <PARENT_DECISION_ID> --mode revert --guidance "..."` targeting a decision that spawned the now-applied child plan 4. Expected: Error "Cannot correct: affected subtree includes applied child plan <CHILD_PLAN_ID>. Correct the child plan independently or use --mode=append." 5. Actual: Correction proceeds, potentially creating an inconsistent state ## Impact - **Safety**: Users can accidentally proceed with corrections that have irreversible external effects without being warned - **Data integrity**: Corrections can proceed even when applied child plans block safe reversion, violating the spec's "Never modify already-applied changes" guarantee - **Spec compliance**: Two of the seven correction safety guarantees are not implemented --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 01:11:05 +00:00
Author
Owner

Issue triaged by project owner: Verified as valid spec compliance bug. Priority: Medium. Milestone: v3.2.0.


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

Issue triaged by project owner: Verified as valid spec compliance bug. Priority: Medium. Milestone: v3.2.0. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: 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#5089
No description provided.