UAT: docs/schema/action.schema.yaml and ActionConfigSchema missing safety_profile field — schema diverges from Action domain model #3918

Open
opened 2026-04-06 07:25:08 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-action-schema-safety-profile
  • Commit Message: fix(schema): add safety_profile field to ActionConfigSchema and action.schema.yaml
  • Milestone: Backlog
  • Parent Epic: #3370

Background and Context

The Action domain model (src/cleveragents/domain/models/core/action.py) supports an optional safety_profile field and its from_config() factory method explicitly parses it from YAML config dicts. However, the ActionConfigSchema Pydantic model (src/cleveragents/action/schema.py) — which is the schema-layer gatekeeper for loading action YAML files — does not declare this field and uses extra="forbid". This means any user who includes safety_profile in their action YAML config will receive a confusing ValidationError: Extra inputs are not permitted error, even though the domain model fully supports the field.

The spec states: "Safety profiles can also be referenced standalone on Actions when only safety constraints (without full autonomy thresholds) are needed." The YAML schema documentation (docs/schema/action.schema.yaml) also omits this field entirely, leaving users with no documentation that the field exists.

Current Behavior

  1. ActionConfigSchema in src/cleveragents/action/schema.py has no safety_profile field and uses extra="forbid".
  2. docs/schema/action.schema.yaml does not document the safety_profile field in its fields: section.
  3. Attempting to load an action YAML that includes safety_profile raises ValidationError: Extra inputs are not permitted.

Reproduction:

from cleveragents.action.schema import ActionConfigSchema

yaml_with_safety = """
name: local/my-action
description: Test action
strategy_actor: openai/gpt-4
execution_actor: openai/gpt-4
definition_of_done: Done when complete
safety_profile:
  require_sandbox: true
  require_checkpoints: true
  allow_unsafe_tools: false
  max_retries_per_step: 3
"""

# Raises ValidationError: Extra inputs are not permitted
schema = ActionConfigSchema.from_yaml(yaml_with_safety)

Expected Behavior

ActionConfigSchema should declare safety_profile: SafetyProfileConfigSchema | None = None (consistent with the domain model), and docs/schema/action.schema.yaml should document the safety_profile field with all its sub-fields (require_sandbox, require_checkpoints, allow_unsafe_tools, require_human_approval, allowed_skill_categories, max_cost_per_plan, max_retries_per_step, max_total_cost).

Affected Code Locations

File Issue
src/cleveragents/action/schema.pyActionConfigSchema Missing safety_profile field; extra="forbid" rejects it
docs/schema/action.schema.yaml Missing safety_profile field documentation
src/cleveragents/domain/models/core/action.pyAction Has safety_profile: SafetyProfile | None (correct)
src/cleveragents/domain/models/core/action.pyAction.from_config() Handles safety_profile from config dict (correct)

