fix(skill-review): lower CREATE threshold and log agent decision

This commit is contained in:
xuhd committed 2026-06-05 13:32:19 +08:00
1 parent 5b5e4f8ff0
commit b5d80025e9
1 file changed
+19 -5
@@ -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: