mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Fix code-mode session admission retries for proxy HTTP 503 responses (#61153)
## Why Proxy HTTP 503 responses can contain plain-text or HTML bodies instead of gRPC frames. These responses should reach the existing session admission retry logic as `Unavailable` errors. ## What changed Strip body data from HTTP 503 responses to `OpenSession`, preserving headers and trailers so tonic can honor an explicit gRPC status or infer `Unavailable` when none is present. Keep this handling scoped to session admission and retain the existing five-attempt retry limit. ## Testing Extend admission tests to cover bounded retries for plain-text 503 responses, recovery after an HTML 503 response, and an explicit `Internal` gRPC status that prevents retries. GitOrigin-RevId: c996e13506464e8b65bae06172324bcbadb1f394
This commit is contained in:
@@ -59,6 +59,9 @@ mod transport;
|
||||
|
||||
type GrpcClient = CodeModeHostClient<GrpcTransport>;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct SessionAdmission;
|
||||
|
||||
const SHUTDOWN_ERROR: &str = "code mode session is shutting down";
|
||||
const ROUTE_HEADER: &str = "x-code-mode-route";
|
||||
// Bound result-delivery RPCs, not running tools. A full completion burst can
|
||||
@@ -184,6 +187,7 @@ impl GrpcCodeModeSessionProvider {
|
||||
}
|
||||
},
|
||||
});
|
||||
request.extensions_mut().insert(SessionAdmission);
|
||||
inject_span_traceparent(&mut request, &open_session_span);
|
||||
let result = async {
|
||||
let response = client.as_ref().clone().open_session(request).await?;
|
||||
|
||||
Reference in New Issue
Block a user