Skip to content

cli-dispatch-run --model can be overwritten by sourced config #163

Description

@rbinar

Reproduction

  1. Configure AG_MODEL=gemini-3.6-flash-high in ~/.config/cli-dispatch/config.
  2. Run cli-dispatch-run --backend ag --model claude-sonnet-4-6 ....
  3. Observe ag-stream launches with gemini-3.6-flash-high.

Cause

cli-dispatch-run correctly invokes the backend runner with env AG_MODEL=claude-sonnet-4-6, but ag-stream calls source_config before reading MODEL. source_config sources the config directly and overwrites an already-exported environment variable, contrary to its env wins contract.

There is a related validation false warning: model_listed() normalizes and compares the requested slug against each whole slug<TAB>display-name line from agy models, so a valid claude-sonnet-4-6 slug is reported as unlisted.

Expected

Per-call --model / inherited backend env should take precedence over config defaults, and a valid slug from the first column of agy models should validate without warning.

Observed on cli-dispatch 4.27.0, macOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions