fix-codex-chat-2

Fix: codex chat agent — wrong cwd + YOLO mode still sandboxed (cannot launch shell)

Metadata

Statusdone
Assignedagent-1108
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Created2026-04-29T14:34:48.494044434+00:00
Started2026-04-29T14:35:12.048986722+00:00
Completed2026-04-29T15:06:48.235334910+00:00
Tagspriority-high,bug,codex,chat, eval-scheduled
Eval score0.68
└ blocking impact0.65
└ completeness0.60
└ constraint fidelity0.85
└ coordination overhead0.70
└ correctness0.70
└ downstream usability0.70
└ efficiency0.80
└ intent fidelity0.72
└ style adherence0.65

Description

Description

fix-codex-chat (commit 8b5662275) was supposed to land bypass posture for codex chat agents. User report 2026-04-29 shows TWO separate bugs still present:

Bug 1: Wrong working directory

Codex banner reports:

directory:   ~/autohaiku/.wg/chat/chat-0

That's the per-chat subdirectory inside .wg/chat/, NOT the project root ~/autohaiku/. So when the codex agent tries to inspect / interact with the user's project files, it can't see them — they're up two parent directories.

The chat agent should run with cwd = the project root (where the user invoked wg tui), exactly like the claude chat agent does. Per-chat scratch can still go under .wg/chat/chat-N/ for chat-history persistence, but THE PROCESS cwd should be the project root.

Bug 2: 'YOLO mode' is not actually bypassing sandbox

Banner reports:

permissions: YOLO mode

But codex CLI then errors:

The configured shell path is not available in this workspace, so I'm switching the command shell to bash...
Bash also isn't at the expected path for the tool invocation. I'm using /bin/sh directly...
the command runner here is failing before wg starts: it cannot launch the configured shell paths (/usr/bin/zsh, /usr/bin/bash, or /bin/sh).

So whatever flag fix-codex-chat wired (most likely --yolo), it's NOT actually disabling the codex sandbox's execve restrictions. The agent can't even launch bash.

Two hypotheses to verify:

  • H1: --yolo is an alias for --full-auto (sandboxed), NOT --dangerously-bypass-approvals-and-sandbox. The banner says 'YOLO mode' which is codex's user-facing label for full-auto. fix-codex-chat may have picked the wrong flag.
  • H2: The flag IS --dangerously-bypass-approvals-and-sandbox but cwd-restriction prevents shell discovery. If the cwd (~/autohaiku/.wg/chat/chat-0) is in a path codex's sandbox doesn't allow execve from, the bypass flag may not cover that.

Most likely H1, possibly compounded by Bug 1.

Repro

  1. cd ~/autohaiku && wg tui
  2. Open a codex chat (or have one auto-spawn)
  3. Banner should say directory: ~/autohaiku/.wg/chat/chat-0 (Bug 1) and permissions: YOLO mode (Bug 2)
  4. Ask the chat agent to run any shell command via wg or bash
  5. Observe: 'cannot launch the configured shell paths' error

Goal

Both symptoms gone: cwd is project root, shell commands actually run, codex chat agent is symmetric with claude chat agent.

Investigation steps

  1. Find the codex spawn site — what flag is currently wired (--yolo vs --dangerously-bypass-approvals-and-sandbox vs --full-auto)?
  2. Test which flag actually permits execve of /usr/bin/bash. Run: codex --yolo --help vs codex --dangerously-bypass-approvals-and-sandbox --help vs codex --full-auto --help — and try a small shell-launching test against each. Confirm which gives full bypass.
  3. Find the chat-agent cwd resolution — where does directory: ~/...\.wg/chat/chat-0 come from? Should be the project root, not the chat subdir.
  4. Compare with the claude chat agent's spawn site — what cwd does it use? Mirror that for codex.

Validation

  • Failing test written first (TDD): spawn a codex chat agent in a fresh project; banner reports project-root cwd; subsequent shell-command attempt succeeds
  • Live smoke: in ~/autohaiku with the rebuilt binary, open codex chat, confirm: - Banner shows directory: ~/autohaiku (NOT .wg/chat/chat-0) - Asking codex to run wg status succeeds (no shell-launch error, no permission prompt) - Asking codex to run ls succeeds
  • Symmetry confirmation: paste claude chat spawn args + codex chat spawn args side-by-side in the task log. They should be analogous (same cwd resolution, same bypass posture).
  • If H1 confirmed (--yolo was wrong flag): switch to --dangerously-bypass-approvals-and-sandbox; document why in task log
  • cargo build + cargo test pass
  • Permanent smoke scenario added: spawn codex chat, run shell command, assert no errors
  • cargo install --path . was run before claiming done — and live-smoke evidence pasted before claim of done

Process note

This is the SECOND attempt at making codex chat work (fix-codex-chat shipped 13 hours ago). The first attempt's validation said:

Live smoke: spawn a codex CHAT agent. Have it run wg status AND cargo --version AND ls /tmp. No permission prompts.

The agent claimed done without that live smoke actually passing. Do not repeat that pattern. Paste actual command output as evidence in the task log.

Depends on

Required by

Log