-
Notifications
You must be signed in to change notification settings - Fork 123
178 lines (153 loc) · 6.14 KB
/
Copy pathtest_chat_agent.yml
File metadata and controls
178 lines (153 loc) · 6.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
# This workflow tests the GAIA Chat Agent, which ships as the standalone
# gaia-agent-chat wheel (#1102). Tests include the wheel's own smoke tests
# plus the framework-side session, RAG, and path-validation suites.
name: Chat Agent Tests
on:
workflow_call:
push:
branches: [ main ]
paths:
- 'hub/agents/python/chat/**'
- 'src/gaia/agents/base/**'
- 'src/gaia/agents/tools/**'
- 'src/gaia/rag/**'
- 'src/gaia/chat/**'
- 'tests/test_chat_agent.py'
- 'tests/test_chat_sdk.py'
- 'setup.py'
- '.github/workflows/test_chat_agent.yml'
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'hub/agents/python/chat/**'
- 'src/gaia/agents/base/**'
- 'src/gaia/agents/tools/**'
- 'src/gaia/rag/**'
- 'src/gaia/chat/**'
- 'tests/test_chat_agent.py'
- 'tests/test_chat_sdk.py'
- 'setup.py'
- '.github/workflows/test_chat_agent.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:
test-chat-agent:
name: Test Chat 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,rag]
# Install pytest-mock for mocking tests
uv pip install --system pytest-mock
# ChatAgent ships as the standalone gaia-agent-chat wheel (#1102)
uv pip install --system -e hub/agents/python/chat
- name: Run Chat Agent Package Tests
env:
GAIA_MEMORY_DISABLED: "1"
run: |
echo "================================================================"
echo " CHAT AGENT PACKAGE TESTS"
echo "================================================================"
echo "Testing registration shapes, lazy re-exports, and discovery..."
echo ""
python -m pytest hub/agents/python/chat/tests/ -v --tb=short
- name: Run Chat Agent Unit Tests
env:
# Skip memory init — Lemonade isn't available in this CI job; the
# ChatAgent unit tests don't exercise memory functionality.
GAIA_MEMORY_DISABLED: "1"
run: |
echo "================================================================"
echo " CHAT AGENT UNIT TESTS"
echo "================================================================"
echo "Testing core functionality: initialization, tools, session management..."
echo ""
# Run unit tests
python -m pytest tests/test_chat_agent.py::TestChatAgent -v --tb=short
# Store the result
UNIT_TEST_EXIT=$?
if [ $UNIT_TEST_EXIT -eq 0 ]; then
echo "[SUCCESS] Unit tests passed"
else
echo "[FAILURE] Unit tests failed"
exit 1
fi
- name: Run Chat Agent Session Tests
env:
GAIA_MEMORY_DISABLED: "1"
run: |
echo ""
echo "================================================================"
echo " CHAT AGENT SESSION TESTS"
echo "================================================================"
echo "Testing session persistence and chat history..."
echo ""
# Run session tests
python -m pytest tests/test_chat_agent.py::TestChatAgentSessions -v --tb=short
# Store the result
SESSION_TEST_EXIT=$?
if [ $SESSION_TEST_EXIT -eq 0 ]; then
echo "[SUCCESS] Session tests passed"
else
echo "[FAILURE] Session tests failed"
exit 1
fi
- name: Run Chat Agent Path Validation Tests
env:
GAIA_MEMORY_DISABLED: "1"
run: |
echo ""
echo "================================================================"
echo " CHAT AGENT PATH VALIDATION TESTS"
echo "================================================================"
echo "Testing path security and validation..."
echo ""
# Run path validation tests
python -m pytest tests/test_chat_agent.py::TestChatAgentPathValidation -v --tb=short
# Store the result
PATH_TEST_EXIT=$?
if [ $PATH_TEST_EXIT -eq 0 ]; then
echo "[SUCCESS] Path validation tests passed"
else
echo "[FAILURE] Path validation tests failed"
exit 1
fi
- name: Test Summary
if: always()
run: |
echo ""
echo "================================================================"
echo " CHAT AGENT TEST SUMMARY"
echo "================================================================"
echo "Test Categories:"
echo " - Unit Tests: Agent initialization, tool registration"
echo " - Session Tests: Save/load sessions, chat history persistence"
echo " - Path Tests: Security validation, allowed paths"
echo ""
echo "Test Coverage:"
echo " - Chat agent initialization and configuration"
echo " - Session management (save/load/resume)"
echo " - Chat history persistence across sessions"
echo " - RAG document indexing"
echo " - Path validation and security"
echo "================================================================"