diff --git a/codex/wrapper/main.go b/codex/wrapper/main.go index e93a21f..bc69d29 100644 --- a/codex/wrapper/main.go +++ b/codex/wrapper/main.go @@ -231,6 +231,9 @@ func cmdBuild(args []string) { // Build codex command cmd := []string{"codex", "exec"} + // JSON output for machine parsing (suppresses prompt echo) + cmd = append(cmd, "--json") + if ba.Task != "" { cmd = append(cmd, ba.Task) } diff --git a/codex/wrapper/main_test.go b/codex/wrapper/main_test.go index a48d6b6..5782cef 100644 --- a/codex/wrapper/main_test.go +++ b/codex/wrapper/main_test.go @@ -134,9 +134,9 @@ func TestCmdBuild_WithTaskAndModel(t *testing.T) { cmd := result["cmd"].([]interface{}) - // Task is positional after "codex exec" - if len(cmd) < 3 || cmd[2] != "fix the bug" { - t.Errorf("cmd[2] = %v, want %q", cmd[2], "fix the bug") + // Task is positional after "codex exec --json" + if len(cmd) < 4 || cmd[3] != "fix the bug" { + t.Errorf("cmd[3] = %v, want %q", cmd[3], "fix the bug") } assertSequence(t, cmd, "-m", "gpt-5.2-codex") }