Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion codex-rs/app-server/tests/suite/v2/turn_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2476,13 +2476,26 @@ async fn turn_start_streams_apply_patch_change_updates_v2() -> Result<()> {
&server.uri(),
"never",
&BTreeMap::from([
(Feature::ApplyPatchFreeform, true),
(Feature::ApplyPatchStreamingEvents, true),
Comment thread
dylan-hurd-oai marked this conversation as resolved.
(Feature::Plugins, false),
(Feature::RemoteModels, false),
(Feature::ShellSnapshot, false),
]),
)?;
write_models_cache(&codex_home)?;
let cache_path = codex_home.join("models_cache.json");
let mut cache: serde_json::Value =
serde_json::from_str(&std::fs::read_to_string(&cache_path)?)?;
let models = cache["models"]
.as_array_mut()
.expect("models_cache.json models should be an array");
let model = models
.first_mut()
.expect("models_cache.json should contain at least one model");
model["slug"] = serde_json::Value::from("mock-model");
model["display_name"] = serde_json::Value::from("mock-model");
model["apply_patch_tool_type"] = serde_json::Value::from("freeform");
std::fs::write(&cache_path, serde_json::to_string_pretty(&cache)?)?;

let mut mcp = McpProcess::new(&codex_home).await?;
timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??;
Expand Down
6 changes: 0 additions & 6 deletions codex-rs/core/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,6 @@
"in_app_browser": {
"type": "boolean"
},
"include_apply_patch_tool": {
"type": "boolean"
},
"js_repl": {
"type": "boolean"
},
Expand Down Expand Up @@ -4224,9 +4221,6 @@
"in_app_browser": {
"type": "boolean"
},
"include_apply_patch_tool": {
"type": "boolean"
},
"js_repl": {
"type": "boolean"
},
Expand Down
5 changes: 0 additions & 5 deletions codex-rs/core/src/config/config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4320,7 +4320,6 @@ async fn feature_table_overrides_legacy_flags() -> std::io::Result<()> {
.await?;

assert!(!config.features.enabled(Feature::ApplyPatchFreeform));
assert!(!config.include_apply_patch_tool);

Ok(())
}
Expand Down Expand Up @@ -7505,7 +7504,6 @@ async fn test_precedence_fixture_with_o3_profile() -> std::io::Result<()> {
compact_prompt: None,
forced_chatgpt_workspace_id: None,
forced_login_method: None,
include_apply_patch_tool: true,
web_search_mode: Constrained::allow_any(WebSearchMode::Cached),
web_search_config: None,
use_experimental_unified_exec_tool: !cfg!(windows),
Expand Down Expand Up @@ -7954,7 +7952,6 @@ async fn test_precedence_fixture_with_gpt3_profile() -> std::io::Result<()> {
compact_prompt: None,
forced_chatgpt_workspace_id: None,
forced_login_method: None,
include_apply_patch_tool: true,
web_search_mode: Constrained::allow_any(WebSearchMode::Cached),
web_search_config: None,
use_experimental_unified_exec_tool: !cfg!(windows),
Expand Down Expand Up @@ -8117,7 +8114,6 @@ async fn test_precedence_fixture_with_zdr_profile() -> std::io::Result<()> {
compact_prompt: None,
forced_chatgpt_workspace_id: None,
forced_login_method: None,
include_apply_patch_tool: true,
web_search_mode: Constrained::allow_any(WebSearchMode::Cached),
web_search_config: None,
use_experimental_unified_exec_tool: !cfg!(windows),
Expand Down Expand Up @@ -8265,7 +8261,6 @@ async fn test_precedence_fixture_with_gpt5_profile() -> std::io::Result<()> {
compact_prompt: None,
forced_chatgpt_workspace_id: None,
forced_login_method: None,
include_apply_patch_tool: true,
web_search_mode: Constrained::allow_any(WebSearchMode::Cached),
web_search_config: None,
use_experimental_unified_exec_tool: !cfg!(windows),
Expand Down
2 changes: 0 additions & 2 deletions codex-rs/core/src/config/managed_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,10 @@ pub(crate) fn validate_feature_requirements_in_config_toml(
let configured_features = Features::from_sources(
FeatureConfigSource {
features: cfg.features.as_ref(),
include_apply_patch_tool: None,
experimental_use_unified_exec_tool: cfg.experimental_use_unified_exec_tool,
},
FeatureConfigSource {
features: profile.features.as_ref(),
include_apply_patch_tool: None,
experimental_use_unified_exec_tool: profile.experimental_use_unified_exec_tool,
},
FeatureOverrides::default(),
Expand Down
9 changes: 0 additions & 9 deletions codex-rs/core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,11 +764,6 @@ pub struct Config {
/// When set, restricts the login mechanism users may use.
pub forced_login_method: Option<ForcedLoginMethod>,

/// Include the `apply_patch` tool for models that benefit from invoking
/// file edits as a structured tool call. When unset, this falls back to the
/// model info's default preference.
pub include_apply_patch_tool: bool,

/// Explicit or feature-derived web search mode.
pub web_search_mode: Constrained<WebSearchMode>,

Expand Down Expand Up @@ -2301,12 +2296,10 @@ impl Config {
let configured_features = Features::from_sources(
FeatureConfigSource {
features: cfg.features.as_ref(),
include_apply_patch_tool: None,
experimental_use_unified_exec_tool: cfg.experimental_use_unified_exec_tool,
},
FeatureConfigSource {
features: config_profile.features.as_ref(),
include_apply_patch_tool: None,
experimental_use_unified_exec_tool: config_profile
.experimental_use_unified_exec_tool,
},
Expand Down Expand Up @@ -2845,7 +2838,6 @@ impl Config {
config
};

let include_apply_patch_tool_flag = features.enabled(Feature::ApplyPatchFreeform);
let use_experimental_unified_exec_tool = features.enabled(Feature::UnifiedExec);

let forced_chatgpt_workspace_id = cfg
Expand Down Expand Up @@ -3257,7 +3249,6 @@ impl Config {
experimental_thread_store: thread_store_config(cfg.experimental_thread_store),
forced_chatgpt_workspace_id,
forced_login_method,
include_apply_patch_tool: include_apply_patch_tool_flag,
web_search_mode: constrained_web_search_mode.value,
web_search_config,
use_experimental_unified_exec_tool,
Expand Down
2 changes: 0 additions & 2 deletions codex-rs/core/src/guardian/review_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ struct GuardianReviewSessionReuseKey {
main_execve_wrapper_exe: Option<PathBuf>,
zsh_path: Option<PathBuf>,
features: ManagedFeatures,
include_apply_patch_tool: bool,
use_experimental_unified_exec_tool: bool,
}

Expand All @@ -176,7 +175,6 @@ impl GuardianReviewSessionReuseKey {
main_execve_wrapper_exe: spawn_config.main_execve_wrapper_exe.clone(),
zsh_path: spawn_config.zsh_path.clone(),
features: spawn_config.features.clone(),
include_apply_patch_tool: spawn_config.include_apply_patch_tool,
use_experimental_unified_exec_tool: spawn_config.use_experimental_unified_exec_tool,
}
}
Expand Down
1 change: 0 additions & 1 deletion codex-rs/core/src/tools/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,6 @@ async fn test_mcp_tool_array_without_items_gets_default_string_items() {
let model_info = construct_model_info_offline("gpt-5.4", &config);
let mut features = Features::with_defaults();
features.enable(Feature::UnifiedExec);
features.enable(Feature::ApplyPatchFreeform);
let available_models = Vec::new();
let tools_config = ToolsConfig::new(&ToolsConfigParams {
model_info: &model_info,
Expand Down
7 changes: 0 additions & 7 deletions codex-rs/core/tests/common/test_codex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use codex_exec_server::CreateDirectoryOptions;
use codex_exec_server::ExecutorFileSystem;
use codex_exec_server::RemoveOptions;
use codex_extension_api::empty_extension_registry;
use codex_features::Feature;
use codex_login::CodexAuth;
use codex_model_provider_info::ModelProviderInfo;
use codex_model_provider_info::built_in_model_providers;
Expand Down Expand Up @@ -581,12 +580,6 @@ impl TestCodexBuilder {
}
ensure_test_model_catalog(&mut config)?;

if config.include_apply_patch_tool {
config.features.enable(Feature::ApplyPatchFreeform)?;
} else {
config.features.disable(Feature::ApplyPatchFreeform)?;
}

Ok((config, cwd))
}
}
Expand Down
14 changes: 2 additions & 12 deletions codex-rs/core/tests/suite/apply_patch_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ pub async fn apply_patch_harness() -> Result<TestCodexHarness> {
async fn apply_patch_harness_with(
configure: impl FnOnce(TestCodexBuilder) -> TestCodexBuilder,
) -> Result<TestCodexHarness> {
let builder = configure(test_codex()).with_config(|config| {
config.include_apply_patch_tool = true;
});
let builder = configure(test_codex());
// Box harness construction so apply_patch_cli tests do not inline the
// full test-thread startup path into each test future.
Box::pin(TestCodexHarness::with_remote_env_builder(builder)).await
Expand Down Expand Up @@ -989,15 +987,7 @@ async fn apply_patch_cli_verification_failure_has_no_side_effects(
) -> Result<()> {
skip_if_no_network!(Ok(()));

let harness = apply_patch_harness_with(|builder| {
builder.with_config(|config| {
config
.features
.enable(Feature::ApplyPatchFreeform)
.expect("test config should allow feature update");
})
})
.await?;
let harness = apply_patch_harness().await?;

// Compose a patch that would create a file, then fail verification on an update.
let call_id = "apply-partial-no-side-effects";
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/core/tests/suite/approvals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
content: "freeform-patch-danger",
},
sandbox_permissions: SandboxPermissions::UseDefault,
features: vec![Feature::ApplyPatchFreeform],
features: vec![],
model_override: Some("gpt-5.4"),
outcome: Outcome::Auto,
expectation: Expectation::PatchApplied {
Expand Down
32 changes: 4 additions & 28 deletions codex-rs/core/tests/suite/code_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,11 @@ async fn run_code_mode_turn(
server: &MockServer,
prompt: &str,
code: &str,
include_apply_patch: bool,
) -> Result<(TestCodex, ResponseMock)> {
let mut builder = test_codex()
.with_model("test-gpt-5.1-codex")
.with_config(move |config| {
let _ = config.features.enable(Feature::CodeMode);
config.include_apply_patch_tool = include_apply_patch;
});
let test = builder.build(server).await?;

Expand Down Expand Up @@ -291,7 +289,6 @@ async fn code_mode_can_return_exec_command_output() -> Result<()> {
r#"
text(JSON.stringify(await tools.exec_command({ cmd: "printf code_mode_exec_marker" })));
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -541,7 +538,6 @@ const result = await tools.update_plan({
});
text(JSON.stringify(result));
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -666,7 +662,6 @@ text(JSON.stringify(await tools.exec_command({
max_output_tokens: 100
})));
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -705,7 +700,6 @@ text("before crash");
text("still before crash");
throw new Error("boom");
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -752,7 +746,6 @@ try {
text(`caught:${error?.message ?? String(error)}`);
}
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -1769,7 +1762,6 @@ async fn code_mode_can_output_serialized_text_via_global_helper() -> Result<()>
r#"
text({ json: true });
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -1801,7 +1793,6 @@ async fn code_mode_can_resume_after_set_timeout() -> Result<()> {
await new Promise((resolve) => setTimeout(resolve, 10));
text("timer done");
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -1830,7 +1821,6 @@ notify("code_mode_notify_marker");
await tools.test_sync_tool({});
text("done");
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -1868,7 +1858,6 @@ text("before");
exit();
text("after");
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -1907,7 +1896,6 @@ const circular = {};
circular.self = circular;
text(circular);
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -1947,7 +1935,6 @@ async fn code_mode_can_output_images_via_global_helper() -> Result<()> {
image("https://example.com/image.jpg");
image("data:image/png;base64,AAA");
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down Expand Up @@ -2137,13 +2124,8 @@ async fn code_mode_can_apply_patch_via_nested_tool() -> Result<()> {
);
let code = format!("text(await tools.apply_patch({patch:?}));\n");

let (test, second_mock) = run_code_mode_turn(
&server,
"use exec to run apply_patch",
&code,
/*include_apply_patch*/ true,
)
.await?;
let (test, second_mock) =
run_code_mode_turn(&server, "use exec to run apply_patch", &code).await?;

let req = second_mock.single_request();
let items = custom_tool_output_items(&req, "call-1");
Expand Down Expand Up @@ -2465,13 +2447,8 @@ const tool = ALL_TOOLS.find(({ name }) => name === "view_image");
text(JSON.stringify(tool));
"#;

let (_test, second_mock) = run_code_mode_turn(
&server,
"use exec to inspect ALL_TOOLS",
code,
/*include_apply_patch*/ false,
)
.await?;
let (_test, second_mock) =
run_code_mode_turn(&server, "use exec to inspect ALL_TOOLS", code).await?;

let req = second_mock.single_request();
let (output, success) = custom_tool_output_body_and_success(&req, "call-1");
Expand Down Expand Up @@ -2890,7 +2867,6 @@ text(JSON.stringify({
waited_long_enough: end_ms - start_ms >= 100,
}));
"#,
/*include_apply_patch*/ false,
)
.await?;

Expand Down
1 change: 0 additions & 1 deletion codex-rs/core/tests/suite/codex_delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ async fn codex_delegate_forwards_patch_approval_and_proceeds_on_decision() {
.permissions
.set_permission_profile(PermissionProfile::read_only())
.expect("set permission profile");
config.include_apply_patch_tool = true;
});
let test = builder.build(&server).await.expect("build test codex");

Expand Down
Loading
Loading