Codex notifications: know when a Codex run finishes, fails or waits on you
LastPing's Codex hook install reports every Codex CLI run: a start when you send a prompt and a finish when the turn ends. Codex reports failures and waits on you with one command each, and LastPing alerts you by Slack, Discord, email or your phone.
Your assistant can do this for you
Monitor this agent with LastPing
On this page
What gets reported
- Start and finish: automatic: the UserPromptSubmit and Stop hooks open and close a run for every turn, outside the sandbox, so they need no network setting.
- Failure: Codex runs
lastping-report.sh fail "<reason>"when the work failed; the reason lands on the incident. - Waiting on you: Codex runs
lastping-report.sh blocked "<what it needs>". Unlike Claude Code, approval prompts are not detected on their own. - Hung or never started: a maximum runtime on the monitor catches a run that never finishes; a silence floor catches an unattended agent that stops running.
Set it up
Connect LastPing to Codex
Add the MCP server; Codex opens your browser to sign in.
codex mcp add lastping --url https://mcp.lastping.dev/mcpIf the browser did not open, run codex mcp login lastping. Or install the set-up skill with npx skills add lastping-dev/skills, which walks through the same connection.
Ask Codex to monitor itself
In Codex: Monitor this agent with LastPing. It registers the agent, creates an on-demand monitor and asks for the Codex hook install, after you agree to each. Writing to ~/.codex needs your approval, because Codex's default sandbox only writes inside the workspace.
Trust the hooks
The install writes ~/.codex/lastping-report.sh and adds three hooks to ~/.codex/hooks.json: SessionStart, UserPromptSubmit and Stop. Codex runs a hook you added only after you trust it in /hooks. From then on each prompt opens a run and each finished turn closes it.
Let Codex's own calls reach the network
Failures, blocked waits, notes and titles are commands Codex runs inside its sandbox, which has no network by default. Either approve each ping when Codex asks, or add network_access = true under [sandbox_workspace_write] in ~/.codex/config.toml yourself. A fail or blocked call the sandbox stops is kept and sent by the Stop hook, which runs outside the sandbox.
Good to know
The Codex install follows Codex's hook documentation and, for where hooks run, its source code. If a step behaves differently in your Codex version, tell us at hello@lastping.dev. The install never opens ~/.codex/config.toml, which holds keys: the network setting is yours to make. For tokens, cost and tool calls, Codex can also send its OpenTelemetry traces: see trace your agents.
Questions people ask
-
Can I get a notification when Codex finishes a task?
Yes. The Codex hook install closes a run on every Stop. Route the success or every-run event to Slack, Discord, email or a phone app such as ntfy or Pushover in the LastPing console.
-
Does LastPing detect Codex approval prompts automatically?
No. Codex has no hook LastPing uses for approvals, so Codex reports a wait itself with the blocked command. LastPing holds the blocked notification for 10 minutes and sends it only if the run is still waiting.
-
Why do the fail and blocked pings need network access?
They are commands Codex runs inside its sandbox, and Codex's default sandbox has no network. Approve each ping, or set network_access = true under [sandbox_workspace_write] in ~/.codex/config.toml. A call the sandbox stops is kept and sent by the Stop hook, which runs outside the sandbox.
-
Is LastPing free for Codex monitoring?
Yes. LastPing is free for individuals, with no monitor cap.
Codex runs on. You hear when it stops.
Connect once, ask once. Free for individuals.