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:
Eric Traut authored and copyberry committed 2026-09-07 23:52:29 +00:00
1 parent 4b0f44d304
commit 530383e36d
25 files changed
+605 -19

No files matched your search

+41 -2
View File
@@ -3,6 +3,7 @@
//! Owns the main app run loop from app-server bootstrap through terminal shutdown. Startup input
//! remains isolated from protected interactive requests until the initialized composer owns it.
use super::reconnect::ReconnectState;
use super::*;
use crate::session_start::SessionStartAction;
use crate::session_start::cancel_session_start;
@@ -258,6 +259,18 @@ impl App {
&app_server_target,
app_server.server_version(),
);
let initial_server_version_notice =
if !matches!(app_server_target, AppServerTarget::Embedded) {
crate::status::remote_connection::pending_server_version_notice(
&app_server_target,
app_server.server_codex_home(),
CODEX_CLI_VERSION,
app_server.server_version(),
/*last_shown*/ None,
)
} else {
None
};
if let Err(err) = startup_draft.flush_pending_events(tui).await {
return shutdown_on_startup_error(app_server, err).await;
}
@@ -702,7 +715,12 @@ See the Codex keymap documentation for supported actions and examples."
feedback_audience,
environment_manager,
app_server_target,
reconnect: Default::default(),
reconnect: ReconnectState {
seen_version_notice: initial_server_version_notice
.as_ref()
.map(|(_, key)| key.clone()),
..Default::default()
},
pending_update_action: None,
pending_shutdown_exit_thread_id: None,
windows_sandbox: WindowsSandboxState::default(),
@@ -727,6 +745,13 @@ See the Codex keymap documentation for supported actions and examples."
dynamic_tool_status_updates,
dynamic_tool_tasks: HashMap::new(),
pending_startup_thread_start,
pending_server_version_notice: if pending_startup_thread_start {
initial_server_version_notice
.as_ref()
.map(|(notice, _)| notice.clone())
} else {
None
},
pending_open_resume_picker: false,
pending_working_directory_change: None,
pending_start_managed_worktree: None,
@@ -745,6 +770,12 @@ See the Codex keymap documentation for supported actions and examples."
if !tui.is_terminal_focused() {
app.recap.note_focus_lost(Instant::now());
}
app.update_server_version_overview_notice(
CODEX_CLI_VERSION,
initial_server_version_notice
.as_ref()
.and(app_server.server_version()),
);
if start_in_agents_overview {
app.open_agents_overview(&app_server);
} else if !matches!(app.app_server_target, AppServerTarget::Embedded) {
@@ -794,6 +825,14 @@ See the Codex keymap documentation for supported actions and examples."
return shutdown_on_startup_error(app_server, err).await;
}
}
if !start_in_agents_overview
&& !pending_startup_thread_start
&& let Some((notice, _)) = &initial_server_version_notice
{
app.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(
history_cell::new_server_version_warning(notice.clone()),
)));
}
let initial_session_ms = initial_session_started_at.elapsed().as_millis();
// On startup, if a managed filesystem sandbox is active, warn about
@@ -1086,7 +1125,7 @@ See the Codex keymap documentation for supported actions and examples."
reconnect = None;
match result {
Ok(connected) => {
app.finish_reconnect(tui, &mut app_server, &mut app_event_rx, connected).await?;
app.finish_reconnect(tui, &mut app_server, &mut app_event_rx, connected, CODEX_CLI_VERSION).await?;
listen_for_app_server_events = true;
waiting_for_initial_session_configured = false;
}