Skip to content

index_recording / search_recording correctness: cache ignores OCR availability, same-basename recordings share one index, punctuation queries match everything #255

Closed

Description

@TMHSDigital

Why it matters

search_recording is how agents query long recordings without pulling frames. Stale or crossed-over indexes give agents confidently wrong answers.

Evidence

  1. Cache ignores OCR. src/tools/indexRecording.ts:87-91 compares fingerprint, sceneThreshold and maxFrames, but not prior.ocr. After a first run without an OCR language, the note tells the user to install one. When they do and re-run, they get cached:true with no screen text unless they pass force.
  2. Same-basename collision. indexSidecarPath strips the extension (src/utils/recordingIndex.ts:104-106), so demo.mp4 and demo.mkv both map to demo.index.json. They also share the default transcript demo.srt (indexRecording.ts:211). searchIndex never checks index.video, so searching one returns the other's hits, flagged only as "stale".
  3. Punctuation queries. normalizeForMatch("-") returns "_" (src/utils/ocr.ts:120), which matches nearly every item (recordingIndex.ts:326-330).

Suggested approach

  • Invalidate the cache when !prior.ocr && ocrAvailableNow.
  • Key sidecars on the full file name (demo.mp4.index.json), with a read fallback for the old name, and verify index.video.
  • Reject queries with no letters or digits.
  • Move the cache decision into a pure helper so it can be tested.

Done when

Unit tests cover all three cases.

Activity

  1. added
    bug
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions