Manual automation profile disrespected - plan auto-progresses through phases causing invalid phase transitions #4328

Closed
opened 2026-04-07 19:28:04 +00:00 by CoreRasurae · 4 comments
Member

Current Behavior

When executing a plan with --automation-profile "manual" (which requires human approval for ALL phase transitions), the plan auto-progresses through phases it should not:

agents plan use \
  --automation-profile "manual" \
  local/fpga-porting-cyclone-to-xilinx-simple \
  local/fpga-porting-mister-simple

agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ

Observed behavior:

  • Strategize phase: auto-starts and auto-completes (SHOULD require approval)
  • Execute phase: auto-starts and auto-completes (SHOULD require approval)
  • Error logged: "Invalid phase transition from execute to execute"
  • Plan state: Execute/COMPLETE (should be Strategize/COMPLETE waiting for approval)
  • Total time: ~2.5 minutes of automatic execution without any human approval
  • Error occurs when user runs agents plan execute after phases have already auto-executed

Verified Timeline from Fresh Reproduction:

21:16:21.093697 — Plan created (Strategize/QUEUED)
21:16:39.380627 — Strategize STARTED automatically (18 seconds later, by async job system!)
21:16:49.130006 — Strategize COMPLETED (auto-progressed!)
21:16:49.143972 — Execute STARTED (milliseconds later, auto-progressed!)
21:18:47.034208 — Execute COMPLETED (2 minutes of execution work)
21:18:47.056502 — User runs: agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ
21:18:47.056502 — ERROR: "Invalid phase transition from execute to execute"

Critical Finding:

  • Phases auto-executed BEFORE user ran agents plan execute
  • Strategize started 18 seconds after plan creation WITHOUT user command
  • This proves the async job system is auto-executing phases, not just the CLI
  • Error occurs when user finally runs the command and finds phases already done

Profile Setting Confirmed:

  • User explicitly passed: --automation-profile "manual"
  • Plan shows: Automation Profile: manual (source: plan)
  • All thresholds are 1.0 (require human approval)
  • Yet ALL phases executed automatically without waiting for approval

Root Cause Analysis

The "manual" automation profile is defined correctly:

File: src/cleveragents/domain/models/core/automation_profile.py lines 426-448

"manual": AutomationProfile(
    name="manual",
    decompose_task=1.0,      # Block Strategize start
    create_tool=1.0,         # Block Strategize→Execute
    select_tool=1.0,         # Block Execute→Apply
    execute_command=1.0,     # Block Execute commands
    # ... all thresholds = 1.0 (human approval required)
)

But in practice:

  1. User explicitly passes --automation-profile "manual" to plan use
  2. Plan is created with "Automation Profile: manual (source: plan)"
  3. Strategize auto-starts 18 seconds later (async job system, not user command!)
  4. Plan auto-progresses through Strategize→Execute→Complete despite automation=manual
  5. User eventually runs agents plan execute but work is already done
  6. Error occurs: "Invalid phase transition from execute to execute"

Implementation Bug Chain

Bug Scope: BROADER THAN CLI - ASYNC JOB SYSTEM IS PRIMARY

The bug affects THREE components, not just CLI orchestration:

1. Async Job System (PRIMARY ISSUE - The Root Cause)

Location: Async job worker and enqueuing logic (details TBD)

Evidence:

  • Strategize phase started 18 seconds after plan creation
  • User never issued ANY command before this happened
  • Background async worker auto-executed despite manual profile
  • This is the root cause — the async system bypasses profile gates

Problem:

  • When plan transitions to Strategize/QUEUED, an async job is automatically enqueued
  • The async worker picks up the job and runs Strategize phase
  • Automation profile is completely ignored by the async executor
  • This happens BEFORE the user even runs agents plan execute

2. Phase Completion Auto-Progression

Location: src/cleveragents/application/services/plan_lifecycle_service.py

Methods that call auto_progress() unconditionally:

  • complete_strategize() line 1454 → auto-progresses to Execute
  • complete_execute() line 1643 → attempts to auto-progress to Apply
  • fail_strategize() returns result of auto_progress call

Problem: The auto_progress() method is called regardless of automation profile. The profile gates should prevent transitions when thresholds are 1.0 (manual approval required), but they don't.

