Skip to content

Flaky test: test_concurrent_requests_have_unique_request_ids fails on Python 3.13 #129

@Besthope-Official

Description

@Besthope-Official

Problem

test_concurrent_requests_have_unique_request_ids in tests/integration/test_audit_request_tracing.py:212 intermittently fails on Python 3.13 CI. The test fires 5 concurrent requests via asyncio.gather and asserts len(request_ids) >= 5, but aiosqlite drops a write under concurrency on the in-memory SQLite database, resulting in only 4 records.

Minimal Reproducible Example

for i in {1..300};do echo run $i; uv run --python 3.13 --frozen pytest --cov -q tests/integration/test_audit_request_tracing.py::test_concurrent_requests_have_unique_request_ids||break;done

Expected vs Actual

Expected: 5 audit log entries with unique request_id values.

Actual: Only 4 entries written. aiosqlite's _connection_worker_thread raises RuntimeError: Event loop is closed during concurrent writes, causing a silent audit log loss.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Backend-enhancedbackend enhancementbugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions