mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
Add structured error kinds for exec-server process starts (#61358)
## What changed Attach a tagged `ProcessStartErrorData` value to JSON-RPC errors for not-found, permission-denied, and other spawn failures, unavailable sandboxes, and sandbox preparation failures. Record the error code and structured error kind for failed `process/start` responses in the `codex.exec_server.response_received` tracing event. GitOrigin-RevId: 556d0068e469ea25e95108262826a77a66b7d83b
This commit is contained in:
@@ -10,6 +10,7 @@ use std::time::Duration;
|
||||
use crate::process_telemetry::ProcessTelemetry;
|
||||
use crate::process_telemetry::ProcessTelemetryEvent;
|
||||
use codex_exec_server_protocol::JSONRPCErrorError;
|
||||
use codex_exec_server_protocol::ProcessStartErrorData;
|
||||
use codex_network_proxy::NetworkPolicyAuditEvent;
|
||||
use codex_network_proxy::NetworkPolicyAuditObserver;
|
||||
use codex_network_proxy::NetworkProtocol;
|
||||
@@ -456,7 +457,17 @@ impl LocalProcess {
|
||||
) {
|
||||
process_map.remove(&process_id);
|
||||
}
|
||||
return Err(internal_error(err.to_string()));
|
||||
let io_error = err
|
||||
.chain()
|
||||
.find_map(|cause| cause.downcast_ref::<std::io::Error>());
|
||||
let kind = match io_error.map(std::io::Error::kind) {
|
||||
Some(std::io::ErrorKind::NotFound) => ProcessStartErrorData::SpawnNotFound,
|
||||
Some(std::io::ErrorKind::PermissionDenied) => {
|
||||
ProcessStartErrorData::SpawnPermissionDenied
|
||||
}
|
||||
_ => ProcessStartErrorData::SpawnFailed,
|
||||
};
|
||||
return Err(kind.attach_to(internal_error(err.to_string())));
|
||||
}
|
||||
};
|
||||
let metrics = self.inner.telemetry.process_started(&process_id);
|
||||
|
||||
Reference in New Issue
Block a user