cd /news/ai-agents/codex-will-answer-its-own-question-i… · home › topics › ai-agents › article
[ARTICLE · art-152263] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

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

A developer published a workaround for OpenAI Codex's Plan mode, where the agent proceeds with its own recommended option if a user doesn't answer a question quickly, an issue that has drawn 200+ upvotes on GitHub. The script tails Codex's JSONL session rollouts under ~/.codex/sessions and flags any request_user_input tool call lacking a matching function_call_output, firing a macOS notification (or an ntfy push) when the agent is blocked. The author notes that PermissionRequest hooks don't cover questions, that request_user_input_async calls should be skipped, and that log formats aren't a stable API.

by read3 min views2 publishedOct 18, 2026

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 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). 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.

#!/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 topic.

I build Lidnight, 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

── more in #ai-agents 4 stories · sorted by recency
── more on @openai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/codex-will-answer-it…] indexed:0 read:3min 2026-10-18 · —