UAT: Skill, Action, and Resource Type config schemas do not support ${ENV_VAR:default_value} syntax — only ${ENV_VAR} without defaults is implemented #2989

Open
opened 2026-04-05 03:18:20 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/schema-env-var-interpolation-default-value
  • Commit Message: fix(config): support ${ENV_VAR:default_value} syntax and raise ValueError for unset vars without defaults in skill/action/resource schemas
  • Milestone: v3.7.0
  • Parent Epic: #392

Bug Report

Feature Area: Configuration Files — Environment Variable Interpolation (Design Principle #4)

Spec Reference: Design Principles section, Principle #4:

"All configuration files support ${ENV_VAR} and ${ENV_VAR:default_value} syntax for environment variable interpolation. If a variable is not set and no default is provided, an error is raised."

Expected Behavior (per spec)

All configuration files (skill, action, resource type, validation, automation profile) should support both:

  • ${ENV_VAR} — substitutes the env var value, raises error if not set
  • ${ENV_VAR:default_value} — substitutes the env var value, uses default_value if not set

Actual Behavior

The _ENV_VAR_RE regex pattern in the following schema files only matches ${VAR} without default support:

src/cleveragents/skills/schema.py (line ~25):

_ENV_VAR_RE = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)\}")

src/cleveragents/action/schema.py (line ~25):

_ENV_VAR_RE = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)\}")

src/cleveragents/resource/schema.py (line ~25):

_ENV_VAR_RE = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)\}")

