Agent LOG icon enrichment performs full plugin and built-in provider scans in the execution path
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.
### Dify version
`main` at commit `0024a845f7098d0bdf0878fd1a2db5c870f8d3f0` (2026-08-24)
### Cloud or Self Hosted
Self Hosted (Source)
### Steps to reproduce
1. Run an Agent node whose strategy emits one or more `LOG` messages with a non-empty `metadata.provider` value.
2. Instrument the plugin daemon management endpoint, or place counters/breakpoints on `PluginInstaller.list_plugins()` and `BuiltinToolManageService.list_builtin_tools()`.
3. Execute the Agent and inspect each `LOG` message before its `AgentLogEvent` is emitted.
4. Observe that every matching `LOG` message synchronously performs both full-list operations, even though their results are used only to add display icons.
The current call chain is:
- [`AgentMessageTransformer.transform()`](https://github.com/langgenius/dify/blob/0024a845f7098d0bdf0878fd1a2db5c870f8d3f0/api/core/workflow/nodes/agent/message_transformer.py#L194-L228) handles a `LOG` message and calls both list operations before yielding the log event.
- [`PluginInstaller.list_plugins()`](https://github.com/langgenius/dify/blob/0024a845f7098d0bdf0878fd1a2db5c870f8d3f0/api/core/plugin/impl/plugin.py#L63-L70) requests page 1 with `page_size=256` from the plugin daemon, after which the caller performs a linear search for one provider.
- [`BuiltinToolManageService.list_builtin_tools()`](https://github.com/langgenius/dify/blob/0024a845f7098d0bdf0878fd1a2db5c870f8d3f0/api/services/tools/builtin_tools_manage_service.py#L625-L680) enumerates all built-in provider controllers, loads default provider configurations, converts providers with `decrypt_credentials=True`, repacks icons, and converts every tool schema.
- The resulting values are used only for `metadata.icon` and `metadata.icon_dark`.
This is a distinct Agent LOG enrichment path from #37334, which reported redundant plugin-daemon model-list calls during concurrent workflow execution.
### ✔️ Expected Behavior
Agent execution and log delivery should not synchronously enumerate all installed plugins and all built-in providers/tools solely to resolve two presentation fields.
Icon enrichment should be outside the execution-critical path, use a targeted or safely cached lookup, or otherwise fail open. A slow or unavailable plugin daemon, credential decryption failure, or unrelated provider conversion failure should not delay or fail an Agent run when only `icon` and `icon_dark` are missing.
Repeated `LOG` messages for the same provider in one execution should not repeat the same full-list work.
### ❌ Actual Behavior
For every `LOG` message with `metadata.provider`, the Agent message transformer currently:
1. Makes a synchronous plugin-daemon request that returns up to 256 plugins and linearly scans the result.
2. Enumerates and fully converts all built-in providers and their tools, including default configuration loading and credential decryption.
3. Performs both operations before emitting the log event and only uses the result to populate `icon` and `icon_dark`.
There is no per-execution memoization in this path. The work is therefore repeated across matching log messages. The plugin-daemon error path is also handled as an Agent message transformation failure in [`AgentNode._run()`](https://github.com/langgenius/dify/blob/0024a845f7098d0bdf0878fd1a2db5c870f8d3f0/api/core/workflow/nodes/agent/agent_node.py#L168-L195), allowing decorative metadata enrichment to affect execution success.
Contributor guide
Research direction
Start with api/core/workflow/nodes/agent/message_transformer.py, tracing AgentMessageTransformer.transform() for LOG messages and the calls to the plugin and built-in provider services. Check api/core/workflow/nodes/agent/agent_node.py for error propagation. Done means icon enrichment no longer performs repeated full scans in the execution path, and lookup failures do not affect Agent execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100