mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Expose custom status lines in /experimental (#62387)
## Why Custom status lines previously depended on a feature flag in the TUI client's configuration. When the TUI connects to a separate app server, that flag can differ from the setting in the server's active profile. ## What changed Add **Custom status line** to `/experimental` as an opt-in feature. Save the toggle on the connected app server, restart the TUI, then use `/statusline` to choose a provider. Read `tui_extensions_statusline` from the app server's effective configuration at startup. Keep that value when switching conversations or reloading local status line preferences, so toggling the feature takes effect on the next TUI launch. ## Testing Add a menu snapshot and regression coverage for saving the toggle in a server profile while preserving the active provider across a thread change. GitOrigin-RevId: 4025c9771e560d6d7b1e6bd97236bffc44201556
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ Scenario: A user requests the bundled statusline skill by name.
|
||||
|
||||
### Enable and verify
|
||||
|
||||
Install the provider through an installed plugin or register the stdio command on the connected app-serv...guration and restart the TUI if you changed the flag. [hash=42c056811162cca2]
|
||||
Install the provider through an installed plugin or register the stdio command on the connected app-serv...l` on the connected app server, then restart the TUI. [hash=e0f5170a5aeda287]
|
||||
|
||||
Exercise `tools/list` and `resources/read` with a representative snapshot. After adding the server, star... file, restart its stdio process to load the changes. [hash=4d64fb913d86fc64]
|
||||
|
||||
|
||||
@@ -1177,7 +1177,11 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
FeatureSpec {
|
||||
id: Feature::TuiExtensionsStatusLine,
|
||||
key: "tui_extensions_statusline",
|
||||
stage: Stage::UnderDevelopment,
|
||||
stage: Stage::Experimental {
|
||||
name: "Custom status line",
|
||||
menu_description: "Restart the TUI, then use /statusline.",
|
||||
announcement: "",
|
||||
},
|
||||
default_enabled: false,
|
||||
},
|
||||
FeatureSpec {
|
||||
|
||||
@@ -15,6 +15,6 @@ Use a `row` with an explicit whole-number `gap` to group items. Use named theme
|
||||
|
||||
### Enable and verify
|
||||
|
||||
Install the provider through an installed plugin or register the stdio command on the connected app-server host. For example, run `codex mcp add my-statusline -- python3 -u /absolute/path/to/statusline.py` there, using a path and interpreter the host can access. If the workspace is on a separate executor, give the user the provider file to copy to the host and the command to run there. Set `tui_extensions_statusline = true` under `[features]` in the TUI client's configuration and restart the TUI if you changed the flag.
|
||||
Install the provider through an installed plugin or register the stdio command on the connected app-server host. For example, run `codex mcp add my-statusline -- python3 -u /absolute/path/to/statusline.py` there, using a path and interpreter the host can access. If the workspace is on a separate executor, give the user the provider file to copy to the host and the command to run there. Enable **Custom status line** in `/experimental` on the connected app server, then restart the TUI.
|
||||
|
||||
Exercise `tools/list` and `resources/read` with a representative snapshot. After adding the server, start a new conversation in its workspace to connect to it. Open `/statusline`, choose **Choose a status line provider**, and select the provider. Verify that changing threads changes the displayed inputs. F2 shows the failed attempt if the footer falls back. After editing the Python file, restart its stdio process to load the changes.
|
||||
|
||||
@@ -502,7 +502,7 @@ impl App {
|
||||
AppEvent::ChooseStatuslineProvider { scan, id, key } => self.choose_statusline_provider(scan, id, key, app_server).await,
|
||||
AppEvent::CreateCustomStatusline { backend, thread_id, key } => {
|
||||
if app_server.thread_params_mode() != crate::ThreadParamsMode::Cloud
|
||||
&& self.config.features.enabled(Feature::TuiExtensionsStatusLine)
|
||||
&& self.chat_widget.custom_statusline_enabled()
|
||||
&& self.chat_widget.active_view_is(crate::bottom_pane::StatusLineSetupView::VIEW_ID)
|
||||
&& self.chat_widget.model_catalog().backend == backend
|
||||
&& backend.is_none_or(|id| id == app_server.backend_id())
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
use super::*;
|
||||
use crate::app::session_lifecycle::ThreadAttachPresentation;
|
||||
use crate::app::startup::statusline_enabled;
|
||||
use crate::app::tests::make_test_app_with_channels;
|
||||
use codex_app_server_client::AppServerClient;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[tokio::test]
|
||||
async fn experimental_features_use_selected_server_profile_and_preserve_task_settings() -> Result<()>
|
||||
{
|
||||
let home = tempfile::tempdir()?;
|
||||
let selected = AbsolutePathBuf::from_absolute_path(home.path().join("work.config.toml"))?;
|
||||
let managed = home.path().join("managed.toml");
|
||||
std::fs::write(home.path().join("config.toml"), "# unselected\n")?;
|
||||
std::fs::write(&selected, "[features]\nnetwork_proxy = true\n")?;
|
||||
std::fs::write(&managed, "")?;
|
||||
async fn start_feature_server(
|
||||
home: &Path,
|
||||
selected: &AbsolutePathBuf,
|
||||
managed: &Path,
|
||||
) -> Result<(AppServerSession, AppServerStartedThread)> {
|
||||
let loader = LoaderOverrides {
|
||||
user_config_path: Some(selected.clone()),
|
||||
user_config_profile: Some("work".parse()?),
|
||||
managed_config_path: Some(managed.clone()),
|
||||
managed_config_path: Some(managed.to_path_buf()),
|
||||
ignore_project_config: true,
|
||||
..LoaderOverrides::without_managed_config_for_tests()
|
||||
};
|
||||
let config = ConfigBuilder::default()
|
||||
.codex_home(home.path().to_path_buf())
|
||||
.codex_home(home.to_path_buf())
|
||||
.loader_overrides(loader.clone())
|
||||
.build()
|
||||
.await?;
|
||||
@@ -43,7 +41,21 @@ async fn experimental_features_use_selected_server_profile_and_preserve_task_set
|
||||
AppServerClient::InProcess(client),
|
||||
crate::app_server_session::ThreadParamsMode::Remote,
|
||||
);
|
||||
let thread = server.start_thread(&config).await?.session.thread_id;
|
||||
let started = server.start_thread(&config).await?;
|
||||
Ok((server, started))
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn experimental_features_use_selected_server_profile_and_preserve_task_settings() -> Result<()>
|
||||
{
|
||||
let home = tempfile::tempdir()?;
|
||||
let selected = AbsolutePathBuf::from_absolute_path(home.path().join("work.config.toml"))?;
|
||||
let managed = home.path().join("managed.toml");
|
||||
std::fs::write(home.path().join("config.toml"), "# unselected\n")?;
|
||||
std::fs::write(&selected, "[features]\nnetwork_proxy = true\n")?;
|
||||
std::fs::write(&managed, "")?;
|
||||
let (server, started) = start_feature_server(home.path(), &selected, &managed).await?;
|
||||
let thread = started.session.thread_id;
|
||||
let (mut app, mut events, _ops) = make_test_app_with_channels().await;
|
||||
let before = (app.config.clone(), app.chat_widget.config_ref().clone());
|
||||
let updates = vec![
|
||||
@@ -138,3 +150,69 @@ async fn experimental_features_use_selected_server_profile_and_preserve_task_set
|
||||
server.shutdown().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn statusline_uses_the_startup_flag_until_restart() -> Result<()> {
|
||||
let home = tempfile::tempdir()?;
|
||||
let selected = AbsolutePathBuf::from_absolute_path(home.path().join("work.config.toml"))?;
|
||||
let managed = home.path().join("managed.toml");
|
||||
std::fs::write(&selected, "[features]\ntui_extensions_statusline = true\n")?;
|
||||
std::fs::write(&managed, "")?;
|
||||
let (mut server, started) = start_feature_server(home.path(), &selected, &managed).await?;
|
||||
let thread = started.session.thread_id;
|
||||
let (mut app, _events, _ops) = make_test_app_with_channels().await;
|
||||
let cwd = app.config.cwd.display().to_string();
|
||||
let read_flag = async |server: &AppServerSession| -> Result<bool> {
|
||||
let defaults = crate::config_update::read_effective_config_with_layers(
|
||||
&server.request_handle(),
|
||||
cwd.clone(),
|
||||
)
|
||||
.await?;
|
||||
Ok(statusline_enabled(&defaults.config))
|
||||
};
|
||||
app.chat_widget.statusline_feature_enabled = read_flag(&server).await?;
|
||||
assert!(app.chat_widget.statusline_feature_enabled);
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
std::fs::write(
|
||||
&app.local_settings.user_config_path,
|
||||
"[tui]\nstatus_line_provider = { server = 'fixture', tool = 'line' }\n",
|
||||
)?;
|
||||
app.refresh_in_memory_config_from_disk().await?;
|
||||
app.replace_chat_widget_with_app_server_thread(
|
||||
&mut tui,
|
||||
started,
|
||||
ThreadAttachPresentation::Fresh,
|
||||
/*initial_user_message*/ None,
|
||||
)
|
||||
.await?;
|
||||
let provider = app
|
||||
.chat_widget
|
||||
.selected_statusline_provider()
|
||||
.unwrap()
|
||||
.clone();
|
||||
|
||||
let key = Feature::TuiExtensionsStatusLine.key();
|
||||
let (tx, rx) = oneshot::channel();
|
||||
app.save_experimental_features(&server, thread, vec![(key.into(), false)], tx);
|
||||
assert!(rx.await?.expect("server save").warning.is_none());
|
||||
assert_eq!(
|
||||
app.chat_widget.selected_statusline_provider(),
|
||||
Some(&provider)
|
||||
);
|
||||
|
||||
let next = server.start_thread(&app.config).await?;
|
||||
app.replace_chat_widget_with_app_server_thread(
|
||||
&mut tui,
|
||||
next,
|
||||
ThreadAttachPresentation::Fresh,
|
||||
/*initial_user_message*/ None,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(
|
||||
app.chat_widget.selected_statusline_provider(),
|
||||
Some(&provider)
|
||||
);
|
||||
assert!(!read_flag(&server).await?);
|
||||
server.shutdown().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -630,6 +630,7 @@ impl App {
|
||||
chat_widget.config_panel_tui = self.chat_widget.config_panel_tui.clone();
|
||||
chat_widget.config_panel_tui.mouse_scroll_speed =
|
||||
chat_widget.local_settings.tui.mouse_scroll_speed;
|
||||
chat_widget.statusline_feature_enabled = self.chat_widget.statusline_feature_enabled;
|
||||
chat_widget.remote_connection = self.chat_widget.remote_connection.clone();
|
||||
chat_widget.snapshot_local_images = self.app_server_target.uses_remote_workspace();
|
||||
chat_widget.thread_params_mode = self.chat_widget.thread_params_mode;
|
||||
|
||||
@@ -52,25 +52,36 @@ fn spawn_startup_thread_start(
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) async fn prepare_fresh_startup_config(
|
||||
config: &mut Config,
|
||||
app_server: &AppServerSession,
|
||||
pub(super) fn startup_config_cwd<'a>(
|
||||
config: &'a Config,
|
||||
app_server: &'a AppServerSession,
|
||||
app_server_target: &AppServerTarget,
|
||||
cli_kv_overrides: &[(String, TomlValue)],
|
||||
harness_overrides: &ConfigOverrides,
|
||||
environments: &EnvironmentManager,
|
||||
) -> Result<crate::projectless::AppliedDefaults> {
|
||||
let defaults_cwd = match app_server_target {
|
||||
) -> &'a Path {
|
||||
match app_server_target {
|
||||
AppServerTarget::Embedded | AppServerTarget::LocalDaemon { .. } => config.cwd.as_path(),
|
||||
AppServerTarget::Remote { .. } | AppServerTarget::Cloud => {
|
||||
app_server.remote_cwd_override().unwrap_or(Path::new("."))
|
||||
}
|
||||
};
|
||||
let defaults = crate::config_update::read_effective_config_with_layers(
|
||||
&app_server.request_handle(),
|
||||
defaults_cwd.display().to_string(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn statusline_enabled(config: &codex_app_server_protocol::Config) -> bool {
|
||||
config
|
||||
.additional
|
||||
.get("features")
|
||||
.and_then(|features| features.get(Feature::TuiExtensionsStatusLine.key()))
|
||||
.and_then(serde_json::Value::as_bool)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub(super) fn prepare_fresh_startup_config(
|
||||
config: &mut Config,
|
||||
app_server: &AppServerSession,
|
||||
defaults: &crate::config_update::EffectiveConfig,
|
||||
cli_kv_overrides: &[(String, TomlValue)],
|
||||
harness_overrides: &ConfigOverrides,
|
||||
environments: &EnvironmentManager,
|
||||
) -> crate::projectless::AppliedDefaults {
|
||||
super::new_session::overlay_new_session_defaults(
|
||||
config,
|
||||
&defaults.config,
|
||||
@@ -82,7 +93,7 @@ pub(super) async fn prepare_fresh_startup_config(
|
||||
harness_overrides,
|
||||
app_server,
|
||||
environments,
|
||||
&defaults,
|
||||
defaults,
|
||||
);
|
||||
apply_managed_new_thread_defaults(
|
||||
config,
|
||||
@@ -90,7 +101,7 @@ pub(super) async fn prepare_fresh_startup_config(
|
||||
cli_kv_overrides,
|
||||
harness_overrides,
|
||||
);
|
||||
Ok(projectless)
|
||||
projectless
|
||||
}
|
||||
|
||||
pub(super) fn startup_model(
|
||||
@@ -384,31 +395,47 @@ impl App {
|
||||
config.model_reasoning_effort = None;
|
||||
}
|
||||
}
|
||||
let startup_defaults = if fresh_start {
|
||||
match startup_draft
|
||||
.run_until(
|
||||
tui,
|
||||
prepare_fresh_startup_config(
|
||||
&mut config,
|
||||
&app_server,
|
||||
&app_server_target,
|
||||
&cli_kv_overrides,
|
||||
&harness_overrides,
|
||||
&environment_manager,
|
||||
),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Ok(defaults)) => defaults,
|
||||
Ok(Err(err)) => {
|
||||
return shutdown_on_startup_error(app_server, &mut other_backends, err).await;
|
||||
}
|
||||
Err(err) => {
|
||||
return shutdown_on_startup_error(app_server, &mut other_backends, err).await;
|
||||
let cwd = startup_config_cwd(&config, &app_server, &app_server_target)
|
||||
.display()
|
||||
.to_string();
|
||||
let startup_config = match startup_draft
|
||||
.run_until(tui, async {
|
||||
let request_handle = app_server.request_handle();
|
||||
let read_config = crate::config_update::read_effective_config_with_optional_layers(
|
||||
&request_handle,
|
||||
cwd,
|
||||
/*include_layers*/ fresh_start,
|
||||
);
|
||||
if fresh_start {
|
||||
read_config.await
|
||||
} else {
|
||||
tokio::time::timeout(Duration::from_secs(/*secs*/ 2), read_config).await?
|
||||
}
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(Ok(config)) => Some(config),
|
||||
Ok(Err(_)) if !fresh_start => None,
|
||||
Ok(Err(err)) => {
|
||||
return shutdown_on_startup_error(app_server, &mut other_backends, err).await;
|
||||
}
|
||||
} else {
|
||||
crate::projectless::AppliedDefaults::default()
|
||||
Err(err) => {
|
||||
return shutdown_on_startup_error(app_server, &mut other_backends, err).await;
|
||||
}
|
||||
};
|
||||
let statusline_feature_enabled = startup_config
|
||||
.as_ref()
|
||||
.is_some_and(|response| statusline_enabled(&response.config));
|
||||
let startup_defaults = match startup_config.as_ref() {
|
||||
Some(defaults) if fresh_start => prepare_fresh_startup_config(
|
||||
&mut config,
|
||||
&app_server,
|
||||
defaults,
|
||||
&cli_kv_overrides,
|
||||
&harness_overrides,
|
||||
&environment_manager,
|
||||
),
|
||||
_ => crate::projectless::AppliedDefaults::default(),
|
||||
};
|
||||
let mut launch_choices = crate::app_server_session::StartupLaunchChoices::from_launch(
|
||||
&cli_kv_overrides,
|
||||
@@ -937,6 +964,7 @@ impl App {
|
||||
.borrow_mut()
|
||||
.continue_from(&mut startup_draft.blossom.borrow_mut());
|
||||
}
|
||||
chat_widget.statusline_feature_enabled = statusline_feature_enabled;
|
||||
chat_widget.remote_connection = remote_connection;
|
||||
chat_widget.snapshot_local_images = app_server_target.uses_remote_workspace();
|
||||
chat_widget.thread_params_mode = app_server.thread_params_mode();
|
||||
|
||||
@@ -142,7 +142,7 @@ async fn failed_write_preserves_the_file_and_the_live_selection() -> anyhow::Res
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reloading_the_effective_feature_gate_and_reselecting_an_unchanged_preference() {
|
||||
async fn reloading_the_local_provider_preserves_the_server_feature_gate() {
|
||||
let mut app = make_test_app().await;
|
||||
let path = app.local_settings.user_config_path.clone();
|
||||
let configured = "[features]\ntui_extensions_statusline = true\n[tui]\nstatus_line = []\nstatus_line_provider = { tool='line', server='fixture' } # local formatting\n";
|
||||
@@ -156,6 +156,9 @@ async fn reloading_the_effective_feature_gate_and_reselecting_an_unchanged_prefe
|
||||
.into(),
|
||||
)];
|
||||
app.refresh_in_memory_config_from_disk().await.unwrap();
|
||||
assert!(!render_bottom_popup(&app.chat_widget, /*width*/ 80).contains("Initializing…"));
|
||||
app.chat_widget.statusline_feature_enabled = true;
|
||||
app.chat_widget.refresh_status_line();
|
||||
assert!(render_bottom_popup(&app.chat_widget, /*width*/ 80).contains("Initializing…"));
|
||||
|
||||
let selected = app
|
||||
@@ -176,8 +179,5 @@ async fn reloading_the_effective_feature_gate_and_reselecting_an_unchanged_prefe
|
||||
);
|
||||
std::fs::write(&path, configured.replace("= true", "= false")).unwrap();
|
||||
app.refresh_in_memory_config_from_disk().await.unwrap();
|
||||
assert!(!render_bottom_popup(&app.chat_widget, /*width*/ 80).contains("Initializing…"));
|
||||
std::fs::write(&path, configured).unwrap();
|
||||
app.refresh_in_memory_config_from_disk().await.unwrap();
|
||||
assert!(render_bottom_popup(&app.chat_widget, /*width*/ 80).contains("Initializing…"));
|
||||
}
|
||||
|
||||
@@ -161,13 +161,8 @@ impl StatuslinePicker {
|
||||
}
|
||||
}
|
||||
|
||||
fn applies_to(
|
||||
&mut self,
|
||||
thread: Option<ThreadId>,
|
||||
backend: BackendId,
|
||||
config: &Config,
|
||||
) -> bool {
|
||||
if self.backend != backend || !config.features.enabled(Feature::TuiExtensionsStatusLine) {
|
||||
fn applies_to(&mut self, thread: Option<ThreadId>, backend: BackendId) -> bool {
|
||||
if self.backend != backend {
|
||||
return false;
|
||||
}
|
||||
// The picker may open before the displayed thread receives its ID.
|
||||
@@ -178,11 +173,7 @@ impl StatuslinePicker {
|
||||
|
||||
impl App {
|
||||
pub(super) fn open_statusline_picker(&mut self, owner: &AppServerSession) {
|
||||
if !self
|
||||
.config
|
||||
.features
|
||||
.enabled(Feature::TuiExtensionsStatusLine)
|
||||
{
|
||||
if !self.chat_widget.custom_statusline_enabled() {
|
||||
return;
|
||||
}
|
||||
self.statusline_metrics
|
||||
@@ -230,11 +221,8 @@ impl App {
|
||||
.chat_widget
|
||||
.selected_index_for_present_view(PICKER)
|
||||
.is_none()
|
||||
|| !picker.applies_to(
|
||||
self.chat_widget.thread_id(),
|
||||
owner.backend_id(),
|
||||
&self.config,
|
||||
)
|
||||
|| !self.chat_widget.custom_statusline_enabled()
|
||||
|| !picker.applies_to(self.chat_widget.thread_id(), owner.backend_id())
|
||||
{
|
||||
self.statusline_picker = None;
|
||||
return None;
|
||||
|
||||
@@ -25,11 +25,7 @@ async fn picker() -> anyhow::Result<(
|
||||
mpsc::UnboundedReceiver<AppEvent>,
|
||||
)> {
|
||||
let (mut app, events, _) = make_test_app_with_channels().await;
|
||||
app.config
|
||||
.features
|
||||
.enable(Feature::TuiExtensionsStatusLine)?;
|
||||
app.chat_widget
|
||||
.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ true);
|
||||
app.chat_widget.statusline_feature_enabled = true;
|
||||
app.chat_widget.thread_params_mode = ThreadParamsMode::Cloud;
|
||||
let (client, commands, _) = CloudClient::channel(/*capacity*/ 8);
|
||||
let owner = AppServerSession::new(
|
||||
@@ -231,6 +227,7 @@ async fn discovery_only_starts_a_reader_on_explicit_selection() -> anyhow::Resul
|
||||
let cwd = app.config.cwd.to_path_buf();
|
||||
app.chat_widget
|
||||
.handle_thread_session(test_thread_session(thread, cwd));
|
||||
app.chat_widget.statusline_feature_enabled = true;
|
||||
let provider = advertised("work", "calendar", "ui://work/day");
|
||||
|
||||
for (uri, expected) in [
|
||||
|
||||
@@ -2244,8 +2244,7 @@ async fn token_usage_update_refreshes_status_line_with_runtime_context_window()
|
||||
(false, 900_000, "900K window · 8 used"),
|
||||
] {
|
||||
let before = render_bottom_popup(&app.chat_widget, /*width*/ 60);
|
||||
app.chat_widget
|
||||
.set_feature_enabled(Feature::TuiExtensionsStatusLine, extensions);
|
||||
app.chat_widget.statusline_feature_enabled = extensions;
|
||||
app.refresh_status_line();
|
||||
assert_eq!(render_bottom_popup(&app.chat_widget, /*width*/ 60), before);
|
||||
app.handle_thread_event_now(ThreadBufferedEvent::Notification(Box::new(
|
||||
|
||||
@@ -1854,11 +1854,6 @@ async fn fresh_session_saves_input_restored_by_a_late_interrupt() -> Result<()>
|
||||
#[tokio::test]
|
||||
async fn create_statusline_keeps_the_draft_editable() -> Result<()> {
|
||||
let (mut app, mut events, mut ops) = make_test_app_with_channels().await;
|
||||
app.config
|
||||
.features
|
||||
.enable(Feature::TuiExtensionsStatusLine)?;
|
||||
app.chat_widget
|
||||
.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ true);
|
||||
let cwd = app.config.codex_home.to_path_buf();
|
||||
let user_skill = cwd.join("skills/create-statusline");
|
||||
std::fs::create_dir_all(&user_skill)?;
|
||||
@@ -1869,6 +1864,7 @@ async fn create_statusline_keeps_the_draft_editable() -> Result<()> {
|
||||
let source = ThreadId::new();
|
||||
app.enqueue_primary_thread_session(test_thread_session(source, cwd), Vec::new())
|
||||
.await?;
|
||||
app.chat_widget.statusline_feature_enabled = true;
|
||||
app.chat_widget.handle_server_notification(
|
||||
turn_started_notification(source, "running"),
|
||||
/*replay_kind*/ None,
|
||||
|
||||
@@ -332,15 +332,19 @@ async fn local_projectless_defaults_respect_trust_scope_and_explicit_settings()
|
||||
LoaderOverrides::without_managed_config_for_tests(),
|
||||
)
|
||||
.await?;
|
||||
let defaults = crate::config_update::read_effective_config_with_layers(
|
||||
&server.request_handle(),
|
||||
config.cwd.display().to_string(),
|
||||
)
|
||||
.await?;
|
||||
let startup = crate::app::startup::prepare_fresh_startup_config(
|
||||
&mut config,
|
||||
&server,
|
||||
&AppServerTarget::Embedded,
|
||||
&defaults,
|
||||
&[],
|
||||
&overrides,
|
||||
&EnvironmentManager::default_for_tests(),
|
||||
)
|
||||
.await?;
|
||||
);
|
||||
if expected_approval.is_some() {
|
||||
assert_eq!(startup.approval_policy, None);
|
||||
}
|
||||
|
||||
@@ -2030,8 +2030,7 @@ async fn first_prompt_counts_once_before_and_after_resume() -> Result<()> {
|
||||
)
|
||||
.await?;
|
||||
drain_app_events(&mut app, &mut tui, &mut server, &mut events).await?;
|
||||
app.chat_widget
|
||||
.set_feature_enabled(Feature::TuiExtensionsStatusLine, mode == "builtin");
|
||||
app.chat_widget.statusline_feature_enabled = mode == "builtin";
|
||||
for text in ["first prompt", "follow-up"] {
|
||||
let sent = responses::mount_sse_once(&model, responses::sse_completed("ok")).await;
|
||||
app.chat_widget.apply_external_edit(text.into());
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
use super::*;
|
||||
use crate::app::backend_sessions::InitialBackendSessions;
|
||||
use crate::app::startup::prepare_fresh_startup_config;
|
||||
use crate::app::startup::startup_config_cwd;
|
||||
use crate::app::startup::startup_model;
|
||||
use crate::app::startup::statusline_enabled;
|
||||
use crate::app::startup_bootstrap::bootstrap_server_owned_start;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@@ -461,15 +463,21 @@ requires_openai_auth = false
|
||||
if !server_owned {
|
||||
server.bootstrap(&config).await?;
|
||||
}
|
||||
let defaults = crate::config_update::read_effective_config_with_layers(
|
||||
&server.request_handle(),
|
||||
startup_config_cwd(&config, &server, &target)
|
||||
.display()
|
||||
.to_string(),
|
||||
)
|
||||
.await?;
|
||||
prepare_fresh_startup_config(
|
||||
&mut config,
|
||||
&server,
|
||||
&target,
|
||||
&defaults,
|
||||
&cli_kv_overrides,
|
||||
&harness_overrides,
|
||||
&EnvironmentManager::default_for_tests(),
|
||||
)
|
||||
.await?;
|
||||
);
|
||||
if server_owned {
|
||||
bootstrap_server_owned_start(
|
||||
&mut server,
|
||||
@@ -677,15 +685,22 @@ async fn fresh_startup_reads_destination_and_cleared_model_uses_catalog() -> Res
|
||||
bootstrap.default_model.as_deref(),
|
||||
Some("stale-client-model")
|
||||
);
|
||||
let defaults = crate::config_update::read_effective_config_with_layers(
|
||||
&server.request_handle(),
|
||||
startup_config_cwd(&config, &server, &target)
|
||||
.display()
|
||||
.to_string(),
|
||||
)
|
||||
.await?;
|
||||
assert!(!statusline_enabled(&defaults.config));
|
||||
let defaults_read = prepare_fresh_startup_config(
|
||||
&mut config,
|
||||
&server,
|
||||
&target,
|
||||
&defaults,
|
||||
&[],
|
||||
&ConfigOverrides::default(),
|
||||
&EnvironmentManager::default_for_tests(),
|
||||
)
|
||||
.await?;
|
||||
);
|
||||
assert!(!defaults_read.prompt_windows_sandbox);
|
||||
assert_eq!(config.model, None);
|
||||
let selected_model =
|
||||
|
||||
@@ -54,6 +54,7 @@ fn experimental_features_display_metadata() {
|
||||
Feature::AnalyticsPlanHistory,
|
||||
Feature::LoginShellPackagePath,
|
||||
Feature::RespectSystemProxy,
|
||||
Feature::TuiExtensionsStatusLine,
|
||||
] {
|
||||
let stage = feature.stage();
|
||||
let (app_tx, _app_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
---
|
||||
source: tui/src/bottom_pane/experimental_features_view_tests.rs
|
||||
expression: buffer_text(&buffer)
|
||||
---
|
||||
|
||||
Experimental features
|
||||
Checked features are configured on. Some experimental features take effect
|
||||
only in new tasks or after restarting the Codex server.
|
||||
|
||||
|
||||
› [ ] Custom status line Restart the TUI, then use /statusline.
|
||||
|
||||
|
||||
space toggle · enter save · esc cancel
|
||||
@@ -577,6 +577,7 @@ pub(crate) struct ChatWidget {
|
||||
status_account_display: Option<StatusAccountDisplay>,
|
||||
pub(crate) remote_connection: Option<RemoteConnectionStatus>,
|
||||
pub(crate) app_server_path_convention: Option<PathConvention>,
|
||||
pub(crate) statusline_feature_enabled: bool,
|
||||
statusline_read: Option<statusline_reader::ActiveStatuslineRead>,
|
||||
pub(crate) statusline_disconnected: bool,
|
||||
/// Remote app servers cannot read image paths on the TUI host.
|
||||
|
||||
@@ -154,6 +154,7 @@ impl ChatWidget {
|
||||
status_account_display,
|
||||
remote_connection: None,
|
||||
app_server_path_convention: None,
|
||||
statusline_feature_enabled: false,
|
||||
statusline_read: None,
|
||||
statusline_disconnected: false,
|
||||
snapshot_local_images: false,
|
||||
|
||||
@@ -65,6 +65,10 @@ impl ChatWidget {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn custom_statusline_enabled(&self) -> bool {
|
||||
self.statusline_feature_enabled
|
||||
}
|
||||
|
||||
fn on_session_configured_with_display_and_fork_parent_title(
|
||||
&mut self,
|
||||
session: ThreadSessionState,
|
||||
|
||||
@@ -332,11 +332,7 @@ impl ChatWidget {
|
||||
use crate::bottom_pane::StatuslineProviderActions;
|
||||
|
||||
let configured_status_line_items = self.configured_status_line_items();
|
||||
let providers = if !self
|
||||
.config
|
||||
.features
|
||||
.enabled(codex_features::Feature::TuiExtensionsStatusLine)
|
||||
{
|
||||
let providers = if !self.custom_statusline_enabled() {
|
||||
StatuslineProviderActions::Hidden
|
||||
} else if self.thread_params_mode == crate::ThreadParamsMode::Cloud {
|
||||
StatuslineProviderActions::Choose
|
||||
|
||||
@@ -23,7 +23,6 @@ use crate::ui_tree::UiNode;
|
||||
use crate::ui_tree::UiTree;
|
||||
use codex_config::types::StatusLineProviderId;
|
||||
use codex_config::types::StatusLineSelection;
|
||||
use codex_features::Feature;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use std::time::Duration;
|
||||
@@ -80,10 +79,7 @@ impl ChatWidget {
|
||||
.app_event_tx
|
||||
.voice_only
|
||||
.load(std::sync::atomic::Ordering::Relaxed)
|
||||
|| !self
|
||||
.config
|
||||
.features
|
||||
.enabled(Feature::TuiExtensionsStatusLine)
|
||||
|| !self.custom_statusline_enabled()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ async fn custom_statusline_requests_headline_and_billing_with_no_native_items()
|
||||
server: "fixture".into(),
|
||||
tool: "line".into(),
|
||||
})));
|
||||
chat.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ true);
|
||||
chat.statusline_feature_enabled = true;
|
||||
chat.refresh_status_line();
|
||||
|
||||
let events: Vec<_> = std::iter::from_fn(|| rx.try_recv().ok()).collect();
|
||||
@@ -111,14 +111,13 @@ async fn statusline_reader_waits_for_the_displayed_thread_and_keeps_its_result()
|
||||
chat.local_settings.tui.status_line = Some(Vec::new());
|
||||
chat.thread_id = Some(ThreadId::new());
|
||||
chat.local_settings.tui.status_line_provider = Some(selected.clone());
|
||||
chat.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ false);
|
||||
chat.refresh_status_line();
|
||||
assert!(read_events(&mut rx).is_empty());
|
||||
|
||||
chat.local_settings.tui.status_line_provider = Some(Box::new(StatusLineSelection::Builtin(
|
||||
BuiltinStatusLine::Default,
|
||||
)));
|
||||
chat.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ true);
|
||||
chat.statusline_feature_enabled = true;
|
||||
chat.refresh_status_line();
|
||||
assert!(read_events(&mut rx).is_empty());
|
||||
chat.thread_id = None;
|
||||
@@ -224,7 +223,7 @@ impl Reader {
|
||||
ThreadParamsMode::Cloud,
|
||||
);
|
||||
chat.thread_id = Some(ThreadId::new());
|
||||
chat.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ true);
|
||||
chat.statusline_feature_enabled = true;
|
||||
chat.local_settings.tui.status_line_provider =
|
||||
Some(Box::new(StatusLineSelection::Mcp(StatusLineProviderId {
|
||||
server: "fixture".into(),
|
||||
|
||||
@@ -154,7 +154,7 @@ async fn status_surface_preview_lines_live_only_snapshot() {
|
||||
#[tokio::test]
|
||||
async fn status_line_setup_popup_live_only_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ true);
|
||||
chat.statusline_feature_enabled = true;
|
||||
cache_project_root(&mut chat, "preview-live-root");
|
||||
chat.status_line_branch = Some("feature/live-preview-branch".to_string());
|
||||
chat.thread_name = Some("Live preview thread".to_string());
|
||||
@@ -173,7 +173,7 @@ async fn status_line_setup_popup_live_only_snapshot() {
|
||||
#[tokio::test]
|
||||
async fn status_line_setup_popup_cloud_hides_create() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.set_feature_enabled(Feature::TuiExtensionsStatusLine, /*enabled*/ true);
|
||||
chat.statusline_feature_enabled = true;
|
||||
chat.thread_params_mode = crate::ThreadParamsMode::Cloud;
|
||||
assert_chatwidget_snapshot!(
|
||||
"status_line_setup_popup_native_cloud",
|
||||
|
||||
@@ -441,12 +441,20 @@ pub(crate) struct EffectiveConfig {
|
||||
pub(crate) async fn read_effective_config_with_layers(
|
||||
request_handle: &AppServerRequestHandle,
|
||||
cwd: String,
|
||||
) -> Result<EffectiveConfig> {
|
||||
read_effective_config_with_optional_layers(request_handle, cwd, /*include_layers*/ true).await
|
||||
}
|
||||
|
||||
pub(crate) async fn read_effective_config_with_optional_layers(
|
||||
request_handle: &AppServerRequestHandle,
|
||||
cwd: String,
|
||||
include_layers: bool,
|
||||
) -> Result<EffectiveConfig> {
|
||||
request_handle
|
||||
.request_typed(ClientRequest::ConfigRead {
|
||||
request_id: RequestId::String(format!("tui-config-read-{}", Uuid::new_v4())),
|
||||
params: ConfigReadParams {
|
||||
include_layers: true,
|
||||
include_layers,
|
||||
cwd: Some(cwd),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::chatwidget::ChatWidget;
|
||||
use crate::legacy_core::config::Config;
|
||||
use codex_config::types::DEFAULT_OTEL_ENVIRONMENT;
|
||||
use codex_config::types::OtelExporterKind;
|
||||
use codex_features::Feature;
|
||||
use codex_otel::MetricsClient;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -59,11 +58,7 @@ impl StatuslineMetrics {
|
||||
return;
|
||||
}
|
||||
self.first_prompt_recorded = true;
|
||||
let mode = if !chat
|
||||
.config_ref()
|
||||
.features
|
||||
.enabled(Feature::TuiExtensionsStatusLine)
|
||||
{
|
||||
let mode = if !chat.custom_statusline_enabled() {
|
||||
"feature_off"
|
||||
} else if chat.selected_statusline_provider().is_some() {
|
||||
"custom"
|
||||
|
||||
Reference in New Issue
Block a user