Skip to content

Commit 5b1c91d

Browse files
committed
fix: Add debug logging and ensure is_stillme_query is set for system architecture queries
CRITICAL FIX: System architecture queries may not be creating stillme_instruction. Problems: - is_stillme_query may not be set when detecting system architecture queries - stillme_instruction may be empty string even when is_system_architecture_query = True - No debug logging to track instruction creation Fixes: 1. Added code to set is_stillme_query = True when detecting system architecture queries 2. Added debug logging to track is_stillme_query, is_philosophical, is_system_architecture_query 3. Added info logging when creating stillme_instruction Result: Better visibility into why stillme_instruction may not be created.
1 parent 4c0d6f8 commit 5b1c91d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

backend/api/routers/chat_router.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,6 +4105,10 @@ async def chat_with_rag(request: Request, chat_request: ChatRequest):
41054105
for pattern in system_architecture_patterns:
41064106
if regex_module.search(pattern, question_lower, regex_module.IGNORECASE):
41074107
is_system_architecture_query = True
4108+
# CRITICAL: System architecture queries are StillMe queries (about StillMe itself)
4109+
if not is_stillme_query:
4110+
is_stillme_query = True
4111+
logger.info(f"🎯 System architecture query detected - marking as StillMe query")
41084112
logger.info(f"🎯 System architecture query detected - will use self-inspection mode")
41094113
break
41104114

@@ -5918,7 +5922,9 @@ def truncate_text(text: str, max_tokens: int) -> str:
59185922
# Special instruction for StillMe queries with ERROR STATE CHECKING
59195923
# CRITICAL: Skip for philosophical questions to reduce prompt size
59205924
stillme_instruction = ""
5925+
logger.debug(f"🔍 DEBUG: is_stillme_query={is_stillme_query}, is_philosophical={is_philosophical}, is_system_architecture_query={is_system_architecture_query}")
59215926
if is_stillme_query and not is_philosophical:
5927+
logger.info(f"✅ Creating stillme_instruction for StillMe query (is_system_architecture_query={is_system_architecture_query})")
59225928
# CRITICAL: Check system status BEFORE answering about StillMe
59235929
# This ensures StillMe is honest about its own errors
59245930
from backend.services.system_status_tracker import get_system_status_tracker

0 commit comments

Comments
 (0)