fix(dispatch): model flag splice broke -o argument ordering

When model variant was specified, the splice inserted --model
between -o and its value, making Codex see -o with no file path.
Fixed by appending --model and prompt sequentially instead of
splicing into the middle of the args slice.

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-03-22 15:00:49 +00:00
parent c73ea6ad7a
commit 69f0acce0d

View file

@ -78,11 +78,11 @@ func agentCommand(agent, prompt string) (string, []string, error) {
"exec",
"--full-auto",
"-o", "../.meta/agent-codex.log",
prompt,
}
if model != "" {
args = append(args[:3], append([]string{"--model", model}, args[3:]...)...)
args = append(args, "--model", model)
}
args = append(args, prompt)
return "codex", args, nil
case "claude":
args := []string{