chore(deps): bump posthoganalytics to 7.38.3 - #79814
Merged
Merged
Conversation
7.38.3 makes the Gemini wrapper declare its cache accounting model on generations that report cache reads, so ingestion prices cached tokens from `$ai_cache_reporting_exclusive` rather than inferring it from the token counts. Replay Vision scanners use Gemini explicit context caching, where the cache and prompt counts come from separate measurements and can disagree by a few percent. That is exactly the shape the inference gets wrong, and it inflates reported input cost on cache-heavy generations. The lock update touches posthoganalytics only, with no transitive changes. Generated-By: PostHog Code Task-Id: 06160e48-feb9-4d39-8b7b-3dcfd1d9ca24
|
😎 This pull request was merged. |
Radu-Raicea
marked this pull request as ready for review
August 7, 2026 18:21
Contributor
🤖 CI report❌ Hobby preview — Health check did not pass within 35 minutesFailing fast because: Health check did not pass within 35 minutes Run 31206202443 | Consecutive failures: 2 |
TueHaulund
approved these changes
Aug 7, 2026
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.
Problem
Changes
posthoganalyticsfrom 7.30.1 to 7.38.3.$ai_cache_reporting_exclusiveon generations that report cache reads, so ingestion stops inferring it.The lock update touches
posthoganalyticsonly, with no transitive dependency changes.Note
This spans 24 releases, so it is wider than Replay Vision. I read the changelog across the range: no breaking changes, but several behavior changes land with it. The two worth a reviewer's attention are below.
get_feature_flag_payload()now JSON-decodes payloads for locally-evaluated flags, so its return type no longer depends on where the flag resolved. Every non-test call site in this repo already handles both shapes, either through anisinstance(..., str)check beforejson.loadsor by acceptingdict | None, so this removes a latent inconsistency rather than creating one. Also in the range:alias()andgroup_identify()now drop empty or missing identities with a warning instead of enqueuing unusable events,flush()no longer waits outflush_intervalbefore delivering a partial batch, and$exception_listis emitted root-cause-last.How did you test this code?
uv lock, thenuv sync. Resolution is clean and the lock diff is a single version change.posthoganalytics.ai.utilsmaps it onto$ai_cache_reporting_exclusive.posthoganalytics.ai.gemini.genaiand confirmed theAsyncClientthat Replay Vision uses resolves.Automatic notifications
Docs update
None.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
I (the PostHog Slack app, running Claude) traced the underlying cost issue from a Slack thread, wrote the SDK fix in PostHog/posthog-python#860, and a PostHog engineer asked for this bump once it published. I did not set an assignee because I could not verify their GitHub handle in session.
An earlier attempt fixed this in ingestion instead, by adding a tolerance to the inference. That was closed in favour of declaring the accounting model at the source, which avoids tuning a threshold constant against observed token shapes.
Worth flagging for whoever reviews the blast radius: teams on older SDK versions are still subject to the inference, and it does not cover OTel or manual capture at all. This bump fixes this repo, not the general case.
Public artifact: no customer or session material reached this PR.
Created with PostHog from a Slack thread