UAT: Settings class missing server_url, server_token, and format fields — spec-required env vars not captured by pydantic-settings #2866

Closed
opened 2026-04-04 21:09:23 +00:00 by freemo · 4 comments
Owner

Metadata

  • Branch: fix/settings-missing-spec-fields
  • Commit Message: fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings
  • Milestone: v3.7.0
  • Parent Epic: #399

Bug Description

The Settings class in src/cleveragents/config/settings.py does not define fields for several spec-required environment variables: CLEVERAGENTS_SERVER_URL, CLEVERAGENTS_SERVER_TOKEN, CLEVERAGENTS_FORMAT, and CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR. Any code that reads these settings via Settings() will get an AttributeError.

Expected Behavior (from spec)

Config Key Env Var Purpose
server.url CLEVERAGENTS_SERVER_URL Sets the URL for the CleverAgents server endpoint, enabling server mode
server.token CLEVERAGENTS_SERVER_TOKEN Provides the authentication token for connecting to the server
core.format CLEVERAGENTS_FORMAT Sets the default output format, overriding the core.format config key
core.default_estimation_actor CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR Sets the default actor used for estimation tasks

Actual Behavior

from cleveragents.config.settings import Settings
s = Settings()

s.server_url    # AttributeError: 'Settings' object has no attribute 'server_url'
s.server_token  # AttributeError: 'Settings' object has no attribute 'server_token'
s.format        # AttributeError: 'Settings' object has no attribute 'format'

Verified by Running

from cleveragents.config.settings import Settings
fields = list(Settings.model_fields.keys())

print([f for f in fields if 'server' in f.lower()])
# outputs: ['server_host', 'server_port', 'server_reload']
# Missing: server_url, server_token

print([f for f in fields if 'format' in f.lower()])
# outputs: []
# Missing: format

Impact

  1. Code that needs to check if server mode is enabled cannot use Settings().server_url — it must use ConfigService instead. This creates an inconsistent API.
  2. The CLEVERAGENTS_FORMAT env var is documented in the spec but has no corresponding field in Settings, meaning it cannot be accessed via the standard settings API.
  3. The CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR env var (spec-required) is also missing from Settings.
  4. The ConfigService registry correctly handles all these env vars via _REGISTRY, but the Settings pydantic-settings class (the primary runtime configuration object) does not.

Note: A related issue (#2541) tracks the missing server.token config key and CLEVERAGENTS_SERVER_TOKEN env var in isolation. This issue is broader, covering all missing spec-required fields in Settings.

Code location: src/cleveragents/config/settings.py — missing field definitions

Subtasks

  • Add server_url: str | None = None field to Settings mapped to CLEVERAGENTS_SERVER_URL
  • Add server_token: str | None = None field to Settings mapped to CLEVERAGENTS_SERVER_TOKEN
  • Add format: str | None = None field to Settings mapped to CLEVERAGENTS_FORMAT
  • Add default_estimation_actor: str | None = None field to Settings mapped to CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR
  • Verify all new fields use correct model_config prefix and env aliases consistent with existing Settings conventions
  • Add BDD unit tests (Behave) for each new field — env var binding, default value, and type validation
  • Run nox -e typecheck to confirm Pyright passes with new fields
  • Run nox -e unit_tests and nox -e coverage_report to confirm coverage >= 97%

Definition of Done

  • Settings().server_url returns the value of CLEVERAGENTS_SERVER_URL env var (or None if unset)
  • Settings().server_token returns the value of CLEVERAGENTS_SERVER_TOKEN env var (or None if unset)
  • Settings().format returns the value of CLEVERAGENTS_FORMAT env var (or None if unset)
  • Settings().default_estimation_actor returns the value of CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR env var (or None if unset)
  • All new fields are fully statically typed (no # type: ignore)
  • BDD scenarios cover all new fields
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/settings-missing-spec-fields` - **Commit Message**: `fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings` - **Milestone**: v3.7.0 - **Parent Epic**: #399 ## Bug Description The `Settings` class in `src/cleveragents/config/settings.py` does not define fields for several spec-required environment variables: `CLEVERAGENTS_SERVER_URL`, `CLEVERAGENTS_SERVER_TOKEN`, `CLEVERAGENTS_FORMAT`, and `CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR`. Any code that reads these settings via `Settings()` will get an `AttributeError`. ### Expected Behavior (from spec) | Config Key | Env Var | Purpose | |---|---|---| | `server.url` | `CLEVERAGENTS_SERVER_URL` | Sets the URL for the CleverAgents server endpoint, enabling server mode | | `server.token` | `CLEVERAGENTS_SERVER_TOKEN` | Provides the authentication token for connecting to the server | | `core.format` | `CLEVERAGENTS_FORMAT` | Sets the default output format, overriding the `core.format` config key | | `core.default_estimation_actor` | `CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR` | Sets the default actor used for estimation tasks | ### Actual Behavior ```python from cleveragents.config.settings import Settings s = Settings() s.server_url # AttributeError: 'Settings' object has no attribute 'server_url' s.server_token # AttributeError: 'Settings' object has no attribute 'server_token' s.format # AttributeError: 'Settings' object has no attribute 'format' ``` ### Verified by Running ```python from cleveragents.config.settings import Settings fields = list(Settings.model_fields.keys()) print([f for f in fields if 'server' in f.lower()]) # outputs: ['server_host', 'server_port', 'server_reload'] # Missing: server_url, server_token print([f for f in fields if 'format' in f.lower()]) # outputs: [] # Missing: format ``` ### Impact 1. Code that needs to check if server mode is enabled cannot use `Settings().server_url` — it must use `ConfigService` instead. This creates an inconsistent API. 2. The `CLEVERAGENTS_FORMAT` env var is documented in the spec but has no corresponding field in `Settings`, meaning it cannot be accessed via the standard settings API. 3. The `CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR` env var (spec-required) is also missing from `Settings`. 4. The `ConfigService` registry correctly handles all these env vars via `_REGISTRY`, but the `Settings` pydantic-settings class (the primary runtime configuration object) does not. **Note:** A related issue (#2541) tracks the missing `server.token` config key and `CLEVERAGENTS_SERVER_TOKEN` env var in isolation. This issue is broader, covering all missing spec-required fields in `Settings`. **Code location:** `src/cleveragents/config/settings.py` — missing field definitions ## Subtasks - [x] Add `server_url: str | None = None` field to `Settings` mapped to `CLEVERAGENTS_SERVER_URL` - [x] Add `server_token: str | None = None` field to `Settings` mapped to `CLEVERAGENTS_SERVER_TOKEN` - [x] Add `format: str | None = None` field to `Settings` mapped to `CLEVERAGENTS_FORMAT` - [x] Add `default_estimation_actor: str | None = None` field to `Settings` mapped to `CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR` - [x] Verify all new fields use correct `model_config` prefix and `env` aliases consistent with existing `Settings` conventions - [x] Add BDD unit tests (Behave) for each new field — env var binding, default value, and type validation - [x] Run `nox -e typecheck` to confirm Pyright passes with new fields - [x] Run `nox -e unit_tests` and `nox -e coverage_report` to confirm coverage >= 97% ## Definition of Done - [ ] `Settings().server_url` returns the value of `CLEVERAGENTS_SERVER_URL` env var (or `None` if unset) - [ ] `Settings().server_token` returns the value of `CLEVERAGENTS_SERVER_TOKEN` env var (or `None` if unset) - [ ] `Settings().format` returns the value of `CLEVERAGENTS_FORMAT` env var (or `None` if unset) - [ ] `Settings().default_estimation_actor` returns the value of `CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR` env var (or `None` if unset) - [ ] All new fields are fully statically typed (no `# type: ignore`) - [ ] BDD scenarios cover all new fields - [ ] 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-04 21:09:42 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — The Settings class is missing spec-required fields (server_url, server_token, format, default_estimation_actor). Code that reads these settings via Settings() gets AttributeError. This creates an inconsistent API between Settings and ConfigService.
  • Milestone: v3.7.0 (already set correctly)
  • MoSCoW: Should Have — The spec defines these environment variables and config keys. The Settings pydantic-settings class (the primary runtime configuration object) should capture all spec-required fields. However, ConfigService handles these correctly via _REGISTRY, so there is a working alternative path.
  • Parent Epic: #399 (Epic: Post-MVP Server & Clients) — server_url and server_token are server-mode fields.

Note: Related to #2541 which tracks the missing server.token config key in isolation. This issue is broader.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — The `Settings` class is missing spec-required fields (`server_url`, `server_token`, `format`, `default_estimation_actor`). Code that reads these settings via `Settings()` gets `AttributeError`. This creates an inconsistent API between `Settings` and `ConfigService`. - **Milestone**: v3.7.0 (already set correctly) - **MoSCoW**: Should Have — The spec defines these environment variables and config keys. The `Settings` pydantic-settings class (the primary runtime configuration object) should capture all spec-required fields. However, `ConfigService` handles these correctly via `_REGISTRY`, so there is a working alternative path. - **Parent Epic**: #399 (Epic: Post-MVP Server & Clients) — `server_url` and `server_token` are server-mode fields. Note: Related to #2541 which tracks the missing `server.token` config key in isolation. This issue is broader. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Starting implementation on branch fix/settings-missing-spec-fields.

Plan:

  • Wave 1 (parallel): Write BDD tests for all 4 new fields + implement all 4 fields in Settings class
  • Wave 2: Run quality gates (typecheck, unit tests, coverage)

Following TDD: writing BDD scenarios first, then implementing the fields.


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

Starting implementation on branch `fix/settings-missing-spec-fields`. **Plan:** - Wave 1 (parallel): Write BDD tests for all 4 new fields + implement all 4 fields in Settings class - Wave 2: Run quality gates (typecheck, unit tests, coverage) Following TDD: writing BDD scenarios first, then implementing the fields. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

All subtasks complete. Quality gates passed. PR #3176 created on branch fix/settings-missing-spec-fields.

Implementation summary:

  • Added server_url, server_token, format, and default_estimation_actor fields to Settings class
  • All fields typed as str | None, default to None, use AliasChoices with exact env var names
  • 14 new BDD scenarios covering env var binding, defaults, type annotations, and model_fields presence
  • nox -e typecheck: 0 errors | All 47 settings scenarios pass

PR review and merge handled by continuous review stream.


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

All subtasks complete. Quality gates passed. PR #3176 created on branch `fix/settings-missing-spec-fields`. **Implementation summary:** - Added `server_url`, `server_token`, `format`, and `default_estimation_actor` fields to `Settings` class - All fields typed as `str | None`, default to `None`, use `AliasChoices` with exact env var names - 14 new BDD scenarios covering env var binding, defaults, type annotations, and `model_fields` presence - `nox -e typecheck`: 0 errors | All 47 settings scenarios pass PR review and merge handled by continuous review stream. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Owner

State label reconciliation:

  • Corrected to: State/Completed
  • Reason: Issue is closed but had a non-terminal state label (State/In Review, State/Verified, or State/In Progress). CONTRIBUTING.md requires closed issues to have State/Completed or State/Wont Do.

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

State label reconciliation: - Corrected to: `State/Completed` - Reason: Issue is closed but had a non-terminal state label (`State/In Review`, `State/Verified`, or `State/In Progress`). CONTRIBUTING.md requires closed issues to have `State/Completed` or `State/Wont Do`. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#2866
No description provided.