3. CLI Orchestration (SECONDARY ISSUE)

Location: src/cleveragents/cli/commands/plan.py function execute_plan() (lines 1939-2150)

The CLI manually orchestrates phases instead of using the designed try_auto_run() method:

  1. Line 2065-2069: Calls executor.run_strategize(plan_id) if in Strategize

  2. Execution continues through executor:

    • PlanExecutor.run_strategize() → calls _lifecycle.complete_strategize()
    • complete_strategize() calls auto_progress() automatically (line 1454)
    • auto_progress() is called regardless of automation profile
  3. Line 2070-2100: CLI re-fetches plan and finds it's already in Execute

    • Comment says: "Auto-progress in complete_strategize may have already advanced the plan to Execute"
    • The code EXPECTS auto-progression to happen, violating the manual profile
  4. Line 2106-2111: If plan is in Execute/QUEUED, calls executor.run_execute()

    • This runs the Execute phase to completion
    • Execute completion ALSO calls auto_progress()

4. Dead Code Complication

Location: src/cleveragents/application/services/plan_lifecycle_service.py lines 2272-2347

Method try_auto_run() exists to properly handle automated phase transitions with profile gates, but:

  • It is NEVER CALLED anywhere in the codebase
  • The CLI and async system manually orchestrate phases instead
  • This creates a mismatch where automation profile guards are bypassed

Impact

  • Manual automation profile is completely ineffective
  • Async job system auto-executes phases without checking profile gates (PRIMARY ISSUE)
  • Phase completion methods auto-progress without profile checks
  • Users cannot prevent automatic phase progression
  • Plan execution bypasses human approval gates
  • "Invalid phase transition from execute to execute" errors occur when user finally checks on plan
  • Cannot safely use --automation-profile "manual" for gated workflows
  • Plans auto-execute before user even runs any command (critical security issue)
  • Affects all 8 built-in profiles (only manual is verified, but all may have issues)

Expected Behavior

When --automation-profile "manual" is used:

  1. Plan transitions to Strategize/QUEUED after plan use
  2. Plan does NOT auto-execute (must wait for user approval)
  3. Plan remains in Strategize/QUEUED until user explicitly approves
  4. User runs agents plan execute <id> to approve Strategize start
  5. System starts Strategize, runs LLM strategy, and stops at Strategize/COMPLETE
  6. User reviews strategy and runs agents plan execute <id> again
  7. System transitions to Execute/QUEUED but does NOT auto-start Execute
  8. User runs agents plan execute <id> to approve and start Execute
  9. System executes the plan and stops at Execute/COMPLETE
  10. User reviews results and runs agents plan apply <id> to transition to Apply

All phase transitions should require explicit user command when automation=manual.

No automatic execution should occur at any point, whether by CLI or async jobs.

Acceptance Criteria

  • Manual automation profile prevents automatic Strategize start (decompose_task=1.0)
  • Manual automation profile prevents automatic Strategize→Execute transition (create_tool=1.0)
  • Manual automation profile prevents automatic Execute→Apply transition (select_tool=1.0)
  • Async job system respects automation profile BEFORE executing any phase
  • Plan remains in Strategize/QUEUED until user explicitly runs agents plan execute
  • should_auto_progress() returns False for all gates when threshold=1.0
  • Phase completion methods respect automation profile before calling auto_progress()
  • Plan with manual profile stops at phase boundaries and waits for user command
  • User must explicitly run agents plan execute between each phase
  • No "invalid phase transition from X to X" errors occur for valid phase states
  • CLI uses the designed try_auto_run() method instead of manual orchestration
  • Test coverage includes all phase gating scenarios for manual profile
  • All 8 built-in profiles work as documented

Metadata

  • Commit Message: fix(automation): respect automation profile gates in lifecycle service and async jobs
  • Branch: fix/automation-profile-gates-lifecycle

