openclaw - 💡(How to fix) Fix Bug: apply_patch unavailable on non-OpenAI providers due to hardcoded isOpenAIProvider gate

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

In pi-tools-B2ovZXCA.js:

const applyPatchEnabled = applyPatchConfig?.enabled !== false 
    && isOpenAIProvider(options?.modelProvider) 
    && isApplyPatchAllowedForModel({...});

function isOpenAIProvider(provider) {
    return normalized === "openai" || normalized === "openai-codex";
}

This means apply_patch is never created for providers like kimi, anthropic, qwen, etc.

Fix Action

Fix / Workaround

apply_patch Bug Report — Non-OpenAI Provider Unavailability

Bug Summary

apply_patch tool is completely unavailable on non-OpenAI providers due to a hardcoded isOpenAIProvider() provider gate in the runtime.

In pi-tools-B2ovZXCA.js:

const applyPatchEnabled = applyPatchConfig?.enabled !== false 
    && isOpenAIProvider(options?.modelProvider) 
    && isApplyPatchAllowedForModel({...});

Code Example

const applyPatchEnabled = applyPatchConfig?.enabled !== false 
    && isOpenAIProvider(options?.modelProvider) 
    && isApplyPatchAllowedForModel({...});

function isOpenAIProvider(provider) {
    return normalized === "openai" || normalized === "openai-codex";
}
RAW_BUFFERClick to expand / collapse

apply_patch Bug Report — Non-OpenAI Provider Unavailability

Bug Summary

apply_patch tool is completely unavailable on non-OpenAI providers due to a hardcoded isOpenAIProvider() provider gate in the runtime.

Root Cause

In pi-tools-B2ovZXCA.js:

const applyPatchEnabled = applyPatchConfig?.enabled !== false 
    && isOpenAIProvider(options?.modelProvider) 
    && isApplyPatchAllowedForModel({...});

function isOpenAIProvider(provider) {
    return normalized === "openai" || normalized === "openai-codex";
}

This means apply_patch is never created for providers like kimi, anthropic, qwen, etc.

Expected Behavior

Per docs: group:fs includes apply_patch, and allow: ["write"] implicitly allows it. The tool should work regardless of provider.

Actual Behavior

  • apply_patch is silently absent from the tool list on non-OpenAI providers
  • Users must use edit (exact-match only) or write (overwrite entire file) for file changes
  • No multi-file structured patch capability

Related Issues

  • #45269 — apply_patch stripped by policy pipeline (different root cause, affects OpenAI providers)
  • #40538 — log warning noise about apply_patch in profiles (different root cause)

Suggested Fix

Remove the isOpenAIProvider() gate from applyPatchEnabled check. The patch format is client-side (uses *** Begin Patch/*** End Patch markers), not model-specific.

Environment

  • OpenClaw 2026.5.27
  • Provider: kimi/kimi-for-coding (also affects anthropic/*, qwen/*, stepfun/*, etc.)
  • OS: Linux

Status

Reported by: Shweta (engineer agent) Date: 2026-05-30

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Bug: apply_patch unavailable on non-OpenAI providers due to hardcoded isOpenAIProvider gate