-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(telemetry): add app version to exception captures and filter 402 errors #9996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
The processFinishReason() method was clearing rawChunkTracker immediately after emitting tool_call_end events. However, Task.ts doesn't process these events in the main streaming loop - they're only processed via the fallback mechanism in finalizeRawChunks(). This caused MCP tools to never be converted from tool_use to mcp_tool_use type, resulting in 'unknown tool' errors. The fix removes the redundant clear() call from processFinishReason(). The tracker is still properly cleared by: 1. finalizeRawChunks() - after processing remaining tools (line 180) 2. clearRawChunkState() - when a new API request starts
Contributor
Review complete. All issues have been resolved.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
… errors - Add appVersion as required parameter in captureException across TelemetryClient interface - TelemetryService stores appVersion (set once at activation) and automatically passes it to all clients - PostHogTelemetryClient includes $app_version in all exception reports sent to PostHog - Add 402 (payment required) to EXPECTED_API_ERROR_CODES to filter out billing-related errors - Add tests for shouldReportApiErrorToTelemetry and updated captureException tests
8f5e243 to
02003f7
Compare
# Conflicts: # packages/telemetry/src/PostHogTelemetryClient.ts # packages/types/src/__tests__/telemetry.test.ts
Contributor
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on January 17. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
cte
approved these changes
Dec 10, 2025
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Enhancement
New feature or request
Issue/PR - Triage
New issue. Needs quick review to confirm validity and assign labels.
lgtm
This PR has been approved by a maintainer
size:L
This PR changes 100-499 lines, ignoring generated files.
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.
Summary
This PR adds app version tracking to PostHog exception captures and filters out billing-related (402) errors.
Changes
1. Added 402 to EXPECTED_API_ERROR_CODES
402(Payment required - billing issues) to the set of expected API error codes2. Made appVersion a required property in captureException
TelemetryClientinterface to requireappVersionparameter incaptureExceptionPostHogTelemetryClient,CloudTelemetryClient,BaseTelemetryClient)TelemetryServicenow stores appVersion (set once during extension activation) and automatically passes it to all clientsPostHogTelemetryClientincludes it as$app_versionproperty in exception reports sent to PostHog3. Callers don't need to change
The existing callers like
openrouter.tscontinue to work unchanged:The
TelemetryServicehandles passing the appVersion automatically.Test Plan
shouldReportApiErrorToTelemetryandEXPECTED_API_ERROR_CODESPostHogTelemetryClienttests for the new signatureRelated Issues
N/A
Important
Add app version to exception captures and filter out 402 errors in telemetry reporting.
402toEXPECTED_API_ERROR_CODESintelemetry.tsto filter out billing-related errors from telemetry.captureExceptioninPostHogTelemetryClientto includeappVersionin exception reports.TelemetryClientinterface intelemetry.tsto requireappVersionincaptureException.shouldReportApiErrorToTelemetryandEXPECTED_API_ERROR_CODESintelemetry.test.ts.PostHogTelemetryClient.test.tsto test newcaptureExceptionbehavior withappVersion.This description was created by
for 87aab92. You can customize this summary. It will automatically update as commits are pushed.