Repository navigation
Conversation
This was referenced Oct 7, 2026
enable_full_ai_capture now controls only truncation and media redaction. A client object without capture_ai still gets capture calls.
eli-r-ph
force-pushed
the
v1-capture-ai-wrappers
branch
from
October 7, 2026 03:56
fde9c61 to
31c13ba
Compare
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
enable_full_ai_capture. The analytics endpoint caps an event near 1 MB, so large generations can be rejected there.This PR sends every wrapper event through
capture_ai.enable_full_ai_capturenow controls only content: truncation and media redaction.Changes
capture_ai, with or withoutenable_full_ai_capture. They all use one helper,_capture_ai_event.capture_aimethod, such as a custom stand-in, still receivescapturecalls.enable_full_ai_capturedocstrings no longer say the flag routes events._use_ai_laneand_enable_multimodal_capturestay deprecated aliases ofenable_full_ai_capture. Their names are now misleading, but callers that set them get the same result as before.capture, because they are not$ai_*events.Warning
Two breaking effects for users:
Mockclient to a wrapper and asserts onmock.capturenow sees the call onmock.capture_ai. The old helper tests keptMockclients oncaptureon purpose; those tests are replaced./i/v1/ai/eventsnow drops wrapper events. Before this PR, wrapper events without the opt-in used/i/v1/batch/.Divergence from sdk-specs
The
capture-aispec in PostHog/sdk-specs ties wrapper routing to the flag. This PR diverges from it. Proposed spec change:Plus a new requirement: "AI wrappers send through
capture_ai", with one scenario per flag value that asserts the wrapper event arrives on the AI endpoint only. The spec PR is not opened yet.💚 How did you test it?
capture_ai(about 465 assertions, renamed by a script). Every wrapper test therefore checks the default routing, with the flag off.test_routes_only_through_ai_lanesends through a real client, with the flag off and on. It asserts the AI path is the only path posted, so it also catches an event sent on both lanes.test_client_without_capture_ai_falls_back_to_capturecovers a client object with nocapture_ai, with the flag off and on.capture_ai" tests, theMockclient tests and one duplicate lane test are removed. The tests above cover them.📝 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. Skills used:
writing-tests,writing-pr-descriptions.Agreed before implementation: wrappers always use
capture_ai, the flag controls only content, and the PR calls out the spec divergence.Agent calls worth review:
capturestays. Removing it would break custom client objects that have nocapture_ai.