Problem
Two low-severity robustness issues:
- Connection leak on exception in several
tasks.py read paths: they open get_db_connection and call conn.close() without try/finally. An exception between open and close leaks a connection (holding a read lock). Write paths already use try/finally correctly.
- Fire-and-forget tasks without strong references can be garbage-collected mid-flight (asyncio keeps only a weak reference).
Evidence
codeframe/core/tasks.py — tasks.get (171-183) and reads at 290, 628, 672, 719, 745, 771 lack try/finally
codeframe/core/tasks.py:515 — loop.create_task(_safe_close_issue(...)) with no retained reference/done-callback
codeframe/notifications/webhook.py:371 — asyncio.create_task in send_blocker_notification_background with no reference and no no-loop fallback (appears unused; blockers.py uses the safe send_event_background at webhook.py:323, which does it correctly with add_done_callback)
Fix
- Wrap the
tasks.py reads in try/finally (or use a context manager).
- Retain references / add
add_done_callback to the fire-and-forget tasks, mirroring send_event_background. Remove or fix the apparently-unused send_blocker_notification_background.
Acceptance criteria
Source: release-readiness audit 2026-06-13 (backend agent).
Problem
Two low-severity robustness issues:
tasks.pyread paths: they openget_db_connectionand callconn.close()withouttry/finally. An exception between open and close leaks a connection (holding a read lock). Write paths already usetry/finallycorrectly.Evidence
codeframe/core/tasks.py—tasks.get(171-183) and reads at 290, 628, 672, 719, 745, 771 lacktry/finallycodeframe/core/tasks.py:515—loop.create_task(_safe_close_issue(...))with no retained reference/done-callbackcodeframe/notifications/webhook.py:371—asyncio.create_taskinsend_blocker_notification_backgroundwith no reference and no no-loop fallback (appears unused; blockers.py uses the safesend_event_backgroundatwebhook.py:323, which does it correctly withadd_done_callback)Fix
tasks.pyreads intry/finally(or use a context manager).add_done_callbackto the fire-and-forget tasks, mirroringsend_event_background. Remove or fix the apparently-unusedsend_blocker_notification_background.Acceptance criteria
tasks.pyDB reads release the connection on exception.Source: release-readiness audit 2026-06-13 (backend agent).