mirror of
https://github.com/openai/codex.git
synced 2026-05-24 04:54:52 +00:00
Remove workspace message TUI prewarm
This commit is contained in:
1
codex-rs/Cargo.lock
generated
1
codex-rs/Cargo.lock
generated
@@ -3634,7 +3634,6 @@ dependencies = [
|
||||
"codex-app-server-client",
|
||||
"codex-app-server-protocol",
|
||||
"codex-arg0",
|
||||
"codex-backend-client",
|
||||
"codex-chatgpt",
|
||||
"codex-cli",
|
||||
"codex-cloud-requirements",
|
||||
|
||||
@@ -29,7 +29,6 @@ codex-ansi-escape = { workspace = true }
|
||||
codex-app-server-client = { workspace = true }
|
||||
codex-app-server-protocol = { workspace = true }
|
||||
codex-arg0 = { workspace = true }
|
||||
codex-backend-client = { workspace = true }
|
||||
codex-install-context = { workspace = true }
|
||||
codex-chatgpt = { workspace = true }
|
||||
codex-cloud-requirements = { workspace = true }
|
||||
|
||||
@@ -42,7 +42,6 @@ use codex_config::format_config_error_with_source;
|
||||
use codex_exec_server::EnvironmentManager;
|
||||
use codex_exec_server::EnvironmentManagerArgs;
|
||||
use codex_exec_server::ExecServerRuntimePaths;
|
||||
use codex_features::Feature;
|
||||
use codex_login::AuthConfig;
|
||||
use codex_login::default_client::set_default_client_residency_requirement;
|
||||
use codex_login::enforce_login_restrictions;
|
||||
@@ -191,7 +190,6 @@ mod version;
|
||||
mod voice;
|
||||
mod width;
|
||||
mod workspace_command;
|
||||
mod workspace_messages;
|
||||
#[cfg(target_os = "linux")]
|
||||
#[allow(dead_code)]
|
||||
mod voice {
|
||||
@@ -1106,9 +1104,6 @@ async fn run_ratatui_app(
|
||||
color_eyre::install()?;
|
||||
|
||||
tooltips::announcement::prewarm();
|
||||
if initial_config.features.enabled(Feature::WorkspaceMessages) {
|
||||
workspace_messages::prewarm_headline(&initial_config);
|
||||
}
|
||||
|
||||
// Forward panic reports through tracing so they appear in the UI status
|
||||
// line, but do not swallow the default/color-eyre panic handler.
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
use crate::legacy_core::config::Config;
|
||||
use codex_backend_client::Client as BackendClient;
|
||||
use codex_backend_client::CodexWorkspaceMessage;
|
||||
use codex_login::AuthManager;
|
||||
use std::sync::OnceLock;
|
||||
use std::time::Duration;
|
||||
use tokio::time::timeout;
|
||||
|
||||
const HEADLINE_FETCH_TIMEOUT: Duration = Duration::from_millis(1000);
|
||||
|
||||
static WORKSPACE_HEADLINE: OnceLock<Option<CodexWorkspaceMessage>> = OnceLock::new();
|
||||
|
||||
pub(crate) fn prewarm_headline(config: &Config) {
|
||||
if WORKSPACE_HEADLINE.get().is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
let config = config.clone();
|
||||
tokio::spawn(async move {
|
||||
let headline = timeout(HEADLINE_FETCH_TIMEOUT, fetch_headline(config))
|
||||
.await
|
||||
.ok()
|
||||
.flatten();
|
||||
let _ = WORKSPACE_HEADLINE.set(headline);
|
||||
});
|
||||
}
|
||||
|
||||
async fn fetch_headline(config: Config) -> Option<CodexWorkspaceMessage> {
|
||||
let auth_manager =
|
||||
AuthManager::shared_from_config(&config, /*enable_codex_api_key_env*/ false).await;
|
||||
let auth = auth_manager.auth().await?;
|
||||
if !auth.uses_codex_backend() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let client = BackendClient::from_auth(config.chatgpt_base_url, &auth).ok()?;
|
||||
let messages = client.list_workspace_messages().await.ok()?;
|
||||
messages.headlines().next().cloned()
|
||||
}
|
||||
Reference in New Issue
Block a user