fix: tighten OW background request filter to stop spurious task creation

Added three new detection patterns beyond the existing keyword checks:
1. Conversation history dumps: messages containing both "user:" and
   "assistant:" role markers — real user messages never have both
2. Context synthesis phrases: "provided context", "following conversation",
   "based on the conversation" (OW's query augmentation patterns)
3. Markdown template headers: "### " in messages >200 chars (OW uses
   section headers in background templates; real mobile messages don't)

This closes the gap that caused "Fix CobraTrans ESET" to be created
spuriously in Agent Ecosystem from an OW history-dump background request.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 06:31:43 +00:00
parent 4a09def6dc
commit 065a6f3d1a
+18 -2
View File
@@ -64,14 +64,30 @@ def classify_intent(message: str) -> str:
# Open WebUI background tasks — sent automatically after every chat response.
# They include the full chat history, so they'd mis-trigger execute/task intents.
# Patterns: "### Task:", "Query: <text>" (query augmentation), meta-task keywords.
# Pattern 1: OW meta-task headers and keyword phrases
if (msg.startswith("### task:") or
msg.startswith("query:") or
"chat history" in msg or
"summarizing the chat" in msg or
"categorizing the main themes" in msg or
"follow-up questions" in msg or
"3-5 word title" in msg):
"3-5 word title" in msg or
"provided context" in msg or
"following conversation" in msg or
"based on the conversation" in msg):
return "planning"
# Pattern 2: conversation history dumps — contain role marker pairs.
# Real user messages never contain both "user:" and "assistant:" labels.
if "user:" in msg and "assistant:" in msg:
return "planning"
if msg.count("user:") >= 2 or msg.count("assistant:") >= 2:
return "planning"
# Pattern 3: OW markdown template headers (### ) in long messages.
# Real mobile messages don't use markdown section headers.
if "### " in msg and len(msg) > 200:
return "planning"
# Project creation — check before task/query