Skip to content

Expose structured shell status in PostToolUse hook payloads #24175

Open

Description

@Kaspre

Summary

PostToolUse hooks for shell tools currently receive the canonical tool input and a response payload that represents command output, but they do not appear to receive structured process status such as exit code, terminating signal, process id, or whether the process was still running when output was returned.

Please expose structured shell status in the PostToolUse hook input for Bash/shell tool events.

Why this matters

Consumers that need to distinguish host-side process intervention from ordinary command failure currently have to infer from text output or query external state after every shell command. Examples include:

  • host thermal killswitches that terminate a top CPU process,
  • OOM or supervisor kills,
  • stalled interactive sessions that later resolve as killed,
  • retry controllers that should back off on SIGKILL instead of repeating the same workload.

Without structured status, a hook cannot cheaply say "only inspect external kill markers when this command exited 137 or was terminated by SIGKILL." The safer workaround is to run a lightweight external marker check after every Bash PostToolUse, then dedupe markers locally.

Requested fields

For shell PostToolUse payloads, include fields along these lines:

{
  "toolResponse": "...",
  "processStatus": {
    "pid": 12345,
    "exitCode": 137,
    "signal": "SIGKILL",
    "timedOut": false,
    "running": false
  }
}

Exact naming is not important; the key need is a stable, structured way for hooks to identify process termination and correlate it with external audit markers.

Current workaround

A local command hook polls an external thermal-kill marker helper after Bash PostToolUse and on prompt/session boundaries. It stays passive and only injects context, but it has to check more often than necessary because the hook payload lacks shell status.

Related issues found before filing

Activity

  1. added
    enhancementNew feature or request
    CLIIssues related to the Codex CLI
    hooksIssues related to event hooks
    on May 23, 2026
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

    CLIIssues related to the Codex CLIenhancementNew feature or requesthooksIssues related to event hooks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions