SessionStart not firing on session start instead it fires on first user prompt submission

Resolved 💬 2 comments Opened Mar 20, 2026 by shanraisshan Closed Mar 20, 2026

What version of Codex CLI is running?

0.116.1

What subscription do you have?

Plus

Which model were you using?

gpt-5.4 xhigh

What platform is your computer?

mac

What terminal emulator and version are you using (if applicable)?

_No response_

What issue are you seeing?

SessionStart not firing on session start instead it fires on first user prompt submission. When both SessionStart and UserPromptSubmit hooks are registered, they fire simultaneously on the first prompt. On subsequent prompts, only UserPromptSubmit fires (expected).

What steps can reproduce the bug?

Register both hooks in .codex/hooks.json:

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [{ "type": "command", "command": "echo 'SessionStart fired'", "timeout": 10 }]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [{ "type": "command", "command": "echo 'UserPromptSubmit fired'", "timeout": 10 }]
      }
    ]
  }
}

Start Codex CLI with codex -c features.codex_hooks=true
Send the first prompt — both hooks fire simultaneously
Send a second prompt — only UserPromptSubmit fires

What is the expected behavior?

SessionStart should fire on session start and not on first user prompt submission

Additional information

implementation: https://github.com/shanraisshan/codex-cli-hooks

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