Files
cleveragents-core/features
Luis Mendes f07d3475f8 fix(cli): persist plan overrides and run strategize inline in plan execute
The `plan use` CLI set the --automation-profile, actor, and
execution-environment overrides on the in-memory Plan object after
use_action() had already persisted it to the database.  Subsequent CLI
invocations (separate processes) loaded the plan from the database
without the overrides, so `plan execute` could never see the automation
profile.

Additionally, `plan execute` required the plan to be in
Strategize/complete state, but nothing ran the strategize phase between
`plan use` and `plan execute`.  The auto_strategize field existed on
the AutomationProfile model but was never implemented — plans created
with auto_strategize=0.0 (ci, full-auto, trusted, etc.) stayed in
Strategize/queued indefinitely.

Changes:
- Call service._commit_plan(plan) after applying post-creation overrides
  in the `plan use` CLI command so that automation-profile, actor, and
  execution-environment changes survive across process boundaries.
- In the `plan execute` CLI command, detect plans still in
  Strategize/queued and run the strategize phase inline via
  PlanExecutor.run_strategize() before transitioning to Execute.
  After inline strategize, if auto_progress already advanced the plan
  to Execute (e.g. when auto_execute=0.0), skip the explicit
  execute_plan() call and report the current state.
- Widen the auto-select query to include both QUEUED and COMPLETE plans
  (QUEUED plans are now eligible because strategize will run inline).
- Update the "no plans ready" test to use an empty plan list (the old
  test returned a QUEUED plan which is now eligible).
- Add BDD scenarios covering inline strategize, auto-progress handling,
  and automation-profile persistence.

Refs: #746
2026-03-17 10:06:42 +00:00
..
2026-02-23 03:11:12 +00:00