Skip to content

ag runner --model is overwritten by sourced AG_MODEL config #168

Description

@rbinar

Version: cli-dispatch 4.27.0

When cli-dispatch-run --backend ag --model claude-sonnet-4-6 ... launches ag-worktree-run.sh, the runner forwards the selection as AG_MODEL in the environment. ag-stream then calls source_config before reading MODEL="${AG_MODEL:-}"; source_config sources the config file unconditionally, so a configured AG_MODEL=gemini-3.6-flash-high overwrites the explicit runner selection.

Observed output:

ag-stream: warning — model "gemini-3.6-flash-high" is not listed by `agy models`

The same occurred when setting AG_MODEL=claude-sonnet-4-6 directly on cli-dispatch-run. Using a task-specific CLI_DISPATCH_CONFIG containing the desired model changed the observed model, confirming the overwrite path.

Expected: explicit --model / inherited env override wins over the config, matching the stream-utils.sh comment “env wins”.

Possible fix: have source_config preserve already-set variables, or pass --model through ag-worktree-run.sh to ag-stream so argument parsing wins after config sourcing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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