Subtasks

  • Async Job System: Identify where plan transitions to Strategize/QUEUED trigger async job enqueue
  • Async Job System: Find where async worker picks up jobs and executes Strategize phase
  • Async Job System: Add automation profile checks BEFORE async job execution
  • Async Job System: Verify async jobs respect profile gates (decompose_task, create_tool, select_tool)
  • Lifecycle Service: Review _resolve_profile_for_plan() implementation
  • Lifecycle Service: Verify should_auto_progress() correctly evaluates all threshold gates
  • Lifecycle Service: Update complete_strategize() to check profile before calling auto_progress()
  • Lifecycle Service: Update complete_execute() to check profile before calling auto_progress()
  • Lifecycle Service: Add guards to auto_progress() itself to prevent execution when gates blocked
  • CLI: Refactor execute_plan() to use try_auto_run() or call methods with profile checks
  • Code Quality: Remove dead try_auto_run() or integrate it into the execution flow
  • Logging: Add detailed logging to track automation profile gate evaluations at each point
  • Testing: Add integration tests for manual profile with explicit phase progression
  • Testing: Add integration tests for all 8 built-in profiles
  • Error Messages: Verify error messages are clear when gates block progression

Definition of Done

This issue is complete when:

  • Async job system respects automation profile gates BEFORE executing any phase
  • Manual automation profile correctly blocks automatic phase progression at all points
  • Plans remain in Strategize/QUEUED until user explicitly approves
  • User must explicitly approve each phase transition with agents plan execute or similar
  • No auto-progression occurs for any profile with threshold = 1.0 on active gates
  • Integration tests verify all phase gating scenarios for all 8 profiles
  • All subtasks are completed and checked off
  • A commit is created where the first line matches the Commit Message in Metadata exactly
  • The commit is pushed to the remote on the fix/automation-profile-gates-lifecycle branch
  • A pull request is submitted to master, reviewed, and merged
