Skip to content

chore(posthog): drop new_context capture_exceptions workaround - #113

Merged
iloveitaly merged 2 commits into
masterfrom
cursor/posthog-context-exceptions-5cef
Sep 18, 2026
Merged

iloveitaly merged 2 commits into
masterfrom
cursor/posthog-context-exceptions-5cef

Conversation

@iloveitaly

@iloveitaly iloveitaly commented Sep 5, 2026 •

Copy link
Copy Markdown
Owner

Motivation

posthog-python#353 is fixed in PR #680: new_context() now inherits enable_exception_autocapture from the client / default client instead of always capturing exceptions.

This repo already depends on posthog>=7.38.0 (locked at 7.45.1), which includes that behavior. No extra SDK work is required to "support" the upstream change.

Description

We had a workaround of passing capture_exceptions=False on every posthog.new_context() because the SDK ignored the client setting.

That is no longer needed. enable_exception_autocapture=False on the configured client is enough.

Still required: posthog.default_client = posthog_client. Module-level APIs (posthog.new_context, posthog.capture, …) do not automatically use a separately constructed Posthog() instance. Issue #353 also called that out; #680 did not add a different client-assignment API.

Screenshots / Test

Verified against installed posthog==7.45.1:

  • new_context() with no capture_exceptions argument sets capture_exceptions=False when the default client has enable_exception_autocapture=False
  • exceptions inside that context do not call capture_exception
  • explicit capture_exceptions=True still opts in

Links

Open in Web Open in Cursor 

posthog-python now inherits enable_exception_autocapture for new_context,
so per-call capture_exceptions=False is no longer required. Keep assigning
default_client so module-level APIs use the configured instance.

Co-authored-by: Michael Bianco <mike@mikebian.co>
@iloveitaly
iloveitaly marked this pull request as ready for review September 5, 2026 13:52
SDK behavior was already verified against posthog 7.45.1; keep the
workaround cleanup without extra tests.

Co-authored-by: Michael Bianco <mike@mikebian.co>
@cursor cursor Bot changed the title Drop PostHog new_context exception-capture workaround chore(posthog): drop new_context capture_exceptions workaround Sep 16, 2026
@iloveitaly
iloveitaly merged commit 4ac7dc0 into master Sep 18, 2026
2 of 3 checks passed
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