Repository navigation
Description
Problem Description
The Service route GET /config (get_configuration in src/devops_cli/server/routes/workspace.py) says that it returns the active, non-secret configuration. It builds Settings(), not load_settings(). Settings() holds its arguments and the field defaults, and reads no variable and no config file (Settings.settings_customise_sources, #2445). So the route returns the defaults, not the settings that the Service runs with.
Reproduction Steps
- Set a value in the config file, for example
ai.model: example-model, or setDEVOPS_CLI_AI_MODEL=example-model. - Start the Service and send
GET /config. - Read
config.ai.modelin the reply.
Expected vs Actual Behavior
- Expected:
config.ai.modelisexample-model, the value thatload_settings()gives, with credentials redacted. - Actual:
config.ai.modelis the default of the field.
Environment Diagnostics
origin/main at 0137f23. Found while building #2445 (one resolution order for the settings).
Logs, Traces, or Terminal Output
None. The route builds settings = Settings() and dumps it.
Proposed design
Problem statement
The GET /config route in the Service constructs Settings() directly, which returns only field defaults. It should call load_settings(), which reads environment variables and the config file. As written, the route returns defaults instead of the active configuration the Service runs with.
Acceptance criteria
Requirement: Route uses load_settings
The get_configuration route SHALL call load_settings() to obtain the active configuration.
Scenario: Route calls load_settings
- WHEN A client sends GET /config
- THEN The route handler calls load_settings() and does not call Settings() with no arguments
Requirement: Env var override is reflected
The GET /config response SHALL reflect values set through environment variables.
Scenario: Env var overrides a default
- WHEN DEVOPS_CLI_AI_MODEL is set to example-model and the Service is running
- THEN config.ai.model in the response equals example-model
Requirement: Config file value is reflected
The GET /config response SHALL reflect values set in the config file.
Scenario: Config file sets a value
- WHEN The config file contains ai.model: example-model and no env var overrides it
- THEN config.ai.model in the response equals example-model
Requirement: Secrets remain redacted
The GET /config response SHALL redact all secret fields identified by secret_keys().
Scenario: Secret field is present
- WHEN A secret field has a non-empty value in the loaded settings
- THEN That field in the response equals REDACTED
Existing Tool Considered
The project already uses pydantic-settings (Pydantic BaseSettings) for configuration. The function load_settings() in devops_cli.config.settings already implements the correct loading path (env vars plus config file). The fix is a one-line change to call the existing function instead of the bare constructor. No new code is built.
Key questions
- Where is load_settings() defined and what does it return?: load_settings() is in devops_cli.config.settings (the same module that defines Settings). It returns a Settings instance populated from environment variables and the config file. The body confirms it reads variables and the config file, unlike the bare Settings() constructor. [sources: src/devops_cli/server/routes/workspace.py:11]
- Should the route call load_settings() or keep calling Settings()?: Call load_settings(). The route docstring says it returns the active non-secret configuration. Settings() returns only field defaults and reads no variable and no config file. load_settings() reads both, so it returns the settings the Service actually runs with. (best practice) [sources: src/devops_cli/server/routes/workspace.py:114]
- Chosen: Call load_settings(). Returns the active configuration from env vars and config file, matching the route's stated purpose.
- Rejected: Keep calling Settings(). Returns only field defaults. Does not read env vars or config file. Does not match the route's stated purpose.
- Does the import line need to change?: Yes. The current import is from devops_cli.config.settings import Settings. The fix adds load_settings to that import: from devops_cli.config.settings import Settings, load_settings. The Settings import can be removed if no other code in the file uses it. (best practice) [sources: src/devops_cli/server/routes/workspace.py:11]
- Chosen: Add load_settings to the existing import. Minimal change. Keeps the import from the same module.
- Rejected: Add a separate import line. Unnecessary. Both names come from the same module.
Open questions
- Are there other routes or code paths that construct Settings() directly instead of calling load_settings()? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-04: none.
Tool: none found.
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The route returns wrong data because it constructs Settings() instead of calling load_settings().A service endpoint returns incorrect configuration values, which misleads users, but it does not break core functionality or expose secrets.Users querying GET /config see defaults instead of their actual settings, which undermines trust in the diagnostic endpoint.The fix replaces one constructor call with load_settings() in a single route handler.Both ensure settings values are read through the proper loading path rather than raw defaults, but #2447 targets import boundaries for DEFAULT_* constants while the candidate fixes one route handler.devops-cli-service commentedon Oct 29, 2026
Refine cannot set this item to Ready at 0f7bc26 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
devops-cli-service commentedon Nov 4, 2026
Alternatives check: none
Tool: none found
Lacks:
Searches run:
Sources:
Checked on 2026-11-04. A person decides what this means for the item. The check changes no label and closes no issue.
[-]fix(service): GET /config returns the field defaults, not the loaded settings[/-][+]fix(service): Use load_settings() in GET /config[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 63 characters, and the limit is 60. The type and the scope stay.
fix(service): GET /config returns the field defaults, not the loaded settingsfix(service): Use load_settings() in GET /configfix(service): use load_settings() in GET /config (#4233)
devops-cli-service commentedon Nov 9, 2026
Released in v0.101.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.101.0
devops-cli-service commentedon Nov 9, 2026
Live since 2026-11-09 15:38 UTC