From 1bd953bd8d8b87d74ab95b5b87a50c3f05421ed1 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Wed, 16 Sep 2026 15:57:26 +0000 Subject: [PATCH 1/2] Let the last two bin/ scripts run without PYTHONPATH, like the others Four of the six bin/ scripts bootstrap their own sys.path, so they run from anywhere. `embeddings_manager` and `retrieval_baseline` did not, and failed: $ ./bin/embeddings_manager ls ModuleNotFoundError: No module named 'data_generation' The Dockerfile and CI both set PYTHONPATH (`/app/src`, `./bin:./src`), so these worked there and nowhere else -- including in their own documented usage. That is the same defect fixed for `evaluate` and `probe_model_temperature` in cbe20fc; these two were missed. **The cost of leaving it was not hypothetical.** On 2026-09-14 I hit exactly this on `embeddings_manager`, worked around it with a PYTHONPATH prefix rather than fixing it, and then -- because the tool felt awkward -- bypassed it entirely and called `generate_userguide_embeddings` directly. That skipped the `use()` call which registers a bundle, so 16 MB of correctly generated user guide sat on disk invisible to the app, and it took a wasted deploy and a round trip with Adam to notice. A tool that does not run as documented gets worked around, and the workaround is where the bug was. All six now run without PYTHONPATH. Co-Authored-By: Claude Opus 5 --- bin/embeddings_manager | 8 ++++++++ bin/retrieval_baseline | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/bin/embeddings_manager b/bin/embeddings_manager index c3327e7..f343ad1 100755 --- a/bin/embeddings_manager +++ b/bin/embeddings_manager @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os +import sys import re from argparse import ArgumentParser from pathlib import Path, PurePosixPath @@ -12,6 +13,13 @@ import boto3 from botocore import UNSIGNED from botocore.client import Config + +# Run from anywhere without setting PYTHONPATH, like the other bin/ scripts. +# The Dockerfile and CI both set it (`/app/src`, `./bin:./src`), so importing +# worked there and nowhere else -- including in this script's own documented +# usage. +sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src")) + from data_generation.alliance import generate_alliance_embeddings from data_generation.reactome import generate_reactome_embeddings from data_generation.uniprot import generate_uniprot_embeddings diff --git a/bin/retrieval_baseline b/bin/retrieval_baseline index 8763dcd..bacd808 100755 --- a/bin/retrieval_baseline +++ b/bin/retrieval_baseline @@ -38,6 +38,13 @@ from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever from nltk.tokenize import word_tokenize + +# Run from anywhere without setting PYTHONPATH, like the other bin/ scripts. +# The Dockerfile and CI both set it (`/app/src`, `./bin:./src`), so importing +# worked there and nowhere else -- including in this script's own documented +# usage. +sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src")) + from agent.models import get_embedding, get_llm from retrievers.csv_chroma import ( VECTOR_OVERFETCH, From bb3ce3b1f60b3f7b4a7ac35ccf55eefa46fd4938 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Wed, 16 Sep 2026 16:17:41 +0000 Subject: [PATCH 2/2] Sort the import I added Co-Authored-By: Claude Opus 5 --- bin/embeddings_manager | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/embeddings_manager b/bin/embeddings_manager index f343ad1..088ad82 100755 --- a/bin/embeddings_manager +++ b/bin/embeddings_manager @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import os -import sys import re +import sys from argparse import ArgumentParser from pathlib import Path, PurePosixPath from shutil import rmtree