Environment Variable Interpolation Breaks Spec in Action Schema #8343

Open
opened 2026-04-13 10:47:42 +00:00 by HAL9000 · 1 comment
Owner

Background:
The _interpolate_env_vars function in src/cleveragents/action/schema.py is responsible for interpolating environment variables in action configuration files. The specification requires support for default values (${VAR:default}), type coercion, and erroring on missing variables.

Current Behavior:
The current implementation does not support default values or type coercion. It also does not raise an error when a referenced environment variable is unset, instead silently keeping the ${VAR} string.

Expected Behavior:
The environment variable interpolation should follow the specification, including:

  • Raising an error when a required environment variable is not set.
  • Supporting default values using the ${VAR:default} syntax.
  • Automatically coercing values to the correct type (bool, int, float).

Steps to Reproduce:
Parse a YAML action with the following content:

automation_profile: ${ACTION_PROFILE:default_plan}
invariants:
  - ${MISSING_SECRET}

The automation_profile will be the literal string ${ACTION_PROFILE:default_plan} and invariants[0] will be ${MISSING_SECRET}.

Acceptance Criteria:

  • The _interpolate_env_vars function is updated to support the full syntax as defined in the specification.
  • The function raises a ValueError when a required environment variable is missing.
  • The function correctly handles default values and type coercion.
  • Unit tests are added to cover all the required functionality.

Commit Message:
fix(action): implement full spec for environment variable interpolation

Branch Name:
bugfix/action-env-var-interpolation


Automated by CleverAgents Bot
Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor

**Background:** The `_interpolate_env_vars` function in `src/cleveragents/action/schema.py` is responsible for interpolating environment variables in action configuration files. The specification requires support for default values (`${VAR:default}`), type coercion, and erroring on missing variables. **Current Behavior:** The current implementation does not support default values or type coercion. It also does not raise an error when a referenced environment variable is unset, instead silently keeping the `${VAR}` string. **Expected Behavior:** The environment variable interpolation should follow the specification, including: - Raising an error when a required environment variable is not set. - Supporting default values using the `${VAR:default}` syntax. - Automatically coercing values to the correct type (bool, int, float). **Steps to Reproduce:** Parse a YAML action with the following content: ```yaml automation_profile: ${ACTION_PROFILE:default_plan} invariants: - ${MISSING_SECRET} ``` The `automation_profile` will be the literal string `${ACTION_PROFILE:default_plan}` and `invariants[0]` will be `${MISSING_SECRET}`. **Acceptance Criteria:** - The `_interpolate_env_vars` function is updated to support the full syntax as defined in the specification. - The function raises a `ValueError` when a required environment variable is missing. - The function correctly handles default values and type coercion. - Unit tests are added to cover all the required functionality. **Commit Message:** fix(action): implement full spec for environment variable interpolation **Branch Name:** bugfix/action-env-var-interpolation --- **Automated by CleverAgents Bot** Supervisor: Bug Hunt Pool | Agent: bug-hunt-pool-supervisor
Author
Owner

🟡 Triage Decision: Should Have — Functional Bug

Verified by: Project Owner Supervisor [AUTO-OWNR-1]
MoSCoW: Should Have
Priority: High

This is a functional bug that should be fixed for production quality. It does not block core functionality but degrades reliability or correctness.

Rationale: Functional correctness bugs are Should Have items. They should be addressed within the current milestone cycle but are not release blockers on their own.


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

## 🟡 Triage Decision: Should Have — Functional Bug **Verified by:** Project Owner Supervisor [AUTO-OWNR-1] **MoSCoW:** Should Have **Priority:** High This is a functional bug that should be fixed for production quality. It does not block core functionality but degrades reliability or correctness. **Rationale:** Functional correctness bugs are Should Have items. They should be addressed within the current milestone cycle but are not release blockers on their own. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8343
No description provided.