Skip to content

spawn: .command extension prevents boot script execution on Windows inside tmux #282

Description

@masa6161

Summary

On Windows, spawn.sh renames the boot script with a .command extension (spawn.sh:307), which causes Windows to treat the file as a plain text document and open it with the default text application (e.g. Notepad) instead of executing it as a bash script. The spawned agent never starts.

This occurs only inside tmux (psmux on Windows). Outside tmux, the launch_windows_terminal path uses wt.exe new-tab bash -l "$BOOT", which explicitly invokes bash and is unaffected by the file extension.

Root cause

# spawn.sh:307
mv "$BOOT" "$BOOT.command"   # .command so macOS `open` runs it in Terminal

The .command extension is a macOS convention — Terminal.app recognises it and executes the file as a shell script. On Windows, .command has no shell association. When tmux's split-window attempts to run the file, Windows processes it as a plain text file open rather than script execution.

Reproduction

# Inside tmux (psmux) on Windows
spawn.sh codex reviewer --project "$(pwd)" --team <team>
# → A new tmux pane opens, but the boot script is opened in Notepad
#   instead of being executed. No codex session is created.

Verified by checking ~/.codex/sessions/ — no rollout files are created after the tmux spawn, whereas spawning outside tmux (same machine, same boot script content) creates rollout files immediately.

Suggested fix

Skip the .command rename on non-macOS platforms. The extension is only needed for the macOS open -a Terminal path (launch_macos_terminal); all other launch paths invoke bash explicitly and don't depend on the extension.

# Only rename to .command on macOS where `open -a` needs it
case "$(uname -s)" in
  Darwin) mv "$BOOT" "$BOOT.command"; BOOT="$BOOT.command" ;;
esac

Environment

  • Windows 11, Git Bash (MSYS2), psmux (tmux for Windows)
  • agmsg installed at ~/.agents/skills/agmsg/
  • codex-cli 0.142.5

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions