Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): keep media recovery active

liugaowei24dd2ac46985
diff --git a/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts b/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts
index 8606d92faf..2bc8ad369c 100644
--- a/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts
+++ b/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts
@@ -916,12 +916,14 @@ describe('Cindy Core media invocation state and security boundary', () => {
responseJson: JSON.stringify(successPayload),
});
+ mocks.rows.get(invocationId)!.updatedAt = 1;
const completed = {
ok: true,
status: 'complete',
xdt_video_urls: [`cindy-media://blobs/${'d'.repeat(64)}.mp4`],
};
await expect(callCindyMedia({ action: 'poll', invocationId })).resolves.toMatchObject(completed);
+ expect(Number(mocks.rows.get(invocationId)!.updatedAt)).toBeGreaterThan(1);
await expect(callCindyMedia({ action: 'poll', invocationId })).resolves.toMatchObject(completed);
expect(mocks.outboundFetch).toHaveBeenCalledTimes(4);
expect(mocks.outboundFetch.mock.calls[1][0]).toBe(
diff --git a/apps/desktop/src/main/cindy-media/invocationService.ts b/apps/desktop/src/main/cindy-media/invocationService.ts
index cccf60cbf3..f5fb2d7fcc 100644
--- a/apps/desktop/src/main/cindy-media/invocationService.ts
+++ b/apps/desktop/src/main/cindy-media/invocationService.ts
@@ -1220,6 +1220,18 @@ async function pollInvocation(invocation: StoredMediaInvocation): Promise<Record
}
const guide = invocation.guide.response.poll;
if (invocation.responseJson) {
+ // 已有成功响应的 poll 是结果恢复重试;刷新活动时间,避免仍在主动恢复的
+ // 已付费结果被常规 TTL 清理。保持 pending,不引入新的本地状态。
+ await transitionMediaInvocation(
+ {
+ id: invocation.id,
+ owner: invocation.owner,
+ from: 'pending',
+ to: 'pending',
+ },
+ db,
+ );
+ assertAuthScope(scope, invocation.owner);
return materializeAsyncInvocation(invocation, persistedResponse(invocation), scope, db);
}
try {