mirror of
https://github.com/openai/codex.git
synced 2026-04-27 16:15:09 +00:00
[codex] Apply patches through executor filesystem (#17048)
## Summary - run apply_patch through the executor filesystem when a remote environment is present instead of shelling out to the local process - thread the executor FileSystem into apply_patch interception and keep existing local behavior for non-remote turns - make the apply_patch integration harness use the executor filesystem for setup/assertions - add remote-aware skips for turn-diff coverage that still reads the test-runner filesystem ## Why Remote apply_patch needed to mutate the remote workspace instead of the local checkout. The tests also needed to seed and assert workspace state through the same filesystem abstraction so local and remote runs exercise the same behavior. ## Validation - `just fmt` - `git diff --check` - `cargo check -p core_test_support --tests` - `cargo test -p codex-core --test all suite::shell_serialization::apply_patch_custom_tool_call -- --nocapture` - `cargo test -p codex-core --test all suite::apply_patch_cli::apply_patch_cli_updates_file_appends_trailing_newline -- --nocapture` - remote `cargo test -p codex-core --test all apply_patch_cli -- --nocapture` (229 passed)
This commit is contained in:
@@ -303,6 +303,10 @@ pub fn sandbox_network_env_var() -> &'static str {
|
||||
|
||||
const REMOTE_ENV_ENV_VAR: &str = "CODEX_TEST_REMOTE_ENV";
|
||||
|
||||
pub fn remote_env_env_var() -> &'static str {
|
||||
REMOTE_ENV_ENV_VAR
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct RemoteEnvConfig {
|
||||
pub container_name: String,
|
||||
@@ -537,6 +541,30 @@ macro_rules! skip_if_no_network {
|
||||
}};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! skip_if_remote {
|
||||
($reason:expr $(,)?) => {{
|
||||
if ::std::env::var_os($crate::remote_env_env_var()).is_some() {
|
||||
eprintln!(
|
||||
"Skipping test under {}: {}",
|
||||
$crate::remote_env_env_var(),
|
||||
$reason
|
||||
);
|
||||
return;
|
||||
}
|
||||
}};
|
||||
($return_value:expr, $reason:expr $(,)?) => {{
|
||||
if ::std::env::var_os($crate::remote_env_env_var()).is_some() {
|
||||
eprintln!(
|
||||
"Skipping test under {}: {}",
|
||||
$crate::remote_env_env_var(),
|
||||
$reason
|
||||
);
|
||||
return $return_value;
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! codex_linux_sandbox_exe_or_skip {
|
||||
() => {{
|
||||
|
||||
Reference in New Issue
Block a user