Skip to content

Conversation

@448523760
Copy link
Contributor

Slash Command popup issue

#7659

When recalling history, the composer(codex_tui::bottom_pane::chat_composer) restores the previous prompt text (which may start with /) and then calls sync_command_popup. The logic in sync_command_popup treats any first line that starts with / and has the caret inside the initial /name token as an active slash command name:

let is_editing_slash_command_name = if first_line.starts_with('/') && caret_on_first_line {
    let token_end = first_line
        .char_indices()
        .find(|(_, c)| c.is_whitespace())
        .map(|(i, _)| i)
        .unwrap_or(first_line.len());
    cursor <= token_end
} else {
    false
};

This detection does not distinguish between an actual interactive slash command being typed and a normal historical prompt that happens to begin with /. As a result, after history recall, the restored prompt like / test is interpreted as an "editing command name" context and the slash-command popup is (re)activated. Once active_popup is ActivePopup::Command, subsequent Up key presses are handled by handle_key_event_with_slash_popup instead of handle_key_event_without_popup, so they no longer trigger history.navigate_up(...) and the session prompt history cannot be scrolled.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@etraut-openai
Copy link
Collaborator

Thanks for the contribution. I'm not that familiar with the code you're changing here, so I will ask a colleague to review the change. Before I pass it along for review, please address the comments I added.

@etraut-openai etraut-openai added the needs-response Additional information is requested label Dec 8, 2025
@448523760 448523760 force-pushed the fix_recall_prompt_history branch from b754c89 to f180c63 Compare December 9, 2025 04:58
…ke "/ test"

- Updated `sync_command_popup` logic to ensure that the slash command popup only activates when:
  - The input starts with `/` and has no non-whitespace content after `/` (e.g., `/`).
  - The input starts with `/` and the command name is a valid prefix of a built-in command (e.g., `/re` for `/review`).
- Prevents recalled history inputs like `/ test` from incorrectly triggering the command popup.
- Ensures that `/` alone still activates the popup to display all available commands.
Add unit tests for `ChatComposer` to verify slash-command popup behavior:
- ensure the popup does NOT activate for history-like input such as "/  test"
- ensure the popup activates for a bare "/" and for valid command prefixes (e.g., "/re")
@448523760 448523760 force-pushed the fix_recall_prompt_history branch from f180c63 to 17e1651 Compare December 9, 2025 09:02
@etraut-openai etraut-openai removed the needs-response Additional information is requested label Dec 9, 2025
Copy link
Collaborator

@dedrisian-oai dedrisian-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

@etraut-openai etraut-openai merged commit 1a58096 into openai:main Dec 10, 2025
26 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants