- Add face_tracker.rs with core tracking algorithms
- Add trace_id field to Face struct
- Add metadata field to FaceResult struct
- Implement IoU, distance, and embedding similarity calculations
- Implement match_faces and track_faces functions
- Support scene cut detection
- Add unit tests for core functions
- Increased max_tokens from 200/400 to 800 for all languages
- Gemma 4 uses thinking mode, needs more tokens for reasoning before output
- Fixes Scene VLM API request failures
- Create store_face_embeddings_to_qdrant.py script
- Add automatic Qdrant storage call after FaceNet completes
- Store 512D embeddings with metadata (frame, confidence, bbox)
- Enables downstream face tracing and clustering
This ensures embeddings are automatically stored in Qdrant without manual intervention.
- Add Swift FaceNet program using FaceNet CoreML model
- Integrate FaceNet into Rust Face processor (auto-generate embeddings)
- Adjust face_filter_defaults: min_confidence=0.5, min_size=1
- Support 512-dim embeddings with ANE acceleration
- Remove Python dependency for face embedding generation
Verified: 210 embeddings generated successfully (99.1% success rate)
Performance: 6.5s for 210 embeddings
Production ready.
- Modified asrx.rs to prioritize Swift binary (asrx_swift)
- Swift ASRX already compiled (1.5MB)
- Retained Python fallback for backward compatibility
- Removed dependency on asrx_processor.py for main flow
Phase 3 of processor architecture refactoring
All core processors now using Swift/CLI:
- Face: Swift ✅
- OCR: Swift ✅
- ASR: Whisper CLI ✅
- ASRX: Swift ✅
- CUT: FFmpeg ✅
- Scene VLM: Rust ✅
- Modified ocr.rs to prioritize Swift binary over Python wrapper
- Swift OCR already compiled and tested
- Retained Python fallback for backward compatibility
- Created migration plan document for full Python → Rust transition
Phase 1 of processor architecture refactoring (user chose option C)
Related: once_cell::Lazy poisoning issue blocking Python processors
- src/bin/cleanup_orphan_vectors.rs: one-time tool to scan per-file Qdrant
collections (rule1/_faces/_scenes/_vlm/_seeds/face_embeddings/speaker),
dry-run support, delete points whose file_uuid is no longer registered.
Used to remove 53,122 orphan vectors across all production collections.
- docs: scene VLM search design suggestions for Studio team (8868 proxy)
- Remove MOMENTRY_USE_RUST_PROCESSORS from .env
- Face Cluster now tries Rust binary first, falls back to Python
- Appearance and Pose keep using Python (not needed currently)
- Simpler configuration: no global switch needed
** Problem:
- get_face_filter_defaults() used blocking_read() in sync context
- Caused panic: 'Cannot block the current thread from within a runtime'
- VLM generation repeatedly failed with panic
** Root Cause:
- admin_config.rs:473: ADMIN_CONFIG.config.blocking_read()
- Called from FileProfile::defaults() which runs in async context
- Tokio runtime doesn't allow blocking operations
** Fix:
- Replace blocking_read() with try_read()
- Fall back to hardcoded defaults if config is locked
- Non-blocking, safe for async context
** Impact:
- VLM summaries now generate successfully
- No more panics in VLM processing
- Job 779 VLM generation now working
** Problem:
- Worker set FACE_MIN_CONFIDENCE=0.5 via std::env::set_var()
- But Python subprocess received FACE_MIN_CONFIDENCE=0.4 (from config)
- get_face_settings() prioritized admin config over environment variables
** Root Cause:
- Line 17-21: Config checked first, env var as fallback
- Worker's runtime override was ignored
** Fix:
- Reversed priority: Environment variable > Admin config
- Now reads FACE_MIN_CONFIDENCE from env first
- Falls back to config only if env var not set
** Impact:
- Worker can override face thresholds at runtime
- UI 'Deep Scan' will use correct thresholds (0.5, 1)
- Allows per-job threshold customization
** Note:
- Binary built at 05:11
- All jobs currently completed
- Requires new job to test (no active jobs available)
** Problem:
- Worker set processor status to 'running' BEFORE checking capacity
- If capacity limit reached, processor was skipped but status stuck at 'running'
- Worker would skip processors with 'running' status on next poll (deadlock)
** Root Cause:
- Line 591-600: update_processor_progress(..., 'running')
- Line 1434: check capacity (TOO LATE!)
- Result: status='running' but processor never started
** Fix:
- Move capacity check BEFORE setting 'running' status
- If capacity limit reached, mark as 'skipped' immediately
- Prevents 'running' status from being set when processor won't actually run
** Impact:
- Fixes UI 'Deep Scan' deadlock issue
- Workers will no longer get stuck in infinite loop
- Processor status will accurately reflect actual state
** Files Changed:
- src/worker/job_worker.rs: Moved capacity check to line 591-592
- Removed duplicate capacity check at line 1464-1493
- Changed min_confidence from 50.0 to 0.5 (Vision uses 0.0-1.0 range)
- Changed min_size from 32 to 1 (was filtering out all small faces)
- Changed min_capture_quality from 25.0 to 0.25
- Fixes issue where all videos showed 0 faces detected
Root cause: admin_config.rs used wrong defaults (50.0/32) instead of
config.rs constants (0.5/1), causing Vision framework to filter out
ALL faces because confidence threshold exceeded valid range.
Verified: IMG_9449 now correctly detects 191 faces (was 0).
Problem: Re-scan (/api/v1/file/:file_uuid/process) only deleted processor_results from DB,
but not output files. Worker checks if output file exists and skips re-processing,
resulting in stale/incorrect results persisting.
Solution:
- Add 'force' parameter to ProcessRequest struct (default: false)
- When force=true, delete all output files before re-processing
- Worker will then re-run processors from scratch
Changes:
- src/api/processing.rs:
- Added 'force: bool' to ProcessRequest
- Added delete_output_files_for_uuid() helper function
- Modified trigger_processing() to delete output files when force=true
API usage:
POST /api/v1/file/:file_uuid/process
{
"processors": ["face","ocr",...],
"force": true
}
Note: Build currently fails due to unrelated uncommitted admin_config changes.
Those should be fixed separately.
- Delete YOLO processor implementation (src/core/processor/yolo.rs)
- Remove YOLO from processing pipeline and worker
- Clean up YOLO-related code across multiple modules
- Add migration 033_remove_yolo.sql
YOLO functionality removed as part of architecture simplification
- postgres_db.rs: CAST source_weight to ::float8 (NUMERIC→FLOAT8)
- rerank.rs: char-based truncation for UTF-8 safety
- Both fixes prevent tokio worker panics that killed search requests
Bug root causes:
- keyword/BM25: sqlx decode f64 from NUMERIC panicked at postgres_db.rs:3758
- llm-smart: &text[..100] byte slice panicked at rerank.rs:52 on Chinese text
Verified: both /api/v1/search/keyword and /api/v1/search/llm-smart now return 200
- Add info log in vlm_summary.rs showing VLM model name
- Add print statements in Python VLM scripts showing model name
- Applies to: trace_vlm_caption.py, scene_vlm_caption.py, interval_vlm_caption.py
- Add ChunkType::Moment to types.rs
- Add moment_interval to FileProfile (configurable, default 10s)
- Create rule3_moment.rs: reads trace_profile.json, groups by time window,
selects 1-2 diverse key frames using Jaccard similarity on VLM text
- Embed moment chunks into Qdrant using trace VLM embeddings
- Wire into worker: triggers after VLM completes, blocks job completion
- Add moment_chunks progress stage (weight: 0.01)
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.
- vlm_summary now skips VLM call if description exists, but still generates embedding + Qdrant
- API endpoint checks both vlm_description AND vlm_embedding before saying 'already done'
- Fixed point_id hash generation (was creating 0, now properly hashes)
- Add upsert_vlm_embedding to QdrantDb with trace_id in payload
- chunk_id format: {file_uuid}_t{trace_id_hex} for search enrichment
- Update enrich_vlm_from_pg to extract trace_id from chunk_id
- VLM summary now searchable via semantic search with source_type=vlm
- Move VLM trigger from TKG spawn to worker poll loop
- Each poll checks if VLM is incomplete and key_frames are ready
- If VLM was interrupted (server restart), next poll will restart it
- Removed duplicate VLM spawn from TKG block
- Added trace_profiles query to compute vlm_done/vlm_total
- vlm_summary stage now shows actual progress (e.g. 312/4829)
- Status shows 'running' while in progress, 'completed' when done
- Add TraceArtifacts phase to TkgPhase enum (phase 18)
- Report progress as key_frame.jpg/key_face.jpg are created
- VLM trigger now polls until ALL key_frame.jpg files exist
(was: started after TKG build, before artifacts were ready)
- Add iron rule to AGENTS.md: ask before removing data
Tested: Gamma 8 (27 traces) → 27/27 VLM summaries completed
- Move P5 VLM trigger from TKG block to Face Dedup block
(trace_profiles DB is written by update_face_track_labels, not TKG)
- Update on-disk trace_profile.json label when Face Dedup updates names
- Add output_dir and redis_clone to Face Dedup spawn scope
Pipeline flow:
Face → P2 Tracing → P3 Cluster → update_face_track_labels
→ DB trace_profiles + on-disk JSON updated
→ P5 VLM triggered with verified trace count
VLM summary was blocking job completion, causing jobs created before
P5 deployment to be stuck forever (vlm=false, all_ok=false).
Now VLM logs progress but doesn't block: vlm_done_bool always true.
This allows older jobs to complete while VLM can be triggered
separately via API.
Register should only write videos table, not automatically create
monitor jobs. This violates the design principle that register does
not trigger deep scan.
The auto-pipeline (triggered only for new files with auto_pipeline_enabled)
handles job creation separately. Re-scan via processing API will handle
job creation when needed.
When a file is re-registered after unregister, the monitor_job is
missing. The register function now checks if a job exists and creates
one with full pipeline processors (cut, asr, asrx, ocr, face,
face_cluster) if missing.
This ensures re-scan after unregister triggers the complete pipeline
including face detection → TKG → VLM summary (P5).
verify_traces_ready now runs synchronously after build_tkg().await
completes, not inside a separate spawned task. This guarantees the
DB transaction from TKG is fully committed before VLM checks for data.
Before: TKG spawn → P5 spawn (race: P5 may run before TKG DB commit)
After: TKG spawn → build_tkg() await → verify → spawn VLM (sequential)
B: Replace wait_for_traces polling with verify_traces_ready
- Uses JOIN query: trace_profiles INNER JOIN tkg_nodes
- Ensures trace_profiles data is consistent with TKG before VLM runs
- Single query instead of 30 retry attempts
C: Add 5-minute timeout to VLM generation
- tokio::time::timeout(300s) prevents worker from hanging
- Logs completion stats or timeout error
This fixes the root cause: P5 no longer polls blindly waiting for
TKG to finish. The JOIN query only returns rows when both
trace_profiles AND tkg_nodes face_track entries exist.
- Add wait_for_traces() helper: polls trace_profiles table every 2s
up to 60s, returning when rows appear (TKG may still be writing)
- Replace one-shot face_count query in both P5 triggers (has_face +
no-face paths) with polling
- Verified: 22/22 traces summarized for 9df18017, semantic search
returns 10 VLM results with sim 0.601-0.696
- Add vlm_point_id column to trace_profiles (stores Qdrant point ID)
- Add upsert_chunk_embedding_u64 to QdrantDb (numeric ID support)
- Add chunk_id to VLM payload in Qdrant for search enrichment
- Update enrich_from_pg to fallback to VLM lookup when chunk not found
- Add /api/v1/file/:uuid/vlm-summary endpoint for manual trigger
- Fix VLM point_id: use u64 hash instead of string (Qdrant requirement)
- Fix VLM timeout: was 0 (immediate timeout), now 120s
Verified: semantic search returns [vlm] results with proper enrichment
- tkg.rs: key_frame/key_face/best_bbox now use best-confidence frame
(was cq_best capture-quality) so thumbnails agree with trace_agent_api
best_face_frame / [F..] labels
- keep cq_best_quality as trace-level stat only
- add backfill_trace_dirs + skip_existing resume mode
- trace_agent_api.rs regenerate-thumbnail: use strict > tie-break (reduce)
matching list_traces_sorted so equal-confidence frames pick the same one