Skip to content

Expose TUI question prompts ("Implement this plan?", reasoning scope, etc.) to the external hook system #19328

Open

Description

@RousselPaul

Context

PR #17563 shipped PermissionRequest hooks for shell, unified exec, and network approvals. Thank you! We built a desktop overlay (Masko, related to #15311) that uses those hooks to show Allow/Deny cards outside the TUI.

There's one remaining class of prompt that we can't surface: TUI-internal question popups like "Implement this plan?", "Reasoning scope", and the request_user_input dialog chain.

The gap

Looking at codex-rs/tui/src/chatwidget.rs:

enum Notification {
    AgentTurnComplete { response: String },
    ExecApprovalRequested { command: String },
    EditApprovalRequested { cwd: PathBuf, changes: Vec<PathBuf> },
    ElicitationRequested { server_name: String },
    PlanModePrompt { title: String },   // ← invisible externally
}

PlanModePrompt fires on these TUI flows:

  • open_plan_implementation_prompt — "Implement this plan?"
  • Reasoning scope selection
  • A few other plan-mode dialogs

It dispatches through tui.notify() → OSC9/BEL escape sequences only. The legacy notify = ["..."] config in ~/.codex/config.toml (codex-rs/hooks/src/legacy_notify.rs) handles AgentTurnComplete but not PlanModePrompt. There's no external signal.

The preceding update_plan tool call does fire PostToolUse hooks, but it's an inference — there's no guarantee the popup will actually appear (other conditions like has_queued_follow_up_messages can suppress it).

Proposal

Any of these would unblock external UIs:

  1. Add a PermissionRequest variant for TUI questions — with tool_name: "request_user_input" or similar, carrying the title + option labels in tool_input. External hooks could respond with the picked option, same pattern as shell approvals.

  2. Add a new hook event — TuiQuestionOpened / TuiQuestionClosed, dispatched via the engine hooks alongside PreToolUse etc. Could be observability-only (no decision), which at least lets external UIs show the user "Codex needs you".

  3. Extend legacy_notify to fire for PlanModePrompt and ExecApprovalRequested too. Cheap, already-documented mechanism.

Option 1 is the most complete (matches the existing PermissionRequest contract). Option 2 is the smallest change that gives us visibility. Option 3 is the absolute minimum and keeps backward compat.

Related

Use case

Desktop overlays, remote observability, multi-agent orchestrators. Anything that wants to surface "Codex is waiting on the user" outside the TUI currently goes dark during plan-mode dialogs.

Activity

  1. added
    enhancementNew feature or request
    CLIIssues related to the Codex CLI
    hooksIssues related to event hooks
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    planIssues involving plan mode
    on Apr 24, 2026
  2. github-actions commented on Apr 24, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. removed
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    CLIIssues related to the Codex CLI
    on Apr 24, 2026
  4. ma08 commented on May 5, 2026

    @ma08

    +1 badly need hook support for internal questions like plan approval and request_user_input etc.

    the usecase i have is to receive whatsapp/email messages via hooks when working on a remote workspace

    this picture has an overview of my remote workspace setup to use codex in a VM be pinged on whatsapp/email when it needs user input: https://github.com/ma08/botfiles/blob/main/docs/assets/readme/remote-development-stack.jpg

    explained in this article: https://x.com/curious_queue/status/2049660997993152855?s=20

  5. oxysoft commented on May 8, 2026

    @oxysoft

    Indexed this hook ticket in the umbrella tracker: #21753

    Goal: collect the scattered Codex hook requests and bugs into one parity matrix for Full Claude Code Hook Parity (29+), while preserving this issue as the detailed thread for its specific behavior.

  6. ma08 commented on May 11, 2026

    @ma08

    +1 badly need hook support for internal questions like plan approval and request_user_input etc.

    the usecase i have is to receive whatsapp/email messages via hooks when working on a remote workspace

    this picture has an overview of my remote workspace setup to use codex in a VM be pinged on whatsapp/email when it needs user input: https://github.com/ma08/botfiles/blob/main/docs/assets/readme/remote-development-stack.jpg

    explained in this article: https://x.com/curious_queue/status/2049660997993152855?s=20

    i was able to temporarily circumvent this using the app server approach to track request_user_input event and do necessary actions (like sending message to update user about need for input etc): ma08/botfiles#25

    sharing in case this helps others

    would still appreciate native hook support for events like this!

  7. microHoffman commented on May 15, 2026

    @microHoffman

    +1 to implement this feature, it would be very much helpful also for detecting the session status for agent-of-empires/agent-of-empires#1126

  8. brennanb2025 commented on May 17, 2026

    @brennanb2025

    +1 This is a real integration blocker for us at Orca.

    For external UIs/orchestrators, the lack of a hook for Codex sessions requesting user input leaves them incorrectly marked as working while they are actually blocked on the user. As it is now, the state contract is incomplete, as we can't distinguish "agent is actively working" from "agent is idle and waiting for human input."

    This matters for:

    • dashboards showing agent status
    • remote sessions where the TUI is not visible
    • multi-agent orchestration
    • notifications / attention routing
    • timeout and stuck-agent detection

    Any TUI prompt that blocks progress should emit a hook event, even if it's observability-only. A RequestUserInput event with title/options would be enough for integrations to mark the session as waiting and route attention correctly.

  9. khughitt commented on Aug 3, 2026

    @khughitt

    A cross-agent terminal status integration encounters this exact observability gap on codex-cli 0.146.0.

    It can map UserPromptSubmit to working, PermissionRequest to needs approval, and Stop to done. However, no hook fires when request_user_input opens, even though Codex’s native terminal pet correctly enters its Waiting / Needs input state. External status renderers therefore continue showing working while Codex is blocked on the user.

    An observation-only opened/resolved event would be sufficient. Both transitions are important so integrations can enter needs-input and later return to working without inspecting question contents or scraping the transcript.

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

    enhancementNew feature or requesthooksIssues related to event hooksplanIssues involving plan mode

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions