mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
Keep Fast Mode command feature gated
This commit is contained in:
@@ -5065,10 +5065,6 @@ impl ChatWidget {
|
||||
self.open_model_popup();
|
||||
}
|
||||
SlashCommand::Fast => {
|
||||
if !self.can_use_fast_mode() {
|
||||
self.add_error_message(self.fast_mode_unavailable_message().to_string());
|
||||
return;
|
||||
}
|
||||
let next_tier = if matches!(self.config.service_tier, Some(ServiceTier::Fast)) {
|
||||
None
|
||||
} else {
|
||||
@@ -5372,10 +5368,6 @@ impl ChatWidget {
|
||||
let trimmed = args.trim();
|
||||
match cmd {
|
||||
SlashCommand::Fast => {
|
||||
if !self.can_use_fast_mode() {
|
||||
self.add_error_message(self.fast_mode_unavailable_message().to_string());
|
||||
return;
|
||||
}
|
||||
if trimmed.is_empty() {
|
||||
self.dispatch_command(cmd);
|
||||
return;
|
||||
@@ -9476,7 +9468,6 @@ impl ChatWidget {
|
||||
self.has_chatgpt_account = has_chatgpt_account;
|
||||
self.bottom_pane
|
||||
.set_connectors_enabled(self.connectors_enabled());
|
||||
self.sync_fast_command_enabled();
|
||||
}
|
||||
|
||||
pub(crate) fn should_show_fast_status(
|
||||
@@ -9489,30 +9480,10 @@ impl ChatWidget {
|
||||
&& self.has_chatgpt_account
|
||||
}
|
||||
|
||||
fn fast_mode_feature_enabled(&self) -> bool {
|
||||
fn fast_mode_enabled(&self) -> bool {
|
||||
self.config.features.enabled(Feature::FastMode)
|
||||
}
|
||||
|
||||
fn can_use_fast_mode(&self) -> bool {
|
||||
self.fast_mode_feature_enabled()
|
||||
&& self.has_chatgpt_account
|
||||
&& self
|
||||
.model_catalog
|
||||
.try_list_models()
|
||||
.ok()
|
||||
.is_some_and(|models| models.into_iter().any(|preset| preset.supports_fast_mode()))
|
||||
}
|
||||
|
||||
fn fast_mode_unavailable_message(&self) -> &'static str {
|
||||
if !self.fast_mode_feature_enabled() {
|
||||
"Fast mode is not available."
|
||||
} else if !self.has_chatgpt_account {
|
||||
"Fast mode requires ChatGPT sign-in."
|
||||
} else {
|
||||
"Fast mode is not available for your current models."
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_realtime_audio_device(
|
||||
&mut self,
|
||||
kind: RealtimeAudioDeviceKind,
|
||||
@@ -9594,7 +9565,7 @@ impl ChatWidget {
|
||||
|
||||
fn sync_fast_command_enabled(&mut self) {
|
||||
self.bottom_pane
|
||||
.set_fast_command_enabled(self.can_use_fast_mode());
|
||||
.set_fast_command_enabled(self.fast_mode_enabled());
|
||||
}
|
||||
|
||||
fn sync_personality_command_enabled(&mut self) {
|
||||
|
||||
@@ -571,8 +571,6 @@ async fn undo_started_hides_interrupt_hint() {
|
||||
async fn fast_slash_command_updates_and_persists_local_service_tier() {
|
||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(Some("gpt-5.3-codex")).await;
|
||||
chat.set_feature_enabled(Feature::FastMode, /*enabled*/ true);
|
||||
set_chatgpt_auth(&mut chat);
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
|
||||
chat.dispatch_command(SlashCommand::Fast);
|
||||
|
||||
@@ -600,35 +598,11 @@ async fn fast_slash_command_updates_and_persists_local_service_tier() {
|
||||
assert_matches!(op_rx.try_recv(), Err(TryRecvError::Empty));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn fast_slash_command_is_ignored_without_chatgpt_auth() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
|
||||
chat.set_feature_enabled(Feature::FastMode, /*enabled*/ true);
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
|
||||
chat.dispatch_command(SlashCommand::Fast);
|
||||
|
||||
let events = std::iter::from_fn(|| rx.try_recv().ok()).collect::<Vec<_>>();
|
||||
assert!(
|
||||
!events.iter().any(|event| matches!(
|
||||
event,
|
||||
AppEvent::CodexOp(Op::OverrideTurnContext {
|
||||
service_tier: Some(Some(ServiceTier::Fast)),
|
||||
..
|
||||
}) | AppEvent::PersistServiceTierSelection {
|
||||
service_tier: Some(ServiceTier::Fast),
|
||||
}
|
||||
)),
|
||||
"fast-mode events should not be emitted without ChatGPT auth; events: {events:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn user_turn_carries_service_tier_after_fast_toggle() {
|
||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(Some("gpt-5.3-codex")).await;
|
||||
chat.thread_id = Some(ThreadId::new());
|
||||
set_chatgpt_auth(&mut chat);
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
chat.set_feature_enabled(Feature::FastMode, /*enabled*/ true);
|
||||
|
||||
chat.dispatch_command(SlashCommand::Fast);
|
||||
@@ -653,7 +627,6 @@ async fn user_turn_clears_service_tier_after_fast_is_turned_off() {
|
||||
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(Some("gpt-5.3-codex")).await;
|
||||
chat.thread_id = Some(ThreadId::new());
|
||||
set_chatgpt_auth(&mut chat);
|
||||
set_fast_mode_test_catalog(&mut chat);
|
||||
chat.set_feature_enabled(Feature::FastMode, /*enabled*/ true);
|
||||
|
||||
chat.dispatch_command(SlashCommand::Fast);
|
||||
|
||||
Reference in New Issue
Block a user