From 0eb5fcc9408d47a1e23864275d15df43713f7d03 Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 7 Nov 2025 14:56:48 -0500 Subject: [PATCH] debug: enable stdout/stderr for MCP services to diagnose parameter injection MCP services were started with stdout/stderr redirected to DEVNULL, making debug logs invisible. This prevented diagnosing why _current_position parameter is not being received by buy() function. Changed subprocess.Popen to redirect MCP service output to main process stdout/stderr, allowing [DEBUG buy] logs to be visible in docker logs. This will help identify whether: 1. _current_position is being sent by ContextInjector but not received 2. MCP HTTP transport filters underscore-prefixed parameters 3. Parameter serialization is failing Related to negative cash bug where final position shows -$3,049.83 instead of +$727.92 tracked by ContextInjector. --- agent_tools/start_mcp_services.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/agent_tools/start_mcp_services.py b/agent_tools/start_mcp_services.py index cad9f7d..51d5ad6 100755 --- a/agent_tools/start_mcp_services.py +++ b/agent_tools/start_mcp_services.py @@ -78,10 +78,11 @@ class MCPServiceManager: env['PYTHONPATH'] = str(Path.cwd()) # Start service process (output goes to Docker logs) + # Enable stdout/stderr for debugging (previously sent to DEVNULL) process = subprocess.Popen( [sys.executable, str(script_path)], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, + stdout=sys.stdout, # Redirect to main process stdout + stderr=sys.stderr, # Redirect to main process stderr cwd=Path.cwd(), # Use current working directory (/app) env=env # Pass environment with PYTHONPATH )