Skip to content

Agent tool schema forces mutually exclusive working_dir and isolation parameters #7315

Description

@jpwong

Description

In Qwen Code 0.20.0, Agent tool calls generated through an OpenAI-compatible provider can make the optional working_dir and isolation fields behave as if both are required. This makes normal, caller-owned-worktree, and isolated-worktree subagent launches fail validation.

The model can explicitly recognize the conflict and say that it will omit one field, but the next emitted tool call still contains both fields. Repeated retries can eventually trigger loop detection.

Environment

  • Qwen Code: 0.20.0
  • Model: gpt-5.6-sol
  • Provider interface: OpenAI-compatible
  • OS: Linux
  • Agent type used: built-in Explore

Reproduction 1: caller-owned worktree

Create a Git repository with an existing registered linked worktree, then ask:

Use the Explore subagent to inspect the existing linked worktree at /path/to/repo/.qwen/worktrees/existing. Pin the subagent to that caller-owned worktree and wait for its result.

Expected Agent arguments:

{
  "subagent_type": "Explore",
  "working_dir": "/path/to/repo/.qwen/worktrees/existing",
  "run_in_background": false
}

Actual Agent arguments:

{
  "isolation": "worktree",
  "subagent_type": "Explore",
  "working_dir": "/path/to/repo/.qwen/worktrees/existing",
  "run_in_background": false
}

Result:

Parameters "working_dir" and "isolation" are mutually exclusive.

The model then says it will retry without isolation, but emits the same arguments repeatedly until loop detection stops the run.

Reproduction 2: isolated temporary worktree

Ask:

Use the Explore subagent in a newly created isolated temporary worktree.

Expected Agent arguments:

{
  "subagent_type": "Explore",
  "isolation": "worktree",
  "run_in_background": false
}

Actual calls contain either:

{
  "isolation": "worktree",
  "working_dir": ""
}

or a non-empty current-repository path in working_dir. The resulting errors are:

Parameter "working_dir" must be a non-empty string when set.

or:

Parameters "working_dir" and "isolation" are mutually exclusive.

Reproduction 3: normal current-repository subagent

Even when asking the Explore agent to run in the current repository without requesting any worktree mode, the generated call can contain both:

{
  "isolation": "worktree",
  "working_dir": "/path/to/repo"
}

and fail with the same mutual-exclusion error.

Relevant implementation detail

The bundled Agent schema in 0.20.0 declares only these fields as required:

required: ["description", "prompt"]

working_dir and isolation are optional in that source schema, and runtime validation correctly rejects their simultaneous presence. However, the model-facing tool declaration appears to force/default both fields. This suggests the issue may be in schema conversion or tool registration between the Agent JSON Schema and the OpenAI-compatible tool declaration.

Expected behavior

  • Normal launch: omit both working_dir and isolation.
  • Caller-owned worktree: send only working_dir.
  • Agent-managed temporary worktree: send only isolation: "worktree".
  • Optional tool properties must remain omittable through OpenAI-compatible providers.

Additional impact

Because the model understands the validation error but cannot omit the schema-forced field on retry, it may repeat identical invalid Agent calls and terminate with:

Loop detection halted the run (consecutive_identical_tool_calls...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions