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.

feat(ingestion-consumer): add worker streaming ingest proto (#85171)

José Sequeira47194a7e13aa
diff --git a/.github/workflows/ci-proto.yml b/.github/workflows/ci-proto.yml
index 68b12fe6896f..6ba702975bf2 100644
--- a/.github/workflows/ci-proto.yml
+++ b/.github/workflows/ci-proto.yml
@@ -42,7 +42,9 @@ jobs:
- 'posthog/personhog_client/proto/generated/**'
- 'bin/generate_personhog_proto.sh'
- 'nodejs/src/common/generated/personhog/**'
+ - 'nodejs/src/common/generated/ingestion-worker/**'
- 'nodejs/buf.gen.yaml'
+ - 'nodejs/buf.gen.ingestion-worker.yaml'
- 'nodejs/package.json'
- '.github/workflows/ci-proto.yml'
@@ -157,16 +159,18 @@ jobs:
install-command: pnpm --filter=@posthog/nodejs... install --frozen-lockfile
- name: Regenerate Node proto stubs
- run: pnpm --dir nodejs run generate:personhog-proto
+ run: |
+ pnpm --dir nodejs run generate:personhog-proto
+ pnpm --dir nodejs run generate:ingestion-worker-proto
- name: Check for diff
run: |
# Intent-to-add so brand-new generated files show up in git diff
- git add -N nodejs/src/common/generated/personhog/
- if ! git diff --exit-code nodejs/src/common/generated/personhog/; then
+ git add -N nodejs/src/common/generated/personhog/ nodejs/src/common/generated/ingestion-worker/
+ if ! git diff --exit-code nodejs/src/common/generated/personhog/ nodejs/src/common/generated/ingestion-worker/; then
echo ""
echo "ERROR: Generated Node proto stubs are out of date."
- echo "Run 'pnpm run generate:personhog-proto' in nodejs/ and commit the result."
+ echo "Run 'pnpm run generate:personhog-proto' and 'pnpm run generate:ingestion-worker-proto' in nodejs/ and commit the result."
exit 1
fi
echo "Generated Node proto stubs are up to date."
diff --git a/nodejs/buf.gen.ingestion-worker.yaml b/nodejs/buf.gen.ingestion-worker.yaml
new file mode 100644
index 000000000000..e38aecb87692
--- /dev/null
+++ b/nodejs/buf.gen.ingestion-worker.yaml
@@ -0,0 +1,6 @@
+version: v2
+plugins:
+ - local: ../nodejs/node_modules/.bin/protoc-gen-es
+ out: ../nodejs/src/common/generated/ingestion-worker
+ opt:
+ - target=ts
diff --git a/nodejs/package.json b/nodejs/package.json
index 3310c81ba73a..6279514dfadb 100644
--- a/nodejs/package.json
+++ b/nodejs/package.json
@@ -46,6 +46,7 @@
"build:replay-anonymizer": "pnpm --filter=@posthog/replay-anonymizer package",
"build:replay-anonymizer:dev": "pnpm --filter=@posthog/replay-anonymizer run build:dev",
"generate:personhog-proto": "cd ../proto && buf generate --template ../nodejs/buf.gen.yaml --path personhog/service --path personhog/identity --path personhog/lifecycle --path personhog/types . && cd ../nodejs && eslint --fix src/common/generated/personhog && prettier --write src/common/generated/personhog",
+ "generate:ingestion-worker-proto": "cd ../proto && buf generate --template ../nodejs/buf.gen.ingestion-worker.yaml --path ingestion/worker . && cd ../nodejs && eslint --fix src/common/generated/ingestion-worker && prettier --write src/common/generated/ingestion-worker",
"update-ai-costs": "ts-node src/ingestion/pipelines/ai/costs/scripts/update-ai-costs.ts",
"gen:ingestion-warning-types": "ts-node src/ingestion/common/scripts/generate-ingestion-warning-types.ts",
"sync-segment-icons": "DATABASE_URL=something ts-node src/cdp/segment/sync-segment-icons.ts",
diff --git a/nodejs/src/common/generated/ingestion-worker/ingestion/worker/v1/worker_pb.ts b/nodejs/src/common/generated/ingestion-worker/ingestion/worker/v1/worker_pb.ts
new file mode 100644
index 000000000000..5bf637d0ed7b
--- /dev/null
+++ b/nodejs/src/common/generated/ingestion-worker/ingestion/worker/v1/worker_pb.ts
@@ -0,0 +1,289 @@
+// @generated by protoc-gen-es v2.11.0 with parameter "target=ts"
+// @generated from file ingestion/worker/v1/worker.proto (package ingestion.worker.v1, syntax proto3)
+import type { Message } from '@bufbuild/protobuf'
+import type { GenEnum, GenFile, GenMessage, GenService } from '@bufbuild/protobuf/codegenv2'
+import { enumDesc, fileDesc, messageDesc, serviceDesc } from '@bufbuild/protobuf/codegenv2'
+
+/**
+ * Describes the file ingestion/worker/v1/worker.proto.
+ */
+export const file_ingestion_worker_v1_worker: GenFile =
+ /*@__PURE__*/
+ fileDesc(
+ 'CiBpbmdlc3Rpb24vd29ya2VyL3YxL3dvcmtlci5wcm90bxITaW5nZXN0aW9uLndvcmtlci52MSKDAQoTSW5nZXN0U3RyZWFtUmVxdWVzdBIxCgVoZWxsbxgBIAEoCzIgLmluZ2VzdGlvbi53b3JrZXIudjEuU3RyZWFtSGVsbG9IABIyCglzdWJfYmF0Y2gYAiABKAsyHS5pbmdlc3Rpb24ud29ya2VyLnYxLlN1YkJhdGNoSABCBQoDbXNnIjgKC1N0cmVhbUhlbGxvEhMKC2NvbnN1bWVyX2lkGAEgASgJEhQKDHN0cmVhbV9lcG9jaBgCIAEoBCKIAQoIU3ViQmF0Y2gSCwoDc2VxGAEgASgEEhAKCGJhdGNoX2lkGAIgASgJEjMKCG1lc3NhZ2VzGAMgAygLMiEuaW5nZXN0aW9uLndvcmtlci52MS5LYWZrYU1lc3NhZ2USDgoGcmVwbGF5GAQgASgIEhgKEGFzc2lnbm1lbnRfZXBvY2gYBSABKAQi/AEKDEthZmthTWVzc2FnZRINCgV0b3BpYxgBIAEoCRIRCglwYXJ0aXRpb24YAiABKAUSDgoGb2Zmc2V0GAMgASgDEhEKCXRpbWVzdGFtcBgEIAEoAxIQCgNrZXkYBSABKAlIAIgBARISCgV2YWx1ZRgGIAEoCUgBiAEBEj8KB2hlYWRlcnMYByADKAsyLi5pbmdlc3Rpb24ud29ya2VyLnYxLkthZmthTWVzc2FnZS5IZWFkZXJzRW50cnkaLgoMSGVhZGVyc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFCBgoEX2tleUIICgZfdmFsdWUieQoUSW5nZXN0U3RyZWFtUmVzcG9uc2USCwoDc2VxGAEgASgEEjMKBnN0YXR1cxgCIAEoDjIjLmluZ2VzdGlvbi53b3JrZXIudjEuU3ViQmF0Y2hTdGF0dXMSEAoIYWNjZXB0ZWQYAyABKA0SDQoFZXJyb3IYBCABKAkqaAoOU3ViQmF0Y2hTdGF0dXMSIAocU1VCX0JBVENIX1NUQVRVU19VTlNQRUNJRklFRBAAEhcKE1NVQl9CQVRDSF9TVEFUVVNfT0sQARIbChdTVUJfQkFUQ0hfU1RBVFVTX0ZBSUxFRBACMncKDFdvcmtlckluZ2VzdBJnCgxJbmdlc3RTdHJlYW0SKC5pbmdlc3Rpb24ud29ya2VyLnYxLkluZ2VzdFN0cmVhbVJlcXVlc3QaKS5pbmdlc3Rpb24ud29ya2VyLnYxLkluZ2VzdFN0cmVhbVJlc3BvbnNlKAEwAWIGcHJvdG8z'
+ )
+
+/**
+ * IngestStreamRequest is one frame on the consumer-to-worker stream.
+ *
+ * @generated from message ingestion.worker.v1.IngestStreamRequest
+ */
+export type IngestStreamRequest = Message<'ingestion.worker.v1.IngestStreamRequest'> & {
+ /**
+ * @generated from oneof ingestion.worker.v1.IngestStreamRequest.msg
+ */
+ msg:
+ | {
+ /**
+ * First frame on every stream. A stream carrying sub-batches before its
+ * hello is a protocol error and the worker closes it.
+ *
+ * @generated from field: ingestion.worker.v1.StreamHello hello = 1;
+ */
+ value: StreamHello
+ case: 'hello'
+ }
+ | {
+ /**
+ * @generated from field: ingestion.worker.v1.SubBatch sub_batch = 2;
+ */
+ value: SubBatch
+ case: 'subBatch'
+ }
+ | { case: undefined; value?: undefined }
+}
+
+/**
+ * Describes the message ingestion.worker.v1.IngestStreamRequest.
+ * Use `create(IngestStreamRequestSchema)` to create a new message.
+ */
+export const IngestStreamRequestSchema: GenMessage<IngestStreamRequest> =
+ /*@__PURE__*/
+ messageDesc(file_ingestion_worker_v1_worker, 0)
+
+/**
+ * StreamHello identifies the sender so the worker's feed-order sentinel can
+ * scope its per-key baselines.
+ *
+ * @generated from message ingestion.worker.v1.StreamHello
+ */
+export type StreamHello = Message<'ingestion.worker.v1.StreamHello'> & {
+ /**
+ * Consumer process incarnation. A consumer restart replays uncommitted
+ * offsets, so the sentinel rebaselines instead of firing false violations.
+ *
+ * @generated from field: string consumer_id = 1;
+ */
+ consumerId: string
+
+ /**
+ * Bumped each time this consumer (re)connects to this worker. A reconnect
+ * replays the un-acked tail, so the sentinel rebaselines on a new epoch.
+ *
+ * @generated from field: uint64 stream_epoch = 2;
+ */
+ streamEpoch: bigint
+}
+
+/**
+ * Describes the message ingestion.worker.v1.StreamHello.
+ * Use `create(StreamHelloSchema)` to create a new message.
+ */
+export const StreamHelloSchema: GenMessage<StreamHello> = /*@__PURE__*/ messageDesc(file_ingestion_worker_v1_worker, 1)
+
+/**
+ * SubBatch is one routed unit of work: a batch slice for one worker.
+ *
+ * @generated from message ingestion.worker.v1.SubBatch
+ */
+export type SubBatch = Message<'ingestion.worker.v1.SubBatch'> & {
+ /**
+ * Per-stream monotonic sequence, starting at 1 after the hello. The worker
+ * rejects gaps and regressions — a hole means frames were lost or reordered
+ * and the per-key order guarantee no longer holds.
+ *
+ * @generated from field: uint64 seq = 1;
+ */
+ seq: bigint
+
+ /**
+ * The Kafka batch that produced this sub-batch, for logs and debugging.
+ *
+ * @generated from field: string batch_id = 2;
+ */
+ batchId: string
+
+ /**
+ * @generated from field: repeated ingestion.worker.v1.KafkaMessage messages = 3;
+ */
+ messages: KafkaMessage[]
+
+ /**
+ * True when this sub-batch may repeat previously delivered messages: the
+ * reconnect replay of an un-acked tail, or a deferred-flush re-route. The
+ * worker's sentinel counts repeats on replay sub-batches as at-least-once
+ * redelivery rather than order violations.
+ *
+ * @generated from field: bool replay = 4;
+ */
+ replay: boolean
+
+ /**
+ * Bumped when the consumer's Kafka partition assignment changes. A
+ * rebalance legitimately replays uncommitted offsets, so the worker's
+ * sentinel rebaselines on a new epoch instead of firing.
+ *
+ * @generated from field: uint64 assignment_epoch = 5;
+ */
+ assignmentEpoch: bigint
+}
+
+/**
+ * Describes the message ingestion.worker.v1.SubBatch.
+ * Use `create(SubBatchSchema)` to create a new message.
+ */
+export const SubBatchSchema: GenMessage<SubBatch> = /*@__PURE__*/ messageDesc(file_ingestion_worker_v1_worker, 2)
+
+/**
+ * KafkaMessage mirrors `SerializedKafkaMessage` in
+ * `rust/ingestion-consumer/src/types.rs` and
+ * `nodejs/src/ingestion/api/types.ts`. Values are raw UTF-8 strings —
+ * PostHog Kafka messages are always JSON text.
+ *
+ * @generated from message ingestion.worker.v1.KafkaMessage
+ */
+export type KafkaMessage = Message<'ingestion.worker.v1.KafkaMessage'> & {
+ /**
+ * @generated from field: string topic = 1;
+ */
+ topic: string
+
+ /**
+ * @generated from field: int32 partition = 2;
+ */
+ partition: number
+
+ /**
+ * @generated from field: int64 offset = 3;
+ */
+ offset: bigint
+
+ /**
+ * @generated from field: int64 timestamp = 4;
+ */
+ timestamp: bigint
+
+ /**
+ * @generated from field: optional string key = 5;
+ */
+ key?: string
+
+ /**
+ * @generated from field: optional string value = 6;
+ */
+ value?: string
+
+ /**
+ * @generated from field: map<string, string> headers = 7;
+ */
+ headers: { [key: string]: string }
+}
+
+/**
+ * Describes the message ingestion.worker.v1.KafkaMessage.
+ * Use `create(KafkaMessageSchema)` to create a new message.
+ */
+export const KafkaMessageSchema: GenMessage<KafkaMessage> =
+ /*@__PURE__*/
+ messageDesc(file_ingestion_worker_v1_worker, 3)
+
+/**
+ * IngestStreamResponse acks one sub-batch.
+ *
+ * @generated from message ingestion.worker.v1.IngestStreamResponse
+ */
+export type IngestStreamResponse = Message<'ingestion.worker.v1.IngestStreamResponse'> & {
+ /**
+ * The `SubBatch.seq` this ack resolves.
+ *
+ * @generated from field: uint64 seq = 1;
+ */
+ seq: bigint
+
+ /**
+ * @generated from field: ingestion.worker.v1.SubBatchStatus status = 2;
+ */
+ status: SubBatchStatus
+
+ /**
+ * Messages accepted into the pipeline. Meaningful only on
+ * SUB_BATCH_STATUS_OK.
+ *
+ * @generated from field: uint32 accepted = 3;
+ */
+ accepted: number
+
+ /**
+ * Human-readable failure reason. Set only on SUB_BATCH_STATUS_FAILED.
+ *
+ * @generated from field: string error = 4;
+ */
+ error: string
+}
+
+/**
+ * Describes the message ingestion.worker.v1.IngestStreamResponse.
+ * Use `create(IngestStreamResponseSchema)` to create a new message.
+ */
+export const IngestStreamResponseSchema: GenMessage<IngestStreamResponse> =
+ /*@__PURE__*/
+ messageDesc(file_ingestion_worker_v1_worker, 4)
+
+/**
+ * SubBatchStatus is the outcome of processing one sub-batch.
+ *
+ * @generated from enum ingestion.worker.v1.SubBatchStatus
+ */
+export enum SubBatchStatus {
+ /**
+ * @generated from enum value: SUB_BATCH_STATUS_UNSPECIFIED = 0;
+ */
+ UNSPECIFIED = 0,
+
+ /**
+ * Every message of the sub-batch was processed, side effects included.
+ * This is the commit barrier: the consumer treats it exactly like today's
+ * HTTP 200.
+ *
+ * @generated from enum value: SUB_BATCH_STATUS_OK = 1;
+ */
+ OK = 1,
+
+ /**
+ * The sub-batch failed. The consumer must treat the stream as dead: later
+ * sub-batches may already carry the same routing keys, so per-key order on
+ * this stream is unrecoverable.
+ *
+ * @generated from enum value: SUB_BATCH_STATUS_FAILED = 2;
+ */
+ FAILED = 2,
+}
+
+/**
+ * Describes the enum ingestion.worker.v1.SubBatchStatus.
+ */
+export const SubBatchStatusSchema: GenEnum<SubBatchStatus> = /*@__PURE__*/ enumDesc(file_ingestion_worker_v1_worker, 0)
+
+/**
+ * WorkerIngest is the streaming ingest transport between the Rust ingestion
+ * consumer and the Node.js ingestion-api workers.
+ *
+ * One bidirectional stream per (consumer process, worker pod) pair. The
+ * stream is the ordering primitive: sub-batches are delivered to the worker
+ * in send order, and the worker feeds them to its pipeline in read order, so
+ * per-routing-key order holds as long as a key sticks to one worker (the
+ * consumer's dispatcher pins guarantee that). Acks flow back on the response
+ * stream and may complete out of order; `seq` correlates them.
+ *
+ * @generated from service ingestion.worker.v1.WorkerIngest
+ */
+export const WorkerIngest: GenService<{
+ /**
+ * @generated from rpc ingestion.worker.v1.WorkerIngest.IngestStream
+ */
+ ingestStream: {
+ methodKind: 'bidi_streaming'
+ input: typeof IngestStreamRequestSchema
+ output: typeof IngestStreamResponseSchema
+ }
+}> = /*@__PURE__*/ serviceDesc(file_ingestion_worker_v1_worker, 0)
diff --git a/proto/AGENTS.md b/proto/AGENTS.md
index 711b87ed8fa5..ad02537c409d 100644
--- a/proto/AGENTS.md
+++ b/proto/AGENTS.md
@@ -33,3 +33,13 @@ No codegen step needed (tonic regenerates on `cargo build`), but you must:
- Implement the RPC in `rust/personhog-replica/` (storage layer + service handler)
- Wire it through `rust/personhog-router/` (backend, router, and service layers)
- Add tests (see Rust test conventions in `rust/personhog-replica/AGENTS.md`)
+
+## Ingestion worker protos
+
+When you add or modify an RPC or message type in `ingestion/` protos, regenerate the Node.js stubs and commit them (CI rejects stale stubs):
+
+```bash
+cd nodejs && pnpm run generate:ingestion-worker-proto
+```
+
+Rust bindings (`rust/ingestion-worker-proto`) regenerate on `cargo build`.
diff --git a/proto/README.md b/proto/README.md
index ccf01a011fa9..383e42bc9bec 100644
--- a/proto/README.md
+++ b/proto/README.md
@@ -9,6 +9,8 @@ proto/
├── buf.yaml
├── cymbal/ # Cymbal internal services
│ └── resolution/v1/ # Exception-level symbol resolution
+├── ingestion/ # Event ingestion
+│ └── worker/v1/ # Consumer → worker streaming ingest transport
├── kafka_assigner/ # Kafka partition assignment
└── personhog/ # Person data service
├── types/v1/
@@ -18,11 +20,12 @@ proto/
## Consumers
-| Proto | Rust | Python | Node.js |
-| ----------------- | -------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------- |
-| `cymbal/` | `rust/cymbal-proto` (auto via tonic) | — | — |
-| `personhog/` | `rust/personhog-proto` (auto via tonic) | `posthog/personhog_client/proto/generated/` (checked in) | `nodejs/src/common/generated/personhog` (checked in) |
-| `kafka_assigner/` | `rust/kafka-assigner-proto` (auto via tonic) | — | — |
+| Proto | Rust | Python | Node.js |
+| ----------------- | ---------------------------------------------- | -------------------------------------------------------- | ----------------------------------------------------------- |
+| `cymbal/` | `rust/cymbal-proto` (auto via tonic) | — | — |
+| `ingestion/` | `rust/ingestion-worker-proto` (auto via tonic) | — | `nodejs/src/common/generated/ingestion-worker` (checked in) |
+| `personhog/` | `rust/personhog-proto` (auto via tonic) | `posthog/personhog_client/proto/generated/` (checked in) | `nodejs/src/common/generated/personhog` (checked in) |
+| `kafka_assigner/` | `rust/kafka-assigner-proto` (auto via tonic) | — | — |
## Updating protos
diff --git a/proto/ingestion/worker/v1/worker.proto b/proto/ingestion/worker/v1/worker.proto
new file mode 100644
index 000000000000..76cdaa3d7e71
--- /dev/null
+++ b/proto/ingestion/worker/v1/worker.proto
@@ -0,0 +1,96 @@
+syntax = "proto3";
+
+package ingestion.worker.v1;
+
+// WorkerIngest is the streaming ingest transport between the Rust ingestion
+// consumer and the Node.js ingestion-api workers.
+//
+// One bidirectional stream per (consumer process, worker pod) pair. The
+// stream is the ordering primitive: sub-batches are delivered to the worker
+// in send order, and the worker feeds them to its pipeline in read order, so
+// per-routing-key order holds as long as a key sticks to one worker (the
+// consumer's dispatcher pins guarantee that). Acks flow back on the response
+// stream and may complete out of order; `seq` correlates them.
+service WorkerIngest {
+ rpc IngestStream(stream IngestStreamRequest) returns (stream IngestStreamResponse);
+}
+
+// IngestStreamRequest is one frame on the consumer-to-worker stream.
+message IngestStreamRequest {
+ oneof msg {
+ // First frame on every stream. A stream carrying sub-batches before its
+ // hello is a protocol error and the worker closes it.
+ StreamHello hello = 1;
+ SubBatch sub_batch = 2;
+ }
+}
+
+// StreamHello identifies the sender so the worker's feed-order sentinel can
+// scope its per-key baselines.
+message StreamHello {
+ // Consumer process incarnation. A consumer restart replays uncommitted
+ // offsets, so the sentinel rebaselines instead of firing false violations.
+ string consumer_id = 1;
+ // Bumped each time this consumer (re)connects to this worker. A reconnect
+ // replays the un-acked tail, so the sentinel rebaselines on a new epoch.
+ uint64 stream_epoch = 2;
+}
+
+// SubBatch is one routed unit of work: a batch slice for one worker.
+message SubBatch {
+ // Per-stream monotonic sequence, starting at 1 after the hello. The worker
+ // rejects gaps and regressions — a hole means frames were lost or reordered
+ // and the per-key order guarantee no longer holds.
+ uint64 seq = 1;
+ // The Kafka batch that produced this sub-batch, for logs and debugging.
+ string batch_id = 2;
+ repeated KafkaMessage messages = 3;
+ // True when this sub-batch may repeat previously delivered messages: the
+ // reconnect replay of an un-acked tail, or a deferred-flush re-route. The
+ // worker's sentinel counts repeats on replay sub-batches as at-least-once
+ // redelivery rather than order violations.
+ bool replay = 4;
+ // Bumped when the consumer's Kafka partition assignment changes. A
+ // rebalance legitimately replays uncommitted offsets, so the worker's
+ // sentinel rebaselines on a new epoch instead of firing.
+ uint64 assignment_epoch = 5;
+}
+
+// KafkaMessage mirrors `SerializedKafkaMessage` in
+// `rust/ingestion-consumer/src/types.rs` and
+// `nodejs/src/ingestion/api/types.ts`. Values are raw UTF-8 strings —
+// PostHog Kafka messages are always JSON text.
+message KafkaMessage {
+ string topic = 1;
+ int32 partition = 2;
+ int64 offset = 3;
+ int64 timestamp = 4;
+ optional string key = 5;
+ optional string value = 6;
+ map<string, string> headers = 7;
+}
+
+// SubBatchStatus is the outcome of processing one sub-batch.
+enum SubBatchStatus {
+ SUB_BATCH_STATUS_UNSPECIFIED = 0;
+ // Every message of the sub-batch was processed, side effects included.
+ // This is the commit barrier: the consumer treats it exactly like today's
+ // HTTP 200.
+ SUB_BATCH_STATUS_OK = 1;
+ // The sub-batch failed. The consumer must treat the stream as dead: later
+ // sub-batches may already carry the same routing keys, so per-key order on
+ // this stream is unrecoverable.
+ SUB_BATCH_STATUS_FAILED = 2;
+}
+
+// IngestStreamResponse acks one sub-batch.
+message IngestStreamResponse {
+ // The `SubBatch.seq` this ack resolves.
+ uint64 seq = 1;
+ SubBatchStatus status = 2;
+ // Messages accepted into the pipeline. Meaningful only on
+ // SUB_BATCH_STATUS_OK.
+ uint32 accepted = 3;
+ // Human-readable failure reason. Set only on SUB_BATCH_STATUS_FAILED.
+ string error = 4;
+}
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index ee9b56d757ed..66aeb5aa9c18 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -6057,6 +6057,15 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "ingestion-worker-proto"
+version = "0.1.0"
+dependencies = [
+ "prost 0.13.5",
+ "tonic 0.12.3",
+ "tonic-build 0.12.3",
+]
+
[[package]]
name = "inout"
version = "0.1.4"
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 153b7a40c217..6c37a01dc056 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -54,6 +54,7 @@ members = [
"kafka-assigner-proto",
"ingestion-consumer",
"ingestion-control-plane",
+ "ingestion-worker-proto",
"kafka-deduplicator",
"personhog-common",
"personhog-coordination",
diff --git a/rust/affected-services/determinator-rules.toml b/rust/affected-services/determinator-rules.toml
index c2771ab66683..222e10b18e53 100644
--- a/rust/affected-services/determinator-rules.toml
+++ b/rust/affected-services/determinator-rules.toml
@@ -28,10 +28,10 @@ mark-changed = "all"
globs = [".sqlx/**"]
mark-changed = "all"
-# Proto files trigger the two build-script crates that read them.
+# Proto files trigger the build-script crates that read them.
[[path-rule]]
globs = ["../proto/**"]
-mark-changed = ["personhog-proto", "kafka-assigner-proto", "cymbal-proto"]
+mark-changed = ["personhog-proto", "kafka-assigner-proto", "cymbal-proto", "ingestion-worker-proto"]
# Hypercache contract: Python serializer changes may break Rust deserialization.
# Must come BEFORE the catch-all rule below.
diff --git a/rust/ingestion-worker-proto/Cargo.toml b/rust/ingestion-worker-proto/Cargo.toml
new file mode 100644
index 000000000000..13920b02d450
--- /dev/null
+++ b/rust/ingestion-worker-proto/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "ingestion-worker-proto"
+version = "0.1.0"
+edition = "2021"
+publish = false
+
+[dependencies]
+prost = { workspace = true }
+tonic = { workspace = true }
+
+[build-dependencies]
+tonic-build = { workspace = true }
+
+[package.metadata.cargo-shear]
+ignored = ["prost"]
+
+[lints]
+workspace = true
diff --git a/rust/ingestion-worker-proto/README.md b/rust/ingestion-worker-proto/README.md
new file mode 100644
index 000000000000..db5583517eaa
--- /dev/null
+++ b/rust/ingestion-worker-proto/README.md
@@ -0,0 +1,14 @@
+# ingestion-worker-proto
+
+Rust bindings for the ingestion consumer → worker streaming gRPC API.
+
+Proto definitions live in the top-level [`/proto/ingestion`](/proto/ingestion) directory.
+The `ingestion.worker.v1.WorkerIngest` service carries routed sub-batches from `rust/ingestion-consumer` to the Node.js ingestion-api workers over one ordered bidirectional stream per (consumer, worker) pair.
+
+## Building
+
+```bash
+cargo build -p ingestion-worker-proto
+```
+
+Rust bindings regenerate automatically through `tonic-build` when the crate builds.
diff --git a/rust/ingestion-worker-proto/build.rs b/rust/ingestion-worker-proto/build.rs
new file mode 100644
index 000000000000..448a0df9c6e8
--- /dev/null
+++ b/rust/ingestion-worker-proto/build.rs
@@ -0,0 +1,12 @@
+fn main() -> Result<(), Box<dyn std::error::Error>> {
+ let proto_root = std::env::var("PROTO_ROOT").unwrap_or_else(|_| "../../proto".to_string());
+
+ tonic_build::configure()
+ .build_server(true)
+ .build_client(true)
+ .compile_protos(
+ &[format!("{proto_root}/ingestion/worker/v1/worker.proto")],
+ &[proto_root],
+ )?;
+ Ok(())
+}
diff --git a/rust/ingestion-worker-proto/src/lib.rs b/rust/ingestion-worker-proto/src/lib.rs
new file mode 100644
index 000000000000..ced9e9ee4254
--- /dev/null
+++ b/rust/ingestion-worker-proto/src/lib.rs
@@ -0,0 +1,7 @@
+pub mod ingestion {
+ pub mod worker {
+ pub mod v1 {
+ tonic::include_proto!("ingestion.worker.v1");
+ }
+ }
+}