Repository navigation
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-07T17:48:39.279437+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-option-layers
branch
from
October 7, 2026 02:03
816a97e to
0f828c1
Compare
eli-r-ph
force-pushed
the
v1-capture-ai-personless-option
branch
from
October 7, 2026 02:03
c92aadd to
3f09f03
Compare
eli-r-ph
force-pushed
the
v1-capture-ai-personless-option
branch
from
October 7, 2026 17:43
3f09f03 to
5e3fddc
Compare
eli-r-ph
force-pushed
the
v1-capture-option-layers
branch
from
October 7, 2026 17:43
0f828c1 to
4753ddb
Compare
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:44
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
AI wrappers and MCP instrumentation fall back to a trace, run or session ID when the caller gives no distinct ID. A person profile for that ID is always wrong, so these integrations turn person processing off. Until now they did it with the legacy
$process_person_profileproperty. As of the previous PR in this stack, a property loses to any option, so a global or context option could turn person processing back on for these events.This PR moves the override to a per-event option,
process_person_profile: false. A per-event option beats every lower layer: legacy properties,super_optionsand context options.before_sendcan still change it.Sites:
$exceptioneventsBehavior changes:
$process_person_profile: trueinposthog_propertiesor MCP custom properties no longer opts a fallback-ID event in. For non-streaming OpenAI, Anthropic and Gemini calls the caller used to win; everywhere else the SDK did. Now the SDK wins everywhere.PostHogCaptureEventgains anoptionskey. The MCPbefore_sendhook sees it and can change it._capture_event, instead of at each call site. Span handlers takeOptional[str]distinct IDs.Not in this PR: routing every AI wrapper event through
capture_ai. That comes later in the stack.💚 How did you test it?
options == {"process_person_profile": False}instead of the property. Identified events assert that nooptionsis passed.$process_person_profile: true. It covers the async and streaming paths, which no earlier test did.super_optionsvalue, a caller option and a legacy property all set totruestill sendsfalsebefore_sendcan set it back totruebefore_sendoverride.options, on both MCP SDK majorspython -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:
before_sendcan still change itAgent calls worth review:
_capture_ai_eventtakes apersonlessflag and merges the option over any calleroptions. No wrapper passes caller options today._capture_eventtakes the fallback ID from the event's$ai_trace_id. Every handler sets it. If one did not, the existing"unknown"fallback applies.capture(). They are not$ai_*events, socapture_aidoes not apply.