From 70bb2783b9344bc801b4863180b935f08ec63c08 Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 8 Jun 2026 23:11:54 +0800 Subject: [PATCH] =?UTF-8?q?chore(knowledge):=20=E6=AF=8F=E6=AC=A1=E6=B2=89?= =?UTF-8?q?=E6=B7=80=E5=BF=85=E6=89=93=E5=85=A5=E5=8F=A3/=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=97=A5=E5=BF=97=EF=BC=8C=E4=BE=BF=E4=BA=8E=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=98=AF=E5=90=A6=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit success 路径原先完全静默,导致"看不到日志"无法区分"没触发"还是"日志不可见"。 现在每次 capture_thread 至少打 [knowledge] capturing… + 结果/跳过/失败 各一行。 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../harness/deerflow/knowledge/service.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/knowledge/service.py b/offline-backend-20260512/backend/packages/harness/deerflow/knowledge/service.py index 78351be6..7d41ae9b 100644 --- a/offline-backend-20260512/backend/packages/harness/deerflow/knowledge/service.py +++ b/offline-backend-20260512/backend/packages/harness/deerflow/knowledge/service.py @@ -228,11 +228,22 @@ class KnowledgeService: Returns ``{"note": , "created": bool}``. Raises :class:`EmptyThreadError` when there is nothing worth keeping. """ + # Always-on entry log: proves a capture was triggered for this thread, + # regardless of how it ends (success / skip / fallback). Lets you tell + # "capture never ran" apart from "logs not visible" via one grep. + logger.info( + "[knowledge] capturing thread %s (msgs=%d, llm_extract=%s, skip_existing=%s)", + thread_id, + len(messages or []), + self.config.llm_extract_enabled, + skip_existing, + ) if skip_existing: existing = await self.repo.find_by_source("thread", thread_id) if existing is None and self.adapter.manifest.has_source(f"thread:{thread_id}"): existing = await self.repo.find_by_source("thread", thread_id) if existing: + logger.info("[knowledge] thread %s already captured (note %s); skipping", thread_id, existing.get("id")) return {"note": existing, "created": False} sources = [] @@ -286,6 +297,7 @@ class KnowledgeService: ) drafts = [single] if single else [] if not drafts: + logger.info("[knowledge] thread %s has no sediment-able content; skipping", thread_id) raise EmptyThreadError(f"Thread {thread_id} has no sediment-able content") # When the LLM was enabled but silently fell back to rule-based extraction, @@ -318,6 +330,14 @@ class KnowledgeService: draft.related = list(dict.fromkeys([*siblings, *draft.related])) notes = [await self._persist_draft(draft, created_by=created_by) for draft in drafts] + logger.info( + "[knowledge] thread %s captured → %d note(s) [%s], status=%s, llm_fallback=%s", + thread_id, + len(notes), + ", ".join(n.get("title", "") for n in notes), + normalized, + llm_fallback, + ) return {"note": notes[0], "created": True, "notes": notes, "llm_fallback": llm_fallback} async def capture_search(