ai-devkit icon indicating copy to clipboard operation
ai-devkit copied to clipboard

fix(agent-manager): codex helper detection mis-parses variadic -i/--image values

Open codeaholicguy opened this issue 2 months ago • 0 comments

Problem

CodexAdapter's helper-subcommand check (firstPositionalArgument, introduced in #259) skips exactly one value after each flag in CODEX_VALUE_FLAGS. Codex CLI 0.157.1 declares -i, --image <FILE>..., which takes several values:

-i, --image <FILE>...
        Optional image(s) to attach to the initial prompt

So codex -i a.png b.png cloud reads b.png as the first positional argument and misses the cloud subcommand. That helper process is then detected, and listed, as an agent. Found while working on #283.

Proposed fix

Handle variadic value flags. For -i/--image, consume values until the next token that starts with - or is a known subcommand, following clap's num_args(1..) behaviour. Also consider --image=a.png,b.png and repeated -i a -i b. Check codex --help (and codex <sub> --help) for any other variadic root flags in 0.157.1.

Acceptance criteria

  • [ ] codex -i a.png b.png cloud, codex --image a.png b.png app-server and codex -i a.png -i b.png agents are recognised as helpers (not handled).
  • [ ] codex -i a.png "fix the bug" (interactive with a prompt) and codex -i a.png resume --last are still handled as agents.
  • [ ] Other variadic root flags in Codex 0.157.1 are identified and covered, or documented as none.
  • [ ] Existing CodexAdapter tests pass.

codeaholicguy avatar Sep 29 '26 13:09 codeaholicguy