codex - 💡(How to fix) Fix Expose TUI question prompts ("Implement this plan?", reasoning scope, etc.) to the external hook system [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19328Fetched 2026-04-25 06:11:36
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×5unlabeled ×2commented ×1

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.

Root Cause

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.

Fix Action

Fix / Workaround

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.

  1. Add a new hook eventTuiQuestionOpened / 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".

Code Example

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

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 eventTuiQuestionOpened / 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

  • #17563 (PermissionRequest hooks) — this is a natural extension, already listed as a follow-up item in that PR's description.
  • #15311 (original blocking-hook request from Masko).

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.

extent analysis

TL;DR

To address the issue of surfacing TUI-internal question popups, consider adding a PermissionRequest variant for TUI questions or introducing a new hook event like TuiQuestionOpened/TuiQuestionClosed.

Guidance

  • Investigate adding a PermissionRequest variant for TUI questions, which would match the existing contract and allow external hooks to respond with the picked option.
  • Consider introducing a new hook event, such as TuiQuestionOpened or TuiQuestionClosed, to provide visibility into TUI question popups without requiring a decision.
  • Evaluate extending the legacy_notify mechanism to fire for PlanModePrompt and ExecApprovalRequested events, ensuring backward compatibility.
  • Review related issues, such as #17563 and #15311, to understand the context and potential implications of the proposed solutions.

Example

No specific code example is provided due to the high-level nature of the proposal, but the Notification enum in codex-rs/tui/src/chatwidget.rs would likely need to be updated to include the new variant or hook event.

Notes

The chosen solution should balance the need for visibility into TUI question popups with the potential complexity and backward compatibility implications of introducing new hooks or extending existing mechanisms.

Recommendation

Apply a workaround by introducing a new hook event, such as TuiQuestionOpened/TuiQuestionClosed, as it provides the smallest change that gives visibility into TUI question popups while minimizing potential disruptions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Expose TUI question prompts ("Implement this plan?", reasoning scope, etc.) to the external hook system [1 comments, 2 participants]