From d65960d57be3208b99c8a4de7d0d7151ef1ac58d Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Fri, 13 Mar 2026 15:55:10 -0700 Subject: [PATCH] tui: restore multi-agents slash alias Co-authored-by: Codex --- codex-rs/tui/src/bottom_pane/help_view.rs | 4 +- .../tui/src/bottom_pane/slash_commands.rs | 13 ++++ codex-rs/tui/src/slash_command.rs | 73 ++++++++++++++++++- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/codex-rs/tui/src/bottom_pane/help_view.rs b/codex-rs/tui/src/bottom_pane/help_view.rs index e88596acd2..886768f2c7 100644 --- a/codex-rs/tui/src/bottom_pane/help_view.rs +++ b/codex-rs/tui/src/bottom_pane/help_view.rs @@ -19,7 +19,7 @@ use crate::bottom_pane::bottom_pane_view::BottomPaneView; use crate::bottom_pane::popup_consts::MAX_POPUP_ROWS; use crate::bottom_pane::selection_popup_common::render_menu_surface; use crate::key_hint; -use crate::slash_command::built_in_slash_commands; +use crate::slash_command::visible_built_in_slash_commands; use crate::wrapping::RtOptions; use crate::wrapping::word_wrap_lines; @@ -103,7 +103,7 @@ impl SlashHelpView { }, ]; - for (_, cmd) in built_in_slash_commands() { + for cmd in visible_built_in_slash_commands() { rows.push(HelpRow { plain_text: format!("/{}", cmd.command()), line: Line::from(format!("/{}", cmd.command()).cyan().bold()), diff --git a/codex-rs/tui/src/bottom_pane/slash_commands.rs b/codex-rs/tui/src/bottom_pane/slash_commands.rs index 15b70f232c..ffd8f2344c 100644 --- a/codex-rs/tui/src/bottom_pane/slash_commands.rs +++ b/codex-rs/tui/src/bottom_pane/slash_commands.rs @@ -101,6 +101,19 @@ mod tests { ); } + #[test] + fn multi_agents_alias_still_resolves_for_dispatch() { + assert_eq!( + find_builtin_command("multi-agents", all_enabled_flags()), + Some(SlashCommand::MultiAgents) + ); + assert_eq!( + find_builtin_command("subagents", all_enabled_flags()), + Some(SlashCommand::MultiAgents) + ); + assert_eq!(SlashCommand::MultiAgents.command(), "subagents"); + } + #[test] fn fast_command_is_hidden_when_disabled() { let mut flags = all_enabled_flags(); diff --git a/codex-rs/tui/src/slash_command.rs b/codex-rs/tui/src/slash_command.rs index d2c58ee342..b9104f002e 100644 --- a/codex-rs/tui/src/slash_command.rs +++ b/codex-rs/tui/src/slash_command.rs @@ -56,7 +56,7 @@ pub enum SlashCommand { Realtime, Settings, TestApproval, - #[strum(serialize = "subagents")] + #[strum(serialize = "subagents", serialize = "multi-agents")] MultiAgents, // Debugging commands. #[strum(serialize = "debug-m-drop")] @@ -119,7 +119,59 @@ impl SlashCommand { /// Command string without the leading '/'. Provided for compatibility with /// existing code that expects a method named `command()`. pub fn command(self) -> &'static str { - self.into() + match self { + SlashCommand::MultiAgents => "subagents", + _ => self.into(), + } + } + + /// Additional accepted built-in names besides `command()`. + pub fn command_aliases(self) -> &'static [&'static str] { + match self { + SlashCommand::Help + | SlashCommand::Model + | SlashCommand::Fast + | SlashCommand::Approvals + | SlashCommand::Permissions + | SlashCommand::ElevateSandbox + | SlashCommand::SandboxReadRoot + | SlashCommand::Experimental + | SlashCommand::Skills + | SlashCommand::Review + | SlashCommand::Rename + | SlashCommand::New + | SlashCommand::Resume + | SlashCommand::Fork + | SlashCommand::Init + | SlashCommand::Compact + | SlashCommand::Plan + | SlashCommand::Collab + | SlashCommand::Agent + | SlashCommand::Diff + | SlashCommand::Copy + | SlashCommand::Mention + | SlashCommand::Status + | SlashCommand::DebugConfig + | SlashCommand::Statusline + | SlashCommand::Theme + | SlashCommand::Mcp + | SlashCommand::Apps + | SlashCommand::Logout + | SlashCommand::Quit + | SlashCommand::Exit + | SlashCommand::Feedback + | SlashCommand::Rollout + | SlashCommand::Ps + | SlashCommand::Stop + | SlashCommand::Clear + | SlashCommand::Personality + | SlashCommand::Realtime + | SlashCommand::Settings + | SlashCommand::TestApproval + | SlashCommand::MemoryDrop + | SlashCommand::MemoryUpdate => &[], + SlashCommand::MultiAgents => &["multi-agents"], + } } /// Human-facing forms accepted by the TUI. @@ -313,7 +365,22 @@ pub enum SlashCommandExecutionKind { pub fn built_in_slash_commands() -> Vec<(&'static str, SlashCommand)> { SlashCommand::iter() .filter(|command| command.is_visible()) - .map(|c| (c.command(), c)) + .flat_map(|command| { + std::iter::once((command.command(), command)).chain( + command + .command_aliases() + .iter() + .copied() + .map(move |alias| (alias, command)), + ) + }) + .collect() +} + +/// Return all visible built-in commands once each, in presentation order. +pub fn visible_built_in_slash_commands() -> Vec { + SlashCommand::iter() + .filter(|command| command.is_visible()) .collect() }