Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(docker): install posthog-owners non-editable in llm-analytics image (#84152)

Keelan J.76ed86101f66
diff --git a/Dockerfile.llm-analytics b/Dockerfile.llm-analytics
index fa9a261174c2..7afcdf715c11 100644
--- a/Dockerfile.llm-analytics
+++ b/Dockerfile.llm-analytics
@@ -44,9 +44,12 @@ RUN --mount=type=cache,id=uv-libxmlsec1.2.37-2,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=tools/hogli,target=tools/hogli \
# uv sync validates workspace membership even with --no-dev, so every
- # workspace member must be present in the build context.
+ # workspace member must be present in the build context. tools/owners is also a real install
+ # source here: posthog-owners is a runtime dependency (stamphog's digest reads owners.yaml
+ # through it, and posthog/urls.py imports that chain unconditionally), and --no-editable copies
+ # it into the venv so the image never depends on this bind mount's path surviving.
--mount=type=bind,source=tools/owners,target=tools/owners \
- uv sync --locked --no-dev --no-install-project --group sentiment --no-binary-package lxml --no-binary-package xmlsec
+ uv sync --locked --no-dev --no-editable --no-install-project --group sentiment --no-binary-package lxml --no-binary-package xmlsec
# Copy project files
COPY manage.py manage.py
@@ -63,6 +66,13 @@ ENV PATH=/python-runtime/bin:$PATH \
POSTHOG_SENTIMENT_MODEL_CACHE=/opt/posthog-sentiment-model \
TIKTOKEN_CACHE_DIR=/code/.tiktoken_cache
+# posthog-owners is installed from a bind mount that does not survive into the image, so a missing
+# --no-editable above leaves an editable install pointing at /code/tools/owners and every Django
+# entrypoint dies on `import posthog_owners` at runtime instead of here. The root Dockerfile asserts
+# the same invariant with `test -d tools/owners/posthog_owners`; this image never copies that source
+# tree, so assert importability instead of presence.
+RUN python -c "import posthog_owners"
+
# Pre-warm the tiktoken BPE encoding cache into the image so runtime token counting reads the
# blobs from disk instead of fetching them from OpenAI's blob host on first use, which fails under
# restricted egress or flaky DNS. Covers the two encodings our callers resolve to: o200k_base