mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Omit unknown server versions from /status (#62202)
## Why `/status` appends `(unknown)` to the server label when a cloud or remote server does not report a version. ## What changed Show the cloud label or remote address on its own when the version is unavailable. When a version is reported, use the same `v` prefix for cloud and remote servers. The daemon menu still displays `unknown` for a running local daemon whose version is unavailable. ## Testing Add `/status` snapshots for cloud connections with and without a reported version and for a remote WebSocket connection without a reported version. GitOrigin-RevId: 113d2502fc7de6af37da3b3029ee28923af29e6f
This commit is contained in:
committed by
copyberry
parent
e58677f0cb
commit
a734a13ad7
@@ -47,7 +47,12 @@ impl App {
|
||||
.remote_connection
|
||||
.as_ref()
|
||||
.filter(|_| matches!(self.app_server_target, AppServerTarget::LocalDaemon { .. }))
|
||||
.map(|connection| format!("Running daemon: {}", connection.version))
|
||||
.map(|connection| {
|
||||
format!(
|
||||
"Running daemon: {}",
|
||||
connection.version.as_deref().unwrap_or("unknown")
|
||||
)
|
||||
})
|
||||
.unwrap_or_else(|| "Not connected to the local background server.".to_string());
|
||||
let mut header = vec![Line::from("Daemon".bold()), Line::from(status.dim())];
|
||||
let unavailable = if matches!(
|
||||
|
||||
@@ -81,7 +81,7 @@ async fn daemon_menu_is_read_only_and_confirmation_can_cancel_or_handoff() {
|
||||
};
|
||||
app.chat_widget.remote_connection = Some(RemoteConnectionStatus {
|
||||
address: "local".into(),
|
||||
version: "v0.153.0".into(),
|
||||
version: Some("v0.153.0".into()),
|
||||
is_local_daemon: true,
|
||||
is_managed_daemon: true,
|
||||
});
|
||||
@@ -308,7 +308,7 @@ async fn unavailable_daemon_menu_offers_guidance_without_update_actions() {
|
||||
};
|
||||
app.chat_widget.remote_connection = Some(RemoteConnectionStatus {
|
||||
address: "ws://example.test:1234".into(),
|
||||
version: "v0.153.0".into(),
|
||||
version: Some("v0.153.0".into()),
|
||||
is_local_daemon: false,
|
||||
is_managed_daemon: false,
|
||||
});
|
||||
|
||||
@@ -13,7 +13,8 @@ impl App {
|
||||
.chat_widget
|
||||
.remote_connection
|
||||
.as_ref()
|
||||
.and_then(|connection| connection.version.strip_prefix('v'))
|
||||
.and_then(|connection| connection.version.as_deref())
|
||||
.and_then(|version| version.strip_prefix('v'))
|
||||
.map(str::to_owned);
|
||||
let _ = self.initialize_server_version_notice(client_version, server_version.as_deref());
|
||||
}
|
||||
|
||||
@@ -1509,8 +1509,9 @@ async fn remote_overview_startup_hides_disabled_older_server_notice() -> Result<
|
||||
.remote_connection
|
||||
.as_ref()
|
||||
.expect("remote status")
|
||||
.version,
|
||||
"v2.0.0"
|
||||
.version
|
||||
.as_deref(),
|
||||
Some("v2.0.0")
|
||||
);
|
||||
app.local_settings.tui.show_server_version_notice = true;
|
||||
app.refresh_server_version_overview_notice("2.1.0");
|
||||
|
||||
@@ -1306,7 +1306,7 @@ async fn startup_config_warning_is_not_repeated_by_thread() {
|
||||
chat.remote_connection =
|
||||
Some(crate::status::remote_connection::RemoteConnectionStatus {
|
||||
address: "local".into(),
|
||||
version: "v0.153.0".into(),
|
||||
version: Some("v0.153.0".into()),
|
||||
is_local_daemon: true,
|
||||
is_managed_daemon: managed_daemon,
|
||||
});
|
||||
|
||||
@@ -535,7 +535,7 @@ async fn status_command_requests_thread_usage_for_remote_connection_metadata() {
|
||||
);
|
||||
chat.remote_connection = Some(crate::status::remote_connection::RemoteConnectionStatus {
|
||||
address: "wss://remote.example.com".to_string(),
|
||||
version: "v1.0.0".to_string(),
|
||||
version: Some("v1.0.0".to_string()),
|
||||
is_local_daemon: false,
|
||||
is_managed_daemon: false,
|
||||
});
|
||||
|
||||
@@ -830,12 +830,11 @@ impl StatusHistoryCell {
|
||||
let value = if remote_connection.is_local_daemon {
|
||||
Line::from("Local background server")
|
||||
} else {
|
||||
Line::from(vec![
|
||||
Span::from(remote_connection.address.clone()),
|
||||
Span::from(" (").dim(),
|
||||
Span::from(remote_connection.version.clone()).dim(),
|
||||
Span::from(")").dim(),
|
||||
])
|
||||
let mut spans = vec![remote_connection.address.clone().into()];
|
||||
if let Some(version) = &remote_connection.version {
|
||||
spans.push(format!(" ({version})").dim());
|
||||
}
|
||||
Line::from(spans)
|
||||
};
|
||||
let wrapped_remote = word_wrap_lines([value], RtOptions::new(value_width.max(1)));
|
||||
let mut wrapped_remote = wrapped_remote.into_iter();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Formats connection metadata and notices, preserving unavailable server versions as absent.
|
||||
|
||||
use crate::AppServerTarget;
|
||||
use crate::RemoteAppServerEndpoint;
|
||||
use crate::update_versions::ServerVersionNoticeKind;
|
||||
@@ -8,7 +10,7 @@ use url::Url;
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub(crate) struct RemoteConnectionStatus {
|
||||
pub(crate) address: String,
|
||||
pub(crate) version: String,
|
||||
pub(crate) version: Option<String>,
|
||||
pub(crate) is_local_daemon: bool,
|
||||
pub(crate) is_managed_daemon: bool,
|
||||
}
|
||||
@@ -23,33 +25,23 @@ pub(crate) fn remote_connection_status_value(
|
||||
app_server_target: &AppServerTarget,
|
||||
server_version: Option<&str>,
|
||||
) -> Option<RemoteConnectionStatus> {
|
||||
let endpoint = match app_server_target {
|
||||
let address = match app_server_target {
|
||||
AppServerTarget::Embedded => return None,
|
||||
AppServerTarget::Cloud => {
|
||||
return Some(RemoteConnectionStatus {
|
||||
address: "Cloud".into(),
|
||||
version: server_version.unwrap_or("unknown").into(),
|
||||
is_local_daemon: false,
|
||||
is_managed_daemon: false,
|
||||
});
|
||||
}
|
||||
AppServerTarget::Cloud => "Cloud".to_string(),
|
||||
AppServerTarget::LocalDaemon { endpoint, .. } | AppServerTarget::Remote { endpoint } => {
|
||||
endpoint
|
||||
match endpoint {
|
||||
RemoteAppServerEndpoint::WebSocket { websocket_url, .. } => {
|
||||
sanitized_websocket_url(websocket_url)
|
||||
.map(|url| url.to_string())
|
||||
.unwrap_or_else(|| "<invalid websocket URL>".to_string())
|
||||
}
|
||||
RemoteAppServerEndpoint::UnixSocket { socket_path } => {
|
||||
format!("unix://{}", socket_path.display())
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
let address = match endpoint {
|
||||
RemoteAppServerEndpoint::WebSocket { websocket_url, .. } => {
|
||||
sanitized_websocket_url(websocket_url)
|
||||
.map(|url| url.to_string())
|
||||
.unwrap_or_else(|| "<invalid websocket URL>".to_string())
|
||||
}
|
||||
RemoteAppServerEndpoint::UnixSocket { socket_path } => {
|
||||
format!("unix://{}", socket_path.display())
|
||||
}
|
||||
};
|
||||
let version = server_version
|
||||
.map(|version| format!("v{version}"))
|
||||
.unwrap_or_else(|| "unknown".to_string());
|
||||
let version = server_version.map(|version| format!("v{version}"));
|
||||
Some(RemoteConnectionStatus {
|
||||
address,
|
||||
version,
|
||||
@@ -201,7 +193,7 @@ mod tests {
|
||||
remote_connection_status_value(&websocket_target, Some("1.2.3")),
|
||||
Some(RemoteConnectionStatus {
|
||||
address: "ws://127.0.0.1:4500/".to_string(),
|
||||
version: "v1.2.3".to_string(),
|
||||
version: Some("v1.2.3".to_string()),
|
||||
is_local_daemon: false,
|
||||
is_managed_daemon: false,
|
||||
})
|
||||
@@ -218,7 +210,7 @@ mod tests {
|
||||
remote_connection_status_value(&daemon_target, /*server_version*/ None),
|
||||
Some(RemoteConnectionStatus {
|
||||
address: format!("unix://{}", socket_path.display()),
|
||||
version: "unknown".to_string(),
|
||||
version: None,
|
||||
is_local_daemon: true,
|
||||
is_managed_daemon: false,
|
||||
})
|
||||
@@ -232,7 +224,7 @@ mod tests {
|
||||
remote_connection_status_value(&remote_socket_target, Some("1.2.3")),
|
||||
Some(RemoteConnectionStatus {
|
||||
address: format!("unix://{}", socket_path.display()),
|
||||
version: "v1.2.3".to_string(),
|
||||
version: Some("v1.2.3".to_string()),
|
||||
is_local_daemon: false,
|
||||
is_managed_daemon: false,
|
||||
})
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
source: tui/src/status/tests.rs
|
||||
expression: sanitized
|
||||
---
|
||||
/status
|
||||
|
||||
>_ OpenAI Codex (v0.0.0)
|
||||
|
||||
Visit https://chatgpt.com/settings/usage for up-to-date
|
||||
information on rate limits and credits
|
||||
|
||||
Server: Cloud
|
||||
|
||||
Model: gpt-5.1-codex-max (reasoning medium)
|
||||
Directory: [[workspace]]
|
||||
Permissions: Custom (workspace with network access, Ask for approval)
|
||||
Agents.md: <none>
|
||||
|
||||
Token usage: 750 total (500 input + 250 output)
|
||||
Context window: 100% left (750 used / 272K)
|
||||
Limits: data not available yet
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
source: tui/src/status/tests.rs
|
||||
expression: sanitized
|
||||
---
|
||||
/status
|
||||
|
||||
>_ OpenAI Codex (v0.0.0)
|
||||
|
||||
Visit https://chatgpt.com/settings/usage for up-to-date
|
||||
information on rate limits and credits
|
||||
|
||||
Server: Cloud (v0.133.0)
|
||||
|
||||
Model: gpt-5.1-codex-max (reasoning medium)
|
||||
Directory: [[workspace]]
|
||||
Permissions: Custom (workspace with network access, Ask for approval)
|
||||
Agents.md: <none>
|
||||
|
||||
Token usage: 750 total (500 input + 250 output)
|
||||
Context window: 100% left (750 used / 272K)
|
||||
Limits: data not available yet
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
source: tui/src/status/tests.rs
|
||||
expression: sanitized
|
||||
---
|
||||
/status
|
||||
|
||||
>_ OpenAI Codex (v0.0.0)
|
||||
|
||||
Visit https://chatgpt.com/settings/usage for up-to-date
|
||||
information on rate limits and credits
|
||||
|
||||
Server: ws://devbox.example.com:4500/
|
||||
|
||||
Model: gpt-5.1-codex-max (reasoning medium)
|
||||
Directory: [[workspace]]
|
||||
Permissions: Custom (workspace with network access, Ask for approval)
|
||||
Agents.md: <none>
|
||||
|
||||
Token usage: 750 total (500 input + 250 output)
|
||||
Context window: 100% left (750 used / 272K)
|
||||
Limits: data not available yet
|
||||
@@ -17,6 +17,7 @@ use crate::legacy_core::config::PermissionProfileSnapshot;
|
||||
use crate::pager_overlay::TranscriptOverlay;
|
||||
use crate::status::StatusAccountDisplay;
|
||||
use crate::status::remote_connection::RemoteConnectionStatus;
|
||||
use crate::status::remote_connection::remote_connection_status_value;
|
||||
use crate::test_support::PathBufExt;
|
||||
use crate::test_support::test_path_buf;
|
||||
use crate::token_usage::TokenUsage;
|
||||
@@ -1744,22 +1745,46 @@ async fn status_snapshot_uses_default_reasoning_when_config_empty() {
|
||||
.with_ymd_and_hms(2024, 2, 3, 4, 5, 6)
|
||||
.single()
|
||||
.expect("timestamp");
|
||||
for (is_local_daemon, snapshot) in [
|
||||
let connections = [
|
||||
(
|
||||
None,
|
||||
"status_snapshot_uses_default_reasoning_when_config_empty",
|
||||
),
|
||||
(Some(false), "status_snapshot_remote_server"),
|
||||
(Some(true), "status_snapshot_local_background_server"),
|
||||
] {
|
||||
]
|
||||
.map(|(is_local_daemon, snapshot)| {
|
||||
let remote_connection = is_local_daemon.map(|is_local_daemon| RemoteConnectionStatus {
|
||||
address: "unix:///tmp/codex-home/app-server-control/app-server-control.sock"
|
||||
.to_string(),
|
||||
version: "v0.133.0".to_string(),
|
||||
version: Some("v0.133.0".to_string()),
|
||||
is_local_daemon,
|
||||
is_managed_daemon: is_local_daemon,
|
||||
});
|
||||
|
||||
(remote_connection, snapshot)
|
||||
});
|
||||
for (remote_connection, snapshot) in connections.into_iter().chain([
|
||||
(
|
||||
remote_connection_status_value(
|
||||
&crate::AppServerTarget::Cloud,
|
||||
/*server_version*/ None,
|
||||
),
|
||||
"status_snapshot_cloud_server",
|
||||
),
|
||||
(
|
||||
remote_connection_status_value(&crate::AppServerTarget::Cloud, Some("0.133.0")),
|
||||
"status_snapshot_cloud_server_with_version",
|
||||
),
|
||||
(
|
||||
remote_connection_status_value(
|
||||
&crate::AppServerTarget::Remote {
|
||||
endpoint: crate::resolve_remote_addr("ws://devbox.example.com:4500").unwrap(),
|
||||
},
|
||||
/*server_version*/ None,
|
||||
),
|
||||
"status_snapshot_remote_server_without_version",
|
||||
),
|
||||
]) {
|
||||
let model_slug = get_model_offline_for_tests(config.model.as_deref());
|
||||
let token_info = token_info_for(&model_slug, &config, &usage);
|
||||
let (composite, _) = new_status_output_with_rate_limits_handle(
|
||||
|
||||
Reference in New Issue
Block a user