Skip to content

Feed initial prompt to Codex on autolaunch (CROW-493)#500

Merged
dgershman merged 1 commit into
mainfrom
feature/crow-493-codex-bare-launch
Jun 12, 2026
Merged

Feed initial prompt to Codex on autolaunch (CROW-493)#500
dgershman merged 1 commit into
mainfrom
feature/crow-493-codex-bare-launch

Conversation

@dgershman

Copy link
Copy Markdown
Collaborator

Summary

OpenAICodexAgent.autoLaunchCommand returned "codex\n" for .work and nil for every other session kind. Result: skill-created Codex coding sessions opened a bare codex TUI sitting at >_ waiting for the user to type, and app-created Codex .job sessions never auto-launched at all (SessionService logged a skip and pasted a ⚠️ echo).

Switches to a kind-based dispatch that mirrors CursorAgent.autoLaunchCommand:

  • .work — bare codex\n (skill seeds the prompt at first launch; in-app resume just reopens the TUI)
  • .job — first launch passes .crow-job-prompt.md as a positional argv (codex "$(cat …)"); subsequent launches fall back to bare codex (no --continue in MVP)
  • .reviewnil (review-on-Codex stays gated per the ticket's acceptance criterion 3)
  • .managernil

The implementation now also honors defaults.binaries.codex via findBinary() ?? "codex", matching the Claude/Cursor convention — minor adjacent bug fixed along the way.

The skill side (crow-workspace/setup.sh::launch_codex + the Resources/.template mirror) is updated to pass the prompt the same way launch_claude_code / launch_cursor already do: cd \$WORKTREE_PATH && \$bin "\$(cat \$prompt_path)". Codex v0.139.0's --help confirms codex [OPTIONS] [PROMPT] is supported.

CROW-424 (Cursor .work)

Bundled-check requested in plan: after tracing both paths, Cursor's .work doesn'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 bare agent\n is the intentional MVP behavior — same shape Codex .work now adopts. The deeper "auto-feed prompt on .work resume" feature would need a new .crow-work-prompt.md convention + 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 — passes
  • arch -arm64 swift test --arch arm64 --filter OpenAICodexAgent (from Packages/CrowCodex) — 11/11 pass, including new .job first-launch / .job resume / .manager / binary-override-on-.work cases
  • bash -n skills/crow-workspace/setup.sh — clean
  • codex --help confirms codex [OPTIONS] [PROMPT] positional form is supported on v0.139.0
  • Manual end-to-end: open a Codex coding session for a crow:auto ticket 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

@dgershman dgershman requested a review from dhilgaertner as a code owner June 11, 2026 23:42
@dgershman dgershman added the crow:merge Crow auto-merge on green label Jun 11, 2026

@dhilgaertner dhilgaertner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code & Security Review

Critical Issues

None.

Security Review

Strengths:

  • The .job first-launch command codex "$(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/$(…)/$VAR inside 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.launchAgent preflights .crow-job-prompt.md existence before dispatch (OpenAICodexAgent.swift:74SessionService.swift:604-617), so a missing file surfaces a ⚠️ echo instead of launching Codex against an empty string.

Concerns:

  • None.

Code Quality

  • autoLaunchCommand now mirrors CursorAgent.autoLaunchCommand precisely — kind-based dispatch with .work → bare codex, .job → positional prompt on first launch / bare on resume (gated by reviewPromptDispatched), .review/.managernil. Good parity, clear comments.
  • Adjacent bug correctly fixed: .work now resolves through findBinary() ?? "codex" instead of hardcoding the token, restoring defaults.binaries.codex honoring (CROW-484), with a dedicated regression test (autoLaunchCommandHonorsBinaryOverride).
  • The skill-side launch_codex in both skills/crow-workspace/setup.sh and the Resources/…template mirror are byte-identical and match launch_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 .job sessions get the file.

Verification performed:

  • swift test --filter OpenAICodexAgent → 11/11 pass (new .job first/subsequent, .manager, binary-override cases included).
  • bash -n clean on both setup scripts.
  • Confirmed launch_codex blocks 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.)


🐦‍⬛ Reviewed by Crow via Claude Code

`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.
@dgershman dgershman force-pushed the feature/crow-493-codex-bare-launch branch from 2cb73f6 to b955704 Compare June 12, 2026 00:00
@dgershman dgershman merged commit 8dba3c7 into main Jun 12, 2026
2 checks passed
@dgershman dgershman deleted the feature/crow-493-codex-bare-launch branch June 12, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crow:merge Crow auto-merge on green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex coding session launches bare — no prompt delivered to the agent (parity with Claude Code launch)

2 participants