Skip to content

Codex Desktop lifecycle SessionStart hooks are detected but command hooks never execute #35863

Description

@maurice85

What version of the Codex App are you using (From “About Codex” dialog)?

26.721.41059

What subscription do you have?

Pro

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

User-defined SessionStart lifecycle hooks are detected by Codex Desktop and appear correctly in the Hooks UI, but the configured command is never executed.

The hook is listed under the User Config hooks, its status message is displayed during session startup, but no process is launched and no side effects occur.

This makes SessionStart hooks unusable for startup automation.

What steps can reproduce the bug?

  1. Create a hooks.json file containing a simple SessionStart hook that executes a command (for example, launching PowerShell, Notepad, Calculator, or creating a file).
{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup",
        "hooks": [
          {
            "type": "command",
            "command": "powershell.exe -NoExit -NoProfile -Command \"Write-Host 'Hello, World';\"",
            "statusMessage": "Opening PowerShell...",
            "timeout": 30
          }
        ]
      }
    ]
  }
}
  1. Restart Codex Desktop.

  2. Open Settings → Hooks and click Trust for the discovered hook.

  3. Start a new Codex session.

Commands tested include:

  • powershell.exe -NoExit -NoProfile -Command "Write-Host 'Hello, World'"
  • cmd.exe /c echo Hook executed > %TEMP%\codex-hook-test.txt
  • notepad.exe
  • calc.exe

Observed behavior:

  • The hook appears correctly in the Hooks UI.
  • The hook can be trusted.
  • The configured status message is displayed when the session starts.
  • None of the configured commands are executed.
  • No PowerShell window opens.
  • Notepad and Calculator do not launch.
  • The test file is never created.

What is the expected behavior?

SessionStart command hooks should execute the configured command when a new session starts.

For the examples above:

  • PowerShell should open and display the configured message.
  • Notepad or Calculator should launch.
  • The test file should be created in the Temp directory.

If the hook configuration is invalid or unsupported, Codex Desktop should display a clear error message instead of silently ignoring the command.

Additional information

Environment:

  • Windows 11

The hook is marked as Trusted.

The Hooks UI successfully discovers the SessionStart hook and displays it under User Config, including the configured matcher, timeout and status message. This suggests the hook is being parsed correctly, but the command itself is never executed.

I originally discovered this while trying to use a SessionStart hook to trigger the Windows permission prompt for PowerShell before running autonomous tasks. During testing it became clear that no command executes at all, regardless of whether it launches PowerShell, Notepad, Calculator or simply creates a file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workinghooksIssues related to event hookswindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions