Feed initial prompt to Codex on autolaunch (CROW-493)#500
Merged
Conversation
dhilgaertner
approved these changes
Jun 11, 2026
dhilgaertner
left a comment
Contributor
There was a problem hiding this comment.
Code & Security Review
Critical Issues
None.
Security Review
Strengths:
- The
.jobfirst-launch commandcodex "$(cat <promptPath>)"is the established cross-agent convention (shared with Claude/Cursor). It is injection-safe: the file content is the output of a double-quoted command substitution, so backticks/$(…)/$VARinside the generated prompt are not re-evaluated by the shell. No new attack surface. - No secrets, no telemetry/OTEL prefix, no remote-control flag leaked into the Codex command (asserted by
autoLaunchCommandIgnoresTelemetryAndRemoteControl). SessionService.launchAgentpreflights.crow-job-prompt.mdexistence before dispatch (OpenAICodexAgent.swift:74↔SessionService.swift:604-617), so a missing file surfaces a⚠️echo instead of launching Codex against an empty string.
Concerns:
- None.
Code Quality
autoLaunchCommandnow mirrorsCursorAgent.autoLaunchCommandprecisely — kind-based dispatch with.work→ barecodex,.job→ positional prompt on first launch / bare on resume (gated byreviewPromptDispatched),.review/.manager→nil. Good parity, clear comments.- Adjacent bug correctly fixed:
.worknow resolves throughfindBinary() ?? "codex"instead of hardcoding the token, restoringdefaults.binaries.codexhonoring (CROW-484), with a dedicated regression test (autoLaunchCommandHonorsBinaryOverride). - The skill-side
launch_codexin bothskills/crow-workspace/setup.shand theResources/…templatemirror are byte-identical and matchlaunch_cursor's shape. - End-to-end wiring verified: job-prompt file is written agent-agnostically at job creation (
SessionService.swift:1892-1902), so app-created Codex.jobsessions get the file.
Verification performed:
swift test --filter OpenAICodexAgent→ 11/11 pass (new.jobfirst/subsequent,.manager, binary-override cases included).bash -nclean on both setup scripts.- Confirmed
launch_codexblocks identical across skill + template.
Summary Table
| Color | Meaning | Verdict effect |
|---|---|---|
| Red | Must fix | Request changes |
| Yellow | Should fix | Request changes |
| Green | Consider | Approve allowed |
Recommendation: Approve — driven by [0 Red, 0 Yellow, 0 Green] findings. Clean, well-tested change with strong parity to the existing Cursor/Claude launch paths. (Note the PR's own unchecked manual end-to-end item is a post-merge acceptance step, not a blocker.)
`OpenAICodexAgent.autoLaunchCommand` returned `"codex\n"` for `.work` and `nil` for everything else, so Codex coding sessions never received the ticket prompt — the TUI opened at an empty `>_` and waited for input. Switch to a kind-based dispatch that mirrors `CursorAgent`: `.job` feeds `.crow-job-prompt.md` as a positional argument on first launch and falls back to bare `codex` on resume (Codex has no `--continue` in MVP); `.work` stays bare (skill seeds the first-launch prompt); `.review` and `.manager` return `nil`. Also honors `defaults.binaries.codex` via `findBinary()`. Skill-side `launch_codex` (live + template) now passes the prompt the same way `launch_claude_code` / `launch_cursor` do.
2cb73f6 to
b955704
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenAICodexAgent.autoLaunchCommandreturned"codex\n"for.workandnilfor every other session kind. Result: skill-created Codex coding sessions opened a barecodexTUI sitting at>_waiting for the user to type, and app-created Codex.jobsessions never auto-launched at all (SessionService logged a skip and pasted a⚠️echo).Switches to a kind-based dispatch that mirrors
CursorAgent.autoLaunchCommand:.work— barecodex\n(skill seeds the prompt at first launch; in-app resume just reopens the TUI).job— first launch passes.crow-job-prompt.mdas a positional argv (codex "$(cat …)"); subsequent launches fall back to barecodex(no--continuein MVP).review—nil(review-on-Codex stays gated per the ticket's acceptance criterion 3).manager—nilThe implementation now also honors
defaults.binaries.codexviafindBinary() ?? "codex", matching the Claude/Cursor convention — minor adjacent bug fixed along the way.The skill side (
crow-workspace/setup.sh::launch_codex+ theResources/.templatemirror) is updated to pass the prompt the same waylaunch_claude_code/launch_cursoralready do:cd \$WORKTREE_PATH && \$bin "\$(cat \$prompt_path)". Codex v0.139.0's--helpconfirmscodex [OPTIONS] [PROMPT]is supported.CROW-424 (Cursor
.work)Bundled-check requested in plan: after tracing both paths, Cursor's
.workdoesn't actually have the same Codex bug. The skill (launch_cursor, setup.sh:822) already feeds the prompt at first launch, and the in-app resume returning bareagent\nis the intentional MVP behavior — same shape Codex.worknow adopts. The deeper "auto-feed prompt on.workresume" feature would need a new.crow-work-prompt.mdconvention + SessionService writer, applicable to all three agents simultaneously; out of scope here. Verify the CROW-424 repro against this PR before closing.Test plan
swift build --arch arm64 --target CrowCodex— passesarch -arm64 swift test --arch arm64 --filter OpenAICodexAgent(fromPackages/CrowCodex) — 11/11 pass, including new.jobfirst-launch /.jobresume /.manager/ binary-override-on-.workcasesbash -n skills/crow-workspace/setup.sh— cleancodex --helpconfirmscodex [OPTIONS] [PROMPT]positional form is supported on v0.139.0crow:autoticket and confirm the agent receives the prompt as its first message and starts working without manual paste (post-merge acceptance per ticket criterion 1)Closes #493