ESA, NOAA, and LOC stock adapters generate unstable clip IDs

Author: manish511-githubCreated Sep 1, 2026Updated Sep 1, 2026
Labelsbug

Summary

The ESA, NOAA, and Library of Congress stock-source adapters use Python's built-in hash() to generate source_id values from media URLs. Python randomizes string hashes between processes, so the same media URL receives different source_id and clip_id values across separate OpenMontage runs. This can cause cache misses, duplicate corpus records, repeated downloads, and unreliable deduplication.

Operating system

Ubuntu 24.04 (all)

Pipeline

No response

Runtime / renderer

No response

Steps to reproduce

  1. Open a terminal in the OpenMontage repository.

  2. Confirm that the affected adapters use Python's built-in hash():

    git grep -n 'hash(' -- tools/video/stock_sources/esa.py tools/video/stock_sources/noaa.py tools/video/stock_sources/loc.py

  3. Create an ESA Candidate using the original adapter logic in a Python process with hash seed 1:

    PYTHONHASHSEED=1 python3 -c 'from tools.video.stock_sources.base import Candidate; url="https://www.esa.int/ESA_Multimedia/Videos/2026/08/Sophie_Adenot_s_first_spacewalk"; candidate=Candidate(source="esa", source_id=f"esa_{hash(url) & 0xFFFFFFFF:08x}", source_url=url, download_url=url, kind="video"); print(candidate.clip_id)'

  4. Repeat the same operation in a separate Python process with hash seed 2:

    PYTHONHASHSEED=2 python3 -c 'from tools.video.stock_sources.base import Candidate; url="https://www.esa.int/ESA_Multimedia/Videos/2026/08/Sophie_Adenot_s_first_spacewalk"; candidate=Candidate(source="esa", source_id=f"esa_{hash(url) & 0xFFFFFFFF:08x}", source_url=url, download_url=url, kind="video"); print(candidate.clip_id)'

  5. Compare the two clip_id values. They are different even though the source and media URL are identical.

On the reproduced environment, the output was:

PYTHONHASHSEED=1 -> esa_esa_7c5d721c PYTHONHASHSEED=2 -> esa_esa_d14f73b6

The exact hexadecimal values can vary by Python build, but changing PYTHONHASHSEED changes the ID. NOAA and Library of Congress use the same URL-hashing pattern and therefore have the same problem.

Expected behavior

  • The same media URL should always produce the same source_id and clip_id, regardless of which Python process handles it or which hash seed is used.
  • URL-backed IDs should use a deterministic algorithm such as SHA-256.

Actual behavior

The same URL produces different IDs in separate Python processes:

PYTHONHASHSEED=1 -> esa_esa_7c5d721c PYTHONHASHSEED=2 -> esa_esa_d14f73b6

Because Candidate.clip_id is used by the corpus and shared clip cache, these changing IDs can result in duplicate records, repeated downloads, cache misses, and failed deduplication.

Relevant logs or error output

bash
$ PYTHONHASHSEED=1 python3 -c 'from tools.video.stock_sources.base import Candidate; url="https://www.esa.int/ESA_Multimedia/Videos/2026/08/Sophie_Adenot_s_first_spacewalk"; candidate=Candidate(source="esa", source_id=f"esa_{hash(url) & 0xFFFFFFFF:08x}", source_url=url, download_url=url, kind="video"); print(candidate.clip_id)'
esa_esa_7c5d721c

$ PYTHONHASHSEED=2 python3 -c 'from tools.video.stock_sources.base import Candidate; url="https://www.esa.int/ESA_Multimedia/Videos/2026/08/Sophie_Adenot_s_first_spacewalk"; candidate=Candidate(source="esa", source_id=f"esa_{hash(url) & 0xFFFFFFFF:08x}", source_url=url, download_url=url, kind="video"); print(candidate.clip_id)'
esa_esa_d14f73b6