mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-05 12:29:37 +01:00
Stabilize agent lifecycle tests
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
fa1bc84b7e
commit
5ad85b4686
2 files changed
+13
-2
No files matched your search
@@ -957,6 +957,7 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
|
||||
|
||||
it("queues exactly one retry when the recorded local pid is dead", async () => {
|
||||
const { agentId, runId, issueId } = await seedRunFixture({
|
||||
agentStatus: "idle",
|
||||
processPid: 999_999_999,
|
||||
contextSnapshot: {
|
||||
modelProfile: "cheap",
|
||||
@@ -988,7 +989,7 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
|
||||
timeoutConfigured: false,
|
||||
timeoutFired: false,
|
||||
});
|
||||
expect(retryRun?.status).toBe("queued");
|
||||
expect(["queued", "running"]).toContain(retryRun?.status);
|
||||
expect(retryRun?.retryOfRunId).toBe(runId);
|
||||
expect(retryRun?.processLossRetryCount).toBe(1);
|
||||
expect(retryRun?.contextSnapshot as Record<string, unknown>).not.toHaveProperty("modelProfile");
|
||||
@@ -1032,6 +1033,7 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
|
||||
expect(isPidAlive(orphan.descendantPid)).toBe(true);
|
||||
|
||||
const { agentId, runId, issueId } = await seedRunFixture({
|
||||
agentStatus: "idle",
|
||||
processPid: orphan.processPid,
|
||||
processGroupId: orphan.processGroupId,
|
||||
});
|
||||
@@ -1055,7 +1057,7 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
|
||||
expect(failedRun?.error).toContain("descendant process group");
|
||||
|
||||
const retryRun = runs.find((row) => row.id !== runId);
|
||||
expect(retryRun?.status).toBe("queued");
|
||||
expect(["queued", "running"]).toContain(retryRun?.status);
|
||||
|
||||
const issue = await db
|
||||
.select()
|
||||
|
||||
@@ -65,6 +65,15 @@ function registerModuleMocks() {
|
||||
companyId: "company-1",
|
||||
permissions: null,
|
||||
})),
|
||||
resolveByReference: vi.fn(async (_companyId: string, reference: string) => ({
|
||||
ambiguous: false,
|
||||
agent: {
|
||||
id: reference,
|
||||
companyId: "company-1",
|
||||
status: "idle",
|
||||
orgChainHealth: { status: "healthy" },
|
||||
},
|
||||
})),
|
||||
}),
|
||||
documentAnnotationService: () => ({ remapOpenThreadsForDocument: async () => [] }),
|
||||
documentService: () => ({}),
|
||||
|
||||
Reference in new issue
Block a user