- Add /api/v1/mbe/health endpoint for status checks
- Add /api/v2/service/start to start llama-server
- Add /api/v2/service/stop to stop llama-server
- Use TCP connection test for port detection (more reliable than lsof)
- Add ps aux fallback for PID detection
- Implement structured bilingual VLM tags
- Add VLM integration documentation for Studio team
Endpoints tested and working with Momentry Studio AdminView UI.
- Added Redis paused set for job management
- Worker skips paused jobs during polling
- Added POST /api/v1/jobs/:uuid/pause endpoint
- Added POST /api/v1/jobs/:uuid/resume endpoint
- Added GET /api/v1/jobs/paused endpoint
- Paused jobs are excluded from worker processing queue
- Created trace_sync module with sync_trace_label() to sync labels across:
1. tkg_nodes.label (PostgreSQL)
2. trace_profiles.name (PostgreSQL)
3. trace_profile.json label (FS)
4. Qdrant _faces payload.label (NEW - was missing)
- Fixed is_tkg_done: allow 0 trace dirs if tkg_nodes exist
(prevents permanent stuck in 'Scanning' status)
- Updated Face Cluster to use sync_trace_label
- Updated merge_trace to use sync_trace_label + cleanup source dir
- Created Face_Operations_Complete.md reference document
(consolidates all face-related docs into single source of truth)
- Worker was calling Python store_traced_faces.py instead of Rust version
- This caused trace_id=0 in Qdrant, blocking TKG and file completion
- Now uses rust_binary_path() to find and execute rust_store_traced_faces
- Also removed all Python implementations from processor config
- Removed POSE processor (deprecated)
- Added redis_publisher.py symlink for face clustering
Fixed: file stuck in 'Scanning' due to trace stability check failure
- Add DynamicSemaphore, SystemMonitor, VlmMonitor, AutoScaler
- Replace static SCENE_VLM_SEM with dynamic version (max: 3)
- Start AutoScaler in Worker::run() for automatic adjustment
- Configured for M5Max48: 48GB, thresholds at 38GB/41GB
- Expected processing time: 23-28 days for 10000 files
Note: VLM response tracking to be added separately if needed
Core changes:
- Face clustering threshold: 0.35 → 0.15 (better male/female separation)
- Add auto-filtering for low-quality clusters (face_count<20, bbox_area>150000)
- Add filesystem fallback for trace-profile API
Face clustering improvements:
- Correctly separates male and female faces
- Filters hand detections and isolated faces
- Result: 2 persons (186 male, 174 female) vs 4 persons before
Trace profile API:
- GET /api/v1/trace-profile?file_uuid=X&trace_id=Y
- Returns data from PostgreSQL or filesystem fallback
- Simplifies frontend: no need to know filesystem structure
- Fixes Studio 'trace profile not found' error
Issue: docs_v1.0/M4_workspace/2026-10-16_studio_trace_profile_bug_report.md
Consolidated snapshot (previously WIP in working tree).
- core/pipeline_config: new module loading config/pipeline_flows.json as the
source of truth for stage execution mode (parallel/blocking) and dependencies
- worker/job_worker: dispatch Scene VLM to a background task when the stage is
declared parallel, unblocking the worker poll loop; resolve processor
dependencies from pipeline_flows.json (fallback to built-in)
- config/pipeline_flows.json: asrx depends on [cut, asr]
- scripts/fix_stuck_jobs: fix UTC timezone comparison, raise default threshold
to 6h, skip jobs with recent processor activity
- rust_asrx: Rust speaker diarization CLI + processor wiring
- processor metadata helper; fast_face_clustering script; file_progress pipeline
API; scan API; VAD updates
Major Changes:
- Pipeline Queue integration completed (internal.file + pipeline.commands)
- Fixed old job_worker database compatibility with new command_queue table
- Compiled Swift OCR binary (was missing, causing empty OCR results)
- Added deep scan functionality through re-scan API
Fixes:
- Changed CommandJob.id from i32 to i64 for database compatibility
- Added UUID generation in create_command (message_id field)
- Fixed claim_pending_commands to query queue_name = 'internal.file'
- Fixed field mappings: command_id → message_id, job_type → command_type
- Added support for 'processing' status in CommandJobStatus
Queue System:
- internal.file queue: for register/unregister/re-scan commands (job_worker)
- pipeline.commands queue: for vectorize/store_asrx/etc commands (pipeline_worker)
Documentation:
- Added comprehensive queue system documentation
- Created M4 workspace status reports
- Updated AGENTS.md with queue system details
Issue: Files with face_traced.json status=null and total_faces=0 stuck in PROCESSING forever
Root cause:
- ingestion_complete checks trace_status == 'no_faces' to skip TKG
- But some old files have status=null instead of 'no_faces'
- TKG check fails because no nodes for no-face videos
Solution:
- Check both status='no_faces' AND total_faces=0
- Skip TKG check for no-face videos (total_faces=0)
- Also update face_cluster_done to handle total_faces=0
Impact:
- Fixes stuck files with null status in face_traced.json
- Consistent with scan.rs fix (commit 0d11c601)
Affected: M4ProMini file 18173b62d80bf829910348fa1a6ddcf5
- Improve face fast-path trigger: recognize has_faces with empty frames
- Add re-evaluation mechanism: check PROCESSING files every 10 mins
- Enhance ASRX silent fast-path: detect empty segments array
- Fix files stuck in PROCESSING status when all data is produced
Related: M4ProMini deep scan (114 files, 89 bad + 2 stuck)
Issue: ASRX & FACE_CLUSTER forever running/0, no completion trigger
Pose was previously decided to be removed (ProcessorType::all()
already excludes it: 'Disabled in production pipeline'). However,
create_monitor_job's default processors array still contained 'pose',
job_worker's auto-pipeline status init still listed pose/appearance,
and processor_tools_v3.json had pose implementations enabled.
This reverts the pose portions of 8c6a2de8 (pose.rs placeholder
expansion and config --output args change) and fully disables Pose:
- config/processor_tools_v3.json: pose swift/mediapipe enabled=false,
restore original --output args for swift
- src/core/db/postgres_db.rs: create_monitor_job default processors
no longer includes 'pose'
- src/worker/job_worker.rs: auto-pipeline status init no longer lists
pose/appearance
- src/core/processor/pose.rs: revert placeholder expansion (unchanged
from pre-8c6a2de8)
Face config-driven fix (positional args + placeholder expansion) is kept.
- AsrxSegment.start_frame/end_frame -> Option<u64> so the ASR fallback
(which emits null frames) deserializes instead of erroring
- P2 face-trace trigger gated on has_face alone (not has_asrx), so
no-face videos still get face_traced.json via the fast-path,
unblocking FaceCluster and preventing the job from failing
- Add Rust face processor module (detection, embedding, tracking, qdrant)
- Add Facenet CoreML/ONNX conversion scripts and tests
- Refactor swift_face into Sources/swift_face with ArgumentParser support
- Update store_traced_faces to handle face.json correctly
- Fix ASRX parsing and TKG bbox reading from Qdrant
- Improve admin_config and trace_agent APIs
- Add M4 workspace docs for face clustering, dedup, and Facenet validation
- Fix worker heartbeat TTL (poll_interval x 3, min 60s) for offline detection
** 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).
- 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
- 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.
- 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
- 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.
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
job_worker.rs was overriding Apple Vision defaults with 0.75/64 even when
no face_settings were provided, causing fewer faces to be detected.
Now detect all faces with Vision defaults (confidence 0.5, min_size 1px);
filter later for display via face_filter settings.
Part B (source fix): Enhanced TKG build Qdrant readiness check in
job_worker.rs. Previously only checked point count >= expected_faces,
which could fire before short traces finished uploading. Now verifies
trace_id stability: two consecutive scroll checks (2s apart) with same
unique trace count before proceeding.
Part A (repair): New scripts/repair_tkg_face_tracks.py reconciles Qdrant
_faces traces with PG tkg_nodes face_track rows, inserts missing ones.
Fixed 233 missing traces in 44c37c (1197 → 1430).
- job_worker.rs: Read face_settings from monitor_jobs before processing
- job_worker.rs: Set FACE_MIN_CONFIDENCE and FACE_MIN_SIZE env vars
- job_worker.rs: Restore env vars after processing completes
- Add detailed logging: [WORKER] face_settings and env var changes
This ensures the executor receives the correct face settings from the job.
1. Per-job concurrency budget: add can_start_for_job() to ProcessorPool
so multiple files process in parallel instead of one job starving others.
Uses active_job_count to compute fair slot budget per job.
2. FaceCluster race condition: add face_traced.json existence check before
running face_cluster processor. face_traced.json is produced by P2
store_traced_faces.py which runs AFTER process_job completes, so
clustering was producing no_faces (0 clusters) despite having faces.
The P3 Face Dedup trigger previously only logged when cluster_count !=
face_track_count without actually syncing labels. Now it calls
update_face_track_labels to:
- UPDATE tkg_nodes SET label = cluster_id for each trace
- UPSERT trace_profiles SET name = cluster_id
- Reset unclustered traces to default Person_N name
This matches what the manual 'Face Deduplication' button in Studio
already does via the cluster-agent API endpoint, ensuring the automatic
pipeline produces the same result without requiring manual intervention.
The PythonExecutor.run() hardcoded output_idx=1, which treats args[1] as
an output file path and rewrites it to .json.tmp. For scripts like
store_traced_faces.py that use --file-uuid (not an output path) at
position 1, this corrupted the UUID into a file path, causing the script
to fail with exit status 1 within 90ms.
- run_with_output_idx: output_idx changed from usize to Option<usize>
- run_with_output_idx_and_frames: same change
- run(): doc comment added, passes Some(1) for backward compatibility
- job_worker.rs: store_traced_faces.py and release_pack.py calls now
pass None for output_idx (no output path substitution)
- appearance.rs: passes Some(2) explicitly (output at index 2)
Verified: Gamma 8 file completed full pipeline with 24 face traces
and 185 TKG nodes.