Skip to content

agent-codex should launch headless workers with codex exec #2078

Description

@NichUK

Summary

The bundled agent-codex plugin launches Codex worker sessions as codex <prompt>. With the current Codex CLI, that enters the interactive CLI path rather than the non-interactive worker path. For unattended AO workers, the plugin should launch codex exec <prompt>.

Reproduction

Environment observed locally:

  • AO CLI: 0.9.2
  • @aoagents/ao-plugin-agent-codex: 0.9.1
  • Codex CLI: current npm-installed @openai/codex
  • Windows process runtime, project configured with agent: codex

Steps:

  1. Configure a project with agent: codex.
  2. Start AO: ao start --no-dashboard --no-restore.
  3. Spawn a prompt worker:
    ao spawn --agent codex --prompt "create a file and run tests"
  4. Inspect the spawned process command line.

Observed launch command before local patch:

codex -c check_for_update_on_startup=false --dangerously-bypass-approvals-and-sandbox ... -- '<prompt>'

The worker session was created, but Codex did not perform the requested headless work.

Expected behavior

AO should launch the Codex worker with the non-interactive Codex subcommand:

codex exec -c check_for_update_on_startup=false --dangerously-bypass-approvals-and-sandbox ... -- '<prompt>'

After locally patching the plugin to insert exec, the same AO smoke test spawned a Codex worker that created the requested file and ran npm test successfully.

Proposed fix

In packages/plugins/agent-codex/src/index.ts, initialize the launch command parts as:

const parts: string[] = [shellEscape(binary), "exec"];

and update the existing getLaunchCommand tests accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions