463aced7a1
Script_UsingDatabase_QueriesViaGateway failed in about 2 of 27 full InboundAPI runs. Looping the suite 30 times captured the failure 4 times, always as "Internal script error". The exception underneath was SqliteException 'no such table: Machine'. Cause: the seeding helper opened its keep-alive SqliteConnection in a local. Once the helper returned, nothing referenced that connection. After a GC (likely during the Roslyn compile, under full-suite load), Microsoft.Data.Sqlite's pool reclaimed the leaked connection and closed the last connection to the shared in-memory database, which destroyed it. Fix: hold the keep-alive in a static field. InboundDatabaseHelperTests had the same latent bug and gets the same fix. The test now forces GC plus SqliteConnection.ClearAllPools() before the query. That makes the old pattern fail deterministically and the fix pass deterministically. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV