dify/api/services
Jyong 4d71c4a83a fix(knowledge-fs): allow one unresolved bad case per retrieval trace
A retrieval test record could be flagged as a bad case any number of times,
piling duplicate open cases onto the quality page. Refuse to file another bad
case while the trace already has one that is open or replaying, and let the
retrieval test page know about it.

- knowledge-fs: `createBadCase` looks up an unresolved case for the trace
  inside its transaction and throws `QualityBadCaseAlreadyOpenError`; the
  create route answers 409 with `QUALITY_BAD_CASE_ALREADY_OPEN`. Quality trace
  list items expose `openBadCaseId`.
- api: pass `open_bad_case_id` through the console trace response;
  regenerate the contracts.
- web: show the saved-as-bad-case state instead of the flag action when the
  selected trace already has an unresolved case, treat a 409 on flagging the
  same way, and refresh the history so the state follows the server.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 01:40:11 -04:00
..
agent refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
auth refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
data_migration fix(api): enforce app-scoped access on indirect resources (#40893) 2026-08-21 00:52:39 +00:00
document_indexing_proxy refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
enterprise Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 21:56:53 +08:00
entities Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 10:31:10 +08:00
errors fix(workflow): block manual runs for trigger workflows (#41519) 2026-08-31 09:30:52 +00:00
knowledge_fs fix(knowledge-fs): allow one unresolved bad case per retrieval trace 2026-09-03 01:40:11 -04:00
openapi refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
plugin fix(api): scope temporary capabilities to owners (#39863) 2026-08-07 09:21:13 +00:00
rag_pipeline refactor(models): pass session into PipelineCustomizedTemplate.created_user_name (#41394) 2026-08-28 02:26:41 +00:00
retention refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
tools fix(api): chain original exception in 13 except blocks per PEP 3134 (#40738) 2026-08-13 17:50:05 +00:00
trigger fix: replace bare except with except Exception in core agent, storage and vector backends (#40801) 2026-08-15 00:56:09 +00:00
workflow refactor(agent): simplify Agent v2 output contract (#41062) 2026-08-21 11:55:25 +00:00
__init__.py chore(api/services): apply ruff reformatting (#7599) 2024-08-26 13:43:57 +08:00
account_activation_adapters.py feat: new user add automatic add to app / dataset whitelist (#41363) 2026-08-27 08:51:05 +00:00
account_activation_service.py feat: new user add automatic add to app / dataset whitelist (#41363) 2026-08-27 08:51:05 +00:00
account_avatar_file_gateway.py refactor(api): move account access behind application services (#40437) 2026-08-21 05:56:30 +00:00
account_avatar_service.py refactor(api): move account access behind application services (#40437) 2026-08-21 05:56:30 +00:00
account_billing_adapters.py refactor(api): complete account education boundary (#41153) 2026-08-25 01:48:12 +00:00
account_change_email_adapters.py refactor(api): extract change email state machine (#40439) 2026-08-21 08:13:23 +00:00
account_change_email_ports.py refactor(api): extract change email state machine (#40439) 2026-08-21 08:13:23 +00:00
account_change_email_service.py refactor(api): extract change email state machine (#40439) 2026-08-21 08:13:23 +00:00
account_deletion_adapters.py refactor(api): extract change email state machine (#40439) 2026-08-21 08:13:23 +00:00
account_deletion_feedback_service.py refactor(api): finish account controller application boundary (#40440) 2026-08-21 08:46:06 +00:00
account_deletion_service.py refactor(api): move account lifecycle into application services (#40438) 2026-08-21 08:05:43 +00:00
account_education_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
account_email_registration_adapters.py refactor(api): extract email registration application service (#41108) 2026-08-31 03:22:01 +00:00
account_email_registration_service.py refactor(api): extract email registration application service (#41108) 2026-08-31 03:22:01 +00:00
account_email.py fix(auth): normalize Gmail registration emails (#41249) 2026-08-26 07:14:27 +00:00
account_errors.py refactor(api): extract email registration application service (#41108) 2026-08-31 03:22:01 +00:00
account_initialization_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
account_integration_service.py refactor(api): move account access behind application services (#40437) 2026-08-21 05:56:30 +00:00
account_password_hasher.py refactor(api): move account access behind application services (#40437) 2026-08-21 05:56:30 +00:00
account_password_service.py refactor(api): move account access behind application services (#40437) 2026-08-21 05:56:30 +00:00
account_ports.py refactor(api): extract email registration application service (#41108) 2026-08-31 03:22:01 +00:00
account_profile_service.py refactor(api): add account profile application service (#40436) 2026-08-20 05:03:08 +00:00
account_service.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 10:31:10 +08: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 fix(agent): align Binding file upload timeouts (#41027) 2026-08-20 18:59:44 +00:00
agent_config_service.py feat: support agent skill (#39675) 2026-08-24 05:29:14 +00:00
agent_llm_inner_service.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
agent_service.py fix: fix when tool execute in progress tool_meta miss tool_provider_type (#39513) 2026-07-24 11:35:12 +00:00
agent_tool_inner_service.py Expand application capabilities and refactor core workflows 2026-07-22 05:09:09 -04:00
annotation_service.py chore: remove unnecessary type conversions (#41454) 2026-08-29 07:04:18 +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 Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 21:56:53 +08:00
app_definition_query_service.py refactor(api): extract web app runtime bootstrap (#40949) 2026-08-20 05:05:31 +00:00
app_dsl_service.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-21 10:39:39 +08:00
app_generate_service.py fix(workflow): block manual runs for trigger workflows (#41519) 2026-08-31 09:30:52 +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(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
app_site_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
app_task_service.py chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
async_workflow_service.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
attachment_service.py chore: port isinstance to match case (#37271) 2026-06-18 00:18:03 +00:00
audio_service.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
billing_portal_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
billing_service.py refactor(api): standardize compliance downloads (#41057) 2026-08-26 06:32:13 +00:00
clear_free_plan_tenant_expired_logs.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
code_based_extension_service.py remove bare list, dict, Sequence, None, Any (#25058) 2025-09-06 03:32:23 +08:00
compliance_download_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
conversation_service.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +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(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
data_source_oauth_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
dataset_api_key_service.py feat: allow knowledge base API keys to be scoped to a single dataset (#37569) 2026-09-02 10:30:42 +00:00
dataset_knowledge_fs_upgrade_file_lease.py refactor(knowledge_fs): rename services and update imports for dataset knowledge file lease 2026-08-18 10:42:07 +08:00
dataset_knowledge_fs_upgrade_service.py feat(knowledge-fs): add upgrade job listing API 2026-08-19 15:12:21 +08: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 Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 21:56:53 +08:00
datasource_provider_service.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-18 10:54:19 +08: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
email_code_login_challenge.py fix(auth): harden email code login verification (#40960) 2026-08-19 06:57:47 +00:00
end_user_service.py refactor(api): type end user records with enum (#36945) 2026-06-19 01:02:01 +00:00
explore_banner_query_service.py refactor(api): snapshot explore banner feature flag (#40555) 2026-08-19 10:34:37 +00:00
external_knowledge_service.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-07 09:55:10 +08:00
feature_query_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
feature_service_gateway.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
feature_service.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
feedback_service.py fix(api): end_date filter in feedback export excludes the entire end date (#40114) 2026-08-10 03:27:56 +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 feat(knowledge_fs): expand supported document upload formats 2026-08-25 19:58:15 +08: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
init_validation_service.py refactor(api): extract init validation into layered application service (#40046) 2026-08-12 08:42:09 +00:00
inner_mail_service.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
installed_app_service.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
knowledge_fs_capability.py refactor(knowledge_fs): replace credential service with dataset API key authorization. Remove the API token feature at the space level for knowledgeFs. 2026-08-26 15:40:18 +08:00
knowledge_retrieval_inner_service.py refactor: thread explicit sessions through app retrieval paths (#38309) 2026-07-02 17:00:47 +00: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 feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
metadata_service.py fix(api): bind dataset operations to owners (#40149) 2026-08-11 16:37:14 +00:00
model_load_balancing_service.py feat: support azure keyvault (#39933) 2026-08-07 00:42:13 +00:00
model_provider_service.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
notification_gateway.py refactor(api): decouple onboarding and notification services (#40759) 2026-08-31 04:37:07 +00:00
notification_service.py refactor(api): decouple onboarding and notification services (#40759) 2026-08-31 04:37:07 +00:00
notion_data_source_gateway.py refactor(api): thin OAuth controllers and extract application services (#40692) 2026-08-26 07:33:37 +00:00
oauth_device_flow.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
oauth_server_service.py refactor(api): thin OAuth controllers and extract application services (#40692) 2026-08-26 07:33:37 +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
partner_tenant_binding_service.py refactor(api): standardize console billing portal errors (#41055) 2026-08-24 01:55:48 +00:00
quota_service.py fix: replace bare except with except Exception in core agent, storage and vector backends (#40801) 2026-08-15 00:56:09 +00:00
recommended_app_catalog_gateway.py refactor(api): replace legacy recommended app retrieval stack (#40395) 2026-08-20 13:13:43 +00:00
recommended_app_query_service.py refactor(api): replace legacy recommended app retrieval stack (#40395) 2026-08-20 13:13:43 +00:00
saved_message_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
schema_definition_service.py refactor(api): decouple setup and spec endpoints (#40104) 2026-08-08 11:52:15 +00:00
setup_adapters.py refactor(api): standardize session factory wiring (#41085) 2026-08-24 01:57:17 +00:00
setup_service.py refactor(api): decouple setup and spec endpoints (#40104) 2026-08-08 11:52:15 +00:00
skill_management_service.py fix(api): attribute Skill Builder credit usage (#41290) 2026-08-26 07:02:45 +00:00
snippet_dsl_service.py fix(snippet): support snippet history version export (#41012) 2026-08-20 08:52:45 +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 fix(agent): complete ownership-aware deletion lifecycle (#40888) 2026-08-20 07:48:02 +00:00
step_by_step_tour_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
summary_index_service.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
system_feature_service.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 10:31:10 +08:00
tag_application_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
tag_service.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
telemetry_service.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
trial_app_usage.py refactor(api): isolate trial app usage writes (#40208) 2026-08-20 13:13:42 +00:00
turnstile_service.py fix(auth): harden email code login verification (#40960) 2026-08-19 06:57:47 +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 feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
vector_space_admission_service.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
web_app_runtime_query_service.py refactor(api): extract web app runtime bootstrap (#40949) 2026-08-20 05:05:31 +00:00
web_conversation_service.py chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
web_passport_gateways.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
web_passport_service.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
webapp_access_query_service.py refactor(api): reuse web app access queries for permissions (#40984) 2026-08-20 02:27:49 +00:00
webapp_auth_service.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +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 refactor(models): pass session into WorkflowAppLog accessors (#41440) 2026-08-28 14:32:27 +00:00
workflow_collaboration_service.py fix(api): enforce app-scoped access on indirect resources (#40893) 2026-08-21 00:52:39 +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 feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +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 Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 10:31:10 +08:00
workflow_statistic_query_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
workflow_version_number_service.py feat: app deployment v2 (#39829) 2026-08-12 01:55:36 +00:00
workspace_member_query_service.py refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
workspace_member_role_resolver.py refactor(api): extract workspace member listing into layered service (#39974) 2026-08-06 01:08:39 +00:00
workspace_plan_gateway.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
workspace_query_service.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
workspace_service.py fix(web): render workspace plan badge during SSR (#40581) 2026-08-12 07:45:39 +00:00