mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Reconnect idle Cloud conversations after transient stream loss (#60969)
## Why A lost Cloud reply stream previously required reopening the conversation, even when it was idle. Recover the displayed conversation automatically while holding queued input until its reply stream is usable. ## What changed - Add bounded retries for transient stream failures in the displayed, idle conversation, with credential and network-policy checks. Keep explicit reopen behavior when recovery is unavailable or fails. - Enable HTTP/2 keepalive pings for Cloud connections. - Queue input while disconnected and resume ordinary submission after recovery. Mark recovered history as potentially incomplete so an explicit reopen reloads missed turns while preserving drafts and reconciling pending submissions. - Store retained input per backend and apply background settings updates to the owning backend's drafts. ## Testing Add regression coverage for queued input during disconnection and extend resume and backend-handoff tests to cover history refresh, draft preservation, and retained settings. GitOrigin-RevId: 3d753e53d3c0d594680a90cac8a75fe33b91e219
This commit is contained in:
committed by
copyberry
parent
5c3ff1dabf
commit
f988ada4bf
@@ -35,6 +35,7 @@ use crate::with_chatgpt_cloudflare_cookie_store;
|
||||
#[derive(Clone)]
|
||||
pub struct HttpClientBuilder {
|
||||
http2_prior_knowledge: bool,
|
||||
http2_keep_alive: Option<(Duration, Duration)>,
|
||||
disable_pool_idle_timeout: bool,
|
||||
pub(crate) default_headers: Option<HeaderMap>,
|
||||
follow_redirects: bool,
|
||||
@@ -151,6 +152,12 @@ impl HttpClientBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sends HTTP/2 keepalive pings while a request stream is open.
|
||||
pub fn http2_keep_alive(mut self, interval: Duration, timeout: Duration) -> Self {
|
||||
self.http2_keep_alive = Some((interval, timeout));
|
||||
self
|
||||
}
|
||||
|
||||
/// Limits only connection establishment, not the request as a whole.
|
||||
pub fn connect_timeout(mut self, timeout: Duration) -> Self {
|
||||
self.connect_timeout = Some(timeout);
|
||||
@@ -400,6 +407,11 @@ impl HttpClientBuilder {
|
||||
if self.http2_prior_knowledge {
|
||||
builder = builder.http2_prior_knowledge();
|
||||
}
|
||||
if let Some((interval, timeout)) = self.http2_keep_alive {
|
||||
builder = builder
|
||||
.http2_keep_alive_interval(interval)
|
||||
.http2_keep_alive_timeout(timeout);
|
||||
}
|
||||
if self.tls_backend == TlsBackend::Rustls || self.tls.client_identity.is_some() {
|
||||
ensure_rustls_crypto_provider();
|
||||
builder = builder.use_rustls_tls();
|
||||
@@ -437,6 +449,7 @@ impl Default for HttpClientBuilder {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
http2_prior_knowledge: false,
|
||||
http2_keep_alive: None,
|
||||
disable_pool_idle_timeout: false,
|
||||
default_headers: None,
|
||||
follow_redirects: true,
|
||||
|
||||
Reference in New Issue
Block a user