Add configurable basename display for command approval notifications
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What variant of Codex are you using?
Codex CLI/TUI 0.153.0 on NixOS.
What feature would you like to see?
Add an opt-in TUI setting that controls whether command-approval notifications show the full executable path or only its basename:
[tui]
notification_command_display = "basename"
Supported values would be:
"full"— current behavior and the default, preserving backward compatibility."basename"— replace onlyargv[0]in the notification preview with its filename before applying the existing shell quoting and truncation.
For example:
Approval requested: /run/current-system/sw/bin/git ...
would become:
Approval requested: git ...
The full command shown in the approval UI, the approval payload, and the command eventually executed must remain unchanged.
Reasoning
On NixOS, executable paths commonly start with /run/current-system/sw/bin/ or a long /nix/store/.../bin/ path. Approval notifications currently truncate the rendered command to 30 graphemes, so the executable path consumes the useful part of the notification. Multiple notifications can therefore look effectively identical even when they request different commands.
This should be opt-in rather than unconditional: the full path can be useful security context when distinguishing executables. Keeping "full" as the default preserves current behavior.
Reproduction
-
Configure approval notifications:
[tui] notifications = ["approval-requested"] notification_method = "osc9" notification_condition = "always" -
Run Codex on NixOS.
-
Trigger an action requiring approval whose executable is resolved to a NixOS system or store path.
-
Observe that the desktop notification starts with
Approval requested: /run/current-system/sw/bin/...(or/nix/store/...) and truncates before the useful command context.
Proposed patch
The current flow joins the complete event command in handle_exec_approval_now, then the notification renderer truncates that string to 30 graphemes.
A minimal implementation would:
- Add a
NotificationCommandDisplayenum (Full,Basename) tocodex-rs/config/src/types.rs, serialized as lowercase. - Add
notification_command_displaytoTuiNotificationSettingswithFullas its serde/default value. - When constructing the notification preview, clone the command vector and, only in
Basenamemode, replace its first element usingstd::path::Path::file_name(). Fall back to the original token when no filename is available. - Pass that preview through the existing
shlex::try_joinand truncation path. Do not mutateev.command. - Regenerate
config.schema.jsonand add focused config/rendering tests for the default and opt-in modes.
Acceptance criteria
- An absent setting and
notification_command_display = "full"produce today's notification text. notification_command_display = "basename"shortens only the executable token; arguments remain present and quoted as today.- Bare executable names remain unchanged.
- The approval UI, approval payload, and executed command retain the original full path.
- The generated config schema documents the new option.
Additional information
The repository's contributing guide says external code contributions and pull requests are not accepted, so this issue includes the proposed implementation rather than an external PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with handle_exec_approval_now in codex-rs/tui/src/chatwidget/tool_requests.rs and the notification renderer in codex-rs/tui/src/chatwidget/notifications.rs. Then inspect TuiNotificationSettings and related types in codex-rs/config/src/types.rs, along with existing config and rendering tests. Done means the default and full modes preserve current text, basename mode changes only the preview executable, and config.schema.json documents the option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100