Skip to content

MCP Client Support: Connect GAIA agents to any MCP server #843

MCP Client Support: Connect GAIA agents to any MCP server

MCP Client Support: Connect GAIA agents to any MCP server #843

# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
# This workflow tests the GAIA Code Agent functionality
# Tests include: Code generation, parsing, linting, formatting, and integration tests
name: Code Agent Tests
on:
workflow_call:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
workflow_dispatch:
# Cancel in-progress runs when a new run is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test-code-agent:
name: Test Code Agent
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
steps:
- uses: actions/checkout@v6
- name: Free disk space
uses: ./.github/actions/free-disk-space
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: |
uv pip install --system -e .[dev]
# Install optional dependencies for code agent
uv pip install --system black pylint
- name: Run Code Agent Mixin Architecture Tests
run: |
echo "================================================================"
echo " CODE AGENT MIXIN ARCHITECTURE TESTS"
echo "================================================================"
echo "Testing refactored mixin architecture and tool registration..."
echo ""
# Run mixin tests
python -m pytest tests/test_code_agent_mixins.py -v --tb=short
# Store the result
MIXIN_TEST_EXIT=$?
if [ $MIXIN_TEST_EXIT -eq 0 ]; then
echo "[SUCCESS] All 38 mixin tests passed"
else
echo "[FAILURE] Mixin architecture tests failed"
exit 1
fi
- name: Run Code Agent Unit Tests
run: |
echo ""
echo "================================================================"
echo " CODE AGENT UNIT TESTS"
echo "================================================================"
echo "Testing core functionality: parsing, generation, tools..."
echo ""
# Run with pytest for better output formatting
python -m pytest tests/test_code_agent.py::TestCodeAgent -v --tb=short \
-k "not workflow and not integration and not process_query" \
|| true
# Store the result
UNIT_TEST_EXIT=$?
if [ $UNIT_TEST_EXIT -eq 0 ]; then
echo "[SUCCESS] Unit tests passed"
else
echo "[WARNING] Some unit tests failed (non-blocking for now)"
fi
- name: Run Code Agent Integration Tests
run: |
echo ""
echo "================================================================"
echo " CODE AGENT INTEGRATION TESTS"
echo "================================================================"
echo "Testing workflows and complex scenarios..."
echo ""
# Run integration tests
python -m pytest tests/test_code_agent.py::TestCodeAgentIntegration -v --tb=short \
|| true
# Store the result
INTEGRATION_TEST_EXIT=$?
if [ $INTEGRATION_TEST_EXIT -eq 0 ]; then
echo "[SUCCESS] Integration tests passed"
else
echo "[WARNING] Some integration tests failed (non-blocking for now)"
fi
- name: Run Code Agent Workflow Tests
run: |
echo ""
echo "================================================================"
echo " CODE AGENT WORKFLOW TESTS"
echo "================================================================"
echo "Testing complete code generation workflows..."
echo ""
# Run workflow tests with timeout
timeout 300 python -m pytest tests/test_code_agent.py -v --tb=short \
-k "workflow or process_query or complete_workflow" \
|| true
# Store the result
WORKFLOW_TEST_EXIT=$?
if [ $WORKFLOW_TEST_EXIT -eq 0 ]; then
echo "[SUCCESS] Workflow tests passed"
elif [ $WORKFLOW_TEST_EXIT -eq 124 ]; then
echo "[WARNING] Workflow tests timed out (5 min limit)"
else
echo "[WARNING] Some workflow tests failed (non-blocking for now)"
fi
- name: Test Summary
if: always()
run: |
echo ""
echo "================================================================"
echo " CODE AGENT TEST SUMMARY"
echo "================================================================"
echo "Test Categories:"
echo " ✅ Mixin Architecture Tests: 38 tests validating refactored structure"
echo " ✅ Unit Tests: Tool functionality, parsing, generation"
echo " ✅ Integration Tests: Multi-step operations"
echo " ✅ Workflow Tests: Complete code generation pipelines"
echo ""
echo "Test Coverage:"
echo " - Mixin architecture and tool registration (NEW)"
echo " - Code parsing and validation"
echo " - Function/class/test generation"
echo " - File I/O operations"
echo " - Pylint and Black integration"
echo " - Error recovery mechanisms"
echo " - Complete workflow simulations"
echo "================================================================"
echo ""
echo "Note: Tests are currently non-blocking to allow for gradual fixes"
echo "================================================================"