mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 05:24:49 +09:00
test_command_roundtrip_via_send_command drives agent_registry.send_command from a background thread while the main thread handles /poll and /result. Flask-SQLAlchemy serves :memory: from a single shared connection (StaticPool), so the two threads issue interleaved transactions on one connection and the background commit intermittently dies with ObjectDeletedError / PendingRollbackError (it passed some CI runs, failed others). Point tests at a temp-file SQLite instead: each thread gets its own connection with SQLite's file locking, which is safe and deterministic. Add synchronous=OFF / journal_mode=MEMORY PRAGMAs so the file DB stays ~as fast as in-memory (throwaway data needs no durability). No production code changed. Verified: the e2e roundtrip passes 22/22 consecutive runs (was flaky); full suite green (exit 0, 232 passed / 12 skipped locally). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>