Skip to content

Conversation

@daniel-lxs
Copy link
Member

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

Summary

Adds telemetry error capture to the Mistral provider, following the pattern established in PR #10073 for OpenRouter.

Changes

  • Import TelemetryService from @roo-code/telemetry
  • Import ApiProviderError from @roo-code/types
  • Add providerName property to MistralHandler class
  • Wrap createMessage() client.chat.stream() call in try/catch with telemetry capture
  • Add telemetry capture in completePrompt() catch block
  • Add tests to verify telemetry is called on error for both methods

Related

Follows the pattern established in PR #10073 for OpenRouter provider.

Testing

  • All 19 tests in mistral.spec.ts pass
  • Added 2 new tests specifically for telemetry error capture:
    • should capture telemetry exception on createMessage error
    • should capture telemetry exception on completePrompt error

Important

Add telemetry error capture to Mistral provider's createMessage and completePrompt methods with tests for error handling.

  • Behavior:
    • Add telemetry error capture in createMessage() and completePrompt() methods in mistral.ts using TelemetryService.
    • Wrap client.chat.stream() and client.chat.complete() calls in try/catch blocks to capture exceptions.
  • Imports:
    • Import TelemetryService from @roo-code/telemetry.
    • Import ApiProviderError from @roo-code/types.
  • Tests:
    • Add tests in mistral.spec.ts to verify telemetry is called on errors in createMessage and completePrompt methods.
    • Add mock for TelemetryService to capture exceptions in tests.

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

- Import TelemetryService and ApiProviderError
- Add providerName property to MistralHandler class
- Wrap createMessage() client.chat.stream() call in try/catch with telemetry capture
- Add telemetry capture in completePrompt() catch block
- Add tests to verify telemetry is called on error for both methods

Follows the pattern established in PR #10073 for OpenRouter provider.
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 15, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 15, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly adds telemetry error capture to the Mistral provider, following the pattern established in PR #10073 for OpenRouter. The changes are well-tested with comprehensive coverage for both createMessage and completePrompt error scenarios.

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 15, 2025
@daniel-lxs
Copy link
Member Author

Closing - changes will be added to PR #10059 instead

@daniel-lxs daniel-lxs closed this Dec 15, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 15, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Dec 15, 2025
const errorMessage = error instanceof Error ? error.message : String(error)
const apiError = new ApiProviderError(errorMessage, this.providerName, model, "createMessage")
TelemetryService.instance.captureException(apiError)
throw new Error(`Mistral completion error: ${errorMessage}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider preserving the original error’s stack trace by attaching the caught error as a cause when rethrowing (e.g. using the { cause: error } option) to provide better debugging context.

Suggested change
throw new Error(`Mistral completion error: ${errorMessage}`)
throw new Error(`Mistral completion error: ${errorMessage}`, { cause: error })

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

Labels

Enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants