: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(aio): match production ai ingestion lane topology in dev and e2e (#81105)
Carlos Marchal327ded0052a2
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.ymlindex dffae89b8777..6a7c9f4ce649 100644--- a/.github/workflows/ci-e2e-playwright.yml+++ b/.github/workflows/ci-e2e-playwright.yml@@ -863,9 +863,9 @@ jobs:# ingestion-error-tracking: error tracking ingestion (ingestion-errortracking mode)# ingestion-logs: logs ingestion (ingestion-logs mode)# ingestion-traces: traces ingestion (ingestion-traces mode)- # capture-ai: AI event capture (/i/v0/ai/batch/, CAPTURE_MODE=events)- # ingestion-ai: AI event ingestion incl. multimodal blob offload (INGESTION_PIPELINE=ai)- COMPOSE_FILE=docker-compose.dev.yml COMPOSE_PROFILES=capture,ingestion bin/ci-wait-for-docker launch plugins ingestion-general ingestion-sessionreplay recording-api ingestion-error-tracking ingestion-logs ingestion-traces capture-ai ingestion-ai+ # capture-ai: AI event capture (/i/v0/ai/batch/, CAPTURE_MODE=ai); ingestion-general's+ # combined-mode AI consumer ingests the lane incl. multimodal blob offload+ COMPOSE_FILE=docker-compose.dev.yml COMPOSE_PROFILES=capture,ingestion bin/ci-wait-for-docker launch plugins ingestion-general ingestion-sessionreplay recording-api ingestion-error-tracking ingestion-logs ingestion-traces capture-ai# Install Playwright browsers while we wait for PostHog to be ready- name: Install Playwright browsers@@ -883,7 +883,7 @@ jobs:env:COMPOSE_FILE: docker-compose.dev.ymlCOMPOSE_PROFILES: capture,ingestion- run: bin/ci-wait-for-docker wait plugins ingestion-general ingestion-sessionreplay recording-api ingestion-error-tracking ingestion-logs ingestion-traces capture-ai ingestion-ai+ run: bin/ci-wait-for-docker wait plugins ingestion-general ingestion-sessionreplay recording-api ingestion-error-tracking ingestion-logs ingestion-traces capture-ai- name: Clean snapshot directoryrun: find playwright/__snapshots__ -name '*.png' -delete 2>/dev/null || true@@ -1005,7 +1005,6 @@ jobs:docker logs posthog-ingestion-logs-1 > playwright/test-results/docker-ingestion-logs.log 2>&1 || echo "No ingestion-logs container" > playwright/test-results/docker-ingestion-logs.logdocker logs posthog-ingestion-traces-1 > playwright/test-results/docker-ingestion-traces.log 2>&1 || echo "No ingestion-traces container" > playwright/test-results/docker-ingestion-traces.logdocker logs posthog-capture-ai-1 > playwright/test-results/docker-capture-ai.log 2>&1 || echo "No capture-ai container" > playwright/test-results/docker-capture-ai.log- docker logs posthog-ingestion-ai-1 > playwright/test-results/docker-ingestion-ai.log 2>&1 || echo "No ingestion-ai container" > playwright/test-results/docker-ingestion-ai.log- name: Archive test artifactsif: always()diff --git a/bin/mprocs.yaml b/bin/mprocs.yamlindex b6d8536cca1a..198cd551ebc1 100755--- a/bin/mprocs.yaml+++ b/bin/mprocs.yaml@@ -113,19 +113,22 @@ procs:layer: Ingestion pipelinetech: Node- ingestion-ai:+ ingestion:sandbox: true- shell: 'bin/wait-for-docker && PLUGIN_SERVER_MODE=ingestion-v2 INGESTION_PIPELINE=ai HTTP_SERVER_PORT=6746 ./bin/posthog-node'- capability: ai_capture+ shell: 'bin/wait-for-docker objectstorage && PLUGIN_SERVER_MODE=ingestion-v2-combined HTTP_SERVER_PORT=6739 ./bin/posthog-node'+ capability: event_ingestionready_pattern: 'All systems go'groups:layer: Ingestion pipelinetech: Nodeenv:- INGESTION_CONSUMER_CONSUME_TOPIC: ai_events_ingestion- INGESTION_CONSUMER_GROUP_ID: ingestion-ai+ # The combined-mode AI consumer reads persons through PersonHog; the+ # event_ingestion capability pulls the personhog services in.PERSONHOG_ENABLED: 'true'PERSONHOG_ADDR: '127.0.0.1:50052'+ # Combined mode's AI consumer owns the events_plugin_ingestion_ai lane locally;+ # without a bucket it silently skips blob offload, so give it the same store the+ # compose stacks use.AI_BLOB_S3_BUCKET: ai-blobsAI_BLOB_S3_PREFIX: 'aio/'AI_BLOB_S3_ENDPOINT: 'http://localhost:19000'@@ -134,20 +137,6 @@ procs:AI_BLOB_S3_SECRET_ACCESS_KEY: object_storage_root_passwordAI_BLOB_OFFLOAD_TEAMS: '*'- ingestion:- sandbox: true- shell: 'bin/wait-for-docker && PLUGIN_SERVER_MODE=ingestion-v2-combined HTTP_SERVER_PORT=6739 ./bin/posthog-node'- capability: event_ingestion- ready_pattern: 'All systems go'- groups:- layer: Ingestion pipeline- tech: Node- env:- # The combined-mode AI consumer reads persons through PersonHog; the- # event_ingestion capability pulls the personhog services in.- PERSONHOG_ENABLED: 'true'- PERSONHOG_ADDR: '127.0.0.1:50052'-ingestion-sessionreplay:sandbox: trueshell: 'bin/wait-for-docker && PLUGIN_SERVER_MODE=recordings-blob-ingestion-v2 HTTP_SERVER_PORT=6740 ./bin/posthog-node'diff --git a/bin/start-rust-service b/bin/start-rust-serviceindex 72e38c96c5e9..9a8df02963c0 100755--- a/bin/start-rust-service+++ b/bin/start-rust-service@@ -93,10 +93,11 @@ case "$RS_SVC" inexport RUST_BACKTRACE=1export ADDRESS=0.0.0.0:3309 # avoid port conflict in local dev (3308 is used by llm-gateway)export KAFKA_HOSTS="$DEFAULT_KAFKA"- export KAFKA_TOPIC=ai_events_ingestion+ export KAFKA_TOPIC=events_plugin_ingestion_aiexport REDIS_URL="$DEFAULT_REDIS"export DATABASE_URL="${DATABASE_URL:-$DEFAULT_PG}"- export CAPTURE_MODE=events+ # `ai` mode produces to the AI lane as its main topic, matching prod capture-ai+ export CAPTURE_MODE=aiexport LOG_LEVEL=debugexport DEBUG=1export DEV_RUST_SVC_OVERRIDE=capture # we want to run the same "capture" binary in a separate modediff --git a/bin/verify-ai-ingestion-stack b/bin/verify-ai-ingestion-stackindex 1fa4e77528b5..2eb45de65283 100755--- a/bin/verify-ai-ingestion-stack+++ b/bin/verify-ai-ingestion-stack@@ -1,5 +1,5 @@#!/usr/bin/env bash-# Verifies capture-ai -> Kafka -> ingestion-ai (blob offload) -> ClickHouse ai_events.+# Verifies capture-ai -> Kafka -> combined ingestion's AI consumer (blob offload) -> ClickHouse ai_events.set -euo pipefailPROXY="${PROXY:-http://localhost:8010}"diff --git a/docker-compose.base.yml b/docker-compose.base.ymlindex 7adc234b8f15..ad40f3bad2ba 100644--- a/docker-compose.base.yml+++ b/docker-compose.base.yml@@ -414,10 +414,12 @@ services:restart: on-failureenvironment:ADDRESS: '0.0.0.0:3000'- KAFKA_TOPIC: 'ai_events_ingestion'+ KAFKA_TOPIC: 'events_plugin_ingestion_ai'KAFKA_HOSTS: 'kafka:9092'REDIS_URL: 'redis://redis7:6379/'- CAPTURE_MODE: events+ # `ai` mode produces to the AI lane as its main topic (no $ai_* divert needed),+ # matching the production capture-ai deployment.+ CAPTURE_MODE: aiRUST_LOG: 'info,rdkafka=warn'capture-logs:@@ -568,26 +570,9 @@ services:COOKIELESS_REDIS_PORT: 6379CDP_REDIS_HOST: redis7ENCRYPTION_SALT_KEYS: '00beef0000beef0000beef0000beef00'-- ingestion-ai:- command: node nodejs/dist/index.js- restart: on-failure- environment:- PLUGIN_SERVER_MODE: 'ingestion-v2'- INGESTION_PIPELINE: 'ai'- INGESTION_CONSUMER_CONSUME_TOPIC: 'ai_events_ingestion'- INGESTION_CONSUMER_GROUP_ID: 'ingestion-ai'- DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog'- PERSONS_DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog'- KAFKA_HOSTS: 'kafka:9092'- REDIS_URL: 'redis://redis7:6379/'- CLICKHOUSE_HOST: 'clickhouse'- CLICKHOUSE_DATABASE: 'posthog'- CLICKHOUSE_SECURE: 'false'- CLICKHOUSE_VERIFY: 'false'- COOKIELESS_REDIS_HOST: redis7- COOKIELESS_REDIS_PORT: 6379- ENCRYPTION_SALT_KEYS: '00beef0000beef0000beef0000beef00'+ # Combined mode consumes the events_plugin_ingestion_ai lane, where capture diverts+ # $ai_* events, so it owns AI blob offload. Without a bucket, buildAiBlobStore returns+ # null and multimodal payloads are stored inline instead of as phaiblob:// pointers.AI_BLOB_S3_BUCKET: ai-blobsAI_BLOB_S3_PREFIX: 'aio/'AI_BLOB_S3_ENDPOINT: 'http://objectstorage:19000'diff --git a/docker-compose.dev.yml b/docker-compose.dev.ymlindex 186cbe8a0d20..5ecd4477779e 100644--- a/docker-compose.dev.yml+++ b/docker-compose.dev.yml@@ -231,39 +231,6 @@ services:# The combined-mode AI consumer reads persons through PersonHogPERSONHOG_ADDR: 'personhog-router:50052'PERSONHOG_ENABLED: 'true'- depends_on:- kafka:- condition: service_started- redis7:- condition: service_healthy- db:- condition: service_healthy- personhog-router:- condition: service_started- healthcheck:- test: ['CMD', 'curl', '-f', 'http://localhost:6738/_ready']- interval: 5s- timeout: 5s- retries: 30- start_period: 15s- profiles:- - ingestion-- ingestion-ai:- extends:- file: docker-compose.base.yml- service: ingestion-ai- image: ghcr.io/posthog/posthog-node:${POSTHOG_NODE_TAG:-master}- ports:- - '6746:6738'- environment:- DATABASE_URL: postgres://posthog:posthog@db:5432/${POSTHOG_DB_NAME:-posthog}- PERSONS_DATABASE_URL: postgres://posthog:posthog@db:5432/${POSTHOG_PERSONS_DB_NAME:-posthog}- CLICKHOUSE_DATABASE: ${CLICKHOUSE_DATABASE:-posthog}- # CDP Redis defaults to 127.0.0.1 — must point to the Docker service- CDP_REDIS_HOST: redis7- PERSONHOG_ADDR: 'personhog-router:50052'- PERSONHOG_ENABLED: 'true'depends_on:kafka:condition: service_started@@ -272,8 +239,8 @@ services:db:condition: service_healthyobjectstorage:- # SeaweedFS creates the ai-blobs bucket asynchronously, and this service exits- # at startup if the bucket is missing, so wait for the bootstrap sentinel.+ # The combined AI consumer's blob store healthchecks the ai-blobs bucket at+ # startup, and SeaweedFS creates it asynchronously, so wait for the sentinel.condition: service_healthypersonhog-router:condition: service_starteddiff --git a/docker-compose.hobby.yml b/docker-compose.hobby.ymlindex 6c50766c9c0a..e52f5a42598b 100644--- a/docker-compose.hobby.yml+++ b/docker-compose.hobby.yml@@ -242,6 +242,8 @@ services:- redis7- clickhouse- kafka+ # The combined AI consumer's blob store healthchecks the ai-blobs bucket at startup+ - objectstorage- personhog-routeringestion-sessionreplay:diff --git a/hogli.yaml b/hogli.yamlindex 29e22c77936f..d8ef8fc7f421 100644--- a/hogli.yaml+++ b/hogli.yaml@@ -1201,5 +1201,5 @@ environment:hidden: trueverify:ai:ingestion:stack:bin_script: verify-ai-ingestion-stack- description: 'Check the multimodal AI ingestion path at the data layer: send an $ai_generation with an inline base64 image through capture-ai and assert ingestion-ai offloaded it to a blob pointer in ClickHouse'+ description: 'Check the multimodal AI ingestion path at the data layer: send an $ai_generation with an inline base64 image through capture-ai and assert ingestion offloaded it to a blob pointer in ClickHouse'hidden: truediff --git a/products/ai_observability/frontend/e2e/multimodal-trace.spec.ts b/products/ai_observability/frontend/e2e/multimodal-trace.spec.tsindex bcf6e820ac6a..f05380e921d3 100644--- a/products/ai_observability/frontend/e2e/multimodal-trace.spec.ts+++ b/products/ai_observability/frontend/e2e/multimodal-trace.spec.ts@@ -16,11 +16,6 @@ const SCREENSHOT_BYTES = fs.readFileSync(path.join(FIXTURE_DIR, 'screenshot.png'const POINTER_RE = /phaiblob:\/\/v1\/sha256\/(?<hash>[0-9a-f]{64})\?mime=(?<mime>[^&]+)&size=(?<size>\d+)/test.describe('AI observability multimodal trace', () => {- test.skip(- true,- 'Flaky: blob offloading can exceed the CI polling window. Follow-up: https://github.com/PostHog/posthog/issues/80843'- )-test('a screenshot sent through ingestion renders in the trace view', async ({page,request,