@@ -16,6 +16,7 @@ import (
1616
1717 "github.com/charmbracelet/crush/internal/app"
1818 "github.com/charmbracelet/crush/internal/backend"
19+ "github.com/charmbracelet/crush/internal/db"
1920 "github.com/charmbracelet/crush/internal/message"
2021 "github.com/charmbracelet/crush/internal/permission"
2122 "github.com/charmbracelet/crush/internal/proto"
@@ -357,9 +358,14 @@ func TestE2E_TwoClientsReceiveSameMessage(t *testing.T) {
357358 ws, err := h.backend.GetWorkspace(wsRespA.ID)
358359 require.NoError(t, err)
359360 // Override the shutdown callback so test cleanup doesn't run
360− // the full app.Shutdown path (which would tear down LSP/MCP/DB
361− // resources the test doesn't need to exercise).
362− backend.SetWorkspaceShutdownFnForTest(ws, func() {})
361+ // the full app.Shutdown path (which would tear down LSP/MCP
362+ // resources the test doesn't need to exercise), but still
363+ // release the pooled DB connection so Windows can clean up
364+ // the temp data directory.
365+ wsDataDir := ws.Cfg.Config().Options.DataDirectory
366+ backend.SetWorkspaceShutdownFnForTest(ws, func() {
367+ _ = db.Release(wsDataDir)
368+ })
363369
364370 evcA, cancelA := h.subscribeSSE(t, ctx, ws.ID, cidA)
365371 t.Cleanup(cancelA)