# Codex will answer its own question if you're not looking. Here's how to catch it

> Source: <https://dev.to/dawonlee/codex-will-answer-its-own-question-if-youre-not-looking-heres-how-to-catch-it-3gb8>
> Published: 2026-10-18 10:07:17+00:00

If you use Codex in Plan mode, you've probably seen this: Codex stops to ask you something ("Which folder should I refactor?"), and if you don't answer quickly it goes ahead with its own recommended option. People have asked for a way to turn that off. The [issue](https://github.com/openai/codex/issues/28969) has 200+ 👍.

Until there's a setting, the practical fix is to **find out the moment Codex asks**, even when the terminal is behind three other windows or you're on the couch.

Codex hooks cover `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PermissionRequest`, `PostToolUse`, `Stop` and a few others ([docs](https://developers.openai.com/codex/hooks)). `PermissionRequest` fires for approvals (shell escalation, network), **not** for questions. So a `notify`/hook setup that pings you on approvals stays silent when Codex asks a question.

Every Codex session writes a JSONL rollout under `~/.codex/sessions/YYYY/MM/DD/`. A question is a tool call named `request_user_input`:

```
{"type":"response_item","payload":{"type":"function_call","name":"request_user_input",
 "arguments":"{\"questions\":[{\"header\":\"Scope\",\"question\":\"Which folder should I refactor?\"}],\"isBlocking\":true}",
 "call_id":"call_…"}}
```

When you answer, a `function_call_output` with the same `call_id` follows. So **a `request_user_input` call with no output yet = Codex is waiting on you.**

Two caveats from checking my own logs:

`request_user_input_async`. It gets `{"accepted":true}` back within a fraction of a second and Codex keeps working, so it isn't a blocking wait. Skip it.`protocol/src/request_user_input.rs`) and matches the envelope in my logs, but log formats aren't a stable API, so expect to adjust it someday.

``` bash
#!/usr/bin/env python3
"""Notify (macOS) when Codex is blocked on a question you haven't answered yet."""
import json, os, subprocess, time, glob

ROOT = os.path.expanduser("~/.codex/sessions")
seen = set()

def pending(path):
    calls, done = {}, set()
    with open(path, errors="ignore") as f:
        f.seek(max(0, os.path.getsize(path) - 256_000))   # the tail is enough
        for line in f:
            if '"response_item"' not in line:
                continue
            try:
                p = json.loads(line)["payload"]
            except (ValueError, KeyError):
                continue
            if p.get("type") == "function_call_output":
                done.add(p.get("call_id"))
            elif p.get("type") == "function_call" and p.get("name") == "request_user_input":
                try:
                    q = json.loads(p.get("arguments") or "{}")["questions"][0]
                    text = q.get("question") or q.get("header") or ""
                except (ValueError, KeyError, IndexError):
                    text = ""
                calls[p.get("call_id")] = text
    return {c: t for c, t in calls.items() if c not in done}

def notify(text):
    msg = (text or "Codex is waiting for your answer")[:180].replace('"', "'")
    subprocess.run(["osascript", "-e",
        f'display notification "{msg}" with title "Codex has a question" sound name "Glass"'])

while True:
    for path in glob.glob(f"{ROOT}/*/*/*/*.jsonl"):
        if time.time() - os.path.getmtime(path) > 1800:   # only live sessions
            continue
        for cid, text in pending(path).items():
            if cid not in seen:
                seen.add(cid)
                notify(text)
    time.sleep(3)
```

Run it in a spare terminal (`python3 codex-question-alert.py`). It only reads files that changed in the last 30 minutes and only the last 256 KB of each, so it's cheap. I tested it against a synthetic log (one unanswered question, one answered) and against a week of my real logs (no false alarms).

To get it on your phone, swap `notify()` for a `curl` to an [ntfy](https://ntfy.sh) topic.

I build [Lidnight](https://lidnight.app/en/), a menu bar app that keeps a MacBook awake (lid closed, even on battery) while Claude Code and Codex work and lets it sleep when they're done. Version 1.7.68 does the check above on its own: when Codex is blocked on a question, you get a Mac notification and a phone push (if you've linked one) right away, with the question text. It can't answer for you. It just makes sure you see the question in time.

Lidnight is free (AI Auto mode) with a one-time Pro; launch price is 50% off through Oct 31. `brew install whereisdw/tap/lidnight`