None of these support the :default_value syntax. The _env_replacer functions in these files also do not handle defaults — they simply leave the placeholder as-is when the variable is not set (no error raised either, violating the spec's "error is raised" requirement).

By contrast, src/cleveragents/actor/config.py does implement the full ${ENV_VAR:default_value} syntax with proper error handling when no default is provided.

Steps to Reproduce

  1. Create a skill YAML config with ${MY_VAR:fallback_value} in a string field
  2. Run agents skill add --config skill.yaml without MY_VAR set
  3. Observe: The literal string ${MY_VAR:fallback_value} is passed through unchanged instead of using fallback_value

Impact

  • Users cannot use default values in skill/action/resource type configs
  • Missing variables are silently ignored (no error) instead of raising an error as the spec requires
  • Inconsistency between actor config (correct) and all other config types (incorrect)

Code Locations

  • src/cleveragents/skills/schema.py_ENV_VAR_RE, _env_replacer, _interpolate_env_vars
  • src/cleveragents/action/schema.py_ENV_VAR_RE, _env_replacer, _interpolate_env_vars
  • src/cleveragents/resource/schema.py_ENV_VAR_RE, _env_replacer, _interpolate_env_vars

Fix Direction

Update the regex to r"\$\{([A-Za-z_][A-Za-z0-9_]*)(?::([^}]*))?\}" and update _env_replacer to:

  1. Use the default value when the env var is not set and a default is provided
  2. Raise ValueError when the env var is not set and no default is provided

Subtasks

  • Update _ENV_VAR_RE in src/cleveragents/skills/schema.py to capture optional :default_value group
  • Update _env_replacer in src/cleveragents/skills/schema.py to use default or raise ValueError
  • Update _ENV_VAR_RE in src/cleveragents/action/schema.py to capture optional :default_value group
  • Update _env_replacer in src/cleveragents/action/schema.py to use default or raise ValueError
  • Update _ENV_VAR_RE in src/cleveragents/resource/schema.py to capture optional :default_value group
  • Update _env_replacer in src/cleveragents/resource/schema.py to use default or raise ValueError
  • Tests (Behave): Add failing scenario for ${ENV_VAR:default_value} in skill YAML (TDD — failing test first)
  • Tests (Behave): Add failing scenario for ${ENV_VAR:default_value} in action YAML (TDD — failing test first)
  • Tests (Behave): Add failing scenario for ${ENV_VAR:default_value} in resource type YAML (TDD — failing test first)
  • Tests (Behave): Add scenario verifying ValueError is raised when env var is unset and no default is provided (all three schema modules)

Definition of Done

  • All three schema modules (skills/schema.py, action/schema.py, resource/schema.py) support ${ENV_VAR:default_value} syntax
  • All three schema modules raise ValueError when an env var is unset and no default is provided
  • Behaviour is consistent with src/cleveragents/actor/config.py (the reference implementation)
  • TDD workflow followed: failing Behave scenarios committed and merged before fix implementation
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/schema-env-var-interpolation-default-value` - **Commit Message**: `fix(config): support ${ENV_VAR:default_value} syntax and raise ValueError for unset vars without defaults in skill/action/resource schemas` - **Milestone**: v3.7.0 - **Parent Epic**: #392 ## Bug Report **Feature Area:** Configuration Files — Environment Variable Interpolation (Design Principle #4) **Spec Reference:** Design Principles section, Principle #4: > "All configuration files support `${ENV_VAR}` and `${ENV_VAR:default_value}` syntax for environment variable interpolation. If a variable is not set and no default is provided, an error is raised." ### Expected Behavior (per spec) All configuration files (skill, action, resource type, validation, automation profile) should support both: - `${ENV_VAR}` — substitutes the env var value, raises error if not set - `${ENV_VAR:default_value}` — substitutes the env var value, uses `default_value` if not set ### Actual Behavior The `_ENV_VAR_RE` regex pattern in the following schema files only matches `${VAR}` without default support: **`src/cleveragents/skills/schema.py`** (line ~25): ```python _ENV_VAR_RE = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)\}") ``` **`src/cleveragents/action/schema.py`** (line ~25): ```python _ENV_VAR_RE = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)\}") ``` **`src/cleveragents/resource/schema.py`** (line ~25): ```python _ENV_VAR_RE = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)\}") ``` None of these support the `:default_value` syntax. The `_env_replacer` functions in these files also do not handle defaults — they simply leave the placeholder as-is when the variable is not set (no error raised either, violating the spec's "error is raised" requirement). By contrast, `src/cleveragents/actor/config.py` **does** implement the full `${ENV_VAR:default_value}` syntax with proper error handling when no default is provided. ### Steps to Reproduce 1. Create a skill YAML config with `${MY_VAR:fallback_value}` in a string field 2. Run `agents skill add --config skill.yaml` without `MY_VAR` set 3. Observe: The literal string `${MY_VAR:fallback_value}` is passed through unchanged instead of using `fallback_value` ### Impact - Users cannot use default values in skill/action/resource type configs - Missing variables are silently ignored (no error) instead of raising an error as the spec requires - Inconsistency between actor config (correct) and all other config types (incorrect) ### Code Locations - `src/cleveragents/skills/schema.py` — `_ENV_VAR_RE`, `_env_replacer`, `_interpolate_env_vars` - `src/cleveragents/action/schema.py` — `_ENV_VAR_RE`, `_env_replacer`, `_interpolate_env_vars` - `src/cleveragents/resource/schema.py` — `_ENV_VAR_RE`, `_env_replacer`, `_interpolate_env_vars` ### Fix Direction Update the regex to `r"\$\{([A-Za-z_][A-Za-z0-9_]*)(?::([^}]*))?\}"` and update `_env_replacer` to: 1. Use the default value when the env var is not set and a default is provided 2. Raise `ValueError` when the env var is not set and no default is provided ## Subtasks - [ ] Update `_ENV_VAR_RE` in `src/cleveragents/skills/schema.py` to capture optional `:default_value` group - [ ] Update `_env_replacer` in `src/cleveragents/skills/schema.py` to use default or raise `ValueError` - [ ] Update `_ENV_VAR_RE` in `src/cleveragents/action/schema.py` to capture optional `:default_value` group - [ ] Update `_env_replacer` in `src/cleveragents/action/schema.py` to use default or raise `ValueError` - [ ] Update `_ENV_VAR_RE` in `src/cleveragents/resource/schema.py` to capture optional `:default_value` group - [ ] Update `_env_replacer` in `src/cleveragents/resource/schema.py` to use default or raise `ValueError` - [ ] Tests (Behave): Add failing scenario for `${ENV_VAR:default_value}` in skill YAML (TDD — failing test first) - [ ] Tests (Behave): Add failing scenario for `${ENV_VAR:default_value}` in action YAML (TDD — failing test first) - [ ] Tests (Behave): Add failing scenario for `${ENV_VAR:default_value}` in resource type YAML (TDD — failing test first) - [ ] Tests (Behave): Add scenario verifying `ValueError` is raised when env var is unset and no default is provided (all three schema modules) ## Definition of Done - [ ] All three schema modules (`skills/schema.py`, `action/schema.py`, `resource/schema.py`) support `${ENV_VAR:default_value}` syntax - [ ] All three schema modules raise `ValueError` when an env var is unset and no default is provided - [ ] Behaviour is consistent with `src/cleveragents/actor/config.py` (the reference implementation) - [ ] TDD workflow followed: failing Behave scenarios committed and merged before fix implementation - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-05 03:19:05 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Confirmed
  • MoSCoW: Should Have

Valid finding verified during batch triage.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: Confirmed - **MoSCoW**: Should Have Valid finding verified during batch triage. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-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.

Blocks
#392 Epic: Actor YAML & Compiler
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2989
No description provided.