fix: remove isOpenAIProvider gate from applyPatchEnabled#88359
fix: remove isOpenAIProvider gate from applyPatchEnabled#88359bottenbenny wants to merge 7 commits into
Conversation
apply_patch was unconditionally gated to only work with OpenAI providers (openai, openai-codex) via isOpenAIProvider(). This prevented the tool from being available on kimi, anthropic, qwen, stepfun, and all other providers. The apply_patch format is client-side (*** Begin Patch/End Patch markers) and is not model-specific. The remaining isApplyPatchAllowedForModel check still allows per-model allowlisting via tools.exec.applyPatch.allowModels. Fixes openclaw#88357 Closes openclaw#45269 (related - same underlying issue of apply_patch being treated as provider-specific)
|
Codex review: needs real behavior proof before merge. Reviewed June 1, 2026, 1:40 PM ET / 17:40 UTC. Summary PR surface: Source -6, Tests 0. Total -6 across 3 files. Reproducibility: yes. from source: current main gates apply_patch on Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the current default boundary until maintainers define an explicit provider/model capability or non-OpenAI opt-in path, then update tests, docs/help/UI text, and require direct runtime proof for that chosen contract. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main gates apply_patch on Is this the best way to solve the issue? No. Removing the provider gate is a plausible implementation, but the best fix needs an explicit provider/model capability or opt-in contract plus upgrade-safe docs and direct apply_patch runtime proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against ba88b7a1780f. Label changesLabel justifications:
Evidence reviewedPR surface: Source -6, Tests 0. Total -6 across 3 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Updates tests to match the fix that removes the isOpenAIProvider gate from applyPatchEnabled, making apply_patch available for all providers. The tests previously enforced the old (buggy) behavior where apply_patch was only available for openai and openai-codex providers.
Repairs a batch of narrow model/provider edge cases: - honor OpenAI and Anthropic base URL environment overrides when provider config does not set an explicit base URL - preserve OpenRouter Anthropic cache retention while stripping unsupported transport options - allow apply_patch for non-OpenAI providers when the tool config otherwise permits it - prune stale same-provider model selections from configure/model picker state - expose GitHub Copilot bundled thinking policy metadata to offline/provider-policy lookups - repair additive SQLite shared-state upgrades for existing databases - keep same-size rotated log readers from reusing stale content in CI tooling Proof: - GitHub PR checks green on exact head 4651490 - Crabbox delegated Blacksmith Testbox tbx_01kt3em5r9vd7g0bnykrff6jdk exited 0 - Focused local Vitest/oxlint/format proof recorded in PR body and land-ready comment Fixes #80347. Fixes #88357. Fixes #45269. Supersedes #74427, #74432, #79370, #79894, #80366, and #88359.
Repairs a batch of narrow model/provider edge cases: - honor OpenAI and Anthropic base URL environment overrides when provider config does not set an explicit base URL - preserve OpenRouter Anthropic cache retention while stripping unsupported transport options - allow apply_patch for non-OpenAI providers when the tool config otherwise permits it - prune stale same-provider model selections from configure/model picker state - expose GitHub Copilot bundled thinking policy metadata to offline/provider-policy lookups - repair additive SQLite shared-state upgrades for existing databases - keep same-size rotated log readers from reusing stale content in CI tooling Proof: - GitHub PR checks green on exact head 4651490 - Crabbox delegated Blacksmith Testbox tbx_01kt3em5r9vd7g0bnykrff6jdk exited 0 - Focused local Vitest/oxlint/format proof recorded in PR body and land-ready comment Fixes openclaw#80347. Fixes openclaw#88357. Fixes openclaw#45269. Supersedes openclaw#74427, openclaw#74432, openclaw#79370, openclaw#79894, openclaw#80366, and openclaw#88359.
Repairs a batch of narrow model/provider edge cases: - honor OpenAI and Anthropic base URL environment overrides when provider config does not set an explicit base URL - preserve OpenRouter Anthropic cache retention while stripping unsupported transport options - allow apply_patch for non-OpenAI providers when the tool config otherwise permits it - prune stale same-provider model selections from configure/model picker state - expose GitHub Copilot bundled thinking policy metadata to offline/provider-policy lookups - repair additive SQLite shared-state upgrades for existing databases - keep same-size rotated log readers from reusing stale content in CI tooling Proof: - GitHub PR checks green on exact head 4651490 - Crabbox delegated Blacksmith Testbox tbx_01kt3em5r9vd7g0bnykrff6jdk exited 0 - Focused local Vitest/oxlint/format proof recorded in PR body and land-ready comment Fixes openclaw#80347. Fixes openclaw#88357. Fixes openclaw#45269. Supersedes openclaw#74427, openclaw#74432, openclaw#79370, openclaw#79894, openclaw#80366, and openclaw#88359.
Repairs a batch of narrow model/provider edge cases: - honor OpenAI and Anthropic base URL environment overrides when provider config does not set an explicit base URL - preserve OpenRouter Anthropic cache retention while stripping unsupported transport options - allow apply_patch for non-OpenAI providers when the tool config otherwise permits it - prune stale same-provider model selections from configure/model picker state - expose GitHub Copilot bundled thinking policy metadata to offline/provider-policy lookups - repair additive SQLite shared-state upgrades for existing databases - keep same-size rotated log readers from reusing stale content in CI tooling Proof: - GitHub PR checks green on exact head 4651490 - Crabbox delegated Blacksmith Testbox tbx_01kt3em5r9vd7g0bnykrff6jdk exited 0 - Focused local Vitest/oxlint/format proof recorded in PR body and land-ready comment Fixes openclaw#80347. Fixes openclaw#88357. Fixes openclaw#45269. Supersedes openclaw#74427, openclaw#74432, openclaw#79370, openclaw#79894, openclaw#80366, and openclaw#88359.
Bug
apply_patch was unconditionally gated to only work with OpenAI providers (openai, openai-codex) via isOpenAIProvider(). This prevented the tool from being available on kimi, anthropic, qwen, stepfun, and all other providers.
Root cause
In src/agents/agent-tools.ts, the applyPatchEnabled logic included a check that only allowed the tool for OpenAI providers.
Fix
Remove the isOpenAIProvider check. The apply_patch format is client-side (*** Begin Patch / *** End Patch markers) and is not model-specific. The remaining isApplyPatchAllowedForModel check still allows per-model allowlisting via tools.exec.applyPatch.allowModels.
Changes
Fixes
apply_patchis treated as an unknown/plugin-only tool in agent policy pipeline, so agent-routed runs cannot execute it #45269 (related — same underlying issue of apply_patch being treated as provider-specific)Verification
Real behavior proof
Behavior or issue addressed: apply_patch tool was gated to only work with OpenAI providers (openai, openai-codex) via isOpenAIProvider(). This prevented non-OpenAI providers like kimi, anthropic, qwen, and stepfun from using the apply_patch tool even when explicitly enabled in config.
Real environment tested: OpenClaw gateway 2026.5.27 (27ae826) running on Linux (Ubuntu 24.04), agent:engineer session, kimi/kimi-for-coding provider (non-OpenAI).
Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: The edit tool (which internally uses apply_patch) successfully modified the file on the kimi provider. The tool call completed without errors and the file content was updated as expected. This confirms apply_patch is now available and functional on non-OpenAI providers.
What was not tested: Direct apply_patch tool invocation via the raw patch format (*** Begin Patch / *** End Patch markers) — only tested through the edit tool wrapper. Other non-OpenAI providers (anthropic, qwen, stepfun, google) not explicitly tested, but the code change removes the provider gate universally.