Skip to content

docs(plans): Agent Factory — the developer flow, automated (against t… #3090

docs(plans): Agent Factory — the developer flow, automated (against t…

docs(plans): Agent Factory — the developer flow, automated (against t… #3090

Workflow file for this run

# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
# Fast unit tests that don't require Lemonade server or external dependencies
# These tests run first to provide quick feedback on core SDK components
# Platform: Ubuntu (pure Python tests, no platform-specific code)
name: Unit Tests
on:
workflow_call:
push:
branches: [ main ]
paths:
- 'src/**'
- 'tests/**'
- 'setup.py'
- 'pyproject.toml'
- '.github/workflows/test_unit.yml'
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/**'
- 'tests/**'
- 'setup.py'
- 'pyproject.toml'
- '.github/workflows/test_unit.yml'
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:
unit-tests:
name: Unit Tests (py${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: |
# pyfakefs is required by tests/unit/installer/test_uninstall_command.py
# which uses the `fs` fixture to build a fake filesystem for testing
# tiered uninstall logic cross-platform without touching the real FS.
# pytest-mock is required by the browser/filesystem tool tests.
# keyring + httpx + respx are required by tests/unit/connections/
# (issue #915). The in-memory keyring backend in tests/conftest.py
# avoids the SecretService daemon prerequisite on Linux runners.
uv pip install --system pytest pytest-cov pytest-asyncio pytest-mock pytest-timeout \
pyfakefs keyring httpx respx
uv pip install --system -e ".[api]"
- name: Validate packaging integrity
run: |
echo "=== Validating Packaging Integrity ==="
echo "Checking setup.py packages, __init__.py files, and entry points"
echo ""
pytest tests/unit/test_packaging.py -v --tb=short
echo "✅ Packaging integrity checks passed"
- name: Run unit tests
env:
# Skip memory init — Lemonade isn't available in this CI job; the
# unit tests don't exercise memory functionality (memory has its
# own dedicated tests with mocked embeddings).
GAIA_MEMORY_DISABLED: "1"
run: |
echo "=== Running Unit Tests ==="
echo "These are fast tests for core SDK components"
echo ""
pytest tests/unit/ -v --tb=short \
--cov=src/gaia --cov-report=term-missing --cov-report=xml:coverage.xml
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@v7
with:
files: coverage.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Run DatabaseMixin integration tests
env:
GAIA_MEMORY_DISABLED: "1"
run: |
echo "=== Running DatabaseMixin Integration Tests ==="
echo "Testing DatabaseMixin with Agent class"
echo ""
pytest tests/integration/test_database_mixin_integration.py -v --tb=short
- name: Run DatabaseAgent integration tests
env:
GAIA_MEMORY_DISABLED: "1"
run: |
echo "=== Running DatabaseAgent Integration Tests ==="
echo "Testing DatabaseAgent with auto-registered tools"
echo ""
pytest tests/integration/test_database_agent.py -v --tb=short
- name: Unit test summary
if: always()
run: |
echo ""
echo "=== Test Coverage ==="
echo "CLI Smoke Tests (pytest, auto-discovered):"
echo " - tests/unit/cli/test_cli_smoke.py: --help for every subcommand + console script"
echo ""
echo "Unit Tests:"
echo " - SDToolsMixin: Stable Diffusion image generation for agents"
echo " - DatabaseMixin: SQLite database access for agents"
echo " - FileWatcher: File system monitoring utilities"
echo " - Testing Utilities: MockLLMProvider, MockVLMClient, fixtures"
echo " - EMR Agent: Medical intake form processing"
echo " - EMR CLI: Command-line interface for EMR agent"
echo " - LLM Client: Language model client utilities"
echo " - ASR: Automatic speech recognition utilities"
echo " - TTS: Text-to-speech utilities"
echo " - InitCommand: gaia init profiles and installer logic"
echo " - FileSystemIndex: Persistent file index with FTS5 search"
echo " - FileSystemToolsMixin: browse_directory, tree, file_info, find_files, read_file, bookmark tools"
echo " - ScratchpadService: SQLite working memory for data analysis"
echo " - ScratchpadToolsMixin: create_table, insert_data, query_data, list_tables, drop_table tools"
echo " - BrowserTools: WebClient SSRF prevention, HTML extraction, downloads"
echo " - WebClient Edge Cases: parse_html fallback, extract_text, tables, links, download redirects"
echo " - Categorizer: auto_categorize, category map completeness, extension uniqueness"
echo " - ChatAgent Integration: filesystem, scratchpad, browser init/config/cleanup"
echo " - File Write Guardrails: blocked dirs, sensitive files, size limits, backup, audit"
echo " - Security Edge Cases: symlinks, audit logging, TOCTOU, prompt_overwrite"
echo " - Service Edge Cases: DB corruption rebuild, shared DB, row limits, transaction atomicity"
echo ""
echo "Integration Tests:"
echo " - DatabaseMixin + Agent: Full agent lifecycle with database"
echo " - DatabaseAgent: Auto-registered database tools"
# Experimental macOS smoke test — validates core SDK imports and pure-Python
# unit tests on Darwin. continue-on-error until the full suite is macOS-clean.
unit-tests-macos:
name: Unit Tests (macOS smoke)
runs-on: macos-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
continue-on-error: true
steps:
- uses: actions/checkout@v6
- 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 pytest pytest-asyncio pytest-mock pytest-timeout \
pyfakefs keyring httpx respx
uv pip install --system -e ".[api]"
- name: Validate packaging integrity
run: |
echo "=== Validating Packaging Integrity ==="
echo "Checking setup.py packages, __init__.py files, and entry points"
echo ""
pytest tests/unit/test_packaging.py -v --tb=short
echo "✅ Packaging integrity checks passed"
- name: Run unit tests (macOS smoke)
env:
GAIA_MEMORY_DISABLED: "1"
run: |
echo "=== macOS Smoke Test ==="
echo "Running unit tests on macOS to catch platform-specific issues"
echo ""
pytest tests/unit/ -x --timeout=60 -v --tb=short