From 8e10a24d550e533962bd22e1995ccf671cde0153 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 7 May 2026 15:49:12 +0800 Subject: [PATCH] fix: LLM config query uses 'default' DB only, not calling module's DB Problem: When integrated_crm_app calls llm_chat(), _get_llm_config() used env.get_module_dbname('harnessed_agent') which returned 'crm_db' (the calling module's DB), causing it to read stale/wrong config (qwen3-max) instead of the correct config from default DB (qwen3.6-plus). Fix: Remove get_module_dbname() call. LLM config is global and shared across all modules, so always query from 'default' database. --- harnessed_agent/llm_client.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/harnessed_agent/llm_client.py b/harnessed_agent/llm_client.py index b18609e..4a538c6 100644 --- a/harnessed_agent/llm_client.py +++ b/harnessed_agent/llm_client.py @@ -76,15 +76,13 @@ LLM_PROVIDERS = { # ============================================================ async def _get_llm_config() -> Dict[str, Any]: - """Get LLM client configuration from harnessed_agent_config table.""" + """Get LLM client configuration from harnessed_agent_config table. + + Uses 'default' database only, as LLM config is global and shared across modules. + Do NOT use get_module_dbname() which returns the calling module's DB (e.g. crm_db), + which may have stale or incorrect config data. + """ dbnames_to_try = ['default'] - try: - env = ServerEnv() - module_db = env.get_module_dbname('harnessed_agent') - if module_db not in dbnames_to_try: - dbnames_to_try.insert(0, module_db) - except Exception: - pass for dbname in dbnames_to_try: try: