UAT: Global --config-path flag missing from CLI main_callback — spec-required override for core.config-path not implemented #5724

Open
opened 2026-04-09 08:50:03 +00:00 by HAL9000 · 0 comments
Owner

Summary

The CLI specification (ADR-021 §Global CLI Flags, spec Command Synopsis) requires a global --config-path <CONFIG_PATH> flag on the root agents/cleveragents command that overrides the default configuration file path. This flag is not implemented in main_callback.

Expected Behavior (from spec)

Per the specification Command Synopsis:

agents|cleveragents  [--data-dir <DATA_PATH>] [--config-path <CONFIG_PATH>]
                     [--format (rich|color|table|plain|json|yaml)]
                     ...

Per ADR-021 §Global CLI Flags table:

Flag Description
--config-path Override core.config-path

Per ADR-024 §Resolution Chain:

CLI flag > environment variable > project-scoped config > global config file > built-in default

The --config-path CLI flag should sit at the top of this resolution chain, allowing users to point to an alternate configuration file for a single invocation.

Actual Behavior

The main_callback in src/cleveragents/cli/main.py only accepts three options:

  • --version
  • --show-secrets
  • --format / -f

There is no --config-path parameter in main_callback. The config path is hardcoded in individual command modules:

  • src/cleveragents/cli/commands/config.py line 52: _CONFIG_PATH = _CONFIG_DIR / "config.toml" (hardcoded)
  • src/cleveragents/cli/commands/server.py line 68: config_path = config_dir / "config.toml" (hardcoded)
  • src/cleveragents/cli/commands/system.py line 112: reads from CLEVERAGENTS_CONFIG_PATH env var (no CLI flag)

Code Location

File: src/cleveragents/cli/main.py
Function: main_callback (line ~294)

@app.callback()
def main_callback(
    ctx: typer.Context,
    version: bool = ...,
    show_secrets: bool = ...,
    fmt: Annotated[OutputFormat, typer.Option("--format", "-f", ...)] = OutputFormat.RICH,
) -> None:
    # --config-path is MISSING here

Impact

  • Users cannot use an alternate config file on a per-invocation basis (e.g., agents --config-path ~/.config/agents/work.toml plan list)
  • CI/CD pipelines that need to use different config files for different environments cannot do so via CLI flags
  • The CLI does not match the documented interface in the specification and ADR-021
  • The agents --help output does not show --config-path as an available option
  • The ConfigService in individual commands is constructed with a hardcoded path, bypassing any global override mechanism

Steps to Reproduce

# This should work but fails with "No such option: --config-path"
agents --config-path /etc/cleveragents/config.toml version

Suggested Fix

Add --config-path to main_callback and store it in ctx.obj for subcommands to consume:

@app.callback()
def main_callback(
    ctx: typer.Context,
    ...
    config_path: Annotated[
        Path | None,
        typer.Option("--config-path", help="Override the config file path (core.config-path)"),
    ] = None,
) -> None:
    if config_path is not None:
        import os
        os.environ["CLEVERAGENTS_CONFIG_PATH"] = str(config_path)
    ctx.obj["config_path"] = str(config_path) if config_path else None

Individual command modules that construct ConfigService must then read ctx.obj["config_path"] to use the override.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Summary The CLI specification (ADR-021 §Global CLI Flags, spec Command Synopsis) requires a global `--config-path <CONFIG_PATH>` flag on the root `agents`/`cleveragents` command that overrides the default configuration file path. This flag is **not implemented** in `main_callback`. ## Expected Behavior (from spec) Per the specification Command Synopsis: ``` agents|cleveragents [--data-dir <DATA_PATH>] [--config-path <CONFIG_PATH>] [--format (rich|color|table|plain|json|yaml)] ... ``` Per ADR-021 §Global CLI Flags table: | Flag | Description | |------|-------------| | `--config-path` | Override `core.config-path` | Per ADR-024 §Resolution Chain: > CLI flag > environment variable > project-scoped config > global config file > built-in default The `--config-path` CLI flag should sit at the top of this resolution chain, allowing users to point to an alternate configuration file for a single invocation. ## Actual Behavior The `main_callback` in `src/cleveragents/cli/main.py` only accepts three options: - `--version` - `--show-secrets` - `--format` / `-f` There is **no `--config-path` parameter** in `main_callback`. The config path is hardcoded in individual command modules: - `src/cleveragents/cli/commands/config.py` line 52: `_CONFIG_PATH = _CONFIG_DIR / "config.toml"` (hardcoded) - `src/cleveragents/cli/commands/server.py` line 68: `config_path = config_dir / "config.toml"` (hardcoded) - `src/cleveragents/cli/commands/system.py` line 112: reads from `CLEVERAGENTS_CONFIG_PATH` env var (no CLI flag) ## Code Location **File:** `src/cleveragents/cli/main.py` **Function:** `main_callback` (line ~294) ```python @app.callback() def main_callback( ctx: typer.Context, version: bool = ..., show_secrets: bool = ..., fmt: Annotated[OutputFormat, typer.Option("--format", "-f", ...)] = OutputFormat.RICH, ) -> None: # --config-path is MISSING here ``` ## Impact - Users cannot use an alternate config file on a per-invocation basis (e.g., `agents --config-path ~/.config/agents/work.toml plan list`) - CI/CD pipelines that need to use different config files for different environments cannot do so via CLI flags - The CLI does not match the documented interface in the specification and ADR-021 - The `agents --help` output does not show `--config-path` as an available option - The `ConfigService` in individual commands is constructed with a hardcoded path, bypassing any global override mechanism ## Steps to Reproduce ```bash # This should work but fails with "No such option: --config-path" agents --config-path /etc/cleveragents/config.toml version ``` ## Suggested Fix Add `--config-path` to `main_callback` and store it in `ctx.obj` for subcommands to consume: ```python @app.callback() def main_callback( ctx: typer.Context, ... config_path: Annotated[ Path | None, typer.Option("--config-path", help="Override the config file path (core.config-path)"), ] = None, ) -> None: if config_path is not None: import os os.environ["CLEVERAGENTS_CONFIG_PATH"] = str(config_path) ctx.obj["config_path"] = str(config_path) if config_path else None ``` Individual command modules that construct `ConfigService` must then read `ctx.obj["config_path"]` to use the override. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
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#5724
No description provided.