Skip to content

[Feature]: edit tool description doesn't include an example, leading reasoning MoE models to mimic prior wrong shapes #90983

Description

@taerlandsen

Summary

Reasoning MoE models seem to have trouble calling the edit tool in warm and hot calls repeatedly retrying bad calls wasting cycles.

This produces real timeout aborts that look like model failures to users.

Problem to solve

The edit built-in tool's argument schema requires the replacements to be inside an array at edits: {path: string, edits: [{oldText: string, newText: string},
...]}. The current tool description (as exposed to the model in the system prompt's tool catalog) appears to provide the JSON Schema without a literal
example. Reasoning MoE models (Nemotron-3-Super, gpt-oss-120b) interpret the schema and sometimes emit {path, oldText, newText} at the root level instead —
apparently mimicking the shape of other patch-style tools they've seen in training data.

The trap behavior: Once a single wrong-shape attempt is in the conversation history, the model uses it as a template for subsequent calls. Validation rejects.
The model retries with the same wrong template (rather than re-reading the tool definition). This produces a multi-attempt retry loop that burns the
embedded-run timeout budget (~10 min) before aborting.

We observed this on at least two separate sessions in the same workspace. After a session pause (~10 hours), the model went back to the tool definition and
got the schema correct on first try — confirming the issue is hot-context shape-mimicry, not lack of knowledge of the schema.

Reproduction:

  1. Start an iterative code-edit session with Nemotron-3-Super (or gpt-oss-120b)
  2. Make several successful edits to a file (no schema issue yet)
  3. After ~10-20 turns, the model occasionally emits a wrong-shape call
  4. The session enters a retry loop and aborts

Models that don't exhibit this: dense Qwen 27B (in our testing). Possibly because dense models retain schema descriptions more robustly across long contexts than MoE reasoning models do.

Proposed solution

Include an explicit example in the edit tool's description text, e.g.:

edit: Apply targeted replacements to a file. Each replacement is in the edits array.

Example:
{"path": "src/app.js",
"edits": [{"oldText": "foo()", "newText": "bar()"}]}

Note: replacements MUST be inside the edits array. Do not put oldText or newText at the root of the arguments.

The "Do not" reminder is intentional — it appears to help reasoning models that would otherwise generalize incorrectly from JSON Schema alone. Adding ~80-100 tokens of catalog description in exchange for averting multi-minute retry loops is a strongly positive trade.

Alternatives considered

No response

Impact

This impacts anyone using a reasoning MoE model like NVIDIA Nemotron-3-Super-120B-A12B-NVFP4, openai/gpt-oss-120b (via Ollama) on repeated hot edit tool calls

Evidence/examples

No response

Additional information

Environment:

  • OpenClaw 2026.5.28
  • Backend: vLLM 0.19.2rc1.dev134+gfe9c3d6c5 (cu130-nightly Docker image)
  • Models exhibiting the loop: NVIDIA Nemotron-3-Super-120B-A12B-NVFP4, openai/gpt-oss-120b (via Ollama)
  • Tool-call parser: qwen3_coder

Install Method:
vllm/vllm-openai:cu130-nightly

Provider / routing chain:
openclaw -> OpenClaw Gatewayu -> Caddy -> LiteLLM -> Spark Docker Container: nemotron-vllm -> Nemotron-3-Super-120B-A12B-NVFP4

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.enhancementNew feature or requestimpact:crash-loopCrash, hang, restart loop, or process-level availability failure.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions