Unrecognized slash command prevents message from being sent
Bug Report
When a user types a message starting with / followed by an unrecognized command name (e.g., /xxx), the message cannot be sent. Instead, the composer shows an error message and restores the input text, leaving the user stuck with no way to submit that text as a regular message.
Steps to Reproduce
- Open Codex CLI
- Type a message starting with an unrecognized slash command, e.g.,
/xxx hello world - Press Enter to submit
Actual Behavior
The message is blocked with an error:
Unrecognized command '/xxx'. Type "/" for a list of supported commands.
The input text is restored to the composer, and the user cannot send it as a regular message.
Expected Behavior
When a slash command is not recognized, the text should be treated as a regular user message and sent to the model, rather than being blocked entirely. This is especially important because:
- Users may want to discuss slash commands in natural language (e.g., "how do I use /diff?")
- Users may accidentally type a leading slash before a message
- The current behavior creates a dead end where the user must manually delete the leading
/to send their message
Relevant Code
The issue is in codex-rs/tui/src/bottom_pane/chat_composer.rs in the prepare_submission_text_with_options method (around line 2721-2751):
if slash_validation == SlashValidation::Immediate
&& self.slash_commands_enabled()
&& let Some((name, _rest, _rest_offset)) = parse_slash_name(&text)
{
let treat_as_plain_text = input_starts_with_space || name.contains('/');
if !treat_as_plain_text {
let is_known = find_slash_command(
name,
self.builtin_command_flags(),
&self.service_tier_commands,
)
.is_some();
if !is_known {
// This blocks the message entirely
let message = format!(
r#"Unrecognized command '/{name}'. Type "/" for a list of supported commands."#
);
// ... restores input and returns None
}
}
}
Similarly, try_dispatch_bare_slash_command (line 2937) and try_dispatch_slash_command_with_args (line 2973) also block unknown commands without falling back to regular message submission.
Suggested Fix
When a slash command is not recognized, treat the input as a regular user message instead of blocking it. This could be done by:
- Removing the early return that blocks unknown slash commands in
prepare_submission_text_with_options - Allowing the text to proceed through normal submission as a regular message
- Optionally showing a brief hint that the command was not recognized, but still sending the message
Environment
- Codex CLI version: latest main
- Platform: all platforms affected
---
This is a UX issue that significantly impacts the interactive experience when users accidentally type unknown slash commands or want to discuss slash command syntax with the model.