## Current Behavior When executing a plan with `--automation-profile "manual"` (which requires human approval for ALL phase transitions), the plan **auto-progresses through phases it should not**: ```bash agents plan use \ --automation-profile "manual" \ local/fpga-porting-cyclone-to-xilinx-simple \ local/fpga-porting-mister-simple agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ ``` **Observed behavior:** - Strategize phase: auto-starts and auto-completes (SHOULD require approval) - Execute phase: auto-starts and auto-completes (SHOULD require approval) - Error logged: "Invalid phase transition from execute to execute" - Plan state: Execute/COMPLETE (should be Strategize/COMPLETE waiting for approval) - Total time: ~2.5 minutes of automatic execution without any human approval - **Error occurs when user runs `agents plan execute` after phases have already auto-executed** **Verified Timeline from Fresh Reproduction:** ``` 21:16:21.093697 — Plan created (Strategize/QUEUED) 21:16:39.380627 — Strategize STARTED automatically (18 seconds later, by async job system!) 21:16:49.130006 — Strategize COMPLETED (auto-progressed!) 21:16:49.143972 — Execute STARTED (milliseconds later, auto-progressed!) 21:18:47.034208 — Execute COMPLETED (2 minutes of execution work) 21:18:47.056502 — User runs: agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ 21:18:47.056502 — ERROR: "Invalid phase transition from execute to execute" ``` **Critical Finding:** - Phases auto-executed BEFORE user ran `agents plan execute` - Strategize started 18 seconds after plan creation WITHOUT user command - This proves the **async job system** is auto-executing phases, not just the CLI - Error occurs when user finally runs the command and finds phases already done **Profile Setting Confirmed:** - User explicitly passed: `--automation-profile "manual"` - Plan shows: `Automation Profile: manual (source: plan)` - All thresholds are 1.0 (require human approval) - Yet ALL phases executed automatically without waiting for approval ## Root Cause Analysis The "manual" automation profile is defined correctly: **File:** `src/cleveragents/domain/models/core/automation_profile.py` lines 426-448 ```python "manual": AutomationProfile( name="manual", decompose_task=1.0, # Block Strategize start create_tool=1.0, # Block Strategize→Execute select_tool=1.0, # Block Execute→Apply execute_command=1.0, # Block Execute commands # ... all thresholds = 1.0 (human approval required) ) ``` **But in practice:** 1. User explicitly passes `--automation-profile "manual"` to `plan use` 2. Plan is created with "Automation Profile: manual (source: plan)" 3. Strategize **auto-starts 18 seconds later** (async job system, not user command!) 4. Plan auto-progresses through Strategize→Execute→Complete despite automation=manual 5. User eventually runs `agents plan execute` but work is already done 6. Error occurs: "Invalid phase transition from execute to execute" ## Implementation Bug Chain ### Bug Scope: BROADER THAN CLI - ASYNC JOB SYSTEM IS PRIMARY The bug affects **THREE components**, not just CLI orchestration: ### 1. Async Job System (PRIMARY ISSUE - The Root Cause) **Location:** Async job worker and enqueuing logic (details TBD) **Evidence:** - Strategize phase started 18 seconds after plan creation - User never issued ANY command before this happened - Background async worker auto-executed despite manual profile - This is the **root cause** — the async system bypasses profile gates **Problem:** - When plan transitions to Strategize/QUEUED, an async job is automatically enqueued - The async worker picks up the job and runs Strategize phase - Automation profile is **completely ignored** by the async executor - This happens BEFORE the user even runs `agents plan execute` ### 2. Phase Completion Auto-Progression **Location:** `src/cleveragents/application/services/plan_lifecycle_service.py` Methods that call `auto_progress()` unconditionally: - `complete_strategize()` line 1454 → auto-progresses to Execute - `complete_execute()` line 1643 → attempts to auto-progress to Apply - `fail_strategize()` returns result of auto_progress call **Problem:** The `auto_progress()` method is called **regardless of automation profile**. The profile gates should prevent transitions when thresholds are 1.0 (manual approval required), but they don't. ### 3. CLI Orchestration (SECONDARY ISSUE) **Location:** `src/cleveragents/cli/commands/plan.py` function `execute_plan()` (lines 1939-2150) The CLI manually orchestrates phases instead of using the designed `try_auto_run()` method: 1. **Line 2065-2069:** Calls `executor.run_strategize(plan_id)` if in Strategize 2. **Execution continues through executor:** - `PlanExecutor.run_strategize()` → calls `_lifecycle.complete_strategize()` - `complete_strategize()` **calls `auto_progress()` automatically** (line 1454) - **`auto_progress()` is called regardless of automation profile** 3. **Line 2070-2100:** CLI re-fetches plan and finds it's already in Execute - Comment says: "Auto-progress in complete_strategize may have already advanced the plan to Execute" - **The code EXPECTS auto-progression to happen, violating the manual profile** 4. **Line 2106-2111:** If plan is in Execute/QUEUED, calls `executor.run_execute()` - This runs the Execute phase to completion - Execute completion ALSO calls `auto_progress()` ### 4. Dead Code Complication **Location:** `src/cleveragents/application/services/plan_lifecycle_service.py` lines 2272-2347 Method `try_auto_run()` exists to properly handle automated phase transitions with profile gates, but: - **It is NEVER CALLED anywhere in the codebase** - The CLI and async system manually orchestrate phases instead - This creates a mismatch where automation profile guards are bypassed ## Impact - ❌ Manual automation profile is completely ineffective - ❌ **Async job system auto-executes phases without checking profile gates** (PRIMARY ISSUE) - ❌ Phase completion methods auto-progress without profile checks - ❌ Users cannot prevent automatic phase progression - ❌ Plan execution bypasses human approval gates - ❌ "Invalid phase transition from execute to execute" errors occur when user finally checks on plan - ❌ Cannot safely use `--automation-profile "manual"` for gated workflows - ❌ **Plans auto-execute before user even runs any command** (critical security issue) - ❌ Affects all 8 built-in profiles (only manual is verified, but all may have issues) ## Expected Behavior When `--automation-profile "manual"` is used: 1. Plan transitions to Strategize/QUEUED after `plan use` 2. Plan **does NOT auto-execute** (must wait for user approval) 3. Plan **remains in Strategize/QUEUED** until user explicitly approves 4. User runs `agents plan execute <id>` to approve Strategize start 5. System starts Strategize, runs LLM strategy, and stops at Strategize/COMPLETE 6. User reviews strategy and runs `agents plan execute <id>` again 7. System transitions to Execute/QUEUED but **does NOT auto-start Execute** 8. User runs `agents plan execute <id>` to approve and start Execute 9. System executes the plan and stops at Execute/COMPLETE 10. User reviews results and runs `agents plan apply <id>` to transition to Apply **All phase transitions should require explicit user command when automation=manual.** **No automatic execution should occur at any point, whether by CLI or async jobs.** ## Acceptance Criteria - [ ] Manual automation profile prevents automatic Strategize start (decompose_task=1.0) - [ ] Manual automation profile prevents automatic Strategize→Execute transition (create_tool=1.0) - [ ] Manual automation profile prevents automatic Execute→Apply transition (select_tool=1.0) - [ ] **Async job system respects automation profile BEFORE executing any phase** - [ ] Plan remains in Strategize/QUEUED until user explicitly runs `agents plan execute` - [ ] `should_auto_progress()` returns False for all gates when threshold=1.0 - [ ] Phase completion methods respect automation profile before calling `auto_progress()` - [ ] Plan with manual profile stops at phase boundaries and waits for user command - [ ] User must explicitly run `agents plan execute` between each phase - [ ] No "invalid phase transition from X to X" errors occur for valid phase states - [ ] CLI uses the designed `try_auto_run()` method instead of manual orchestration - [ ] Test coverage includes all phase gating scenarios for manual profile - [ ] All 8 built-in profiles work as documented ## Metadata - **Commit Message**: `fix(automation): respect automation profile gates in lifecycle service and async jobs` - **Branch**: `fix/automation-profile-gates-lifecycle` ## Subtasks - [ ] **Async Job System**: Identify where plan transitions to Strategize/QUEUED trigger async job enqueue - [ ] **Async Job System**: Find where async worker picks up jobs and executes Strategize phase - [ ] **Async Job System**: Add automation profile checks BEFORE async job execution - [ ] **Async Job System**: Verify async jobs respect profile gates (decompose_task, create_tool, select_tool) - [ ] **Lifecycle Service**: Review `_resolve_profile_for_plan()` implementation - [ ] **Lifecycle Service**: Verify `should_auto_progress()` correctly evaluates all threshold gates - [ ] **Lifecycle Service**: Update `complete_strategize()` to check profile before calling `auto_progress()` - [ ] **Lifecycle Service**: Update `complete_execute()` to check profile before calling `auto_progress()` - [ ] **Lifecycle Service**: Add guards to `auto_progress()` itself to prevent execution when gates blocked - [ ] **CLI**: Refactor `execute_plan()` to use `try_auto_run()` or call methods with profile checks - [ ] **Code Quality**: Remove dead `try_auto_run()` or integrate it into the execution flow - [ ] **Logging**: Add detailed logging to track automation profile gate evaluations at each point - [ ] **Testing**: Add integration tests for manual profile with explicit phase progression - [ ] **Testing**: Add integration tests for all 8 built-in profiles - [ ] **Error Messages**: Verify error messages are clear when gates block progression ## Definition of Done This issue is complete when: - **Async job system respects automation profile gates BEFORE executing any phase** - Manual automation profile correctly blocks automatic phase progression at all points - Plans remain in Strategize/QUEUED until user explicitly approves - User must explicitly approve each phase transition with `agents plan execute` or similar - No auto-progression occurs for any profile with `threshold = 1.0` on active gates - Integration tests verify all phase gating scenarios for all 8 profiles - All subtasks are completed and checked off - A commit is created where the **first line** matches the Commit Message in Metadata exactly - The commit is pushed to the remote on the `fix/automation-profile-gates-lifecycle` branch - A pull request is submitted to `master`, reviewed, and merged
Author
Member

Additional Evidence: Async Job Auto-Execution

A fresh reproduction confirms the bug and reveals additional issues:

New Log Analysis

21:16:21 — Plan created (Strategize/QUEUED)
21:16:39 — Strategize STARTED automatically (18 seconds later, no user command!)
21:16:49 — Strategize COMPLETED
21:16:49 — Execute STARTED automatically (milliseconds later!)
21:18:47 — Execute COMPLETED (2 minute execution)
21:18:47 — ERROR: "Invalid phase transition from execute to execute"

Critical Findings

  1. Async Job System Bypasses Manual Profile

    • Strategize started automatically 18 seconds after plan creation
    • User never issued plan execute or any command
    • Background async job worker ran Strategize despite manual profile
    • This indicates the bug is not just in CLI, but in the lifecycle service and async job system
  2. Immediate Auto-Progression

    • Strategize→Execute transition happened in milliseconds
    • No gap for human review/approval
    • Despite create_tool=1.0 (manual approval required)
  3. Phase Completion Called Automatic auto_progress()

    • After Execute completed at 21:18:47.034208
    • At 21:18:47.056502, error "Invalid phase transition from execute to execute"
    • This is exactly when auto_progress() was called after Execute completion

Scope Expansion

The bug is NOT limited to CLI orchestration. It affects:

  • Async Job Worker — Auto-running phases despite profile gates
  • Lifecycle Serviceauto_progress() being called unconditionally
  • Profile Resolution — Manual profile gates being completely ignored
  • Phase State Management — Attempting Execute→Execute transitions

