mirror of
https://github.com/openai/codex.git
synced 2026-11-06 16:32:29 +00:00
Persist shell mode commands in prompt history (#19618)
## Why `!` shell commands are currently surfaced as "Bash mode", which is misleading for users running shells such as PowerShell or zsh. Those commands also bypass the persistent prompt history path, so they cannot be recalled after starting a new session. Fixes #19613. ## What changed - Rename the TUI footer label and related test wording from "Bash mode" to "Shell mode". - Persist accepted `!` shell commands to prompt history with the leading `!`, so recall restores the composer into shell mode across sessions. - Add coverage for immediate and queued shell-command submissions emitting the prompt-history update. ## Verification - `cargo test -p codex-tui bang_shell` - `cargo test -p codex-tui shell_command_uses_shell_accent_style` - `cargo test -p codex-tui footer_mode_snapshots` - `cargo insta pending-snapshots --manifest-path tui/Cargo.toml` Manually verified fix after confirming presence of bug prior to fix.
This commit is contained in:
1 parent
6c51bf0c7c
commit
0e2300c02c
5 files changed
+39
-11
No files matched your search
@@ -1038,6 +1038,10 @@ async fn bang_shell_enter_while_task_running_submits_run_user_shell_command() {
|
||||
Ok(Op::RunUserShellCommand { command }) => assert_eq!(command, "echo hi"),
|
||||
other => panic!("expected RunUserShellCommand op, got {other:?}"),
|
||||
}
|
||||
assert_matches!(
|
||||
op_rx.try_recv(),
|
||||
Ok(Op::AddToHistory { text }) if text == "!echo hi"
|
||||
);
|
||||
assert_matches!(rx.try_recv(), Err(TryRecvError::Empty));
|
||||
}
|
||||
|
||||
|
||||
@@ -210,6 +210,10 @@ async fn queued_bang_shell_dispatches_after_active_turn() {
|
||||
Ok(Op::RunUserShellCommand { command }) => assert_eq!(command, "echo hi"),
|
||||
other => panic!("expected queued shell command op, got {other:?}"),
|
||||
}
|
||||
assert_matches!(
|
||||
op_rx.try_recv(),
|
||||
Ok(Op::AddToHistory { text }) if text == "!echo hi"
|
||||
);
|
||||
assert!(chat.queued_user_messages.is_empty());
|
||||
}
|
||||
|
||||
@@ -287,7 +291,10 @@ async fn queued_bang_shell_waits_for_user_shell_completion_before_next_input() {
|
||||
Ok(Op::RunUserShellCommand { command }) => assert_eq!(command, "echo hi"),
|
||||
other => panic!("expected queued shell command op, got {other:?}"),
|
||||
}
|
||||
assert_matches!(op_rx.try_recv(), Err(TryRecvError::Empty));
|
||||
assert_matches!(
|
||||
op_rx.try_recv(),
|
||||
Ok(Op::AddToHistory { text }) if text == "!echo hi"
|
||||
);
|
||||
assert_eq!(chat.queued_user_messages.len(), 1);
|
||||
|
||||
let begin = begin_exec_with_source(
|
||||
|
||||
Reference in new issue
Block a user