dify/api/core
Jyong b79b8a879b feat(knowledge-fs): record and count every knowledge space query
Workflow KnowledgeFS retrieval nodes ran through `retrieval-tests`, which
never wrote an AnswerTrace or an overview event, so their queries were
missing from the retrieval history and from the space overview; the history
also only ever showed each member their own traces.

- AnswerTrace gains a `source` (retrieval_test | workflow | service_api |
  agent | mcp; migration 0051_answer_trace_source) derived from the
  Capability v2 caller kind. The retrieval-tests route records one trace per
  run (stages, evidence bundle, profile metadata), returns its id as
  `answerTraceId`, and the workflow node's failed-retrieval capture attaches
  to that trace instead of creating a second record.
- The quality trace list exposes and filters by `source`; traces from other
  caller kinds are visible to any current reader of the space, and counts and
  scores fall back to the evidence embedded in the trace when no bundle row
  exists.
- Overview accounting: retrieval-tests and Research tasks now emit
  `query.requested`, and the Research job state machine emits
  `query.completed` / `query.failed` on terminal stages (wired for both the
  in-process gateway and the durable runtime), so query volume, answer rate
  and outcomes include every caller. Activity details keep `source` and
  `taskKind`.
- Console and service trace routes accept a `source` filter; the retrieval
  test page shows a source badge and an all / retrieval tests / workflow
  filter, with translations for every locale.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-04 05:48:17 -04:00
..
agent Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
app Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-01 09:45:49 +08:00
base fix(api): align Service API OpenAPI contract (#41248) 2026-08-25 10:54:14 +00:00
callback_handler chore: clean Db session from service (#38227) 2026-07-08 03:07:27 +00:00
datasource Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-07 09:55:10 +08:00
db fix(db): parameterize sessionmaker with Session (#30612) 2026-01-06 15:23:50 +08:00
entities fix(api): restore Service API OpenAPI semantics (#41274) 2026-08-26 05:05:36 +00:00
errors chore: drop unnecessary | None on LLMError and Mail.send (#36147) 2026-05-14 03:22:00 +00:00
extension fix(extension): chain original exception in APIBasedExtensionRequestor per PEP 3134 (#40810) 2026-08-15 08:48:28 +00:00
external_data_tool refactor: add missing @override decorator to remaining MCP, Jieba, embeddings, and misc subclasses (#36528) 2026-05-22 13:45:35 +00:00
file refactor(api): centralize remote file handling (#41627) 2026-09-03 06:00:13 +00:00
helper refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
llm_generator fix(api): bound suggested question generation latency (#41705) 2026-09-03 05:02:09 +00:00
logging fix(api): restore deadlock-safe identity logging 2026-08-14 11:21:46 +08:00
mcp fix(workflow): block manual runs for trigger workflows (#41519) 2026-08-31 09:30:52 +00:00
memory perf(memory): batch-load message files in TokenBufferMemory to remove N+1 queries (#38002) 2026-07-03 01:59:48 +00:00
moderation feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
ops fix(api): preserve tracing configuration boundaries (#41403) 2026-08-27 22:11:32 +08:00
plugin Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-03 16:32:30 +08:00
prompt feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
rag feat(knowledge-fs): add automatic metadata filtering to retrieval node 2026-09-02 02:55:12 -04:00
rbac Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
repositories feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
schemas chore: port isinstance to match case (#37271) 2026-06-18 00:18:03 +00:00
telemetry fix: add missing metrics back and enhance typing (#40935) 2026-08-21 09:46:45 +00:00
tools Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
trigger refactor(api): migrate workspace account endpoints to BaseModel (#37954) 2026-07-06 06:57:40 +00:00
workflow feat(knowledge-fs): record and count every knowledge space query 2026-09-04 05:48:17 -04:00
__init__.py Fix basedpyright type errors (#25435) 2025-09-10 01:54:26 +08:00
credit_usage.py fix(api): attribute Skill Builder credit usage (#41290) 2026-08-26 07:02:45 +00:00
hosting_configuration.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
indexing_runner.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
model_context.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
model_manager.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
provider_manager.py fix(api): migrate legacy model types during upgrade (#41326) 2026-08-27 02:00:33 +00:00