fix(runtime-install): address API review feedback

This commit is contained in:
acrognale-oai
2026-06-15 14:38:41 +00:00
parent 2ac7dc97f3
commit afa24ee86e
22 changed files with 53 additions and 536 deletions
+12
View File
@@ -1,4 +1,5 @@
use codex_app_server_protocol::JSONRPCErrorError;
use codex_exec_server::ExecServerError;
const INVALID_PARAMS_ERROR_CODE: i64 = -32602;
const INTERNAL_ERROR_CODE: i64 = -32603;
@@ -11,6 +12,17 @@ pub(crate) fn internal_error(message: impl Into<String>) -> JSONRPCErrorError {
error(INTERNAL_ERROR_CODE, message)
}
pub(crate) fn exec_server_error_to_jsonrpc(err: ExecServerError) -> JSONRPCErrorError {
match err {
ExecServerError::Server { code, message } => JSONRPCErrorError {
code,
message,
data: None,
},
_ => internal_error(err.to_string()),
}
}
fn error(code: i64, message: impl Into<String>) -> JSONRPCErrorError {
JSONRPCErrorError {
code,
+5 -1
View File
@@ -17,6 +17,7 @@ use codex_utils_path_uri::PathUri;
use tokio_util::sync::CancellationToken;
use uuid::Uuid;
use crate::errors::exec_server_error_to_jsonrpc;
use crate::errors::internal_error;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
@@ -55,7 +56,10 @@ pub(crate) struct RuntimeExecutor {
impl RuntimeExecutor {
pub(crate) async fn new(environment: &Environment) -> Result<Self, JSONRPCErrorError> {
let codex_home = environment.codex_home().await?;
let codex_home = environment
.codex_home()
.await
.map_err(exec_server_error_to_jsonrpc)?;
Ok(Self {
backend: environment.get_exec_backend(),
filesystem: environment.get_filesystem(),