Skip to content

Windows Codex hooks use single-quoted commands and fail under cmd.exe #2

@smoochy

Description

@smoochy

Summary

On Windows, the generated Codex hook commands from @superbased/observer are wrapped in POSIX-style single quotes. Codex executes these hook commands through cmd.exe, which does not treat '...' as valid quoting. As a result, the hook command is parsed incorrectly and exits with code 1.

Environment

  • OS: Windows
  • Codex CLI: 0.133.0
  • @superbased/observer: 1.6.27

Generated hook command

Example from hooks.json:

"command": "'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\@superbased\\observer\\node_modules\\@superbased\\observer-win32-x64\\bin\\observer.exe' hook codex SessionStart --config 'C:\\Users\\Administrator\\.observer\\config.toml'"

The same quoting pattern was generated for PermissionRequest, PreToolUse, PostToolUse, SessionStart, Stop, and UserPromptSubmit.

Reproduction

  1. Install @superbased/observer on Windows.
  2. Configure Codex hooks using the current install flow.
  3. Start Codex or submit a prompt.
  4. The hook fails immediately.

Running the generated command through cmd.exe reproduces the problem:

cmd /c "'C:\Users\Administrator\AppData\Roaming\npm\node_modules\@superbased\observer\node_modules\@superbased\observer-win32-x64\bin\observer.exe' hook codex SessionStart --config 'C:\Users\Administrator\.observer\config.toml'"

Actual behavior

The command fails under cmd.exe because the single quotes are interpreted literally instead of as quoting. In my case this caused the hook to error immediately, and Codex showed hook failures on prompt submission / session start.

Expected behavior

On Windows, generated Codex hook commands should use Windows-safe quoting:

  • no single quotes around executable/config paths
  • if quoting is required, use "..." for cmd.exe compatibility

Workaround

Manually editing hooks.json to remove the single quotes fixed it. For example, this form works:

"command": "C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\@superbased\\observer\\node_modules\\@superbased\\observer-win32-x64\\bin\\observer.exe hook codex SessionStart --config C:\\Users\\Administrator\\.observer\\config.toml"

After removing the single quotes, the affected Codex hooks executed successfully.

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