mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Warn when the connected Codex service is older than the CLI (#43622)
## What changed Show an older-service notice at startup and reconnect when both versions are official stable releases. Display it in conversation history or the agents overview, with wrapping and a compact fallback for small terminals. For the implicit local daemon, suggest `codex app-server daemon update` and warn that updating may interrupt active or queued work. Suppress repeated notices for the same service and version pair, and defer fresh-session notices until session attachment. ## Testing Add coverage for version notice eligibility, local-only update guidance, service identity, startup ordering, reconnect deduplication, and overview rendering at narrow and short sizes. GitOrigin-RevId: e0a5b306e0a4d405544c5f6eaa72f77df6d68e6d
This commit is contained in:
1 parent
4b0f44d304
commit
530383e36d
25 files changed
+605
-19
No files matched your search
@@ -88,6 +88,21 @@ pub(crate) fn new_warning_event(message: String) -> PrefixedWrappedHistoryCell {
|
||||
PrefixedWrappedHistoryCell::new(message.yellow(), "⚠ ".yellow(), " ")
|
||||
}
|
||||
|
||||
#[allow(clippy::disallowed_methods)]
|
||||
pub(crate) fn new_server_version_warning(
|
||||
notice: crate::status::remote_connection::ServerVersionNotice,
|
||||
) -> PrefixedWrappedHistoryCell {
|
||||
let mut lines = vec![Line::from(notice.message.yellow())];
|
||||
if notice.offer_update {
|
||||
lines.push(Line::from("To update the service, run:".yellow()));
|
||||
lines.push(Line::from(" codex app-server daemon update".cyan()));
|
||||
lines.push(Line::from(
|
||||
"Updating may interrupt active or queued work.".yellow(),
|
||||
));
|
||||
}
|
||||
PrefixedWrappedHistoryCell::new(Text::from(lines), "⚠ ".yellow(), " ")
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct SafetyAccessBlockCell {
|
||||
title: &'static str,
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tui/src/history_cell/tests.rs
|
||||
expression: "render_lines(&cell.display_lines(100)).join(\"\\n\")"
|
||||
---
|
||||
⚠ A background Codex service is running v0.152.1, older than your Codex CLI v0.153.0.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
---
|
||||
source: tui/src/history_cell/tests.rs
|
||||
expression: "render_lines(&cell.display_lines(100)).join(\"\\n\")"
|
||||
---
|
||||
⚠ A background Codex service is running v0.152.1, older than your Codex CLI v0.153.0.
|
||||
To update the service, run:
|
||||
codex app-server daemon update
|
||||
Updating may interrupt active or queued work.
|
||||
@@ -19,6 +19,7 @@ use codex_protocol::ThreadId;
|
||||
use codex_protocol::account::PlanType;
|
||||
use codex_protocol::error::UnexpectedResponseError;
|
||||
use codex_protocol::parse_command::ParsedCommand;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use dirs::home_dir;
|
||||
use http::StatusCode;
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -34,6 +35,51 @@ use codex_protocol::mcp::Tool;
|
||||
use rmcp::model::ContentBlock;
|
||||
|
||||
const SMALL_PNG_BASE64: &str = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg==";
|
||||
|
||||
#[test]
|
||||
fn connected_server_version_notice_snapshot() {
|
||||
let target = crate::AppServerTarget::Remote {
|
||||
endpoint: crate::RemoteAppServerEndpoint::UnixSocket {
|
||||
socket_path: AbsolutePathBuf::from_absolute_path(
|
||||
std::env::temp_dir().join("codex.sock"),
|
||||
)
|
||||
.expect("absolute socket path"),
|
||||
},
|
||||
};
|
||||
let (notice, _) = crate::status::remote_connection::pending_server_version_notice(
|
||||
&target,
|
||||
/*server_home*/ None,
|
||||
"0.153.0",
|
||||
Some("0.152.1"),
|
||||
/*last_shown*/ None,
|
||||
)
|
||||
.expect("older remote service should have a notice");
|
||||
let cell = new_server_version_warning(notice);
|
||||
insta::assert_snapshot!(render_lines(&cell.display_lines(/*width*/ 100)).join("\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_daemon_version_notice_snapshot() {
|
||||
let target = crate::AppServerTarget::LocalDaemon {
|
||||
endpoint: crate::RemoteAppServerEndpoint::UnixSocket {
|
||||
socket_path: AbsolutePathBuf::from_absolute_path(
|
||||
std::env::temp_dir().join("codex.sock"),
|
||||
)
|
||||
.expect("absolute socket path"),
|
||||
},
|
||||
};
|
||||
let (notice, _) = crate::status::remote_connection::pending_server_version_notice(
|
||||
&target,
|
||||
/*server_home*/ None,
|
||||
"0.153.0",
|
||||
Some("0.152.1"),
|
||||
/*last_shown*/ None,
|
||||
)
|
||||
.expect("older local service should have a notice");
|
||||
let cell = new_server_version_warning(notice);
|
||||
insta::assert_snapshot!(render_lines(&cell.display_lines(/*width*/ 100)).join("\n"));
|
||||
}
|
||||
|
||||
async fn test_config() -> Config {
|
||||
let codex_home = std::env::temp_dir();
|
||||
ConfigBuilder::default()
|
||||
|
||||
Reference in new issue
Block a user