openai / openai/codex

App-server does not dispatch Stop hook after turn/completed

Open
#38,213 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server bug CLI hooks
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_HOME and repository fixture
  • No global hook installation or user configuration changes

Reproduction

  1. Configure trusted lifecycle hooks for SessionStart, UserPromptSubmit, Stop, PostCompact, and SessionEnd.
  2. Start app-server.
  3. Start a temporary persisted thread and a no-tools turn.
  4. Wait for the server to emit turn/completed.
  5. 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

  • SessionStart and UserPromptSubmit are dispatched.
  • The turn reaches turn/completed.
  • No hook/started notification for Stop appears within 10 seconds.
  • When app-server is then shut down, SessionEnd is 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.