From 6d30244fc9037f1833c9b21384ec553137fcb373 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 5 Nov 2025 21:26:20 -0500 Subject: [PATCH] test: remove wrapper entirely to test if it's causing issues Hypothesis: The ToolCallArgsParsingWrapper might be interfering with LangChain's tool binding or response parsing in unexpected ways. Testing with direct ChatOpenAI usage (no wrapper) to see if errors persist. This is Phase 3 of systematic debugging - testing minimal change hypothesis. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- agent/base_agent/base_agent.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/agent/base_agent/base_agent.py b/agent/base_agent/base_agent.py index 3233eb4..7314d11 100644 --- a/agent/base_agent/base_agent.py +++ b/agent/base_agent/base_agent.py @@ -33,7 +33,6 @@ from tools.deployment_config import ( from agent.context_injector import ContextInjector from agent.pnl_calculator import DailyPnLCalculator from agent.reasoning_summarizer import ReasoningSummarizer -from agent.chat_model_wrapper import ToolCallArgsParsingWrapper # Load environment variables load_dotenv() @@ -209,10 +208,10 @@ class BaseAgent: # Create AI model (mock in DEV mode, real in PROD mode) if is_dev_mode(): from agent.mock_provider import MockChatModel - base_model = MockChatModel(date="2025-01-01") # Date will be updated per session + self.model = MockChatModel(date="2025-01-01") # Date will be updated per session print(f"🤖 Using MockChatModel (DEV mode)") else: - base_model = ChatOpenAI( + self.model = ChatOpenAI( model=self.basemodel, base_url=self.openai_base_url, api_key=self.openai_api_key, @@ -220,10 +219,6 @@ class BaseAgent: timeout=30 ) print(f"🤖 Using {self.basemodel} (PROD mode)") - - # Wrap model to fix tool_calls args parsing - self.model = ToolCallArgsParsingWrapper(model=base_model) - print(f"✅ Applied tool_calls args parsing wrapper") except Exception as e: raise RuntimeError(f"❌ Failed to initialize AI model: {e}") @@ -546,7 +541,7 @@ Summary:""" # Update mock model date if in dev mode if is_dev_mode(): - self.model.wrapped_model.date = today_date + self.model.date = today_date # Get job_id from context injector job_id = self.context_injector.job_id if self.context_injector else get_config_value("JOB_ID")