From b5d80025e97b29c43f9d50c8fa938bd79e9842d4 Mon Sep 17 00:00:00 2001 From: xuhd Date: Wed, 3 Jun 2026 16:54:17 +0800 Subject: [PATCH] fix(skill-review): lower CREATE threshold and log agent decision --- .../harness/deerflow/skills/review_worker.py | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/skills/review_worker.py b/offline-backend-20260512/backend/packages/harness/deerflow/skills/review_worker.py index 99e886ea..75005616 100644 --- a/offline-backend-20260512/backend/packages/harness/deerflow/skills/review_worker.py +++ b/offline-backend-20260512/backend/packages/harness/deerflow/skills/review_worker.py @@ -74,11 +74,13 @@ _REVIEW_SYSTEM_PROMPT = textwrap.dedent("""\ ## Decision rules 1. Call skill_list first to see existing skills — avoid creating duplicates. - 2. CREATE a new skill if: the conversation demonstrates a non-trivial, repeatable - workflow (3+ distinct tool operations) that a future agent could reuse verbatim. + 2. CREATE a new skill if: the conversation demonstrates ANY repeatable workflow + or technique that could be reused in future tasks — even a single-step pattern + is worth capturing if it's non-obvious or task-specific knowledge. 3. PATCH an existing skill if: the conversation revealed a gap, error, or improvement to a skill that was already invoked. - 4. DO NOTHING if: the task was one-off, data-specific, trivial, or already covered. + 4. DO NOTHING only if: the task was purely data-specific (one-off query with no + generalizable pattern) or already covered by an existing skill verbatim. ## Skill quality bar - Name: kebab-case, lowercase letters/digits/hyphens only, max 64 chars. @@ -160,7 +162,7 @@ async def _run_review(thread_id: str, messages: list[BaseMessage], app_config: " agent = make_lead_agent(run_config) try: - await asyncio.wait_for( + result = await asyncio.wait_for( asyncio.get_event_loop().run_in_executor( None, lambda: agent.invoke( @@ -170,7 +172,19 @@ async def _run_review(thread_id: str, messages: list[BaseMessage], app_config: " ), timeout=timeout, ) - logger.info("skill_review_worker: review completed for thread %s", thread_id) + # Log the final AI message so we can see what the review agent decided. + final_msgs = (result or {}).get("messages", []) + final_text = "" + for msg in reversed(final_msgs): + content = getattr(msg, "content", None) + if content and isinstance(content, str) and content.strip(): + final_text = content.strip()[:300] + break + logger.info( + "skill_review_worker: review completed for thread %s — agent said: %s", + thread_id, + final_text or "(no text response)", + ) except TimeoutError: logger.warning("skill_review_worker: review timed out after %ds (thread %s)", timeout, thread_id) except Exception: