Skip to content

chore(deps): bump posthoganalytics to 7.38.3 - #79814

Merged
fivestarspicy merged 1 commit into
masterfrom
posthog-code/bump-posthoganalytics-7-38-3
Aug 10, 2026
Merged

chore(deps): bump posthoganalytics to 7.38.3#79814
fivestarspicy merged 1 commit into
masterfrom
posthog-code/bump-posthoganalytics-7-38-3

Conversation

@fivestarspicy

Copy link
Copy Markdown
Contributor

Problem

  • Replay Vision reports inflated input cost in AI observability on cache-heavy scanner generations.
  • Its scanners use Gemini explicit context caching, where the cached-content count and the prompt count come from separate measurements and can disagree by a few percent.
  • Ingestion currently infers Gemini's cache accounting model from those counts, and that shape makes cache reads look like a separate token pool rather than a subset of input.
  • The full input then bills at the prompt rate and the cache bills again at the cache rate. Gemini prices cache reads at a tenth of the prompt rate, so a nearly fully cached prompt bills several times over.

Changes

The lock update touches posthoganalytics only, 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 an isinstance(..., str) check before json.loads or by accepting dict | None, so this removes a latent inconsistency rather than creating one. Also in the range: alias() and group_identify() now drop empty or missing identities with a warning instead of enqueuing unusable events, flush() no longer waits out flush_interval before delivering a partial batch, and $exception_list is emitted root-cause-last.

How did you test this code?

  • Ran uv lock, then uv sync. Resolution is clean and the lock diff is a single version change.
  • Verified against the installed 7.38.3 that the Gemini converter sets the flag and that posthoganalytics.ai.utils maps it onto $ai_cache_reporting_exclusive.
  • Imported posthoganalytics.ai.gemini.genai and confirmed the AsyncClient that Replay Vision uses resolves.
  • Reviewed the changelog for all 24 releases in the range and checked this repo's call sites for the payload, identity, and flush changes named above.
  • Not run: the backend test suite, which needs a database this sandbox does not have. CI covers it. I also did not exercise a live Gemini scanner run, so the end-to-end effect on reported cost is unverified here.

Automatic notifications

  • Publish to changelog?

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

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
@trunk-io

trunk-io Bot commented Aug 7, 2026

Copy link
Copy Markdown

😎 This pull request was merged.

@Radu-Raicea
Radu-Raicea marked this pull request as ready for review August 7, 2026 18:21
@trunk-io

trunk-io Bot commented Aug 7, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Playwright — all passed

All tests passed.

View test results →

Hobby preview — Health check did not pass within 35 minutes

Failing fast because: Health check did not pass within 35 minutes


Run 31206202443 | Consecutive failures: 2

@fivestarspicy
fivestarspicy enabled auto-merge (squash) August 7, 2026 19:39
@fivestarspicy
fivestarspicy merged commit fec8507 into master Aug 10, 2026
348 of 353 checks passed
@fivestarspicy
fivestarspicy deleted the posthog-code/bump-posthoganalytics-7-38-3 branch August 10, 2026 13:51
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 10, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-10 14:25 UTC Run
prod-us ✅ Deployed 2026-08-10 15:04 UTC Run
prod-eu ✅ Deployed 2026-08-10 15:09 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants