mirror of
https://github.com/openai/codex.git
synced 2026-05-03 21:01:55 +03:00
codex: simplify remote sandbox launch payload
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -20,7 +20,8 @@ arc-swap = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
clap = { workspace = true, features = ["derive"] }
|
||||
codex-arg0 = { workspace = true }
|
||||
codex-network-proxy = { workspace = true }
|
||||
codex-protocol = { workspace = true }
|
||||
codex-sandboxing = { workspace = true }
|
||||
codex-app-server-protocol = { workspace = true }
|
||||
codex-utils-absolute-path = { workspace = true }
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
use clap::Parser;
|
||||
use codex_arg0::Arg0DispatchPaths;
|
||||
use codex_arg0::arg0_dispatch_or_else;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
struct ExecServerArgs {
|
||||
@@ -13,11 +11,11 @@ struct ExecServerArgs {
|
||||
listen: String,
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
arg0_dispatch_or_else(|arg0_paths: Arg0DispatchPaths| async move {
|
||||
let args = ExecServerArgs::parse();
|
||||
codex_exec_server::configure_arg0_paths(arg0_paths);
|
||||
codex_exec_server::run_main_with_listen_url(&args.listen).await?;
|
||||
Ok(())
|
||||
})
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args = ExecServerArgs::parse();
|
||||
codex_exec_server::run_main_with_listen_url(&args.listen)
|
||||
.await
|
||||
.map_err(|err| anyhow::Error::msg(err.to_string()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ mod remote_process;
|
||||
mod rpc;
|
||||
mod server;
|
||||
|
||||
use codex_arg0::Arg0DispatchPaths;
|
||||
|
||||
pub use client::ExecServerClient;
|
||||
pub use client::ExecServerError;
|
||||
pub use client_api::ExecServerClientConnectOptions;
|
||||
@@ -67,7 +65,3 @@ pub use server::DEFAULT_LISTEN_URL;
|
||||
pub use server::ExecServerListenUrlParseError;
|
||||
pub use server::run_main;
|
||||
pub use server::run_main_with_listen_url;
|
||||
|
||||
pub fn configure_arg0_paths(arg0_paths: Arg0DispatchPaths) {
|
||||
local_process::configure_codex_linux_sandbox_exe(arg0_paths.codex_linux_sandbox_exe);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ impl ExecBackend for RemoteProcess {
|
||||
let sandbox_type = params
|
||||
.sandbox
|
||||
.as_ref()
|
||||
.map_or(SandboxType::None, |sandbox| sandbox.sandbox_type());
|
||||
.map_or(SandboxType::None, |sandbox| sandbox.sandbox);
|
||||
let session = self.client.register_session(&process_id).await?;
|
||||
match self.client.exec(params).await {
|
||||
Ok(_) => {}
|
||||
|
||||
@@ -17,7 +17,6 @@ use codex_protocol::permissions::FileSystemSandboxPolicy;
|
||||
use codex_protocol::permissions::NetworkSandboxPolicy;
|
||||
use codex_protocol::protocol::SandboxPolicy;
|
||||
use codex_sandboxing::SandboxLaunchConfig;
|
||||
use codex_sandboxing::SandboxLaunchMode;
|
||||
use codex_sandboxing::SandboxType;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
@@ -234,7 +233,7 @@ fn platform_sandbox_type() -> SandboxType {
|
||||
fn write_outside_workspace_sandbox(workspace_root: &std::path::Path) -> SandboxLaunchConfig {
|
||||
let policy = SandboxPolicy::new_workspace_write_policy();
|
||||
SandboxLaunchConfig {
|
||||
mode: SandboxLaunchMode::Require,
|
||||
sandbox: platform_sandbox_type(),
|
||||
policy: policy.clone(),
|
||||
file_system_policy: FileSystemSandboxPolicy::from_legacy_sandbox_policy(
|
||||
&policy,
|
||||
|
||||
Reference in New Issue
Block a user