feat(work): persist queued tasks before device acceptance

This commit is contained in:
ex_tianzy
2026-11-23 15:49:50 +08:00
parent 1e7307e45d
commit 93739a6089
10 changed files with 294 additions and 19 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ class TaskCards:
def snapshot(self,task):
row=self.db.execute('SELECT execution_state FROM work_execution_state_v3 WHERE task_id=?',(task['turn_id'],)).fetchone()
delivery=self.db.execute('SELECT status FROM work_result_outbox_v2 WHERE task_id=?',(task['turn_id'],)).fetchone()
execution=row['execution_state'] if row else 'unknown'
execution=row['execution_state'] if row else 'queued' if task['status']=='queued' else 'unknown'
if task['status']=='unknown' and execution not in {'completed','failed','cancelled','interrupted'}:execution='unknown'
if task['deadline']<=self.clock() and execution not in {'completed','failed','cancelled','interrupted'}:execution='unknown'
lost=self.db.execute('SELECT reason FROM work_task_connection_v3 WHERE task_id=?',(task['turn_id'],)).fetchone()