Skip to content

fix(ml-image-scrub): run tsx directly so the sidecar needs no runtime egress - #70283

Merged
robbie-c merged 1 commit into
masterfrom
posthog-code/ml-image-scrub-sidecar-no-runtime-corepack
Jul 13, 2026
Merged

fix(ml-image-scrub): run tsx directly so the sidecar needs no runtime egress#70283
robbie-c merged 1 commit into
masterfrom
posthog-code/ml-image-scrub-sidecar-no-runtime-corepack

Conversation

@robbie-c

@robbie-c robbie-c commented Jul 12, 2026

Copy link
Copy Markdown
Member

Problem

The sidecar image ran pnpm start as its entrypoint. At container start, that re-invokes corepack, which re-downloads pnpm from the npm registry every boot:

! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-10.29.3.tgz

The build populates corepack's cache as root, but the container runs as the posthog user, so the runtime download is never a cache hit. In production this image has no direct internet egress, so the download is fragile as well as pointless.

Fix

Run the tsx binary directly. It's a production dependency, so it's already installed in the image, and startup does no network I/O.

-CMD ["pnpm", "start"]
+CMD ["node_modules/.bin/tsx", "src/main.ts"]

Related

  • PostHog/charts#13096 — runs this image as the scrub sidecar, where the isolated container makes the runtime download fail rather than just being wasteful.

Created with PostHog Code

@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(ml-image-scrub): run tsx directly so..." | Re-trigger Greptile

@robbie-c
robbie-c marked this pull request as draft July 12, 2026 12:18
@robbie-c
robbie-c force-pushed the posthog-code/ml-image-scrub-sidecar-no-runtime-corepack branch 2 times, most recently from 3780805 to ab0304a Compare July 12, 2026 13:18
… egress

The sidecar image ran `pnpm start`, which re-invokes corepack at container start
and re-downloads pnpm from the npm registry — the build populated root's corepack
cache but the container runs as `posthog`, and in production egress is proxy-only,
so the fetch is fragile (and needless). Run the tsx bin directly (it's a production
dependency) so startup does no network I/O.

Generated-By: PostHog Code
Task-Id: f63910af-2d0c-4349-af97-c79b3edadaaf
@robbie-c
robbie-c force-pushed the posthog-code/ml-image-scrub-sidecar-no-runtime-corepack branch from ab0304a to 6fd7b53 Compare July 12, 2026 13:20
@robbie-c
robbie-c marked this pull request as ready for review July 12, 2026 14:16
@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "fix(ml-image-scrub): run tsx directly so..." | Re-trigger Greptile

@robbie-c robbie-c added the stamphog Request AI approval (no full review) label Jul 12, 2026
@robbie-c
robbie-c enabled auto-merge (squash) July 12, 2026 14:43
@stamphog

stamphog Bot commented Jul 12, 2026

Copy link
Copy Markdown

Note

🤖 stamphog reviewed 6fd7b53f2ba9108ac22f06fee7d17b87daafdd1e — verdict: REFUSED

Gates denied due to deny-list match on infra/CI-relevant Dockerfile change and T2-never tier; this is container build/deploy tooling with no human or substantive agent review as independent assurance.

  • 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
  • Gates denied: Dockerfile change to a production sidecar's entrypoint hits the deny-list (deps_toolchain/infra_cicd) and classifies as T2-never
  • No human or substantive reviewer approval — the Greptile comments are just status pings, not a review with findings
  • Requires a human reviewer familiar with the ml-mirror-image-scrub deployment/sidecar setup to confirm the runtime behavior change is safe before merging
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list matches: deps_toolchain, infra_cicd
size 2L, 1F substantive — within ceiling
tier classified as T2-never: T2-never (2L, 1F, single-area, fix)
stamphog 2.0.0b3 .stamphog/policy.yml @ dc71029 · reviewed head 6fd7b53

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Jul 12, 2026
@robbie-c
robbie-c merged commit ca087f3 into master Jul 13, 2026
364 checks passed
@robbie-c
robbie-c deleted the posthog-code/ml-image-scrub-sidecar-no-runtime-corepack branch July 13, 2026 08:21
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-13 08:53 UTC Run
prod-us ✅ Deployed 2026-07-13 09:08 UTC Run
prod-eu ✅ Deployed 2026-07-13 09:08 UTC Run

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.

2 participants