Skip to content

[Bug]: apply_patch is treated as an unknown/plugin-only tool in agent policy pipeline, so agent-routed runs cannot execute it #45269

@Alfred-claw28

Description

@Alfred-claw28

Bug type

Regression (worked before, now fails)

Summary

Summary

In OpenClaw 2026.3.12, apply_patch appears to exist as a built-in runtime tool, but the agent tool-policy pipeline strips it from allowlists before execution.
This causes repeated warnings like:

  • tools.profile (coding) allowlist contains unknown entries (apply_patch)
  • tools.allow allowlist contains unknown entries (apply_patch)

Steps to reproduce

Reproduction

  1. Configure OpenClaw with tools.exec.applyPatch.enabled = true
  2. Use an eligible OpenAI/Codex model (for example gpt-5.1-codex-mini / gpt-5.4 depending on local config)
  3. Run an agent turn that asks to update a workspace file using apply_patch
  4. Observe:
    • no actual apply_patch tool call in session history
    • file unchanged
    • logs contain unknown-entry warnings for apply_patch

Expected behavior

Expected behavior

If apply_patch is a supported built-in tool for the active runtime/model, it should be recognized as a core/valid tool during allowlist resolution and should not be stripped as an unknown entry.

Actual behavior

Actual behavior

apply_patch is treated as unknown/plugin-only during allowlist sanitization, so agent runs cannot execute it.

OpenClaw version

OpenClaw 2026.3.12

Operating system

Linux Mint 22.3

Install method

npm global

Model

Openai GPT 5-4

Provider / routing chain

openclaw->tailscale-gateway

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

Temporary local workaround used

A narrow local patch that forces apply_patch into coreToolNames for this pipeline:

const coreToolNames = new Set(
  params.tools
    .filter((tool) => !params.toolMeta(tool) || normalizeToolName$1(tool.name) === "apply_patch")
    .map((tool) => normalizeToolName$1(tool.name))
    .filter(Boolean)
);

Questions for maintainers

  • Should apply_patch be treated as a core tool in this path?
  • Is the toolMeta(...) test too broad for built-in tools that carry metadata?
  • Are there other built-ins affected by the same classification issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.bugSomething isn't workingclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.regressionBehavior that previously worked and now fails

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions