App-server does not dispatch Stop hook after turn/completed
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- PR merge metrics
- PR metrics pending
Description
Summary
When a normal app-server turn reaches turn/completed, the configured Stop hook is not dispatched.
Environment
- Codex CLI:
0.147.0-alpha.6.5 - OS: macOS
- Transport: app-server over stdio
- Isolated temporary
CODEX_HOMEand repository fixture - No global hook installation or user configuration changes
Reproduction
- Configure trusted lifecycle hooks for
SessionStart,UserPromptSubmit,Stop,PostCompact, andSessionEnd. - Start app-server.
- Start a temporary persisted thread and a no-tools turn.
- Wait for the server to emit
turn/completed. - Observe hook lifecycle notifications for up to 10 seconds after completion.
Expected behavior
After turn/completed, app-server dispatches the Stop hook and emits the corresponding hook lifecycle notifications.
Actual behavior
SessionStartandUserPromptSubmitare dispatched.- The turn reaches
turn/completed. - No
hook/startednotification forStopappears within 10 seconds. - When app-server is then shut down,
SessionEndis dispatched.
This reproduces consistently in an isolated canary without modifying real user configuration.
Related issue
#22858 discusses interrupted turns. This report concerns a normally completed turn.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the app-server handling for normal turn completion and trace hook dispatch after turn/completed, comparing it with SessionStart, UserPromptSubmit, and SessionEnd dispatch. Reproduce using the isolated stdio setup described, then verify that the Stop hook and its hook/started notification occur after turn/completed without requiring shutdown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100