mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
Handle Guardian infrastructure failures separately
This commit is contained in:
@@ -228,6 +228,9 @@ impl CodexErr {
|
||||
CodexErr::RetryLimit(_) => CodexErrorInfo::ResponseTooManyFailedAttempts {
|
||||
http_status_code: self.http_status_code_value(),
|
||||
},
|
||||
CodexErr::Stream(..) => CodexErrorInfo::ResponseStreamDisconnected {
|
||||
http_status_code: self.http_status_code_value(),
|
||||
},
|
||||
CodexErr::ConnectionFailed(_) => CodexErrorInfo::HttpConnectionFailed {
|
||||
http_status_code: self.http_status_code_value(),
|
||||
},
|
||||
|
||||
@@ -190,6 +190,27 @@ fn to_error_event_handles_response_stream_failed() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_error_event_handles_response_stream_disconnected() {
|
||||
let err = CodexErr::Stream(
|
||||
"WebSocket protocol error: Connection reset without closing handshake".to_string(),
|
||||
None,
|
||||
);
|
||||
|
||||
let event = err.to_error_event(Some("Error running remote compact task".to_string()));
|
||||
|
||||
assert_eq!(
|
||||
event.message,
|
||||
"Error running remote compact task: stream disconnected before completion: WebSocket protocol error: Connection reset without closing handshake"
|
||||
);
|
||||
assert_eq!(
|
||||
event.codex_error_info,
|
||||
Some(CodexErrorInfo::ResponseStreamDisconnected {
|
||||
http_status_code: None,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sandbox_denied_reports_exit_code_when_no_output_available() {
|
||||
let output = ExecToolCallOutput {
|
||||
|
||||
Reference in New Issue
Block a user