Files
open-design/apps/daemon/src
SidandGitHub 0d3de899bd fix(daemon): drop literal - argv from codex spawn so prompts deliver via stdin pipe alone (#342)
Recent Codex CLI versions (≥ 0.122 per #237 reports) reject a bare `-`
argv element with `error: unexpected argument '-' found`, exiting code 2
before any prompt is read. Open Design currently appends `-` after the
positional flags in `apps/daemon/src/agents.ts`, while also setting
`promptViaStdin: true` to deliver the prompt via stdin pipe. The `-`
became redundant after PR #258 standardized stdin delivery — only its
removal was missed for codex, leaving the agent unusable on `main` /
0.2.0 across every platform that runs a current Codex CLI.

This matches the pattern that was already corrected for `cursor-agent`
upstream of this commit (apps/daemon/src/agents.ts line ~392 comment),
where the same `-` sentinel was found to surface as a literal user
prompt. The fix here is the codex equivalent: remove the trailing
`args.push('-')` and rely on `promptViaStdin: true` for delivery.

The existing `agents.test.ts` cases asserted `args.at(-1) === '-'`,
which encoded the broken contract; those assertions are dropped and a
new regression test pins `args.includes('-') === false` across the
plugin, model, reasoning, and disable-plugins permutations so the
sentinel can't sneak back in via a future buildArgs branch.

Out of scope for this PR (not yet verified, left for separate
investigation):

- `--full-auto` is also flagged as deprecated by current Codex versions
  (`use \`--sandbox workspace-write\` instead`). It still parses and
  runs — the warning is non-fatal — and the right replacement involves
  pinning the auto-approval policy that `--full-auto` implies, not just
  `--sandbox`. Cleaning this up safely deserves its own PR after
  confirming the modern equivalent.
- OpenCode (`apps/daemon/src/agents.ts:320`) and Qwen Code
  (`apps/daemon/src/agents.ts:433`) follow the same `args.push('-')` +
  `promptViaStdin: true` shape. Whether their current CLIs also reject
  a bare `-` is unverified; if they do, the same minimal fix applies
  there. Calling out for maintainer assessment alongside #163 / #218.

Closes #237.
2026-05-03 10:45:15 +08:00
..
2026-05-02 19:23:46 +08:00