dify/api/services
dparkmit24 c881abff0c fix(agent): show one log entry per call when a tool repeats in a turn
The console agent log builds one entry per name in the ";"-joined tool
column, then looks each name up in a dict keyed by tool name. A tool
called twice in one turn produced two entries reading the same key, so
both showed the same data -- the display the reproduction in #16220
describes.

Keeping every call's input and observation apart, as this branch already
did, changed what those two entries show without making them right: each
one showed both calls' data instead of one call's data twice.

Read the persisted payloads per call instead. MessageAgentThought now
exposes tool_inputs_per_call, tool_outputs_per_call and
tool_metas_per_call, one entry per entry in tools, in call order, and
get_agent_logs walks them alongside the names. A name whose stored value
is not one value per call gives the same value to each of its calls, so
every record written before those calls were kept apart renders exactly
as it renders today.

That makes tool_invoke_meta safe to group the same way, which it now is.
It carries the provider, the duration and the error the log shows for
each displayed call, so leaving it name-keyed would have left a repeated
tool showing the last call's provider and duration against both entries.
Its other reader, the tool trace, covers the tool rather than one call of
it and takes the last call's meta -- the only one it had before.

The occurrence selector moves to models.model so the reader that builds
the log and the reader that replays history share one definition. Its
behaviour is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 09:47:17 -07:00
..
agent fix(agent): expose feedback in agent logs (#39994) 2026-08-04 14:11:13 +00:00
auth fix(auth): add bounded timeout to WaterCrawl credential validation (#39824) 2026-07-31 13:52:02 +00:00
data_migration chore: bump pyrefly version (#39876) 2026-08-03 05:59:01 +00:00
document_indexing_proxy chore(api): Fix several typing errors (#37248) 2026-06-12 14:02:09 +00:00
enterprise feat: gate agent management behind the agent.manage permission (#39330) 2026-07-23 07:34:07 +00:00
entities feat(agent): support new Agent DSL import and export (#38849) 2026-07-15 02:02:14 +00:00
errors feat(enterprise): enforce licensed seats cap at account creation (#38883) 2026-07-14 06:51:19 +00:00
openapi feat: adding dify cli (#36348) 2026-05-26 01:12:36 +00:00
plugin refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
rag_pipeline feat(workflow): support LLM environment variables (#39125) 2026-08-04 06:17:13 +00:00
recommend_app chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
retention chore: bump pyrefly version (#39876) 2026-08-03 05:59:01 +00:00
tools fix: SSRF bypass via raw httpx.get in API tool schema fetch (#37746) 2026-07-14 08:43:57 +00:00
trigger fix(trigger): return 429 instead of 500 when API quota is exceeded (#38664) 2026-07-10 10:57:50 +00:00
workflow refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
__init__.py chore(api/services): apply ruff reformatting (#7599) 2024-08-26 13:43:57 +08:00
account_service.py chore(api): consolidate chained .where() calls into single calls (#39819) 2026-07-30 16:59:50 +00:00
advanced_prompt_template_service.py refactor: replace bare dict with AdvancedPromptTemplateArgs TypedDict (#35056) 2026-04-13 13:05:23 +00:00
agent_app_feature_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
agent_app_sandbox_service.py refactor: introduce agent working environment architecture (#39480) 2026-07-28 13:16:05 +00:00
agent_config_service.py fix(agent): preserve DSL asset placeholders and count draft references (#39015) 2026-07-15 11:49:11 +00:00
agent_drive_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
agent_service.py fix(agent): show one log entry per call when a tool repeats in a turn 2026-08-05 09:47:17 -07:00
agent_tool_inner_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
annotation_service.py chore(api): consolidate chained .where() calls into single calls (#39819) 2026-07-30 16:59:50 +00:00
api_based_extension_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
api_token_service.py ci: add flag for linter (#37018) 2026-06-08 04:53:12 +00:00
app_dsl_service.py feat(workflow): support LLM environment variables (#39125) 2026-08-04 06:17:13 +00:00
app_generate_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
app_model_config_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
app_ref_service.py fix(api): bind scoped lookups to nested owner refs (#38470) 2026-07-15 09:31:09 +00:00
app_service.py refactor: introduce agent working environment architecture (#39480) 2026-07-28 13:16:05 +00:00
app_task_service.py chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
async_workflow_service.py fix(trigger): return 429 instead of 500 when API quota is exceeded (#38664) 2026-07-10 10:57:50 +00:00
attachment_service.py chore: port isinstance to match case (#37271) 2026-06-18 00:18:03 +00:00
audio_service.py fix(api): bind scoped lookups to nested owner refs (#38470) 2026-07-15 09:31:09 +00:00
billing_service.py fix(api): bound billing service HTTP timeouts (#39874) (#39875) 2026-08-01 10:46:13 +00:00
clear_free_plan_tenant_expired_logs.py refactor: pass db session into service calls (#37403) (#38016) 2026-06-26 07:53:27 +00:00
code_based_extension_service.py remove bare list, dict, Sequence, None, Any (#25058) 2025-09-06 03:32:23 +08:00
conversation_service.py chore(api): consolidate chained .where() calls into single calls (#39819) 2026-07-30 16:59:50 +00:00
conversation_variable_updater.py chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
credential_permission_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
credit_pool_service.py feat: improve ai-credits display (#38589) 2026-07-16 01:51:46 +00:00
dataset_ref_service.py fix(api): bind scoped lookups to nested owner refs (#38470) 2026-07-15 09:31:09 +00:00
dataset_service.py chore: bump pyrefly version (#39876) 2026-08-03 05:59:01 +00:00
datasource_provider_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
dsl_content.py refactor(api): clarify DSL import and plugin migration boundaries (#38483) 2026-07-07 02:06:49 +00:00
dsl_version.py refactor: cleanup duplicate code (#36173) 2026-05-14 10:34:31 +00:00
end_user_service.py refactor(api): type end user records with enum (#36945) 2026-06-19 01:02:01 +00:00
external_knowledge_service.py fix(api): allow external knowledge base creation under enterprise RBAC (#39930) 2026-08-04 04:50:43 +00:00
feature_service.py perf(web): streaming ssr for home page (#39922) 2026-08-04 02:16:08 +00:00
feedback_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
file_request_service.py feat(agent): separate CLI file URL audiences (#39952) 2026-08-04 13:14:02 +00:00
file_service.py chore(api): cloud use presigned download url on api site (#39436) 2026-07-23 03:34:49 +00:00
hit_testing_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
human_input_delivery_test_service.py chore: port isinstance to match case (#37271) 2026-06-18 00:18:03 +00:00
human_input_file_upload_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
human_input_service.py chore(api): upgrade graphon to v0.6.0, migrate HITL logic back to Dify (#38247) 2026-07-03 03:45:21 +00:00
installed_app_service.py chore: paginate installed apps (#39739) 2026-07-29 09:51:34 +00:00
knowledge_fs_operations.py feat(dataset): add crawl source selection (#39325) 2026-07-24 07:11:48 +00:00
knowledge_fs_proxy.py feat(dataset): expose New RAG KnowledgeFS contracts (#39314) 2026-07-23 01:48:36 +00:00
knowledge_retrieval_inner_service.py refactor: thread explicit sessions through app retrieval paths (#38309) 2026-07-02 17:00:47 +00:00
knowledge_service.py refactor: replace dict with BedrockRetrievalSetting BaseModel in knowledge_service (#34080) 2026-03-25 21:33:24 +09:00
legacy_model_type_migration.py feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
message_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
metadata_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
model_load_balancing_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
model_provider_service.py chore(api): Upgrade graphon to v0.5.1 (#37168) 2026-06-11 07:37:27 +00:00
oauth_device_flow.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
oauth_server.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
operation_service.py fix: bound OperationService billing requests (#37425) 2026-06-22 06:45:03 +00:00
ops_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
quota_service.py refactor: quota v3 integration (#35436) 2026-04-27 01:49:40 +00:00
recommended_app_service.py refactor: move trial app capability out of system features (#39562) 2026-07-26 12:02:30 +00:00
saved_message_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
snippet_dsl_service.py refactor: introduce agent working environment architecture (#39480) 2026-07-28 13:16:05 +00:00
snippet_generate_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
snippet_service.py feat(workflow): support LLM environment variables (#39125) 2026-08-04 06:17:13 +00:00
step_by_step_tour_service.py feat(web): add step-by-step tour shell (#38785) 2026-07-20 09:23:25 +00:00
summary_index_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
tag_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
telemetry_service.py feat: add CE telemetry report (#39452) 2026-07-27 02:04:28 +00:00
variable_truncator.py fix(api): honor array-element limit and byte budget for list[File] in VariableTruncator (#39218) (#39220) 2026-07-27 02:12:57 +00:00
vector_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
web_conversation_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
webapp_auth_service.py fix: The expiration time for web app login to JWT is incorrectly set. (#39537) 2026-07-27 02:43:32 +00:00
website_service.py fix(api): bound JinaReader and adaptive-crawl HTTP timeouts (#39859) (#39860) 2026-08-02 02:49:17 +00:00
workflow_app_service.py feat(plugin): cache plugin model providers by tenant (#36449) 2026-05-23 09:12:09 +00:00
workflow_collaboration_service.py fix: prevent hidden-tab collaboration leader from saving stale drafts (#38997) 2026-07-20 06:58:01 +00:00
workflow_comment_service.py feat: collaboration (#30781) 2026-04-16 02:21:04 +00:00
workflow_draft_variable_service.py fix(api): use resource tenant for draft variable files (#39307) 2026-07-21 02:07:47 +00:00
workflow_event_snapshot_service.py feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
workflow_generator_service.py perf(workflow-generator): parallelize node config generation (#38975) 2026-07-17 02:34:15 +00:00
workflow_node_execution_trace_service.py fix: preserve and display workflow retry details (#38854) 2026-07-15 05:58:37 +00:00
workflow_ref_service.py fix(api): scope nested resource lookups by owner refs (#38177) 2026-06-30 08:19:58 +00:00
workflow_restore.py fix: adding a restore API for version control on workflow draft (#33582) 2026-03-20 14:54:23 +08:00
workflow_run_service.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
workflow_service.py feat(workflow): support LLM environment variables (#39125) 2026-08-04 06:17:13 +00:00
workspace_service.py fix: align workspace card plan ownership (#39616) 2026-07-27 05:01:02 +00:00