Merge qualified sleep review fixes and prerequisites

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* commit '2d273d7ebb66179fa5c7c51dcfed6fee7b1f4e16':
  fix(retention): wake blocker retention after no-run workspace export
  Bound blocker workspace history reads by candidate workspace
  Validate eligibility before first attention retention materialization
  fix(retention): exclude finalized blockers before graph bounds
  test: hold lifecycle verification before retry identity assertions
  Exercise saved legacy input through its eligibility producer
  fix: cancel merge confirmation acceptance under lock
  Bound repeated external-object eligibility reconstruction
This commit is contained in:
DottaandPaperclip committed 2026-10-31 02:02:01 -05:00
commit 2ef4fa60c3
19 files changed
+862 -140

No files matched your search

@@ -19,8 +19,8 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
let companyId: string;
const workers: Array<{ stop(): Promise<void> }> = [];
beforeAll(async () => {
if (external) { await applyPendingMigrations(external); db = createDb(external); }
else { database = await startEmbeddedPostgresTestDatabase("paperclip-verification-retry-"); db = createDb(database.connectionString); }
if (external) { await applyPendingMigrations(external); db = createDb(external, { maxConnections: 6 }); }
else { database = await startEmbeddedPostgresTestDatabase("paperclip-verification-retry-"); db = createDb(database.connectionString, { maxConnections: 6 }); }
}, 90_000);
afterAll(async () => { if (external) await closeRegisteredClients(external); else await database?.cleanup(); });
beforeEach(async () => {
@@ -76,12 +76,22 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
it("permits an explicit retry of the same operation and completes verification before readiness", async () => {
const { agent, work, runHost } = await failed();
runHost.mockResolvedValue("complete");
await createAgentLifecycle(db).retry(agent.id);
expect((await current(agent.id)).lifecycleOperation).not.toHaveProperty("retryRequired");
expect((await current(agent.id)).lifecycleOperation).not.toHaveProperty("verificationFailures");
expect((await current(agent.id)).lifecycleOperation!.id).toBe(agent.lifecycleOperation!.id);
await work.process(agent.id);
let release!: () => void;
const verification = new Promise<void>(resolve => { release = resolve; });
runHost.mockImplementation(async () => { await verification; return "complete"; });
let processing: Promise<void> | undefined;
try {
await createAgentLifecycle(db).retry(agent.id);
processing = work.process(agent.id);
const retried = await current(agent.id);
expect(retried).toMatchObject({ lifecycleState: "verifying", status: "paused" });
expect(retried.lifecycleOperation).not.toHaveProperty("retryRequired");
expect(retried.lifecycleOperation).not.toHaveProperty("verificationFailures");
expect(retried.lifecycleOperation!.id).toBe(agent.lifecycleOperation!.id);
} finally {
release();
await processing;
}
expect(await current(agent.id)).toMatchObject({ lifecycleState: "ready", status: "idle", lifecycleError: null });
});