dify - ✅(Solved) Fix Cloned agent app doesn't see Custom Tool operations added after the original was attached [1 pull requests, 3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#35807Fetched 2026-05-06 06:36:28
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
1
Author
Timeline (top)
commented ×3cross-referenced ×1labeled ×1mentioned ×1

Fix Action

Workaround

After cloning, read the source app's agent_mode.tools, deep-copy the existing entry shape, mutate tool_name + tool_parameters to match the new operation, append, then POST back via /console/api/apps/{new_id}/model-config. ~5 lines of patching. Doable but it's a footgun.

PR fix notes

PR #35809: feat: warn when agent app uses a subset of provider's available tool operations

Description (problem / solution / changelog)

fixes #35807

Problem

When a Custom Tool's OpenAPI schema is updated to add new operations, or when an agent-chat app is cloned, the app's agent_mode.tools list may contain only a subset of what the provider currently exposes. There is no visual signal — users discover this only when the LLM hallucinates about calling tools it doesn't have.

As confirmed by @dosu, agent-chat apps have no clone-time or edit-time mechanism to detect that the attached tool operations are a subset of what the provider currently exposes.

Solution

Surface a warning icon in the agent tool-config UI when the app's attached operations for a given provider are a proper subset of that provider's currently available operations. This is the "lowest" (least disruptive) fix suggested in the issue.

How it works

The AgentTools component already has both data sources:

  • agentConfig.tools — the app's attached tool operations
  • collectionList — all available tool collections with their operations

A new useMemo cross-references these to build a Map<provider_id, {attached, available}>. For each tool row where available > attached, an amber warning icon with a descriptive tooltip is rendered.

What this covers

  • Cloned apps with stale tool attachments
  • Apps where the tool schema evolved after initial configuration
  • Non-blocking — warning icon + hover tooltip only
  • Actionable — tooltip tells the user to use the "+" button

What this does NOT change

  • No backend changes
  • No clone behavior changes
  • No auto-attach of missing operations

Changes

FileChange
web/.../agent-tools/index.tsxAdded outOfSyncProviders useMemo + amber warning icon per tool row
web/i18n/en-US/tools.jsonAdded toolOperationsOutOfSync translation key
web/.../agent-tools/__tests__/index.spec.tsxAdded 3 tests for subset, full-match, and single-op cases

Tests

All 13 tests pass (10 existing + 3 new):

Changed files

  • web/app/components/app/configuration/config/agent/agent-tools/__tests__/index.spec.tsx (modified, +86/-0)
  • web/app/components/app/configuration/config/agent/agent-tools/index.tsx (modified, +60/-0)
  • web/i18n/en-US/tools.json (modified, +1/-0)
RAW_BUFFERClick to expand / collapse

I'm running a self-hosted Dify 1.14 stack (docker-compose) and hit a confusing failure mode while cloning an agent-chat app. Putting it here in case it's useful or worth fixing.

What happens

I have a Custom Tool that was originally registered with one operation (op_a). I attached it to an agent-chat app, so model_config.agent_mode.tools for that app has op_a listed.

Later I updated the Custom Tool's OpenAPI schema to add a second operation (op_b) and re-imported it. The workspace tool list now shows the Custom Tool exposes both operations. Good.

But — the original app I attached the tool to still has only op_a in its tools list. New operations don't auto-attach to apps that already use the tool. Fine on its own, that's defensible behavior.

The problem is what happens when I clone that app. The clone gets agent_mode.tools copied verbatim, so the clone also only has op_a. The UI shows the Custom Tool attached and the model sees one operation. If I then prompt the agent to use op_b by name, it narrates "I will use op_b first..." and then actually invokes op_a with op_b's parameters, which errors out.

So functionally op_b is missing from the clone, even though the provider exposes it.

Repro

  1. Create a Custom Tool from an OpenAPI spec with one operation op_a.
  2. Create an agent-chat app, attach the tool. agent_mode.tools = [op_a].
  3. Edit the Custom Tool's OpenAPI to add op_b, re-import. Workspace tool now shows both operations available.
  4. POST /console/api/apps/{src_id}/copy to clone the app.
  5. GET /console/api/apps/{new_id} and look at model_config.agent_mode.tools.
  6. Clone has only op_a. op_b is not there, even though it exists on the provider.

Why it's confusing

There's no visible indicator that the clone has a stale tool attachment. The tool icon shows up in the tool list, the model gets one operation, the UI looks normal. But the model can't reach op_b.

The user-facing failure looks like a model bug. The agent says "I will use op_b first" and then doesn't, or calls op_a with op_b's args. I spent a few hours debugging this as if it was a model orchestration issue — token budget pressure, agent-loop iteration limit, sampling temperature — before I realised the tool just wasn't attached. The narration was the model literally telling me it wanted to call a tool it didn't have, which is how an agent should behave when instructed to use a tool that isn't in it's tool list.

Workaround

After cloning, read the source app's agent_mode.tools, deep-copy the existing entry shape, mutate tool_name + tool_parameters to match the new operation, append, then POST back via /console/api/apps/{new_id}/model-config. ~5 lines of patching. Doable but it's a footgun.

Suggested fixes

A few options, increasing in scope:

  • Lowest: surface a warning on the app's tool-config UI when the attached operations are a subset of what the provider exposes. Something like "Tool X has 3 operations in the workspace, this app uses 1. Manage attachments?"
  • Medium: when cloning, re-resolve every attached Custom Tool against its current provider state and pull in all operations available now. (Would change clone semantics — might be controversial since it makes clones non-faithful copies.)
  • Most upstream: when re-importing a Custom Tool with new operations, prompt "auto-attach op_b to N existing apps that already use this tool?"

I'd be happy with any of them. Right now the lack of any signal is what burns time.

Happy to put together a PR if there's a preferred approach — let me know.

extent analysis

TL;DR

The most likely fix is to update the clone's agent_mode.tools configuration to include the new operation (op_b) after cloning an app that uses a Custom Tool with updated operations.

Guidance

  • When cloning an app, verify that the agent_mode.tools configuration includes all available operations for each attached Custom Tool.
  • To mitigate the issue, manually update the clone's agent_mode.tools configuration to include the new operation (op_b) by reading the source app's configuration, deep-copying the existing entry shape, and appending the new operation.
  • Consider implementing a warning or notification in the app's tool-config UI when the attached operations are a subset of what the provider exposes.
  • Review the suggested fixes, including surfacing a warning, re-resolving attached Custom Tools during cloning, or auto-attaching new operations to existing apps.

Example

No code snippet is provided as the issue does not require a specific code change, but rather a configuration update or a potential feature enhancement.

Notes

The issue highlights a subtle problem that can lead to confusing behavior, and the suggested fixes aim to address this by providing clearer signals or automating the update process. The chosen solution will depend on the desired behavior and potential impact on existing app clones.

Recommendation

Apply a workaround by manually updating the clone's agent_mode.tools configuration after cloning, as this is a straightforward and immediate solution to the problem. A more permanent fix can be explored later, such as implementing one of the suggested fixes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING