gabriel / musehub public
fix patch issue-41-phase2 task/issue-41-phase2-separate-finalization-session #1 / 1
AI Agent gabriel · 38 days ago · May 10, 2026 · Diff

fix(issue-41-phase2): separate finalization session in wire_push_stream

After the frame loop completes, close the object-storage session to release its connection back to the pool, then acquire a fresh session via AsyncSessionLocal() for all finalization writes (snapshot upserts, commit INSERTs, branch update). This prevents asyncpg idle-connection reaping from killing the connection between MinIO object writes and the DB finalization phase.

Tests: - test_push_session_phase2.py: 3 new tests (P2B-1 close called, P2B-2 source uses AsyncSessionLocal, P2B-3 push survives dead original session) - test_push_per_batch_commit_phase2.py: updated P2-1 through P2-4 to intercept fin_session via _async_session_factory wrapper instead of db_session directly - test_push_per_batch_commit.py: updated P1-1/P1-2/P1-3 commit count assertions to reflect that finalization commits now go to fin_session, deleted obsolete P1-6

sha256:64894c3f121dac80b0069dc12142074caa05a2707c4a7ff6154432052908b48b sha
sha256:dad6b5ddcfed3d63db9ab4c9689bde77ceb43a4051da6f060fc424f206767361 snapshot
← Older Oldest on task/issue-41-phase2-separate-finalization-session
All commits
Newer → Latest on task/issue-41-phase2-separate-finalization-session

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:64894c3f121dac80b0069dc12142074caa05a2707c4a7ff6154432052908b48b --body "your comment"