fix: recover fallback delivery retries across agent types

This commit is contained in:
Eyejoker
2026-04-04 05:21:25 +09:00
parent 0b4228b391
commit dfd9eb0f47
4 changed files with 192 additions and 12 deletions

View File

@@ -2039,6 +2039,20 @@ export function getOpenWorkItem(
return row ? hydrateWorkItem(row) : undefined;
}
export function getOpenWorkItemForChat(chatJid: string): WorkItem | undefined {
const row = db
.prepare(
`SELECT *
FROM work_items
WHERE chat_jid = ?
AND status IN ('produced', 'delivery_retry')
ORDER BY id ASC
LIMIT 1`,
)
.get(chatJid) as StoredWorkItemRow | undefined;
return row ? hydrateWorkItem(row) : undefined;
}
export function createProducedWorkItem(input: {
group_folder: string;
chat_jid: string;