diff --git a/server/src/services/fresh-continuation-fallback.test.ts b/server/src/services/fresh-continuation-fallback.test.ts index 390b322b19f..a0351244cf7 100644 --- a/server/src/services/fresh-continuation-fallback.test.ts +++ b/server/src/services/fresh-continuation-fallback.test.ts @@ -6,6 +6,7 @@ import { heartbeatRunEvents, issueComments, issues, nativeRunFinalizations, toolInvocations, } from "@paperclipai/db"; import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } from "../__tests__/helpers/embedded-postgres.js"; +import { truncateTablesWithDeadlockRetry } from "../__tests__/helpers/truncate-with-deadlock-retry.js"; import { deliverReconciledExecutions, settleUnrecoverableExecutions } from "./execution-recovery-resolution.js"; import { PENDING_CONTINUATION_BOUND_MS } from "./recovery-continuation-pacing.js"; import { getExecutionBlocker } from "./execution-blocker.js"; @@ -62,7 +63,8 @@ suite("fresh-continuation fallback", () => { afterEach(async () => { resetBacklogContinuationPacingForTests(db); - await db.execute(sql`truncate table issue_recovery_actions, native_run_finalizations, tool_invocations, + await heartbeatService(db).drainActiveRunExecutions(); + await truncateTablesWithDeadlockRetry(db, `truncate table issue_recovery_actions, native_run_finalizations, tool_invocations, issue_approvals, approvals, issue_thread_interactions, activity_log, agent_wakeup_requests, environment_leases, execution_workspaces, heartbeat_runs, issues cascade`); });