Backlog note: This issue was discovered during autonomous operation
on milestone v3.6.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Subtasks

  • Add safety_profile: SafetyProfileConfigSchema | None = Field(default=None, ...) to ActionConfigSchema in src/cleveragents/action/schema.py
  • Verify SafetyProfileConfigSchema exists (or create it) in the schema layer, consistent with SafetyProfile domain model fields
  • Add safety_profile field documentation to docs/schema/action.schema.yaml with all sub-fields
  • Add/update unit tests for ActionConfigSchema to cover safety_profile round-trip loading
  • Add Behave scenario: action YAML with safety_profile loads without ValidationError
  • Verify Action.from_config() correctly receives and parses safety_profile from schema-validated config
  • Run nox (all default sessions), fix any errors
  • Verify coverage >= 97% via nox -s coverage_report

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • ActionConfigSchema accepts safety_profile without raising ValidationError.
  • docs/schema/action.schema.yaml documents the safety_profile field and all its sub-fields.
  • 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: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/backlog-action-schema-safety-profile` - **Commit Message**: `fix(schema): add safety_profile field to ActionConfigSchema and action.schema.yaml` - **Milestone**: Backlog - **Parent Epic**: #3370 ## Background and Context The `Action` domain model (`src/cleveragents/domain/models/core/action.py`) supports an optional `safety_profile` field and its `from_config()` factory method explicitly parses it from YAML config dicts. However, the `ActionConfigSchema` Pydantic model (`src/cleveragents/action/schema.py`) — which is the schema-layer gatekeeper for loading action YAML files — does **not** declare this field and uses `extra="forbid"`. This means any user who includes `safety_profile` in their action YAML config will receive a confusing `ValidationError: Extra inputs are not permitted` error, even though the domain model fully supports the field. The spec states: *"Safety profiles can also be referenced standalone on Actions when only safety constraints (without full autonomy thresholds) are needed."* The YAML schema documentation (`docs/schema/action.schema.yaml`) also omits this field entirely, leaving users with no documentation that the field exists. ## Current Behavior 1. `ActionConfigSchema` in `src/cleveragents/action/schema.py` has no `safety_profile` field and uses `extra="forbid"`. 2. `docs/schema/action.schema.yaml` does not document the `safety_profile` field in its `fields:` section. 3. Attempting to load an action YAML that includes `safety_profile` raises `ValidationError: Extra inputs are not permitted`. **Reproduction:** ```python from cleveragents.action.schema import ActionConfigSchema yaml_with_safety = """ name: local/my-action description: Test action strategy_actor: openai/gpt-4 execution_actor: openai/gpt-4 definition_of_done: Done when complete safety_profile: require_sandbox: true require_checkpoints: true allow_unsafe_tools: false max_retries_per_step: 3 """ # Raises ValidationError: Extra inputs are not permitted schema = ActionConfigSchema.from_yaml(yaml_with_safety) ``` ## Expected Behavior `ActionConfigSchema` should declare `safety_profile: SafetyProfileConfigSchema | None = None` (consistent with the domain model), and `docs/schema/action.schema.yaml` should document the `safety_profile` field with all its sub-fields (`require_sandbox`, `require_checkpoints`, `allow_unsafe_tools`, `require_human_approval`, `allowed_skill_categories`, `max_cost_per_plan`, `max_retries_per_step`, `max_total_cost`). ## Affected Code Locations | File | Issue | |------|-------| | `src/cleveragents/action/schema.py` — `ActionConfigSchema` | Missing `safety_profile` field; `extra="forbid"` rejects it | | `docs/schema/action.schema.yaml` | Missing `safety_profile` field documentation | | `src/cleveragents/domain/models/core/action.py` — `Action` | Has `safety_profile: SafetyProfile \| None` (correct) | | `src/cleveragents/domain/models/core/action.py` — `Action.from_config()` | Handles `safety_profile` from config dict (correct) | > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.6.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Subtasks - [ ] Add `safety_profile: SafetyProfileConfigSchema | None = Field(default=None, ...)` to `ActionConfigSchema` in `src/cleveragents/action/schema.py` - [ ] Verify `SafetyProfileConfigSchema` exists (or create it) in the schema layer, consistent with `SafetyProfile` domain model fields - [ ] Add `safety_profile` field documentation to `docs/schema/action.schema.yaml` with all sub-fields - [ ] Add/update unit tests for `ActionConfigSchema` to cover `safety_profile` round-trip loading - [ ] Add Behave scenario: action YAML with `safety_profile` loads without `ValidationError` - [ ] Verify `Action.from_config()` correctly receives and parses `safety_profile` from schema-validated config - [ ] Run `nox` (all default sessions), fix any errors - [ ] Verify coverage >= 97% via `nox -s coverage_report` ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `ActionConfigSchema` accepts `safety_profile` without raising `ValidationError`. - `docs/schema/action.schema.yaml` documents the `safety_profile` field and all its sub-fields. - 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: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator
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#3918
No description provided.