From 42a0d3e6b73607c7babd847c67a347ed20203cfb Mon Sep 17 00:00:00 2001 From: Chris La Date: Tue, 17 Mar 2026 11:11:56 -0700 Subject: [PATCH 1/2] Add --json flag to codex exec for structured output Suppresses the verbose prompt echo and outputs JSONL events instead, making output machine-parseable for StrawPot. Co-Authored-By: Claude Opus 4.6 --- codex/wrapper/main.go | 3 +++ 1 file changed, 3 insertions(+) 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) } From 99ebbd00a441d80861e2306dc08f61e42a878663 Mon Sep 17 00:00:00 2001 From: Chris La Date: Tue, 17 Mar 2026 11:15:45 -0700 Subject: [PATCH 2/2] Fix test for --json flag position in codex exec command Update TestCmdBuild_WithTaskAndModel to expect task at cmd[3] instead of cmd[2] since --json is now inserted after exec. Co-Authored-By: Claude Opus 4.6 --- codex/wrapper/main_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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") }