Skip to content

feat: add resilient error handling to analyze_issue_with_seer tool #368

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
merged 3 commits into from
Jul 9, 2025

Conversation

dcramer
Copy link
Member

@dcramer dcramer commented Jul 9, 2025

  • Implement retry logic with exponential backoff for API calls
  • Add proper error recovery during polling with up to 3 consecutive failures allowed
  • Move retryWithBackoff utility to internal/fetch-utils for broader reuse
  • Add comprehensive test coverage for error scenarios including network failures, 500 errors, and timeouts
  • Prevent infinite polling by enforcing existing 5-minute timeout and error limits

This ensures the Seer analysis tool gracefully handles transient API failures and network issues without getting stuck in infinite loops.

🤖 Generated with Claude Code

- Implement retry logic with exponential backoff for API calls
- Add proper error recovery during polling with up to 3 consecutive failures allowed
- Move retryWithBackoff utility to internal/fetch-utils for broader reuse
- Add comprehensive test coverage for error scenarios including network failures, 500 errors, and timeouts
- Prevent infinite polling by enforcing existing 5-minute timeout and error limits

This ensures the Seer analysis tool gracefully handles transient API failures and network issues
without getting stuck in infinite loops.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
cursor[bot]

This comment was marked as outdated.

dcramer and others added 2 commits July 9, 2025 13:28
- Apply consistent retry parameters (maxRetries, initialDelay) to all getAutofixState API calls
- Ensures uniform error handling behavior throughout the polling process
- Addresses review feedback about inconsistent retry configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add catch handler to prevent unhandled promise rejection warning
- Fixes Vitest warning about unhandled errors during test run
- Tests now pass cleanly without any warnings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

codecov bot commented Jul 9, 2025

Codecov Report

Attention: Patch coverage is 92.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 62.40%. Comparing base (5cf76f4) to head (0d66255).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...es/mcp-server/src/tools/analyze-issue-with-seer.ts 88.88% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #368      +/-   ##
==========================================
+ Coverage   60.19%   62.40%   +2.20%     
==========================================
  Files          77       77              
  Lines        6730     6817      +87     
  Branches      539      598      +59     
==========================================
+ Hits         4051     4254     +203     
+ Misses       2679     2563     -116     
Flag Coverage Δ
unittests 62.40% <92.00%> (+2.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: API Autofix Startup Fails Without Retry

The startAutofix API call lacks retryWithBackoff logic, unlike the getAutofixState calls in the same function. This inconsistency causes immediate failure on transient network errors or 5xx responses during analysis startup, while status polling gracefully handles such errors with retries.

packages/mcp-server/src/tools/analyze-issue-with-seer.ts#L118-L123

output += `Starting new analysis...\n\n`;
const startResult = await apiService.startAutofix({
organizationSlug: orgSlug,
issueId: parsedIssueId,
instruction: params.instruction,
});

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@dcramer dcramer merged commit cde70e1 into main Jul 9, 2025
13 checks passed
@dcramer dcramer deleted the improve-seer-error-handling branch July 9, 2025 20:58
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.

1 participant