Skip to content

[BUG] apply_diff sent when diffs disabled, model loops on validation error #9919

@denis-kudelin

Description

@denis-kudelin

Problem (one or two sentences)

apply_diff stays in the advertised tool list and is sent to the model even when diff tools are disabled (diffEnabled=false). The model keeps calling it and hits a validation error (Tool "apply_diff" is not allowed …), blocking progress.

Context (who is affected and when)

  • Any provider using native tools (OpenAI/OpenAI-compatible and others) when the user has turned off diffs in settings/profile.
  • Reproducible in code-editing modes; switching modes does not help.

Reproduction steps

  1. Set diffEnabled=false (profile/state).
  2. Use a native-tools-capable provider; start a task in code (or similar) mode.
  3. Observe: the tools array sent to the model still includes apply_diff.
  4. The model calls apply_diff; extension validation rejects it with “Tool "apply_diff" is not allowed in code mode.”
  5. Model retries the same tool call (reasoning shows the ban), causing a loop/no edits.

Expected result

apply_diff is omitted from advertised tools and not sent to the API when diffs are disabled; the model won’t call it.

Actual result

apply_diff is sent to the model even with diffs disabled; calls fail at validation, and the agent stalls/retries.

Variations tried (optional)

  • Switching between editing modes — tool still advertised.
  • Native tool protocol only; XML catalog correctly drops the description when diff is off, but native still sends the tool definition.

App Version

3.36.2

API Provider (optional)

OpenAI Compatible

Model Used (optional)

N/A

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue/PR - TriageNew issue. Needs quick review to confirm validity and assign labels.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions