fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings #3176

Merged
freemo merged 1 commit from fix/settings-missing-spec-fields into master 2026-04-05 21:09:59 +00:00
Owner

Summary

Closes #2866.

The Settings class in src/cleveragents/config/settings.py was missing four spec-required environment variable fields, causing AttributeError when any code attempted to access them via Settings().

Changes

src/cleveragents/config/settings.py

Added four new fields to the Settings class:

Field Env Var Spec Key Default
server_url CLEVERAGENTS_SERVER_URL server.url None
server_token CLEVERAGENTS_SERVER_TOKEN server.token None
format CLEVERAGENTS_FORMAT core.format None
default_estimation_actor CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR core.default_estimation_actor None

All fields:

  • Are typed as str | None (no # type: ignore)
  • Default to None when the env var is unset
  • Use AliasChoices with the exact env var name, consistent with existing Settings conventions
  • Are placed in logical sections (server_url/server_token in the server config block; format/default_estimation_actor in a new "Core output and estimation configuration" section)

features/settings_missing_spec_fields.feature (new)

14 BDD scenarios covering:

  • Default None value for each field when env var is absent
  • Correct env var binding for each field (two value variants each)
  • Presence of all four fields in Settings.model_fields
  • Type annotation correctness (str | None) for all four fields

features/steps/settings_missing_spec_fields_steps.py (new)

Step definitions for the new feature file, following existing settings_steps.py conventions.

Quality Gates

  • nox -e typecheck: 0 errors, 0 warnings
  • New BDD tests: 14 scenarios, 56 steps — all pass
  • Existing settings tests (33 scenarios across settings_configuration.feature + settings_coverage_boost.feature): all pass
  • Python smoke test: all 4 fields return correct values from env vars and default to None

Implementation Notes

  • server_url and server_token are placed adjacent to the existing server_host, server_port, server_reload fields for logical grouping.
  • format and default_estimation_actor are placed in a new "Core output and estimation configuration" section immediately after the server block.
  • No existing fields were modified; this is a purely additive change.
  • The ConfigService._REGISTRY already handles these env vars correctly; this PR makes Settings consistent with it.

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

## Summary Closes #2866. The `Settings` class in `src/cleveragents/config/settings.py` was missing four spec-required environment variable fields, causing `AttributeError` when any code attempted to access them via `Settings()`. ## Changes ### `src/cleveragents/config/settings.py` Added four new fields to the `Settings` class: | Field | Env Var | Spec Key | Default | |---|---|---|---| | `server_url` | `CLEVERAGENTS_SERVER_URL` | `server.url` | `None` | | `server_token` | `CLEVERAGENTS_SERVER_TOKEN` | `server.token` | `None` | | `format` | `CLEVERAGENTS_FORMAT` | `core.format` | `None` | | `default_estimation_actor` | `CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR` | `core.default_estimation_actor` | `None` | All fields: - Are typed as `str | None` (no `# type: ignore`) - Default to `None` when the env var is unset - Use `AliasChoices` with the exact env var name, consistent with existing `Settings` conventions - Are placed in logical sections (`server_url`/`server_token` in the server config block; `format`/`default_estimation_actor` in a new "Core output and estimation configuration" section) ### `features/settings_missing_spec_fields.feature` (new) 14 BDD scenarios covering: - Default `None` value for each field when env var is absent - Correct env var binding for each field (two value variants each) - Presence of all four fields in `Settings.model_fields` - Type annotation correctness (`str | None`) for all four fields ### `features/steps/settings_missing_spec_fields_steps.py` (new) Step definitions for the new feature file, following existing `settings_steps.py` conventions. ## Quality Gates - ✅ `nox -e typecheck`: 0 errors, 0 warnings - ✅ New BDD tests: 14 scenarios, 56 steps — all pass - ✅ Existing settings tests (33 scenarios across `settings_configuration.feature` + `settings_coverage_boost.feature`): all pass - ✅ Python smoke test: all 4 fields return correct values from env vars and default to `None` ## Implementation Notes - `server_url` and `server_token` are placed adjacent to the existing `server_host`, `server_port`, `server_reload` fields for logical grouping. - `format` and `default_estimation_actor` are placed in a new "Core output and estimation configuration" section immediately after the server block. - No existing fields were modified; this is a purely additive change. - The `ConfigService._REGISTRY` already handles these env vars correctly; this PR makes `Settings` consistent with it. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings
All checks were successful
CI / lint (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 47s
CI / quality (pull_request) Successful in 33s
CI / security (pull_request) Successful in 1m2s
CI / build (pull_request) Successful in 25s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Successful in 6m41s
CI / docker (pull_request) Successful in 1m23s
CI / e2e_tests (pull_request) Successful in 18m32s
CI / coverage (pull_request) Successful in 11m14s
CI / integration_tests (pull_request) Successful in 22m20s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m4s
da0c5f14b5
Add four spec-required environment variable fields to the Settings class
that were previously missing, causing AttributeError when accessed:

- server_url: str | None — maps to CLEVERAGENTS_SERVER_URL (spec: server.url)
- server_token: str | None — maps to CLEVERAGENTS_SERVER_TOKEN (spec: server.token)
- format: str | None — maps to CLEVERAGENTS_FORMAT (spec: core.format)
- default_estimation_actor: str | None — maps to CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR
  (spec: core.default_estimation_actor)

All fields default to None when the corresponding env var is unset, and
are fully statically typed (no type: ignore). BDD scenarios cover env var
binding, default value, type validation, and model_fields presence for
each new field.

ISSUES CLOSED: #2866
freemo added this to the v3.7.0 milestone 2026-04-05 07:21:17 +00:00
Author
Owner

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3176-1743897600]


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3176-1743897600] --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo left a comment

Code Review — LGTM

PR: fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings

Review Checklist

Correctness: Adds 4 missing spec-required fields to Settings class. All typed as str | None, defaulting to None, using AliasChoices consistent with existing conventions.

Test Coverage: 14 BDD scenarios covering defaults, env var bindings, field presence, and type annotations.

Type Safety: No # type: ignore. Pyright passes with 0 errors.

Commit Format: fix(config): follows Conventional Changelog format.

Additive only: No existing fields modified — purely additive change.

Labels/Milestone: Type/Bug, milestone v3.7.0 — correctly assigned.

Decision: LGTM — Proceeding to merge when CI passes.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

## Code Review — LGTM ✅ **PR:** fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings ### Review Checklist **✅ Correctness:** Adds 4 missing spec-required fields to `Settings` class. All typed as `str | None`, defaulting to `None`, using `AliasChoices` consistent with existing conventions. **✅ Test Coverage:** 14 BDD scenarios covering defaults, env var bindings, field presence, and type annotations. **✅ Type Safety:** No `# type: ignore`. Pyright passes with 0 errors. **✅ Commit Format:** `fix(config):` follows Conventional Changelog format. **✅ Additive only:** No existing fields modified — purely additive change. **✅ Labels/Milestone:** `Type/Bug`, milestone `v3.7.0` — correctly assigned. ### Decision: **LGTM** — Proceeding to merge when CI passes. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo scheduled this pull request to auto merge when all checks succeed 2026-04-05 08:32:33 +00:00
freemo merged commit 86999ea959 into master 2026-04-05 21:09:47 +00:00
Sign in to join this conversation.
No reviewers
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!3176
No description provided.