Skip to content

fix: harden SQLAlchemySession against transient SQLite locks#2854

Merged
seratch merged 1 commit intomainfrom
fix/sqlite-session-lock-retries
Apr 7, 2026
Merged

fix: harden SQLAlchemySession against transient SQLite locks#2854
seratch merged 1 commit intomainfrom
fix/sqlite-session-lock-retries

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented Apr 7, 2026

This pull request fixes intermittent SQLite database is locked failures in SQLAlchemySession during concurrent first writes in CI. It updates src/agents/extensions/memory/sqlalchemy_session.py to apply SQLite connection settings that reduce lock contention and to retry transient lock errors during add_items() without changing the public API or schema. It also adds focused regression coverage in tests/extensions/memory/test_sqlalchemy_session.py for transient write locks alongside the existing concurrent first-access cases.

The change is a bug fix in the memory backend. The failure mode showed up as flaky CI when concurrent writers hit SQLite before or during early session initialization, so the implementation now treats short-lived SQLite lock contention as retriable instead of surfacing it immediately.

@seratch seratch added this to the 0.13.x milestone Apr 7, 2026
@github-actions github-actions bot added bug Something isn't working feature:sessions labels Apr 7, 2026
@seratch seratch merged commit c06cd45 into main Apr 7, 2026
9 checks passed
@seratch seratch deleted the fix/sqlite-session-lock-retries branch April 7, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:sessions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant