mirror of
https://github.com/openai/codex.git
synced 2026-11-18 15:01:48 +00:00
Separate Codex error details from retry metadata (#34996)
## What changed - Wrap `CodexErrorDetails` and an optional retry delay in `CodexErr`, allowing any mapped error to preserve server-provided retry timing. - Generate the payload-free `CodexErrKind` classification alongside the error details and reuse it for analytics. - Update error handling sites to inspect `CodexErr::details()` while preserving existing display, debug, protocol mapping, and retryability behavior. ## Testing - Add coverage for legacy debug formatting, error-specific retryability, and retry-delay propagation through API error mapping. GitOrigin-RevId: d3ab8a305f2a2ee21d0c0a8c8c388b06dda9c59a
This commit is contained in:
1 parent
265cd2e100
commit
7bafdada8b
40 files changed
+741
-435
No files matched your search
@@ -61,6 +61,7 @@ use crate::unified_exec::process::UnifiedExecProcess;
|
||||
use codex_network_proxy::NetworkProxy;
|
||||
use codex_protocol::config_types::ShellEnvironmentPolicy;
|
||||
use codex_protocol::error::CodexErr;
|
||||
use codex_protocol::error::CodexErrorDetails;
|
||||
use codex_protocol::error::SandboxErr;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_protocol::protocol::ExecCommandSource;
|
||||
@@ -1203,16 +1204,19 @@ impl UnifiedExecProcessManager {
|
||||
.await
|
||||
.map(|result| (result.output, result.deferred_network_approval))
|
||||
.map_err(|err| match err {
|
||||
ToolError::Codex(CodexErr::Sandbox(SandboxErr::Denied { output, .. })) => {
|
||||
let output = *output;
|
||||
let message = if output.aggregated_output.text.is_empty() {
|
||||
let exit_code = output.exit_code;
|
||||
format!("Process exited with code {exit_code}")
|
||||
} else {
|
||||
output.aggregated_output.text.clone()
|
||||
};
|
||||
UnifiedExecError::sandbox_denied(message, output)
|
||||
}
|
||||
ToolError::Codex(err) => match err.details() {
|
||||
CodexErrorDetails::Sandbox(SandboxErr::Denied { output, .. }) => {
|
||||
let output = output.as_ref().clone();
|
||||
let message = if output.aggregated_output.text.is_empty() {
|
||||
let exit_code = output.exit_code;
|
||||
format!("Process exited with code {exit_code}")
|
||||
} else {
|
||||
output.aggregated_output.text.clone()
|
||||
};
|
||||
UnifiedExecError::sandbox_denied(message, output)
|
||||
}
|
||||
_ => UnifiedExecError::create_process(format!("{err:?}")),
|
||||
},
|
||||
other => UnifiedExecError::create_process(format!("{other:?}")),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user