From 618943b27848ad206f7157cd87c8895b98d8adbb Mon Sep 17 00:00:00 2001 From: Bill Date: Sun, 2 Nov 2025 23:17:52 -0500 Subject: [PATCH] debug: add self attribute logging to ContextInjector.__call__ Log ContextInjector instance ID and attribute values at entry to __call__() to diagnose why attributes appear as None during tool invocation despite being set correctly during set_context(). This will reveal whether: - Multiple ContextInjector instances exist - Attributes are being overwritten/cleared - Wrong instance is being invoked --- agent/context_injector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agent/context_injector.py b/agent/context_injector.py index 1518b51..03984af 100644 --- a/agent/context_injector.py +++ b/agent/context_injector.py @@ -49,6 +49,9 @@ class ContextInjector: """ # Inject context parameters for trade tools if request.name in ["buy", "sell"]: + # Debug: Log self attributes BEFORE injection + print(f"[ContextInjector.__call__] ENTRY: id={id(self)}, self.signature={self.signature}, self.today_date={self.today_date}, self.job_id={self.job_id}, self.session_id={self.session_id}") + # Add signature and today_date to args if not present if "signature" not in request.args: request.args["signature"] = self.signature