Repository navigation
Closed
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
Description
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
- Configure OpenClaw with
tools.exec.applyPatch.enabled = true - Use an eligible OpenAI/Codex model (for example
gpt-5.1-codex-mini/gpt-5.4depending on local config) - Run an agent turn that asks to update a workspace file using
apply_patch - Observe:
- no actual
apply_patchtool call in session history - file unchanged
- logs contain unknown-entry warnings for
apply_patch
- no actual
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_patchbe 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?
Reacted by Leo Wandersleb and ARESXIONG
Metadata
Metadata
Assignees
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
Fields
Priority
None yet
Activity
dsantoreis commentedon Mar 13, 2026
dsantoreis commentedon Mar 13, 2026
Giszmo commentedon Mar 16, 2026
Using ppq.ai's "autoclaw" as described here I'm running into the same issue. As autoclaw is routing to up to 4 different models, it might not be compatible with the fix proposed by @justinhuangcode ?
My crustacean suggests to add:
Crustacean claimed to have patched the local version with #45293 and kimi k2.5 still failed when being triggered via ppq/autoclaw.
huangmingche commentedon Mar 23, 2026
I took another look at this on the latest upstream
main, and I think my original read in #45293 was probably off.At this point, my best read is that the main failure mode here is happening earlier, at tool creation time in
src/agents/pi-tools.ts, not intool-policy-pipeline.apply_patchcurrently only seems to get created when:tools.exec.applyPatch.enabledis onopenaioropenai-codextools.exec.applyPatch.allowModelsmatches, if configuredRelevant source:
So in cases like
ppq/autoclaw, my suspicion is thatapply_patchnever gets created in the first place, which would also explain why applying #45293 locally didn’t help.The current tests also seem to line up with that reading:
So I think this likely needs to be re-triaged as a provider/model capability gating issue rather than a policy-pipeline classification bug.
huangmingche commentedon Mar 23, 2026
Hi @Alfred-claw28, could you please give this another try on the latest stable release,
v2026.3.22(e7d11f6)?The original report was on
2026.3.12, and the warning behavior has changed since then. Newer versions distinguish gated core tools likeapply_patchfrom truly unknown/plugin-only entries, so it would be helpful to confirm whether this still reproduces on current stable.If it does, could you share:
tools.exec.applyPatchconfigfix(agents): include core tools with metadata in coreToolNames
openclaw-barnacle commentedon Apr 28, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
clawsweeper commentedon Apr 29, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Latest ClawSweeper review: 2026-05-24 12:12 UTC / May 24, 2026, 8:12 AM ET.
Workflow note: Future ClawSweeper reviews update this same comment in place.
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Summary
Keep open: current main and v2026.5.22 still construct
apply_patchonly for exactopenaioropenai-codexprovider IDs, so the routed/custom provider support question remains unresolved and security-sensitive.Reproducibility: yes. at source level. Passing a routed/custom
modelProviderother than exactopenaioropenai-codexmakesapplyPatchEnabledfalse before policy filtering, although I did not run a live routed-gateway session.Next step
Maintainers need to choose whether and how routed/custom provider IDs can be trusted for
apply_patchbefore a fix PR should widen the gate.Security
Needs attention: The issue is security-sensitive because routed/custom provider support would change which provider identities can receive a filesystem-mutating tool.
Review details
Best possible solution:
Define a fail-closed trusted-provider or capability contract for routed
apply_patchsupport, or explicitly document routed/custom providers as unsupported, then align creation logic, warnings, docs, and regression coverage.Do we have a high-confidence way to reproduce the issue?
Yes, at source level. Passing a routed/custom
modelProviderother than exactopenaioropenai-codexmakesapplyPatchEnabledfalse before policy filtering, although I did not run a live routed-gateway session.Is this the best way to solve the issue?
No. A policy-pipeline-only workaround addresses the misleading classification symptom, but the durable solution needs explicit routed-provider trust semantics or a documented unsupported boundary.
Label justifications:
P2: This affects a real coding workflow with limited blast radius, but the remaining fix needs maintainer product and security judgment.impact:security: The remaining decision controls access toapply_patch, a filesystem-mutating tool, across provider trust boundaries.impact:auth-provider: The behavior depends on provider identity and routed model selection before the tool is constructed.Security concerns:
src/agents/pi-tools.ts:652Routed/custom provider support would let additional model-provider paths receive
apply_patch, so any implementation should fail closed behind an explicit trusted-provider or capability contract rather than infer trust from provider-name aliases.Confidence: 0.9
Acceptance criteria:
What I checked:
isOpenAIProviderstill accepts onlyopenaiandopenai-codex, so a routed provider alias does not qualify. (src/agents/pi-tools.ts:104, 996d07ee466c)applyPatchEnabledrequires the exact provider gate and model allowlist before theapply_patchtool is created; policy filtering cannot restore it later. (src/agents/pi-tools.ts:652, 996d07ee466c)apply_patchappears foropenaiandopenai-codex, is absent without provider context, and is absent for non-OpenAI providers. (src/agents/pi-tools.create-openclaw-coding-tools.test.ts:687, 996d07ee466c)apply_patchbut still warn for explicit allowlists when the gated core tool is unavailable. (src/agents/tool-policy-pipeline.test.ts:93, 996d07ee466c)apply_patchas enabled by default for OpenAI/OpenAI Codex models and explicitly note it is only available for those models. Public docs:docs/tools/exec.md. (docs/tools/exec.md:255, 996d07ee466c)v2026.5.22contains the same exact-provider construction gate, so the remaining limitation is shipped behavior, not only current-main drift. (src/agents/pi-tools.ts:655, a374c3a5bfd5)Likely related people:
apply_patchand its docs in8b4bdaa8a473, including the exact OpenAI/OpenAI-Codex provider gate; also clarified gated core tool warnings in394fd87c2c49. (role: introduced behavior and adjacent warning-path contributor; confidence: high; commits: 8b4bdaa8a473, 394fd87c2c49; files:src/agents/pi-tools.ts,docs/tools/apply-patch.md,docs/tools/exec.md)src/agents/tool-policy-pipeline.ts,src/agents/tool-policy-pipeline.test.ts,src/agents/pi-tools.ts)src/agents/tool-policy-pipeline.ts,src/agents/tool-policy.ts,src/agents/tool-policy-pipeline.test.ts)src/agents/tool-policy-pipeline.ts,src/agents/tool-policy-pipeline.test.ts)Remaining risk / open question:
apply_patchto routed/custom provider IDs without an explicit trust contract could expose a filesystem-mutating tool to provider paths the operator did not intend to trust.Codex review notes: model gpt-5.5, reasoning high; reviewed against 996d07ee466c.
fix: repair model provider edge cases
fix: repair model provider edge cases