mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-31 14:16:39 +01:00
Merge codex/sleep-27-teams-attempt-recovery into codex/sleep-28-chat-run-milestones
Co-Authored-By: Paperclip <noreply@paperclip.ing> * codex/sleep-27-teams-attempt-recovery: fix(server): release settled voice recovery intent during drain
This commit is contained in:
commit
f035f410a7
4 files changed
+68
-3
No files matched your search
@@ -90,7 +90,16 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
|
||||
await settled(); expect(inspect).toHaveBeenCalledOnce(); await quiet();
|
||||
});
|
||||
it("preserves the first session during drain without passive database reads", async () => {
|
||||
await start(); await settled(); enabled = false; await session(); await quiet(60_000); expect(inspect).not.toHaveBeenCalled();
|
||||
await start(); await settled(); enabled = false;
|
||||
await db.transaction(async tx => {
|
||||
await session({}, tx as unknown as typeof db);
|
||||
await vi.advanceTimersByTimeAsync(60_000);
|
||||
expect(idleWorkSnapshot().active).toBeGreaterThan(0);
|
||||
expect(inspect).not.toHaveBeenCalled();
|
||||
});
|
||||
await vi.waitFor(async () => { await vi.advanceTimersByTimeAsync(1000); expect(idleWorkSnapshot().active).toBe(0); });
|
||||
const drained = idleWorkSnapshot();
|
||||
await quiet(60_000); expect(idleWorkSnapshot()).toEqual(drained); expect(inspect).not.toHaveBeenCalled();
|
||||
enabled = true; await settled(); expect(inspect).toHaveBeenCalledOnce(); await quiet();
|
||||
});
|
||||
it("retries unavailable authority without ending a valid provider call", async () => {
|
||||
|
||||
@@ -1102,7 +1102,9 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
|
||||
const [publication] = await db.insert(chatPublications).values({ companyId: f.companyId, endpointId: f.endpointId,
|
||||
conversationId: f.conversationId, issueId: f.issueId, idempotencyKey: randomUUID(), state: "published", payload: { text: "After resume" } }).returning();
|
||||
await f.store.enqueuePublication(f.companyId, publication.id);
|
||||
await worker.quiet(60_000); expect(f.transport.sendCallMessage).toHaveBeenCalledOnce();
|
||||
await vi.waitFor(async () => { await vi.advanceTimersByTimeAsync(1000); expect(idleWorkSnapshot().active).toBe(0); });
|
||||
const drained = idleWorkSnapshot();
|
||||
await worker.quiet(60_000); expect(idleWorkSnapshot()).toEqual(drained); expect(f.transport.sendCallMessage).toHaveBeenCalledOnce();
|
||||
enabled = true; await worker.settled();
|
||||
expect(f.transport.sendCallMessage).toHaveBeenCalledTimes(2); expect(f.transport.sendCallMessage.mock.calls.at(-1)?.[1]).toBe("After resume");
|
||||
await worker.quiet(); expect(worker.onError).not.toHaveBeenCalled();
|
||||
|
||||
@@ -83,7 +83,9 @@ export function registerScopedDeadlineWork<Entry extends ScheduledEntry, Scope>(
|
||||
}
|
||||
if (errors.length) throw new AggregateError(errors, `${options.queue} could not settle`);
|
||||
},
|
||||
hasPending: async () => dirty.size > 0,
|
||||
// Retain scopes/deadlines for resume without retaining a settled write's
|
||||
// idle hold during drain. The coordinator still fences unresolved XIDs.
|
||||
hasPending: async () => canRun() && dirty.size > 0,
|
||||
nextRunAt: next,
|
||||
});
|
||||
return worker;
|
||||
|
||||
Reference in new issue
Block a user