mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve TUI drafts after app-server disconnects (#41911)
## Why Losing an external app-server connection can leave a submission's outcome uncertain. The TUI must preserve local work without retrying it or allowing stale server events to trigger more actions. ## What changed - Enter an offline state when an external app-server transport disconnects during startup, event streaming, or submission. - Keep conversation drafts, queued input, expanded pastes, attachments, and agent-overview input editable while blocking submissions, remote actions, and automatic queue replay. - Show a connection-lost notice that directs users to copy their work and relaunch, while retaining `Ctrl-C` and an empty-composer `Ctrl-D` as quit shortcuts. - Cancel pending views and asynchronous work, and ignore stale completions after the disconnect. Embedded app-server behavior is unchanged. ## Testing Added unit, snapshot, and pseudo-terminal coverage for lost startup and mutation replies, offline draft editing, queued-input recovery, stale-event quarantine, agent-overview behavior, and end-to-end preservation without reconnection or resubmission. GitOrigin-RevId: 7219a95fad676dda447d625db9e465345b469d58
This commit is contained in:
1 parent
b51b07785b
commit
a7913390f7
35 files changed
+987
-38
No files matched your search
@@ -465,6 +465,16 @@ async fn startup_draft_delayed_approval_becomes_protected_on_redraw() -> Result<
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
let mut app_server =
|
||||
crate::start_embedded_app_server_for_picker(app.chat_widget.config_ref()).await?;
|
||||
app.app_server_target = AppServerTarget::Remote {
|
||||
endpoint: crate::RemoteAppServerEndpoint::WebSocket {
|
||||
websocket_url: "ws://127.0.0.1:1".into(),
|
||||
auth_token: None,
|
||||
},
|
||||
};
|
||||
app.begin_reconnect();
|
||||
assert!(app.startup_protected_input_boundary);
|
||||
// The replacement connection replays the protected request after the old request was dropped.
|
||||
app.reconnect.offline = false;
|
||||
|
||||
let (mut startup_pane, _startup_app_event_rx) = startup_bottom_pane();
|
||||
startup_pane.set_composer_text("draft".to_string(), Vec::new(), Vec::new());
|
||||
@@ -1232,7 +1242,7 @@ async fn startup_thread_start_failure_returns_error() {
|
||||
.await
|
||||
.expect("embedded app server");
|
||||
let err = app
|
||||
.handle_startup_thread_started(&mut app_server, Err("boom".to_string()))
|
||||
.handle_startup_thread_started(&mut app_server, Err(color_eyre::eyre::eyre!("boom")))
|
||||
.await
|
||||
.expect_err("startup thread failure should exit instead of leaving chat unconfigured");
|
||||
|
||||
|
||||
Reference in new issue
Block a user