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:
andrewgu-oai
2026-11-13 18:53:14 +00:00
committed by copyberry
parent 3f2603f2a2
commit dd8cee9822
4 changed files with 66 additions and 12 deletions
@@ -497,6 +497,24 @@ pub struct ShellSnapshotRequest {
pub shell: ShellInfo,
}
/// Optional JSON-RPC error data for a rejected `process/start`.
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "camelCase")]
pub enum ProcessStartErrorData {
SpawnNotFound,
SpawnPermissionDenied,
SpawnFailed,
SandboxUnavailable,
SandboxPreparation,
}
impl ProcessStartErrorData {
pub fn attach_to(self, mut error: JSONRPCErrorError) -> JSONRPCErrorError {
error.data = Some(serde_json::json!(self));
error
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExecResponse {