Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Dec 18, 2025

Summary

Add structured exception tracking via PostHog for 'Roo is having trouble' events (consecutive mistake limit reached).

Changes

New Types (packages/types/src/telemetry.ts)

  • ConsecutiveMistakeReason type: "no_tools_used" | "tool_repetition" | "unknown"
  • ConsecutiveMistakeError class with properties: taskId, consecutiveMistakeCount, consecutiveMistakeLimit, reason
  • isConsecutiveMistakeError() type guard
  • extractConsecutiveMistakeErrorProperties() property extractor

PostHog Integration (packages/telemetry/src/PostHogTelemetryClient.ts)

  • Updated captureException() to detect ConsecutiveMistakeError and auto-extract properties

Tracking Points

  • Task.ts - When model fails to use any tools (reason: no_tools_used)
  • presentAssistantMessage.ts - When model repeats the same tool call (reason: tool_repetition)

PostHog Event Data

When a consecutive mistake event fires, PostHog receives:

Property Description
taskId Unique task identifier
consecutiveMistakeCount How many mistakes occurred
consecutiveMistakeLimit The configured limit threshold
reason Why the limit was reached
message Descriptive error message
Context properties appVersion, apiProvider, modelId, etc.

Testing

  • Added comprehensive tests for the new error class and utilities (69 tests in telemetry.test.ts)
  • All 4784 tests pass

Important

Introduces ConsecutiveMistakeError for tracking consecutive mistake errors via PostHog, with updates to telemetry handling and comprehensive tests.

  • Behavior:
    • Adds ConsecutiveMistakeError class in telemetry.ts for tracking consecutive mistake errors.
    • Updates captureException() in PostHogTelemetryClient.ts to handle ConsecutiveMistakeError.
    • Tracks errors in Task.ts when no tools are used and in presentAssistantMessage.ts for tool repetition.
  • Types and Utilities:
    • Adds ConsecutiveMistakeReason type and isConsecutiveMistakeError() type guard in telemetry.ts.
    • Implements extractConsecutiveMistakeErrorProperties() in telemetry.ts.
  • Testing:
    • Adds tests for ConsecutiveMistakeError and related utilities in telemetry.test.ts.

This description was created by Ellipsis for 2ab2df5. You can customize this summary. It will automatically update as commits are pushed.

…ke errors

Add structured exception tracking via PostHog for 'Roo is having trouble' events:

- Add ConsecutiveMistakeError class with reason field (no_tools_used, tool_repetition, unknown)
- Add type guard isConsecutiveMistakeError() and property extractor
- Update PostHogTelemetryClient.captureException() to auto-extract properties
- Track consecutive mistake limit reached in Task.ts with 'no_tools_used' reason
- Track tool repetition limit in presentAssistantMessage.ts with 'tool_repetition' reason
- Add comprehensive tests (69 tests pass)
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 18, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 18, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. No new issues found.

The changes add provider and modelId properties to ConsecutiveMistakeError for richer telemetry data. The implementation follows existing patterns (mirrors ApiProviderError handling), is well-documented, and has comprehensive test coverage.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@dosubot dosubot bot added the Enhancement New feature or request label Dec 18, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 18, 2025
- Add ConsecutiveMistakeError class with provider and modelId tracking
- Add type guard and property extraction for ConsecutiveMistakeError
- Update PostHogTelemetryClient to handle ConsecutiveMistakeError
- Track 'Roo is having trouble' events via captureException in Task.ts and presentAssistantMessage.ts
- Include both telemetry event (captureConsecutiveMistakeError) and exception tracking
- Add comprehensive tests for new error tracking functionality
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Dec 18, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 18, 2025
@cte cte merged commit 3a2ad6b into main Dec 18, 2025
13 checks passed
@cte cte deleted the feat/consecutive-mistake-exception-tracking branch December 18, 2025 20:59
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Dec 18, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 18, 2025
@cte cte mentioned this pull request Dec 18, 2025
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.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants