Open
Conversation
Implements PostHog error tracking that gracefully degrades when POSTHOG_API_KEY is not set (unlike the previous attempt that crashed). Backend: - Add posthog_client.py module with capture_exception() and capture_event() - Add error tracking middleware for unhandled exceptions - Add exception handlers for validation errors and general exceptions - Add /api/test-error endpoint for verification Frontend: - Add PostHogProvider and PostHogErrorBoundary wrappers - Conditionally enable based on POSTHOG_KEY environment variable - Add error fallback UI component Configuration: - Backend: POSTHOG_API_KEY, POSTHOG_HOST environment variables - Frontend: POSTHOG_KEY, POSTHOG_HOST via webpack DefinePlugin TODO: Set real PostHog API keys in production environment. https://claude.ai/code/session_01Kz3yVbDK5FfzfXiLKnFLXW
Build artifacts should not be committed. https://claude.ai/code/session_01Kz3yVbDK5FfzfXiLKnFLXW
So the professor just needs to add POSTHOG_API_KEY and POSTHOG_KEY to the .env file — no code changes needed to enable error tracking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
kcarnold
approved these changes
Feb 24, 2026
Contributor
kcarnold
left a comment
There was a problem hiding this comment.
Looking generally good. I'll get the key in the Jenkins cert store, but you should include a patch to Jenkinsfile to get that key injected.
| exc_type = type(exception).__name__ | ||
| exc_message = str(exception) | ||
| exc_traceback = "".join( | ||
| traceback.format_exception(type(exception), exception, exception.__traceback__) |
Contributor
There was a problem hiding this comment.
why do we have to do all this? isn't this stuff builtin to Posthog? ("exception autocapture"?)
Contributor
|
Actually the "project token" is "safe to use in public apps" so we can just commit it here. When we upload sourcemaps, we'll need a "personal API key" that has some additional permissions (so should be separate from the key that we distribute publicly). |
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.
This branch adds full front and backend error tracking through posthog which is hosted on https://e.thoughtful-ai.com/. Additionally this contains the smoke test which is a backend test that ensures environment variables wont crash the production server. While this shouldn't break anything if it is merged beforehand, posthog will NOT work if the api key isnt added into the jenkins server secrets.
closes issue #13