The root cause is deeper than CLI: the entire phase progression system doesn't respect automation profile thresholds when completing phases or running async jobs.

  1. Check where async jobs are enqueued for Strategize phase
  2. Verify async worker respects automation profile before executing jobs
  3. Ensure should_auto_progress() gates are checked before auto_progress() calls
  4. Add profile-aware guards to complete_strategize() and complete_execute() methods
## Additional Evidence: Async Job Auto-Execution A fresh reproduction confirms the bug and reveals additional issues: ### New Log Analysis ``` 21:16:21 — Plan created (Strategize/QUEUED) 21:16:39 — Strategize STARTED automatically (18 seconds later, no user command!) 21:16:49 — Strategize COMPLETED 21:16:49 — Execute STARTED automatically (milliseconds later!) 21:18:47 — Execute COMPLETED (2 minute execution) 21:18:47 — ERROR: "Invalid phase transition from execute to execute" ``` ### Critical Findings 1. **Async Job System Bypasses Manual Profile** - Strategize started automatically 18 seconds after plan creation - User never issued `plan execute` or any command - Background async job worker ran Strategize despite manual profile - This indicates the bug is not just in CLI, but in the lifecycle service and async job system 2. **Immediate Auto-Progression** - Strategize→Execute transition happened in milliseconds - No gap for human review/approval - Despite create_tool=1.0 (manual approval required) 3. **Phase Completion Called Automatic `auto_progress()`** - After Execute completed at 21:18:47.034208 - At 21:18:47.056502, error "Invalid phase transition from execute to execute" - This is exactly when `auto_progress()` was called after Execute completion ### Scope Expansion The bug is NOT limited to CLI orchestration. It affects: - **Async Job Worker** — Auto-running phases despite profile gates - **Lifecycle Service** — `auto_progress()` being called unconditionally - **Profile Resolution** — Manual profile gates being completely ignored - **Phase State Management** — Attempting Execute→Execute transitions The root cause is **deeper than CLI**: the entire phase progression system doesn't respect automation profile thresholds when completing phases or running async jobs. ### Recommended Investigation 1. Check where async jobs are enqueued for Strategize phase 2. Verify async worker respects automation profile before executing jobs 3. Ensure `should_auto_progress()` gates are checked before `auto_progress()` calls 4. Add profile-aware guards to `complete_strategize()` and `complete_execute()` methods
Author
Member

Issue Updated with Verified Evidence ✓

The issue has been fully updated with findings from fresh reproduction logs.

Key Updates

  1. Verified Timeline Added

    • Exact timestamps showing automatic execution without user approval
    • Strategize started 18 seconds after plan creation (no user command!)
    • Full execution flow captured in logs
  2. Bug Scope Expanded

    • Originally: Suspected CLI orchestration issue
    • Now verified: Affects async job system, lifecycle service, AND CLI
    • Async worker auto-executing phases despite manual profile is the primary issue
  3. Critical New Finding

    • Strategize phase started automatically without agents plan execute command
    • This indicates the bug is in the background job system, not just user-triggered CLI
    • Manual profile completely ignored by async executor
  4. Subtasks Reorganized

    • 13 specific action items (vs previous 9)
    • Tasks now organized by component: Async, Lifecycle, CLI, Quality, Testing
    • Clear ownership model for investigators
  5. Acceptance Criteria Enhanced

    • 12 specific, testable criteria
    • All 8 built-in profiles must be tested, not just manual
    • Profile gates must block at ALL points in execution flow

Why This Is Critical

This is NOT just a user-facing bug. It's a fundamental breach of the automation gate system:

  • Users cannot prevent automatic execution (manual profile is useless)
  • Sensitive operations can auto-execute without approval
  • Background processes (async jobs) bypass all profile guards
  • All 8 built-in profiles may be affected

Files to Investigate

  1. Async Job System - Find where Strategize started 18 seconds after plan creation
  2. PlanLifecycleService - complete_strategize(), complete_execute(), auto_progress()
  3. CLI execute_plan() - Manual phase orchestration violates profile gates
  4. Profile Resolution - Verify _resolve_profile_for_plan() works correctly

The issue is now production-ready for investigation and fix.

## Issue Updated with Verified Evidence ✓ **The issue has been fully updated with findings from fresh reproduction logs.** ### Key Updates 1. **Verified Timeline Added** - Exact timestamps showing automatic execution without user approval - Strategize started 18 seconds after plan creation (no user command!) - Full execution flow captured in logs 2. **Bug Scope Expanded** - Originally: Suspected CLI orchestration issue - **Now verified**: Affects **async job system, lifecycle service, AND CLI** - Async worker auto-executing phases despite manual profile is the primary issue 3. **Critical New Finding** - Strategize phase started automatically without `agents plan execute` command - This indicates the bug is in the **background job system**, not just user-triggered CLI - Manual profile completely ignored by async executor 4. **Subtasks Reorganized** - 13 specific action items (vs previous 9) - Tasks now organized by component: Async, Lifecycle, CLI, Quality, Testing - Clear ownership model for investigators 5. **Acceptance Criteria Enhanced** - 12 specific, testable criteria - All 8 built-in profiles must be tested, not just manual - Profile gates must block at ALL points in execution flow ### Why This Is Critical This is **NOT just a user-facing bug**. It's a **fundamental breach of the automation gate system**: - ❌ Users cannot prevent automatic execution (manual profile is useless) - ❌ Sensitive operations can auto-execute without approval - ❌ Background processes (async jobs) bypass all profile guards - ❌ All 8 built-in profiles may be affected ### Files to Investigate 1. **Async Job System** - Find where Strategize started 18 seconds after plan creation 2. **PlanLifecycleService** - `complete_strategize()`, `complete_execute()`, `auto_progress()` 3. **CLI execute_plan()** - Manual phase orchestration violates profile gates 4. **Profile Resolution** - Verify `_resolve_profile_for_plan()` works correctly The issue is now production-ready for investigation and fix.
Author
Member

Clarification: User DID Run agents plan execute - But Too Late

Correction to earlier statement: The user DID run agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ, but this occurred AFTER the phases had already auto-executed.

The Sequence of Events

  1. 21:16:21 — User runs: agents plan use --automation-profile "manual" ...

    • Plan created in Strategize/QUEUED state
  2. 21:16:39 — Strategize STARTS AUTOMATICALLY (18 seconds later)

    • NO user command issued at this point
    • Async job system picks up and executes without approval
  3. 21:16:39 → 21:18:47 — Strategize and Execute run to completion

    • Approximately 2+ minutes of automatic execution
    • User never approved any of this
  4. 21:18:47 — User runs: agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ

    • By this time, work is already done
    • Plan is already in Execute/COMPLETE state
    • Error: "Invalid phase transition from execute to execute"

The Real Problem

The async job system auto-executed the plan WITHOUT the user ever running a command.

Strategize started 18 seconds after plan creation, completely autonomously, despite the manual automation profile. This proves:

  • The async job system does NOT respect automation profile gates
  • Plans can auto-execute before the user has a chance to approve
  • This is a critical control bypass — automation profiles are completely ineffective
  • ⚠️ Users cannot prevent execution, even with manual profile set

The "invalid phase transition" error is a symptom, not the root cause. The root cause is that the async job system started Strategize without any user approval.

