@@ -163,6 +163,14 @@ jobs:
163163 shell : bash
164164 run : |
165165 python << 'EOF'
166+ import sys
167+
168+ # Set UTF-8 encoding for Windows compatibility
169+ if sys.platform == 'win32':
170+ import io
171+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
172+ sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
173+
166174 # Check agent_runtime.py line 345
167175 print("=== Checking agent_runtime.py line 345 ===")
168176 with open('sentience/agent_runtime.py', 'r', encoding='utf-8') as f:
@@ -185,11 +193,11 @@ jobs:
185193 # Check for self.assertTrue( - this is the bug
186194 if re.search(r'self\.assertTrue\s*\(', content):
187195 print('ERROR: Found self.assertTrue( - should be self.assert_( instead!')
188- exit(1)
196+ sys. exit(1)
189197 # Check for assertTrue( without self. - unittest style (also wrong)
190198 if re.search(r'(?<!self\.)assertTrue\s*\(', content):
191199 print('ERROR: Found assertTrue( without self. - should use self.assert_( instead!')
192- exit(1)
200+ sys. exit(1)
193201 print('Good: no problematic assertTrue patterns found')
194202 EOF
195203
@@ -226,14 +234,21 @@ jobs:
226234 run : |
227235 echo "=== Final check before tests ==="
228236 python << 'EOF'
237+ import sys
229238 import re
230239 import os
231240
241+ # Set UTF-8 encoding for Windows compatibility
242+ if sys.platform == 'win32':
243+ import io
244+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
245+ sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
246+
232247 # Check the source file directly (not the installed package)
233248 file_path = 'sentience/agent_runtime.py'
234249 if not os.path.exists(file_path):
235250 print(f'WARNING: {file_path} not found!')
236- exit(0) # Don't fail if file doesn't exist
251+ sys. exit(0) # Don't fail if file doesn't exist
237252
238253 with open(file_path, 'r', encoding='utf-8') as f:
239254 content = f.read()
@@ -258,7 +273,7 @@ jobs:
258273 print(' (main branch already has this fix in commit c7a43a9)')
259274 print('\nNOTE: This check is set to continue-on-error for now.')
260275 print('Please fix the code and remove continue-on-error once fixed.')
261- exit(1) # Still exit with error, but workflow continues due to continue-on-error
276+ sys. exit(1) # Still exit with error, but workflow continues due to continue-on-error
262277 else:
263278 # Verify that self.assert_( is used (positive check)
264279 if 'self.assert_(' in content:
0 commit comments