chore: merge origin/main into PR 14718

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
viyatb-oai
2026-04-14 12:43:13 -07:00
co-authored by Codex
151 changed files with 5074 additions and 1422 deletions
+30
View File
@@ -42,6 +42,7 @@ use crate::legacy_core::config::edit::ConfigEdit;
use crate::legacy_core::config::edit::ConfigEditsBuilder;
use crate::legacy_core::config_loader::ConfigLayerStackOrdering;
use crate::legacy_core::lookup_message_history_entry;
use crate::legacy_core::plugins::PluginsManager;
#[cfg(target_os = "windows")]
use crate::legacy_core::windows_sandbox::WindowsSandboxLevelExt;
use crate::model_catalog::ModelCatalog;
@@ -2013,6 +2014,26 @@ impl App {
});
}
fn refresh_plugin_mentions(&mut self) {
let config = self.config.clone();
let app_event_tx = self.app_event_tx.clone();
if !config.features.enabled(Feature::Plugins) {
app_event_tx.send(AppEvent::PluginMentionsLoaded { plugins: None });
return;
}
tokio::spawn(async move {
let plugins = PluginsManager::new(config.codex_home.to_path_buf())
.plugins_for_config(&config)
.await
.capability_summaries()
.to_vec();
app_event_tx.send(AppEvent::PluginMentionsLoaded {
plugins: Some(plugins),
});
});
}
fn submit_feedback(
&mut self,
app_server: &AppServerSession,
@@ -5040,6 +5061,15 @@ impl App {
self.fetch_plugins_list(app_server, cwd);
}
}
AppEvent::RefreshPluginMentions => {
self.refresh_plugin_mentions();
}
AppEvent::PluginMentionsLoaded { mut plugins } => {
if !self.config.features.enabled(Feature::Plugins) {
plugins = None;
}
self.chat_widget.on_plugin_mentions_loaded(plugins);
}
AppEvent::PersistPersonalitySelection { personality } => {
let profile = self.active_profile.as_deref();
match ConfigEditsBuilder::new(&self.config.codex_home)
+4 -1
View File
@@ -385,7 +385,10 @@ fn server_notification_thread_target(
ServerNotification::ThreadRealtimeItemAdded(notification) => {
Some(notification.thread_id.as_str())
}
ServerNotification::ThreadRealtimeTranscriptUpdated(notification) => {
ServerNotification::ThreadRealtimeTranscriptDelta(notification) => {
Some(notification.thread_id.as_str())
}
ServerNotification::ThreadRealtimeTranscriptDone(notification) => {
Some(notification.thread_id.as_str())
}
ServerNotification::ThreadRealtimeOutputAudioDelta(notification) => {
+9
View File
@@ -30,6 +30,7 @@ use crate::bottom_pane::ApprovalRequest;
use crate::bottom_pane::StatusLineItem;
use crate::bottom_pane::TerminalTitleItem;
use crate::history_cell::HistoryCell;
use crate::legacy_core::plugins::PluginCapabilitySummary;
use codex_config::types::ApprovalsReviewer;
use codex_features::Feature;
@@ -270,6 +271,14 @@ pub(crate) enum AppEvent {
result: Result<PluginUninstallResponse, String>,
},
/// Refresh plugin mention bindings from the current config.
RefreshPluginMentions,
/// Result of refreshing plugin mention bindings.
PluginMentionsLoaded {
plugins: Option<Vec<PluginCapabilitySummary>>,
},
/// Advance the post-install plugin app-auth flow.
PluginInstallAuthAdvance {
refresh_connectors: bool,
+1
View File
@@ -657,6 +657,7 @@ impl AppServerSession {
request_id,
params: ThreadRealtimeStartParams {
thread_id: thread_id.to_string(),
output_modality: params.output_modality,
prompt: params.prompt,
session_id: params.session_id,
voice: params.voice,
@@ -8,14 +8,14 @@ expression: "render_lines(&view, 72)"
Type to search
>
› [x] model-name Current model name
[x] current-dir Current working directory
[x] git-branch Current Git branch (omitted when unavaila…
[ ] model-with-reasoning Current model name with reasoning level
[ ] project-root Project root directory (omitted when unav…
[ ] context-remaining Percentage of context window remaining (o…
[ ] context-used Percentage of context window used (omitte…
[ ] five-hour-limit Remaining usage on 5-hour usage limit (om…
› [x] model-name Current model name
[x] current-dir Current working directory
[x] git-branch Current Git branch (omitted when unavail…
[ ] model-with-reasoning Current model name with reasoning level
[ ] project-root Project root directory (omitted when una…
[ ] context-remaining Percentage of context window remaining (…
[ ] context-remaining-... Percentage of context window remaining (…
[ ] context-used Percentage of context window used (omitt…
gpt-5-codex · ~/codex-rs · jif/statusline-preview
Use ↑↓ to navigate, ←→ to move, space to select, enter to confirm, esc
@@ -66,6 +66,10 @@ pub(crate) enum StatusLineItem {
/// Percentage of context window remaining.
ContextRemaining,
/// Percentage of context window remaining.
#[strum(to_string = "context-remaining-percent")]
ContextRemainingPercent,
/// Percentage of context window used.
///
/// Also accepts the legacy `context-usage` config value.
@@ -115,6 +119,9 @@ impl StatusLineItem {
StatusLineItem::ContextRemaining => {
"Percentage of context window remaining (omitted when unknown)"
}
StatusLineItem::ContextRemainingPercent => {
"Percentage of context window remaining (omitted when unknown)"
}
StatusLineItem::ContextUsed => {
"Percentage of context window used (omitted when unknown)"
}
@@ -325,6 +332,18 @@ mod tests {
);
}
#[test]
fn context_remaining_percent_is_separate_selectable_id() {
assert_eq!(
StatusLineItem::ContextRemainingPercent.to_string(),
"context-remaining-percent"
);
assert_eq!(
"context-remaining-percent".parse::<StatusLineItem>(),
Ok(StatusLineItem::ContextRemainingPercent)
);
}
#[test]
fn preview_uses_runtime_values() {
let preview_data = StatusLinePreviewData::from_iter([
+10 -7
View File
@@ -62,7 +62,6 @@ use crate::legacy_core::config::Constrained;
use crate::legacy_core::config::ConstraintResult;
use crate::legacy_core::config_loader::ConfigLayerStackOrdering;
use crate::legacy_core::find_thread_name_by_id;
use crate::legacy_core::plugins::PluginsManager;
use crate::legacy_core::skills::model::SkillMetadata;
#[cfg(target_os = "windows")]
use crate::legacy_core::windows_sandbox::WindowsSandboxLevelExt;
@@ -6273,7 +6272,8 @@ impl ChatWidget {
| ServerNotification::FsChanged(_)
| ServerNotification::FuzzyFileSearchSessionUpdated(_)
| ServerNotification::FuzzyFileSearchSessionCompleted(_)
| ServerNotification::ThreadRealtimeTranscriptUpdated(_)
| ServerNotification::ThreadRealtimeTranscriptDelta(_)
| ServerNotification::ThreadRealtimeTranscriptDone(_)
| ServerNotification::WindowsWorldWritableWarning(_)
| ServerNotification::WindowsSandboxSetupCompleted(_)
| ServerNotification::AccountLoginCompleted(_) => {}
@@ -10369,11 +10369,14 @@ impl ChatWidget {
return;
}
let plugins = PluginsManager::new(self.config.codex_home.to_path_buf())
.plugins_for_config(&self.config)
.capability_summaries()
.to_vec();
self.bottom_pane.set_plugin_mentions(Some(plugins));
self.app_event_tx.send(AppEvent::RefreshPluginMentions);
}
pub(crate) fn on_plugin_mentions_loaded(
&mut self,
plugins: Option<Vec<crate::legacy_core::plugins::PluginCapabilitySummary>>,
) {
self.bottom_pane.set_plugin_mentions(plugins);
}
pub(crate) fn sync_plugin_mentions_config(&mut self, config: &Config) {
+4
View File
@@ -7,6 +7,7 @@ use codex_protocol::protocol::RealtimeConversationClosedEvent;
use codex_protocol::protocol::RealtimeConversationRealtimeEvent;
use codex_protocol::protocol::RealtimeConversationStartedEvent;
use codex_protocol::protocol::RealtimeEvent;
use codex_protocol::protocol::RealtimeOutputModality;
use codex_realtime_webrtc::RealtimeWebrtcEvent;
use codex_realtime_webrtc::RealtimeWebrtcSession;
use codex_realtime_webrtc::RealtimeWebrtcSessionHandle;
@@ -236,6 +237,7 @@ impl ChatWidget {
) {
self.submit_op(AppCommand::realtime_conversation_start(
ConversationStartParams {
output_modality: RealtimeOutputModality::Audio,
prompt: None,
session_id: None,
transport,
@@ -327,7 +329,9 @@ impl ChatWidget {
}
RealtimeEvent::InputAudioSpeechStarted(_) => self.interrupt_realtime_audio_playback(),
RealtimeEvent::InputTranscriptDelta(_) => {}
RealtimeEvent::InputTranscriptDone(_) => {}
RealtimeEvent::OutputTranscriptDelta(_) => {}
RealtimeEvent::OutputTranscriptDone(_) => {}
RealtimeEvent::AudioOut(frame) => self.enqueue_realtime_audio_out(&frame),
RealtimeEvent::ResponseCreated(_) => {}
RealtimeEvent::ResponseCancelled(_) => self.interrupt_realtime_audio_playback(),
@@ -0,0 +1,9 @@
---
source: tui/src/chatwidget/tests/status_and_layout.rs
expression: normalized_backend_snapshot(terminal.backend())
---
" "
" "
"› Ask Codex to do anything "
" "
" gpt-5.4 xhigh fast · Context 100% left · /tmp/project "
@@ -450,7 +450,7 @@ impl ChatWidget {
Some(format!("{} used", format_tokens_compact(total)))
}
}
StatusLineItem::ContextRemaining => self
StatusLineItem::ContextRemaining | StatusLineItem::ContextRemainingPercent => self
.status_line_context_remaining_percent()
.map(|remaining| format!("Context {remaining}% left")),
StatusLineItem::ContextUsed => self
@@ -914,6 +914,24 @@ async fn status_line_legacy_context_usage_renders_context_used_percent() {
);
}
#[tokio::test]
async fn status_line_context_remaining_percent_renders_labeled_percent() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.thread_id = Some(ThreadId::new());
chat.config.tui_status_line = Some(vec!["context-remaining-percent".to_string()]);
chat.refresh_status_line();
assert_eq!(
status_line_text(&chat),
Some("Context 100% left".to_string())
);
assert!(
drain_insert_history(&mut rx).is_empty(),
"context-remaining-percent should remain a valid status line item"
);
}
#[tokio::test]
async fn status_line_branch_state_resets_when_git_branch_disabled() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
@@ -1181,6 +1199,40 @@ async fn status_line_model_with_reasoning_fast_footer_snapshot() {
);
}
#[tokio::test]
async fn status_line_model_with_reasoning_context_remaining_percent_footer_snapshot() {
use ratatui::Terminal;
use ratatui::backend::TestBackend;
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(Some("gpt-5.4")).await;
set_fast_mode_test_catalog(&mut chat);
assert!(get_available_model(&chat, "gpt-5.4").supports_fast_mode());
chat.show_welcome_banner = false;
chat.config.cwd = test_project_path().abs();
chat.config.tui_status_line = Some(vec![
"model-with-reasoning".to_string(),
"context-remaining-percent".to_string(),
"current-dir".to_string(),
]);
chat.set_reasoning_effort(Some(ReasoningEffortConfig::XHigh));
chat.set_service_tier(Some(ServiceTier::Fast));
set_chatgpt_auth(&mut chat);
set_fast_mode_test_catalog(&mut chat);
assert!(get_available_model(&chat, "gpt-5.4").supports_fast_mode());
chat.refresh_status_line();
let width = 80;
let height = chat.desired_height(width);
let mut terminal = Terminal::new(TestBackend::new(width, height)).expect("create terminal");
terminal
.draw(|f| chat.render(f.area(), f.buffer_mut()))
.expect("draw model-with-reasoning footer");
assert_chatwidget_snapshot!(
"status_line_model_with_reasoning_context_remaining_percent_footer",
normalized_backend_snapshot(terminal.backend())
);
}
#[tokio::test]
async fn runtime_metrics_websocket_timing_logs_and_final_separator_sums_totals() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
+1 -8
View File
@@ -367,7 +367,6 @@ fn format_network_constraints(network: &NetworkConstraints) -> String {
dangerously_allow_all_unix_sockets,
domains,
managed_allowed_domains_only,
danger_full_access_denylist_only,
unix_sockets,
allow_local_binding,
} = network;
@@ -405,11 +404,6 @@ fn format_network_constraints(network: &NetworkConstraints) -> String {
"managed_allowed_domains_only={managed_allowed_domains_only}"
));
}
if let Some(danger_full_access_denylist_only) = danger_full_access_denylist_only {
parts.push(format!(
"danger_full_access_denylist_only={danger_full_access_denylist_only}"
));
}
if let Some(unix_sockets) = unix_sockets {
parts.push(format!(
"unix_sockets={}",
@@ -605,7 +599,6 @@ mod tests {
NetworkDomainPermissionToml::Allow,
)]),
}),
danger_full_access_denylist_only: Some(true),
..Default::default()
},
RequirementSource::CloudRequirements,
@@ -676,7 +669,7 @@ mod tests {
assert!(rendered.contains("mcp_servers: docs (source: MDM managed_config.toml (legacy))"));
assert!(rendered.contains("enforce_residency: us (source: cloud requirements)"));
assert!(rendered.contains(
"experimental_network: enabled=true, domains={example.com=allow}, danger_full_access_denylist_only=true (source: cloud requirements)"
"experimental_network: enabled=true, domains={example.com=allow} (source: cloud requirements)"
));
assert!(!rendered.contains(" - rules:"));
}
+1 -10
View File
@@ -19,11 +19,7 @@ use crate::exec_cell::output_lines;
use crate::exec_cell::spinner;
use crate::exec_command::relativize_to_home;
use crate::exec_command::strip_bash_lc_and_escape;
#[cfg(test)]
use crate::legacy_core::McpManager;
use crate::legacy_core::config::Config;
#[cfg(test)]
use crate::legacy_core::plugins::PluginsManager;
use crate::legacy_core::web_search_detail;
use crate::live_wrap::take_prefix_by_width;
use crate::markdown::append_markdown;
@@ -88,8 +84,6 @@ use std::collections::HashMap;
use std::io::Cursor;
use std::path::Path;
use std::path::PathBuf;
#[cfg(test)]
use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;
use tracing::error;
@@ -1877,10 +1871,7 @@ pub(crate) fn new_mcp_tools_output(
lines.push("".into());
}
let mcp_manager = McpManager::new(Arc::new(PluginsManager::new(
config.codex_home.to_path_buf(),
)));
let effective_servers = mcp_manager.effective_servers(config, /*auth*/ None);
let effective_servers = config.mcp_servers.get().clone();
let mut servers: Vec<_> = effective_servers.iter().collect();
servers.sort_by(|(a, _), (b, _)| a.cmp(b));