fix: narrow enrollment cleanup predicate for Drizzle

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-11-01 03:38:53 -06:00
1 parent b32e90908f
commit a4db955403
1 file changed
+1 -1
@@ -50,7 +50,7 @@ export async function hasUnsettledLocalInstructionCopies(db: Db): Promise<boolea
eq(copies.location, "local"), notInArray(copies.state, ["saved", "unchanged", "resolved", "superseded"]), eq(copies.location, "local"), notInArray(copies.state, ["saved", "unchanged", "resolved", "superseded"]),
not(and(eq(copies.state, "unavailable"), isNotNull(copies.processStoppedAt), not(and(eq(copies.state, "unavailable"), isNotNull(copies.processStoppedAt),
sql`coalesce(${copies.receipt}->>'schema', '') = 'paperclip.agent-files.v1'`, sql`coalesce(${copies.receipt}->>'schema', '') = 'paperclip.agent-files.v1'`,
sql`coalesce(${copies.receipt}->>'cleanupPending', '') = 'false'`)), sql`coalesce(${copies.receipt}->>'cleanupPending', '') = 'false'`)!),
)).limit(1)).length > 0; )).limit(1)).length > 0;
} }