Guide · December 2026

AI coding agent stuck waiting for approval

The most common way an overnight run fails isn't an error. The agent asks permission to run a command or asks a question, nobody answers, and it sits there until morning. Get told right away with Claude Code's Notification hook and Codex's notification settings, and cut down how often it needs to ask.

Lidnight stops runaway spend, silent approval stalls, and unexpected limit hits while you step away. Track Claude Code, Codex, Antigravity, Gemini and Kiro sessions, limits and cost, approve from your phone, and keep going with the lid closed.

Download freePro trial included · no card · Apple Silicon, macOS 13+

Homebrew: brew install whereisdw/tap/lidnight

Why it stops

Claude Code pauses on a permission prompt when a tool use needs your approval. Codex depends on its approval policy: with on-request the model decides when to ask, and stricter policies ask unless a command is allowed. An agent can also stop on a question it asks you directly (stuck on a question). Either way there's no timeout you can rely on. The work isn't lost; the night is.

Claude Code: the Notification hook

Claude Code fires a Notification hook when a person is needed, and matchers split it by type. Per the official docs, permission_prompt fires when a tool-use approval prompt has waited about six seconds (each keystroke defers it), and idle_prompt fires about 60 seconds after Claude finishes responding if you haven't typed since. idle_prompt doesn't fire while Claude Code waits for a claude.ai usage limit to reset. To run something the moment Claude asks for permission, the docs point to the PermissionRequest event instead.

{
  "hooks": {
    "Notification": [
      { "matcher": "permission_prompt",
        "hooks": [{ "type": "command", "command": "~/bin/ping-phone.sh 'approval needed'" }] },
      { "matcher": "idle_prompt",
        "hooks": [{ "type": "command", "command": "~/bin/ping-phone.sh 'idle, waiting'" }] }
    ]
  }
}

ping-phone.sh can be anything that reaches you off the Mac: a push service, an email, a chat message. Keep it a few lines and test it from another room to make sure it arrives. First-time setup is in Claude Code notifications.

Codex: notify and approval notifications

Codex's notify setting runs your program after each completed agent turn with a JSON payload (for example agent-turn-complete). That's useful for “it stopped,” but it isn't “it's asking for approval.” The TUI's desktop notifications (notifications under [tui]) include approval-requested, but they appear on the Mac's screen. Codex hooks also have a PermissionRequest event, so you can run your own command when approval is requested; new hooks only run after you trust them in /hooks (Codex hooks not running). Names can change between Codex versions, so check yours.

# ~/.codex/config.toml
notify = ["/Users/you/bin/ping-phone.sh"]

[tui]
notifications = ["agent-turn-complete", "approval-requested"]

Better: make it ask less

Notifications shorten the wait; fewer prompts remove the cause. Put routine, safe commands on an allow list so they never prompt. Decide your approval stance up front for unattended runs. In Claude Code, a PreToolUse hook can refuse the question tool for you so the run goes on with a recorded assumption. Keep anything hard to undo on a prompt, and accept that those will wait for you. Split long jobs so a stall costs minutes, not a night.

With Lidnight

Lidnight gets each session's state through Claude Code and Codex hooks and puts an orange dot in the menu bar on sessions waiting for an approval or an answer, so you stop clicking through terminal tabs. You can allow or deny approval requests right from a Mac notification or the menu bar window (free); with Pro, alerts reach your phone and you can approve, deny or reply there. By default, risky commands can only be approved on the Mac. While you're away, long waits are announced again 5 minutes, 30 minutes and 2 hours in (up to 3 times per wait), and a session with no output for 15 minutes gets a “Looks stuck” alert. It keeps the Mac awake while work runs and lets it sleep afterwards (closed-lid running is Pro), so a sleeping Mac isn't why an approval goes unseen. Hooks are enough for one tool and one session; a monitor earns its place when several agents run at once.

Checked 2026-11-28 against Claude Code's official ‘Hooks’ docs (code.claude.com/docs/en/hooks) and the config, hooks and notification code in the openai/codex repository. Things change; check the docs.

Try Lidnight free

Apple Silicon Macs · macOS 13 or later. Every download includes a free trial of everything in Pro (14 days or 5 lid-closed runs of 10+ minutes, whichever comes first), no payment details needed. Pro is a one-time payment (1 Mac $9.99 · 3 Macs $14.99) with a 14-day refund.

Download freeBuy Pro ›More about Lidnight ›

Homebrew: brew install whereisdw/tap/lidnight