Validate remote exec-server cwd during startup

Fail fast when a remote exec-server cannot see the configured thread cwd. This catches the most dangerous split-brain state before user instructions, skills, or tool processes are resolved from the wrong filesystem.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
jif-oai
2026-04-09 12:15:58 +01:00
parent 8f705b0702
commit 310be316ff

View File

@@ -546,6 +546,15 @@ impl Codex {
.current()
.await
.map_err(|err| CodexErr::Fatal(format!("failed to create environment: {err}")))?;
if let Some(environment) = environment.as_ref()
&& environment.is_remote()
&& let Err(err) = environment.get_filesystem().get_metadata(&config.cwd).await
{
return Err(CodexErr::Fatal(format!(
"remote exec-server cannot access cwd `{}`: {err}",
config.cwd.display()
)));
}
let user_instructions = get_user_instructions(&config, environment.as_deref()).await;
let exec_policy = if crate::guardian::is_guardian_reviewer_source(&session_source) {