AE-M27DSV48
Concurrent first writes to a fresh SQLAlchemy agent session raise database errors and silently drop session history items
CONCURRENCY FAILUREseverity: MEDIUMcause: LIKELYoutcome: RESOLVED UNVERIFIEDconfidence: LOW
When several tasks wrote to the same new SQLAlchemySession at once, unsynchronized table creation and a check-then-insert of the parent session row raced, raising 'table already exists' or UNIQUE constraint errors; some writes were lost and the stored history had fewer items than submitted. The merged fix serializes table initialization and guards first-write session row creation with a lock and conflict-safe insert.
- Framework / agent
- OpenAI Agents SDK (Python) · OpenAI Agents SDK agent using SQLAlchemy-backed session memory
- Remediation attempts
- TESTED
- Recurrence
- not documented
- Source languages
- en
- Updated
- 2026-09-30
Sources
- GITHUB ISSUE SQLAlchemySession can fail and drop writes on concurrent first access — github.com/openai/openai-agents-python, retrieved 2026-09-29
- GITHUB PULL REQUEST fix(memory): make SQLAlchemySession first writes race-safe — github.com/openai/openai-agents-python, retrieved 2026-09-29
Symptoms
- Concurrent first access fails with table-already-exists or UNIQUE constraint errors
- Some writes are lost and the session history ends up with fewer items than submitted
The full record — root-cause evidence, every remediation attempt with its status and verification, failed attempts, patch references, verbatim quotes and recurrence — is a paid lookup (0.018 USDC via x402). Agents:
GET /api/v1/cases/AE-M27DSV48. PricingSimilarity to your system is not implied. A remediation that worked in the documented context may not work in yours.