Investigation Priority

  1. CRITICAL: Find where async jobs are enqueued for plans in Strategize/QUEUED state
  2. CRITICAL: Verify async job execution checks automation profile gates BEFORE running
  3. HIGH: Check if plan creation automatically enqueues async jobs
  4. HIGH: Verify why 18-second delay occurs before Strategize starts
## Clarification: User DID Run `agents plan execute` - But Too Late **Correction to earlier statement:** The user DID run `agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ`, but this occurred AFTER the phases had already auto-executed. ### The Sequence of Events 1. **21:16:21** — User runs: `agents plan use --automation-profile "manual" ...` - Plan created in Strategize/QUEUED state 2. **21:16:39** — Strategize STARTS AUTOMATICALLY (18 seconds later) - **NO user command issued at this point** - **Async job system picks up and executes without approval** 3. **21:16:39 → 21:18:47** — Strategize and Execute run to completion - Approximately 2+ minutes of automatic execution - **User never approved any of this** 4. **21:18:47** — User runs: `agents plan execute 01KNMWVC754ZQYMT3N9JDC4RXJ` - **By this time, work is already done** - Plan is already in Execute/COMPLETE state - Error: "Invalid phase transition from execute to execute" ### The Real Problem **The async job system auto-executed the plan WITHOUT the user ever running a command.** Strategize started 18 seconds after plan creation, completely autonomously, despite the manual automation profile. This proves: - ❌ The async job system does NOT respect automation profile gates - ❌ Plans can auto-execute before the user has a chance to approve - ❌ This is a **critical control bypass** — automation profiles are completely ineffective - ⚠️ Users cannot prevent execution, even with manual profile set The "invalid phase transition" error is a symptom, not the root cause. The root cause is that the async job system started Strategize without any user approval. ### Investigation Priority 1. **CRITICAL**: Find where async jobs are enqueued for plans in Strategize/QUEUED state 2. **CRITICAL**: Verify async job execution checks automation profile gates BEFORE running 3. **HIGH**: Check if plan creation automatically enqueues async jobs 4. **HIGH**: Verify why 18-second delay occurs before Strategize starts
Owner

Thank you for the detailed evidence, @CoreRasurae.

The additional reproduction logs significantly strengthen this issue. The key finding — that the async job system auto-executes phases 18 seconds after plan creation, completely bypassing the manual automation profile — is a critical control bypass.

This issue has the needs feedback label, which means it is awaiting human review before implementation proceeds. The evidence you have provided (exact timestamps, log analysis, scope expansion to async job system + lifecycle service) is exactly what reviewers need to make an informed decision.

Current status:

  • Issue is State/Verified and Priority/High
  • The needs feedback label indicates a human reviewer must approve the implementation approach before work begins
  • Your three comments have been noted and add important context about the scope of the bug

What happens next:
A human reviewer (freemo or another maintainer) needs to review this issue and either:

  1. Approve the implementation approach and remove the needs feedback label, or
  2. Request changes to the proposed fix scope

I will not modify the state or remove the needs feedback label — that requires explicit human approval.


Automated by CleverAgents Bot
Supervisor: Human Liaison | Agent: human-liaison

Thank you for the detailed evidence, @CoreRasurae. The additional reproduction logs significantly strengthen this issue. The key finding — that the async job system auto-executes phases 18 seconds after plan creation, completely bypassing the manual automation profile — is a critical control bypass. This issue has the `needs feedback` label, which means it is awaiting human review before implementation proceeds. The evidence you have provided (exact timestamps, log analysis, scope expansion to async job system + lifecycle service) is exactly what reviewers need to make an informed decision. **Current status:** - Issue is `State/Verified` and `Priority/High` - The `needs feedback` label indicates a human reviewer must approve the implementation approach before work begins - Your three comments have been noted and add important context about the scope of the bug **What happens next:** A human reviewer (freemo or another maintainer) needs to review this issue and either: 1. Approve the implementation approach and remove the `needs feedback` label, or 2. Request changes to the proposed fix scope I will not modify the state or remove the `needs feedback` label — that requires explicit human approval. --- **Automated by CleverAgents Bot** Supervisor: Human Liaison | Agent: human-liaison
HAL9000 added this to the v3.5.0 milestone 2026-04-08 17:43:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#4328
No description provided.