UAT: DEFAULT_AUTOMATION_PROFILE = "balanced" in database models uses a non-existent built-in profile name #2379

Open
opened 2026-04-03 17:26:46 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/default-automation-profile-invalid-builtin
  • Commit Message: fix(db): replace invalid DEFAULT_AUTOMATION_PROFILE "balanced" with a valid built-in profile name
  • Milestone: v3.5.0
  • Parent Epic: #362

Background and Context

In src/cleveragents/infrastructure/database/models.py line 84, the constant DEFAULT_AUTOMATION_PROFILE = "balanced" is defined and used as the NOT NULL server_default for the automation_profile column in the v3_plans table (line 659).

The specification defines exactly 8 built-in automation profiles: manual, review, supervised, cautious, trusted, auto, ci, and full-auto. The "balanced" profile does not exist in the built-in profile registry (BUILTIN_PROFILES dict in src/cleveragents/domain/models/core/automation_profile.py).

Current Behavior (Bug)

The database column automation_profile in v3_plans has a server_default of "balanced", which is not a valid built-in profile name. When LifecyclePlanModel.to_domain() reads this value, it treats it as "unparseable" (line 895: if raw_ap and raw_ap != DEFAULT_AUTOMATION_PROFILE) and returns automation_profile_ref = None. This means plans created without an explicit automation profile silently have no automation profile reference, rather than defaulting to a valid built-in profile. No autonomy thresholds are applied to such plans.

Code locations:

  • src/cleveragents/infrastructure/database/models.py:84DEFAULT_AUTOMATION_PROFILE = "balanced"
  • src/cleveragents/infrastructure/database/models.py:655-660server_default usage on v3_plans.automation_profile
  • src/cleveragents/domain/models/core/automation_profile.py:425-610BUILTIN_PROFILES dict (no "balanced" entry)

Expected Behavior

DEFAULT_AUTOMATION_PROFILE must be set to a valid built-in profile name that exists in BUILTIN_PROFILES (e.g., "auto" or "trusted"). Plans created without an explicit automation profile should default to a known, valid built-in profile so that to_domain() correctly resolves automation_profile_ref and autonomy thresholds are applied.

Steps to Reproduce

  1. Create a plan without specifying an automation profile
  2. The plan's automation_profile column defaults to "balanced" (via server_default)
  3. Call LifecyclePlanModel.to_domain()automation_profile_ref will be None
  4. The plan has no automation profile, so no autonomy thresholds are applied

Acceptance Criteria

  • DEFAULT_AUTOMATION_PROFILE is changed to a valid built-in profile name present in BUILTIN_PROFILES
  • LifecyclePlanModel.to_domain() correctly resolves automation_profile_ref for plans that use the default profile
  • Plans created without an explicit automation profile have a non-None automation_profile_ref after to_domain()
  • A database migration is created if the server_default change requires one
  • All nox stages pass
  • Coverage >= 97%

Subtasks

  • Identify the most appropriate valid built-in profile to use as the default (e.g., "auto" or "trusted") per spec guidance
  • Update DEFAULT_AUTOMATION_PROFILE constant in src/cleveragents/infrastructure/database/models.py:84
  • Verify LifecyclePlanModel.to_domain() logic at line 895 correctly handles the new default value
  • Create a database migration (Alembic) to update the server_default on v3_plans.automation_profile if required
  • Update any fixtures or test data that reference "balanced" as a default automation profile
  • Tests (Behave): Add/update scenarios asserting that plans created without an explicit automation profile resolve to the correct default built-in profile via to_domain()
  • Tests (Robot): Add/update integration test verifying plan creation defaults to a valid automation profile
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • DEFAULT_AUTOMATION_PROFILE references a valid built-in profile name that exists in BUILTIN_PROFILES.
  • LifecyclePlanModel.to_domain() returns a non-None automation_profile_ref for plans using the default profile.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/default-automation-profile-invalid-builtin` - **Commit Message**: `fix(db): replace invalid DEFAULT_AUTOMATION_PROFILE "balanced" with a valid built-in profile name` - **Milestone**: v3.5.0 - **Parent Epic**: #362 ## Background and Context In `src/cleveragents/infrastructure/database/models.py` line 84, the constant `DEFAULT_AUTOMATION_PROFILE = "balanced"` is defined and used as the `NOT NULL` `server_default` for the `automation_profile` column in the `v3_plans` table (line 659). The specification defines exactly **8 built-in automation profiles**: `manual`, `review`, `supervised`, `cautious`, `trusted`, `auto`, `ci`, and `full-auto`. The `"balanced"` profile does **not** exist in the built-in profile registry (`BUILTIN_PROFILES` dict in `src/cleveragents/domain/models/core/automation_profile.py`). ## Current Behavior (Bug) The database column `automation_profile` in `v3_plans` has a `server_default` of `"balanced"`, which is not a valid built-in profile name. When `LifecyclePlanModel.to_domain()` reads this value, it treats it as "unparseable" (line 895: `if raw_ap and raw_ap != DEFAULT_AUTOMATION_PROFILE`) and returns `automation_profile_ref = None`. This means plans created without an explicit automation profile silently have **no automation profile reference**, rather than defaulting to a valid built-in profile. No autonomy thresholds are applied to such plans. **Code locations:** - `src/cleveragents/infrastructure/database/models.py:84` — `DEFAULT_AUTOMATION_PROFILE = "balanced"` - `src/cleveragents/infrastructure/database/models.py:655-660` — `server_default` usage on `v3_plans.automation_profile` - `src/cleveragents/domain/models/core/automation_profile.py:425-610` — `BUILTIN_PROFILES` dict (no `"balanced"` entry) ## Expected Behavior `DEFAULT_AUTOMATION_PROFILE` must be set to a valid built-in profile name that exists in `BUILTIN_PROFILES` (e.g., `"auto"` or `"trusted"`). Plans created without an explicit automation profile should default to a known, valid built-in profile so that `to_domain()` correctly resolves `automation_profile_ref` and autonomy thresholds are applied. ## Steps to Reproduce 1. Create a plan without specifying an automation profile 2. The plan's `automation_profile` column defaults to `"balanced"` (via `server_default`) 3. Call `LifecyclePlanModel.to_domain()` — `automation_profile_ref` will be `None` 4. The plan has no automation profile, so no autonomy thresholds are applied ## Acceptance Criteria - [ ] `DEFAULT_AUTOMATION_PROFILE` is changed to a valid built-in profile name present in `BUILTIN_PROFILES` - [ ] `LifecyclePlanModel.to_domain()` correctly resolves `automation_profile_ref` for plans that use the default profile - [ ] Plans created without an explicit automation profile have a non-`None` `automation_profile_ref` after `to_domain()` - [ ] A database migration is created if the `server_default` change requires one - [ ] All nox stages pass - [ ] Coverage >= 97% ## Subtasks - [ ] Identify the most appropriate valid built-in profile to use as the default (e.g., `"auto"` or `"trusted"`) per spec guidance - [ ] Update `DEFAULT_AUTOMATION_PROFILE` constant in `src/cleveragents/infrastructure/database/models.py:84` - [ ] Verify `LifecyclePlanModel.to_domain()` logic at line 895 correctly handles the new default value - [ ] Create a database migration (Alembic) to update the `server_default` on `v3_plans.automation_profile` if required - [ ] Update any fixtures or test data that reference `"balanced"` as a default automation profile - [ ] Tests (Behave): Add/update scenarios asserting that plans created without an explicit automation profile resolve to the correct default built-in profile via `to_domain()` - [ ] Tests (Robot): Add/update integration test verifying plan creation defaults to a valid automation profile - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `DEFAULT_AUTOMATION_PROFILE` references a valid built-in profile name that exists in `BUILTIN_PROFILES`. - `LifecyclePlanModel.to_domain()` returns a non-`None` `automation_profile_ref` for plans using the default profile. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.5.0 milestone 2026-04-03 17:26:50 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — Using a non-existent built-in profile name as the database default means every new plan starts with an invalid automation profile reference. This will cause runtime errors when the profile is resolved.
  • Milestone: v3.5.0 (as specified in issue metadata)
  • MoSCoW: Must Have — An invalid default automation profile breaks the plan creation flow. Every new plan will reference a non-existent profile, causing failures in the autonomy pipeline.
  • Parent Epic: #362 (Security & Safety Hardening)

Well-described with clear code references. Valid and actionable.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — Using a non-existent built-in profile name as the database default means every new plan starts with an invalid automation profile reference. This will cause runtime errors when the profile is resolved. - **Milestone**: v3.5.0 (as specified in issue metadata) - **MoSCoW**: Must Have — An invalid default automation profile breaks the plan creation flow. Every new plan will reference a non-existent profile, causing failures in the autonomy pipeline. - **Parent Epic**: #362 (Security & Safety Hardening) Well-described with clear code references. Valid and actionable. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo removed this from the v3.5.0 milestone 2026-04-07 01:00:19 +00:00
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
#362 Epic: Security & Safety Hardening
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2379
No description provided.