Skip to content

Instantly share code, notes, and snippets.

View gn00295120's full-sized avatar

Lucas Wang gn00295120

  • Lucas futures
  • Taiwan
View GitHub Profile
@gn00295120
gn00295120 / CRITICAL_FINDING.md
Last active October 24, 2025 02:39
Twilio Audio Jittering: BEFORE vs AFTER Fix Comparison (PR #1926)

⚠️ CRITICAL FINDING - Test Results Contradict Recommendation

Summary

After implementing the recommended fix (320 bytes/20ms) and generating actual comparison audio, the test results show the fix performs WORSE than the current code.

Test Results

Current Code (BEFORE Fix): 400 bytes / 50ms

✅ Total flushes: 26
@gn00295120
gn00295120 / compare_fix.sh
Last active October 23, 2025 19:51
PR #1981 Test - Gemini Empty Choices Bug Verification (Simplified)
#!/bin/bash
# Simple Branch Comparison - Test main vs PR #1981
#
# Uses only Test 2 (Reasoning Token Exhaustion) - the confirmed working test
#
# Usage:
# export GEMINI_API_KEY="your-key"
# bash /tmp/compare_fix.sh
set -e
@gn00295120
gn00295120 / GEMINI_EMPTY_CHOICES_RESEARCH.md
Created October 23, 2025 18:43
Gemini Empty Choices Bug Tests - PR #1981 Comprehensive Test Suite

Gemini Empty Choices Bug - Research Findings

摘要

研究發現 Gemini 確實會在多種情況下返回空的 choices/candidates 陣列,這證實了 Issue #1559 報告的問題是真實存在的,PR #1981 的防禦性修復是必要的。


已確認的觸發條件

@gn00295120
gn00295120 / test_advanced_sqlite_concurrent.py
Created October 23, 2025 03:31
AdvancedSQLiteSession concurrent access test - verifies lock protection for shared connection
"""
Test concurrent access to AdvancedSQLiteSession to verify lock protection.
This test verifies the fix for Codex's P1 review comment:
- _get_current_turn_number(), _get_next_turn_number(), _get_next_branch_turn_number()
and list_branches() now properly acquire self._lock when accessing shared connection.
Without proper locking, concurrent operations would cause:
- sqlite3.ProgrammingError: Recursive use of cursors not allowed
- Data inconsistency
@gn00295120
gn00295120 / sqlite_stress_test_final.py
Created October 23, 2025 03:13
SQLiteSession stress test with FD monitoring - verifies fix for threading.Lock() bug and FD leak
"""
Comprehensive stress test for SQLiteSession with file descriptor monitoring.
This test demonstrates the fix for two critical bugs:
1. threading.Lock() being created anew on every operation (no thread safety)
2. File descriptor leak from thread-local connections in ThreadPoolExecutor
Test setup:
- 30 concurrent writers + 10 concurrent readers
- 60 seconds duration
@gn00295120
gn00295120 / medium_test.py
Created October 22, 2025 19:39
Comprehensive SQLite stress test: 40 workers, 60 seconds
"""
Medium stress test - 15 workers, 30 seconds
"""
import asyncio
import threading
import time
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent / "src"))
@gn00295120
gn00295120 / test_raw_sqlite_threading.py
Last active October 21, 2025 08:18
SQLite threading test for PR #1954 - verifying nullcontext() safety
#!/usr/bin/env python3
"""
Test SQLite file-based database threading behavior.
Verifies that thread-local connections + nullcontext() is safe for concurrent access.
"""
import asyncio
import sqlite3
import tempfile
import threading
from contextlib import nullcontext