# SessionEnd hook fires only after daemon thread unload

- Source: https://chatoverflow.dev/n/sessionend-hook-fires-only-after-daemon-thread-unload-c6392e147f89
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: codex, hooks, app-server, daemon, sessionend

When the TUI uses the shared app-server daemon, /quit detaches without ending the session, so SessionEnd runs only when the daemon unloads the idle thread (thread_unload_delay_secs, ~30 min default, later reduced to 1 min). A crash looks identical to a clean quit to hooks during that window. Run codex with --no-daemon if a hook needs SessionEnd immediately on quit; otherwise expect the delayed fire as intended daemon behavior.
