mirror of
https://github.com/openai/codex.git
synced 2026-04-24 06:35:50 +00:00
Inject executor-aware filesystem into app-server
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -31,11 +31,15 @@ pub(crate) struct FsApi {
|
||||
file_system: Arc<dyn ExecutorFileSystem>,
|
||||
}
|
||||
|
||||
impl FsApi {
|
||||
pub(crate) fn new(file_system: Arc<dyn ExecutorFileSystem>) -> Self {
|
||||
Self { file_system }
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for FsApi {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
file_system: Environment::default().get_filesystem(),
|
||||
}
|
||||
Self::new(Environment::default().get_filesystem())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ fn start_uninitialized(args: InProcessStartArgs) -> InProcessClientHandle {
|
||||
let processor_outgoing = Arc::clone(&outgoing_message_sender);
|
||||
let (processor_tx, mut processor_rx) = mpsc::channel::<ProcessorCommand>(channel_capacity);
|
||||
let mut processor_handle = tokio::spawn(async move {
|
||||
let mut processor = MessageProcessor::new(MessageProcessorArgs {
|
||||
let mut processor = match MessageProcessor::new(MessageProcessorArgs {
|
||||
outgoing: Arc::clone(&processor_outgoing),
|
||||
arg0_paths: args.arg0_paths,
|
||||
config: args.config,
|
||||
@@ -417,7 +417,15 @@ fn start_uninitialized(args: InProcessStartArgs) -> InProcessClientHandle {
|
||||
config_warnings: args.config_warnings,
|
||||
session_source: args.session_source,
|
||||
enable_codex_api_key_env: args.enable_codex_api_key_env,
|
||||
});
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(processor) => processor,
|
||||
Err(err) => {
|
||||
warn!("failed to build in-process message processor: {err}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let mut thread_created_rx = processor.thread_created_receiver();
|
||||
let mut session = ConnectionSessionState::default();
|
||||
let mut listen_for_threads = true;
|
||||
|
||||
@@ -623,7 +623,13 @@ pub async fn run_main_with_transport(
|
||||
config_warnings,
|
||||
session_source: SessionSource::VSCode,
|
||||
enable_codex_api_key_env: false,
|
||||
});
|
||||
})
|
||||
.await
|
||||
.map_err(|err| {
|
||||
std::io::Error::other(format!(
|
||||
"failed to build app-server message processor: {err}"
|
||||
))
|
||||
})?;
|
||||
let mut thread_created_rx = processor.thread_created_receiver();
|
||||
let mut running_turn_count_rx = processor.subscribe_running_assistant_turn_count();
|
||||
let mut connections = HashMap::<ConnectionId, ConnectionState>::new();
|
||||
|
||||
@@ -117,7 +117,7 @@ impl TracingHarness {
|
||||
let server = create_mock_responses_server_repeating_assistant("Done").await;
|
||||
let codex_home = TempDir::new()?;
|
||||
let config = Arc::new(build_test_config(codex_home.path(), &server.uri()).await?);
|
||||
let (processor, outgoing_rx) = build_test_processor(config);
|
||||
let (processor, outgoing_rx) = build_test_processor(config).await;
|
||||
let tracing = init_test_tracing();
|
||||
tracing.exporter.reset();
|
||||
tracing::callsite::rebuild_interest_cache();
|
||||
@@ -224,7 +224,7 @@ async fn build_test_config(codex_home: &Path, server_uri: &str) -> Result<Config
|
||||
.await?)
|
||||
}
|
||||
|
||||
fn build_test_processor(
|
||||
async fn build_test_processor(
|
||||
config: Arc<Config>,
|
||||
) -> (
|
||||
MessageProcessor,
|
||||
@@ -246,7 +246,9 @@ fn build_test_processor(
|
||||
config_warnings: Vec::new(),
|
||||
session_source: SessionSource::VSCode,
|
||||
enable_codex_api_key_env: false,
|
||||
});
|
||||
})
|
||||
.await
|
||||
.expect("test message processor should build");
|
||||
(processor, outgoing_rx)
|
||||
}
|
||||
|
||||
|
||||
@@ -181,6 +181,7 @@ pub use file_watcher::FileWatcherEvent;
|
||||
pub use safety::get_platform_sandbox;
|
||||
pub use tools::spec::parse_tool_input_schema;
|
||||
pub use turn_metadata::build_turn_metadata_header;
|
||||
pub use unified_exec::executor_environment_for_config;
|
||||
pub mod compact;
|
||||
pub mod memory_trace;
|
||||
pub mod otel_init;
|
||||
|
||||
@@ -221,7 +221,6 @@ pub async fn executor_backends_for_config(
|
||||
})
|
||||
.map_err(|err| io::Error::other(err.to_string()))
|
||||
}
|
||||
|
||||
fn default_local_exec_server_command() -> ExecServerLaunchCommand {
|
||||
let binary_name = if cfg!(windows) {
|
||||
"codex-exec-server.exe"
|
||||
|
||||
@@ -51,6 +51,7 @@ pub(crate) fn set_deterministic_process_ids_for_tests(enabled: bool) {
|
||||
pub use backend::ExecutorBackends;
|
||||
pub use backend::executor_backends_for_config;
|
||||
pub(crate) use backend::UnifiedExecSessionFactoryHandle;
|
||||
pub use backend::executor_environment_for_config;
|
||||
pub(crate) use backend::local_unified_exec_session_factory;
|
||||
pub(crate) use backend::session_execution_backends_for_config;
|
||||
pub(crate) use errors::UnifiedExecError;
|
||||
|
||||
Reference in New Issue
Block a user