[codex] Delete function-style apply_patch (#21651)

## Why

`apply_patch` is now a freeform/custom tool. Keeping the old
JSON/function-style registration and parsing path left another way for
models and tests to invoke `apply_patch`, which made the tool surface
harder to reason about.

## What changed

- Removed the `ApplyPatchToolType::Function` variant, JSON `apply_patch`
spec, and handler support for function payloads.
- Kept `apply_patch_tool_type = freeform` as the supported model
metadata path, including Bedrock catalog metadata.
- Migrated `apply_patch` tests and SSE fixtures to custom/freeform tool
calls.

## Verification

- `cargo test -p codex-tools -p codex-protocol -p codex-model-provider`
- `cargo test -p codex-core tools::handlers::apply_patch --lib`
- `cargo test -p codex-core --test all
apply_patch_tool_executes_and_emits_patch_events`
- `cargo test -p codex-core --test all
apply_patch_reports_parse_diagnostics`
- `cargo test -p codex-exec test_apply_patch_tool`
- `just fix -p codex-core`
- `just fix -p codex-tools -p codex-protocol -p codex-model-provider -p
codex-exec`
This commit is contained in:
pakrym-oai authored and GitHub committed 2026-05-08 13:00:57 -07:00
1 parent cf941ede15
commit e783341b70
20 files changed
+143 -374

No files matched your search

+4 -5
View File
@@ -219,11 +219,10 @@ impl ToolsConfig {
model_shell_type
};
let apply_patch_tool_type = match model_info.apply_patch_tool_type {
Some(ApplyPatchToolType::Freeform) => Some(ApplyPatchToolType::Freeform),
Some(ApplyPatchToolType::Function) => Some(ApplyPatchToolType::Function),
None => include_apply_patch_tool.then_some(ApplyPatchToolType::Function),
};
let apply_patch_tool_type = model_info
.apply_patch_tool_type
.clone()
.or_else(|| include_apply_patch_tool.then_some(ApplyPatchToolType::Freeform));
let agent_jobs_worker_tools = include_agent_jobs
&& matches!(