- 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
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).
Two pre-existing bugs broke rename/get operations:
1. schema.rs: DO UPDATE referenced 'tp' alias from LEFT JOIN which is
invisible in ON CONFLICT scope → 'missing FROM-clause entry for table tp'
Fix: use {tp_table}.column instead of tp.column
2. profile.rs: SELECT tp.properties / tn.properties can be NULL when no
trace_profile row exists but decoder expected non-optional Value
→ 'unexpected null; try decoding as an Option'
Fix: decode as Option<serde_json::Value> and handle None in merge logic
- validator::clamp_crop: clamp crop rect to frame dims (fixes OOB shift)
- tkg.rs: use clamp_crop in key_face crop paths (root-cause fix)
- trace_agent_api: POST /api/v1/file/:file_uuid/trace/:trace_id/regenerate-thumbnail
- docs: 26_trace_thumbnail_regenerate.md for Studio team
- Fixed upsert_trace_profile() SQL: changed trace_profiles.xxx to tp.xxx in ON CONFLICT DO UPDATE
to fix invalid reference to FROM-clause entry error
- Fixed cluster_agent.rs error handling: replaced 'let _ =' with proper error logging
- Created migration script to backfill trace_profiles from tkg_nodes for existing files
- Migration successfully inserted 98 missing trace_profiles records
- Verified merge now works correctly: traces_merged > 0 instead of silent no-op
This fixes both the rename 500 error and the merge silent failure, as they share
the same root cause in upsert_trace_profile() SQL.
- Fixed upsert_trace_profile() SQL: replaced scalar subqueries with LEFT JOIN
to properly reference trace_profiles table in backfill logic
- Fixed face_filter routes: changed {file_uuid} to :file_uuid syntax for
axum 0.7.9 compatibility
- Both fixes resolve HTTP 500 errors in rename and 404 errors in face filter
- Database: Added bbox_size column (min(width, height)) to face_filter_features
- API: Updated all endpoints to include bbox_size in responses
- Documentation: Added bbox_size explanation and frontend filtering examples
- Maintains current Swift implementation calculation method
- Enables efficient frontend filtering without backend threshold
This allows the frontend to do real-time filtering using bbox_size
while the backend pre-computes and stores the value.
- Database schema: face_filter_features and filter_rules tables
- Core engine: FilterEngine with 4 filter rules (landmark, mediapipe, embedding, temporal)
- API endpoints:
- GET /faces - Get faces with filtering
- GET /face/{id}/filter-report - Get filter report for single face
- POST /faces/filter - Apply filter rules
- GET /filter-stats - Get filter statistics
- GET/POST /filter-rules - Manage filter rules
- API documentation for Studio team with examples
- Based on FaceNet analysis results from WD and KOBA videos
- 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.
- files.rs: register_file now converts FaceSettings to json and passes to create_monitor_job
- processing.rs: ProcessRequest now includes face_settings field
- processing.rs: trigger_processing now passes face_settings to create_monitor_job and updates existing jobs
- docs: updated API examples to use correct endpoints (/api/v1/files/register and /api/v1/files/:uuid/process)
- schema.rs: Change DATABASE_SCHEMA default from 'dev' to 'public'
- rule2_ingest.rs, files.rs, tools.rs, scan.rs: Same schema default fix
- files.rs, watcher.rs, processing.rs: Change output_dev to output
- identities.rs: Change API schema parameter default from 'dev' to 'public'
- postgres_db.rs: Add face_settings column to SELECT query (fix ColumnIndexOutOfBounds panic)
This fixes worker not processing jobs due to missing dev schema.
- executor.rs: Add cmd.env() for FACE_MIN_CONFIDENCE and FACE_MIN_SIZE in all 4 run methods
- face_processor.py: Pass os.environ to subprocess.Popen to inherit env vars
- Fixes multi-face detection issue where second face was being filtered out
- Tested: CONFIDENCE=0.5 preserves both faces (392 total), CONFIDENCE=0.75 filters second face (196 total), SIZE=100 filters small faces (201 total)
- DB: Added face_settings jsonb column to monitor_jobs
- API: RegisterFileRequest accepts face_settings
- DB: create_monitor_job accepts and stores face_settings
- MonitorJob struct includes face_settings field
- Swift face processor will read from FACE_MIN_CONFIDENCE and FACE_MIN_SIZE env vars
- Changed Cache-Control from 'public, max-age=86400' to 'no-cache, must-revalidate'
- Added ETag header (sha256 hash of image bytes)
- Browser will revalidate on each request
- If file unchanged → 304 Not Modified (save bandwidth)
- If file changed → 200 with new image
- Applied to all thumbnail endpoints (trace, face, chunk, live extraction)
- Changed from 'public, max-age=86400' to 'no-cache'
- Allows immediate verification of rebuilt key_face.jpg files
- Can be changed back to max-age=300 after verification