From 8732c3e0a4e75311832c2e604dfc0eee9510b6e6 Mon Sep 17 00:00:00 2001 From: Accusys Date: Tue, 25 Aug 2026 21:50:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20VLM=20blocking=20in=20worker=20=E2=80=94?= =?UTF-8?q?=20job=20waits=20for=20all=20traces=20to=20have=20VLM=20descrip?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: vlm_done_bool=true was hardcoded, so job completed immediately without waiting for VLM generation. After re-scan, trace_profile.json showed vlm_summary: null. Fix: Query trace_profiles to check VLM completion status before marking all_ok=true. Job now blocks until vlm_done_count >= vlm_total. --- src/worker/job_worker.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/worker/job_worker.rs b/src/worker/job_worker.rs index 00215d06..a503af48 100644 --- a/src/worker/job_worker.rs +++ b/src/worker/job_worker.rs @@ -1860,8 +1860,30 @@ impl JobWorker { } } - // VLM summary: non-blocking — log progress but don't block job completion - let vlm_done_bool: bool = true; + // VLM summary: blocking — wait for all traces to have VLM description + let tp_table_vlm = schema::table_name("trace_profiles"); + let vlm_total: i64 = sqlx::query_scalar(&format!( + "SELECT COUNT(*) FROM {tp_table_vlm} WHERE file_uuid = $1" + )) + .bind(uuid) + .fetch_one(pool) + .await + .unwrap_or(0); + let vlm_done_count: i64 = sqlx::query_scalar(&format!( + "SELECT COUNT(*) FROM {tp_table_vlm} WHERE file_uuid = $1 AND vlm_description IS NOT NULL AND vlm_description != ''" + )) + .bind(uuid) + .fetch_one(pool) + .await + .unwrap_or(0); + let vlm_done_bool: bool = if vlm_total > 0 { vlm_done_count >= vlm_total } else { true }; + + if vlm_total > 0 { + tracing::info!( + "[Ingestion] vlm_summary={}/{} for uuid={}", + vlm_done_count, vlm_total, uuid + ); + } let all_ok = asr_done && trace_done && tkg_done && face_cluster_done && qdrant_face_done && vlm_done_bool;