diff --git a/Packages/CrowCodex/Sources/CrowCodex/OpenAICodexAgent.swift b/Packages/CrowCodex/Sources/CrowCodex/OpenAICodexAgent.swift index b34108b..d65154a 100644 --- a/Packages/CrowCodex/Sources/CrowCodex/OpenAICodexAgent.swift +++ b/Packages/CrowCodex/Sources/CrowCodex/OpenAICodexAgent.swift @@ -50,10 +50,15 @@ public struct OpenAICodexAgent: CodingAgent { // log and skip rather than producing a malformed command. guard session.kind == .work else { return nil } - // Bare `codex` launch — the user types their prompt into the TUI. - // No env prefix (Codex has no OTEL equivalent), no `--continue` - // (MVP doesn't auto-resume), no `--rc` (Codex doesn't do remote - // control). The terminal's cwd is already the worktree path. + // Bare `codex` launch in-app. First-launch prompt delivery happens + // in the workspace skill (`crow-workspace/setup.sh launch_codex`), + // which passes the prompt file as Codex's positional argv before + // handing the terminal off to Crow. In-app re-launches resume the + // existing TUI rather than re-running the original prompt — same + // shape as `CursorAgent` `.work` (no `--continue` equivalent in MVP). + // No env prefix (Codex has no OTEL equivalent), no `--rc` (Codex + // doesn't do remote control). The terminal's cwd is already the + // worktree path. return "codex\n" } diff --git a/Resources/crow-workspace-setup.sh.template b/Resources/crow-workspace-setup.sh.template index e5b1fbe..e28ae73 100755 --- a/Resources/crow-workspace-setup.sh.template +++ b/Resources/crow-workspace-setup.sh.template @@ -714,11 +714,11 @@ launch_codex() { die "launch_agent" "codex binary not found at PATH or known locations; provide --agent-binary" fi log "Resolved codex binary: $bin" - # Codex has no prompt-argv form (matches OpenAICodexAgent.autoLaunchCommand - # — bare `codex` only). The prompt file is still written; the user can - # paste from it into the TUI. - log "Note: Codex has no prompt-argv form; prompt file is at $prompt_path (paste manually if needed)." - local launch_cmd="cd $WORKTREE_PATH && $bin" + # Codex 0.129+ accepts the initial prompt as a positional argv that + # pre-fills the TUI composer — same mechanism Cursor's `agent` uses. + # The prompt-argv form was deferred in MVP because older Codex CLIs + # ignored extra argv; unblocked here (#492). + local launch_cmd="cd $WORKTREE_PATH && $bin \"\$(cat $prompt_path)\"" create_agent_terminal "OpenAI Codex" "$launch_cmd" } diff --git a/skills/crow-workspace/setup.sh b/skills/crow-workspace/setup.sh index 42ea06e..ff4a40e 100755 --- a/skills/crow-workspace/setup.sh +++ b/skills/crow-workspace/setup.sh @@ -837,11 +837,11 @@ launch_codex() { die "launch_agent" "codex binary not found at PATH or known locations; provide --agent-binary" fi log "Resolved codex binary: $bin" - # Codex has no prompt-argv form (matches OpenAICodexAgent.autoLaunchCommand - # — bare `codex` only). The prompt file is still written; the user can - # paste from it into the TUI. - log "Note: Codex has no prompt-argv form; prompt file is at $prompt_path (paste manually if needed)." - local launch_cmd="cd $WORKTREE_PATH && $bin" + # Codex 0.129+ accepts the initial prompt as a positional argv that + # pre-fills the TUI composer — same mechanism Cursor's `agent` uses. + # The prompt-argv form was deferred in MVP because older Codex CLIs + # ignored extra argv; unblocked here (#492). + local launch_cmd="cd $WORKTREE_PATH && $bin \"\$(cat $prompt_path)\"" create_agent_terminal "OpenAI Codex" "$launch_cmd" }