Skip to content

Codex rejects the Stop hook when on-stop.sh returns empty stdout #84

Description

@leeguooooo

When the Warp plugin is enabled in Codex CLI, on-stop.sh can exit 0 without writing JSON. Codex 0.153.2 treats that as a failed Stop hook (hook returned invalid stop hook JSON output).

Reproduction outside Warp / without the structured protocol:

printf '%s\n' '{"hook_event_name":"Stop","stop_hook_active":false}' \
  | TERM_PROGRAM=cmux CLAUDE_PLUGIN_ROOT="$PWD/plugins/warp" \
    bash plugins/warp/scripts/on-stop.sh

Current result: exit 0, zero-byte stdout.

Codex's Stop hook contract requires JSON on stdout for a successful exit. A no-op allow can return:

{}

The same applies to the stop_hook_active=true early return. Redirecting notification-script stdout to stderr also keeps the Stop protocol channel JSON-only.

I verified a local patch that returns {} on every successful non-blocking path: plugins/warp/tests/test-hooks.sh passes 58/58, and a Codex 0.153.2 end-to-end run reports every Stop hook as Completed.

Codex hook reference: https://learn.chatgpt.com/docs/hooks#stop

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions