Repository navigation
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-07T17:48:29.214405+00:00 ✅ All Tests Passed!116/116 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
eli-r-ph
force-pushed
the
v1-capture-ai-config
branch
from
October 7, 2026 02:03
0ae6eb7 to
8da410d
Compare
This was referenced Oct 7, 2026
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:43
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
The AI lane (
capture_ai,/i/v1/ai/events) shared the analytics lane's queue size and timeout, sent uncompressed with no way to change it, and used an 8 MiB guard on the whole serialized event. The endpoint applies its 8 MiB ceiling to properties alone, so the SDK refused some events the endpoint accepts. Batches also appended an event before checking the byte limit, so a request could carry about 13 MiB.New
Clientkeyword arguments (AI lane only):capture_ai_compression: default none.POSTHOG_CAPTURE_COMPRESSIONdoes not apply, so analytics compression never changes AI uploads.capture_ai_max_queue_size: default 1000.capture_ai_timeout: default 30s.capture_ai_max_event_bytes: default 8 MiB plus 64 KiB of envelope headroom. It can only be lowered.These follow posthog-go's
v1defaults (CaptureAICompression,CaptureAIMaxQueueSize,CaptureAIBatchUploadTimeout, and theaiMaxEventBytes + aiEnvelopeHeadroomguard). Invalid values raiseValueErrorat construction. The 5 MiB AI batch target stays a constant.Behavior changes:
sync_modeapplies the lane's size guard and timeout. The AI lane'scapture_ai_timeoutand size guard now apply to sync sends. This also adds the 900 KiB guard to sync analytics sends, which matchesAsyncPosthog.capture_immediate.flush()and shutdown signal every lane to drain before waiting on any of them. Before, the AI lane kept its normal batching cadence while the client waited on the analytics lane. The flush budget did not change.sdk-specs / cross-SDK:
aiLaneConfigcomment says Python does too, which this PR changes. Only the lower-only event cap is public; the batch target stays constant.posthog.<knob> = ...) does not get the new knobs, same ascapture_compression.💚 How did you test it?
POSTHOG_CAPTURE_COMPRESSIONisolationflush()draining the AI lane while an analytics upload is blockedpython -W error -c "import posthog", the public API snapshot anduv lock --check.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileCovered by the existing
capture-v1-majorchangeset; the migration guide lands later in this stack.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee.
Agreed before implementation:
Agent calls worth review: