Skip to content

Commit 0db62f8

Browse files
committed
Add debug steps for logging level and researcher role detection in GitHub Actions workflow
- Introduced a new environment variable for log level and additional steps to search for the 'Researcher' role in YAML files, enhancing visibility during the workflow execution. - Added a step to trace the AutoGen execution path, providing insights into framework decisions and available roles. - Ensured minimal changes to existing code while improving the debugging and testing process for configuration and role management.
1 parent 7d79285 commit 0db62f8

1 file changed

Lines changed: 121 additions & 0 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}" >> $GITHUB_ENV
3232
echo "OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}" >> $GITHUB_ENV
3333
echo "OPENAI_MODEL_NAME=${{ secrets.OPENAI_MODEL_NAME || 'gpt-4o-mini' }}" >> $GITHUB_ENV
34+
echo "LOGLEVEL=DEBUG" >> $GITHUB_ENV
3435
echo "PYTHONPATH=${{ github.workspace }}/src/praisonai-agents:$PYTHONPATH" >> $GITHUB_ENV
3536
3637
- name: Debug API Key Status
@@ -45,10 +46,12 @@ jobs:
4546
fi
4647
echo "🌐 API Base: $OPENAI_API_BASE"
4748
echo "🤖 Model: $OPENAI_MODEL_NAME"
49+
echo "🐛 Log Level: $LOGLEVEL"
4850
echo "📊 Environment Check:"
4951
echo " - OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
5052
echo " - OPENAI_API_BASE: $OPENAI_API_BASE"
5153
echo " - OPENAI_MODEL_NAME: $OPENAI_MODEL_NAME"
54+
echo " - LOGLEVEL: $LOGLEVEL"
5255
5356
- name: Debug Python Environment Variables
5457
run: |
@@ -68,6 +71,124 @@ jobs:
6871
print(f' {key}: {value[:10] if len(value) > 10 else value}...')
6972
"
7073
74+
- name: Find Researcher Role Source
75+
run: |
76+
echo "🔍 Hunting for the mysterious 'Researcher' role..."
77+
python -c "
78+
import os
79+
import yaml
80+
import glob
81+
82+
print('📋 Searching for Researcher role in all YAML files:')
83+
yaml_files = glob.glob('tests/*.yaml')
84+
85+
for yaml_file in yaml_files:
86+
try:
87+
with open(yaml_file, 'r') as f:
88+
config = yaml.safe_load(f)
89+
90+
# Check if any role contains 'researcher'
91+
roles = config.get('roles', {})
92+
for role_key, role_data in roles.items():
93+
role_name = role_data.get('role', '')
94+
if 'researcher' in role_key.lower() or 'researcher' in role_name.lower():
95+
print(f' 🎯 FOUND in {yaml_file}:')
96+
print(f' Framework: {config.get(\"framework\", \"NOT_SET\")}')
97+
print(f' Role key: {role_key}')
98+
print(f' Role name: {role_name}')
99+
print(f' All roles: {list(roles.keys())}')
100+
print()
101+
except Exception as e:
102+
print(f' ❌ Error reading {yaml_file}: {e}')
103+
104+
print('🔍 Checking for default configurations...')
105+
# Check if there are any default configs or hardcoded roles
106+
try:
107+
import praisonai
108+
print(f' PraisonAI package location: {praisonai.__file__}')
109+
110+
# Check if there are any example YAML files in the package
111+
package_dir = os.path.dirname(praisonai.__file__)
112+
for root, dirs, files in os.walk(package_dir):
113+
for file in files:
114+
if file.endswith(('.yaml', '.yml')):
115+
file_path = os.path.join(root, file)
116+
print(f' 📁 Found YAML in package: {file_path}')
117+
except Exception as e:
118+
print(f' ❌ Error checking package: {e}')
119+
"
120+
continue-on-error: true
121+
122+
- name: Trace AutoGen Execution Path
123+
run: |
124+
echo "🔍 Tracing AutoGen execution to find where it diverges..."
125+
python -c "
126+
import os
127+
import sys
128+
sys.path.insert(0, '.')
129+
130+
try:
131+
from praisonai import PraisonAI
132+
from praisonai.agents_generator import AgentsGenerator
133+
134+
# Test the exact execution path
135+
print('🎯 Testing AutoGen execution path:')
136+
137+
praisonai = PraisonAI(agent_file='tests/autogen-agents.yaml')
138+
print(f' 1. PraisonAI framework: \"{praisonai.framework}\"')
139+
140+
agents_gen = AgentsGenerator(
141+
agent_file='tests/autogen-agents.yaml',
142+
framework=praisonai.framework,
143+
config_list=praisonai.config_list
144+
)
145+
print(f' 2. AgentsGenerator framework: \"{agents_gen.framework}\"')
146+
147+
# Load the YAML to check what it contains
148+
import yaml
149+
with open('tests/autogen-agents.yaml', 'r') as f:
150+
config = yaml.safe_load(f)
151+
152+
framework = agents_gen.framework or config.get('framework')
153+
print(f' 3. Final framework decision: \"{framework}\"')
154+
print(f' 4. Available frameworks:')
155+
156+
# Check framework availability
157+
try:
158+
import autogen
159+
print(f' ✅ AutoGen available')
160+
except ImportError:
161+
print(f' ❌ AutoGen NOT available')
162+
163+
try:
164+
from praisonaiagents import Agent
165+
print(f' ✅ PraisonAI agents available')
166+
except ImportError:
167+
print(f' ❌ PraisonAI agents NOT available')
168+
169+
try:
170+
from crewai import Agent
171+
print(f' ✅ CrewAI available')
172+
except ImportError:
173+
print(f' ❌ CrewAI NOT available')
174+
175+
print(f' 5. Roles in YAML: {list(config.get(\"roles\", {}).keys())}')
176+
177+
# Now test the actual framework execution
178+
if framework == 'autogen':
179+
print(f' 6. ✅ Should execute _run_autogen')
180+
elif framework == 'praisonai':
181+
print(f' 6. ❌ Would execute _run_praisonai (WRONG!)')
182+
else:
183+
print(f' 6. ❌ Would execute _run_crewai (DEFAULT FALLBACK)')
184+
185+
except Exception as e:
186+
print(f'❌ Error tracing execution: {e}')
187+
import traceback
188+
traceback.print_exc()
189+
"
190+
continue-on-error: true
191+
71192
- name: Debug YAML Loading and Roles
72193
run: |
73194
echo "🔍 Tracing YAML file loading and role creation..."

0 commit comments

Comments
 (0)