Production evidence
Logfire issue #2589 recorded a pgq.job.resolve_relations failure in production on 2026-08-30 at 11:32:55 UTC. Trace: 01a05271a7f19527aad3e12f3621cd1a.
RelationRepository.clear_pending_search_refreshes() generated one DELETE ... id IN (...) statement for 44,926 refresh marker IDs. Including project_id, the statement exceeded asyncpg's hard limit of 32,767 query arguments and failed before retiring any completed refresh work.
The sibling complete_search_refresh_for_generation() method has the same unbounded IN expansion.
Required fix
- Bound both refresh-marker delete paths into multiple statements within the caller-owned transaction.
- Preserve project scoping and generation fencing.
- Add a regression test that proves the statement bound is load-bearing.
Verification
- Focused SQLite and PostgreSQL repository tests.
- Core static/type checks and full required PR CI.
- After release into Cloud, verify the production resolver completes without recurrence and then resolve Logfire #2589.
Production evidence
Logfire issue #2589 recorded a
pgq.job.resolve_relationsfailure in production on 2026-08-30 at 11:32:55 UTC. Trace:01a05271a7f19527aad3e12f3621cd1a.RelationRepository.clear_pending_search_refreshes()generated oneDELETE ... id IN (...)statement for 44,926 refresh marker IDs. Includingproject_id, the statement exceeded asyncpg's hard limit of 32,767 query arguments and failed before retiring any completed refresh work.The sibling
complete_search_refresh_for_generation()method has the same unboundedINexpansion.Required fix
Verification