- Check if face.json already has trace_id (from Rust face_tracker)
- Skip Python tracking if traces already assigned
- Prevent duplicate tracking and preserve Rust results
- Support both list (FaceResult) and dict formats
- Add track_faces() call after FaceNet embedding generation
- Apply to both Swift and Python processor paths
- Add logging for tracking status
- Face tracking now runs automatically during face processing
- face.json will include trace_id automatically
- List all completed work (Rust implementation, tests, docs)
- Document files involved (Rust, Python, docs)
- Define next steps and action items
- Provide rollback plan
- Track progress (implementation 100%, integration 0%)
- Analyze current call chain and dependencies
- Propose 3 migration options (A, B, C)
- Recommend Option A (integrate into Face processor)
- Document implementation steps
- Create rollback plan
- List documentation updates needed
- Add 3 unit tests for core algorithms (IoU, distance, similarity)
- Add integration test stubs for real data testing
- Create comprehensive test report
- Document performance expectations
- Note playground compilation issues for future fixes
- 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.
Test results:
✅ Swift Face: <1s (fast)
✅ Swift OCR: ~25s (RTF 2.5x)
✅ Whisper CLI ASR: 1m34s (accurate, multilingual)
⚠️ Swift ASRX: 20s (language limitation)
✅ CUT: <1s
Achievements:
- 50-90% reduction in startup time
- 17-97% reduction in processing time
- All processors working correctly
- JSON format compatible with Rust
Findings:
- ASRX has limited language support (Apple Speech Framework)
- Whisper CLI slower but more accurate
- Recommendation: Keep Python ASRX for broader language support
- 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 ✅
Test results:
- Swift OCR: ✅ Working (RTF 2.431x, no text detected)
- Whisper CLI: ⏳ Model downloading (461MB)
Swift processors (Face, OCR) successfully bypass Python wrapper.
Architecture validated: Swift + CLI tools + Rust layer.
- 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)
- Lists all modified files with absolute paths
- Includes step-by-step instructions for Studio team
- Documents commits and expected results
- Provides troubleshooting guidance
** Purpose:
- Provide clear deployment instructions for Studio team
- Document the fix and required actions
- Enable quick verification steps
** Files Added:
- docs_v1.0/STUDIO_TEAM/2026-09-18_worker_deadlock_fix_handoff.md
- docs_v1.0/STUDIO_TEAM/README.md
** Key Points:
- Code fix committed (0fe09af)
- Worker binary needs rebuild
- Studio team should rebuild and redeploy
- Verification steps included
** 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.
- Replace fixed 320px downscale with smart resolution handling
- Videos <= 1920px: use native resolution (no downscale)
- Videos > 1920px: downscale to 1920px width
- Improves OCR quality for small text, subtitles, and scene text
Before: All videos scaled to 320px → poor OCR for small text
After: 1080p/720p videos use native resolution, 4K scales to 1920px
Verified: swift_ocr binary builds and runs correctly
- 720x890 video: native resolution (no scaling)
- 1920x1080 video: native resolution (at threshold)
- Detects video width and applies conditional scaling
Note: PaddleOCR fallback (ocr_processor_mps.py) already uses native resolution
- 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.