Skip to content

Fix duplicate analysis runs, model swapping, stale cloud overrides and OCR-fallback caching found in a live run - #106

Merged
iLevyTate merged 1 commit into
mainfrom
fix/live-test-findings
Nov 10, 2026
Merged

iLevyTate merged 1 commit into
mainfrom
fix/live-test-findings

Conversation

@iLevyTate

Copy link
Copy Markdown
Owner

Found while watching a live dev run on an RTX 4050 Laptop GPU (6 GB, CUDA) with real files.

Fixes

  • Duplicate analysis runs. When Discover re-mounts mid-batch, its new run's batch request is refused because this window's earlier batch is still running (CONCURRENCY_LIMIT). The new run used to treat that as a failure and start the per-file worker pool, so the same files were analyzed two or three times at once. In the live log that meant five restarts, a stuck model-load lock that was force-released, the vision model unable to start, and an image falling back to OCR. The run now waits for the earlier batch, then reruns and gets the finished files from the cache. A superseded or cancelled run stops. Refused attempts no longer send a cancel for a batch that never started. See src/renderer/phases/discover/batchBusy.js.
  • Watcher and Discover on the same file. A new userAnalysisInFlight registry is marked by the batch, document, image and media handlers. The smart-folder watcher defers a file that is in it and re-checks it 15 s later against the analysis history.
  • Text and embedding model swapping. On a GPU that cannot hold both (Qwen2.5-7B, about 5.8 GB, with a 5 GB budget), every file evicted the text model to load the embedding model, then reloaded the text model. That cost about 4-5 s per file. The embedding model now loads on the CPU beside the resident text model (_loadOptionsBesideText plus the memory manager's keepBeside), without the CPU warning badge. The existing rule that an idle resident is evicted stays unchanged.
  • Keyframe consent. A deleted smart folder's AI override stayed in settings and made Describe video keyframes ask for cloud consent. Now only overrides of folders that still exist count.
  • OCR-fallback caching. A text result that stands in for a failed vision step is no longer written to the image cache. Before, a re-run within 30 minutes returned the weaker result.
  • Target Smart Folders. Long paths wrap inside the card, and descriptions typed in quotes are no longer shown in doubled quotes.
  • Icons. The sparkle icon is replaced on every screen. The Live Activity icon key changes from sparkles to lightbulb.

Verified

  • New tests: discoverBatchBusy (12), embeddingBesideText (11), SmartFolderWatcher.userAnalysisDefer (7), plus additions to ProcessingLimitsSection.frameConsent and imageAnalysis.behavior. The new OCR-fallback assertion fails without the fix.
  • Related suites: 69 suites and 1,094 tests, plus 126 more in adjacent suites, all passing. Lint, format, typecheck and typecheck:js are clean. The checkjs floor is raised to 491.
  • Local video analysis with the bundled FFmpeg: scene detection found both cuts in a synthetic 3-scene video. The audio transcode produced 6.00 s of 16 kHz mono, and a silent video reports MEDIA_NO_AUDIO_STREAM.

Not covered

  • The live UI still needs re-testing after merge: leaving and re-entering Discover mid-batch, and a batch with images and documents.
  • Whisper's CUDA build needs the CUDA 12 runtime. This machine has CUDA 13.1, so Whisper uses Vulkan. That is unchanged and still on the GPU.

…OCR-fallback caching, folder cards, icons

Found while watching a live run on an RTX 4050 (6 GB):

- Discover: a run whose batch request is refused because this window's
  earlier batch is still running (Discover re-mounted mid-batch) now waits
  for it and reruns from the cache, instead of starting the per-file pool in
  parallel. That fallback analyzed the same files two or three times at once,
  showed duplicate notifications, kept the progress count low, restarted in a
  loop, and left no memory for the vision model.
- Smart-folder watcher: files a user-started analysis is working on are
  deferred and re-checked afterwards (userAnalysisInFlight registry, marked
  by the batch and per-file analysis handlers).
- Memory: on a GPU that cannot hold both, the embedding model loads on the
  CPU beside the resident text model (keepBeside) instead of evicting it and
  reloading the 7B text model for every file (~4-5 s per file).
- Keyframe consent: overrides of deleted smart folders no longer count as a
  cloud Analysis route.
- Image analysis: a text result that stands in for a failed vision step is
  not cached, so the next analysis tries vision again.
- Target Smart Folders: long paths wrap inside the card; quoted descriptions
  are not shown in doubled quotes.
- The sparkle icon is replaced everywhere with icons for what each place does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant