Skip to content

fix: treat HttpStatus.UNKNOWN as retryable#70

Merged
crleona merged 4 commits intomainfrom
cursor/issue-69-suggestion-cce7
Feb 17, 2026
Merged

fix: treat HttpStatus.UNKNOWN as retryable#70
crleona merged 4 commits intomainfrom
cursor/issue-69-suggestion-cce7

Conversation

@crleona
Copy link
Contributor

@crleona crleona commented Feb 9, 2026

Summary

Implements the suggestion from issue #69 to treat HttpStatus.UNKNOWN responses as retriable, similar to TIMEOUT and FAILED statuses. This enhances the SDK's resilience by preventing immediate event loss for unrecognized server responses.

  • ResponseProcessor now pushes events back to storage for retry on HttpStatus.UNKNOWN.
  • Updated test_worker.py to assert retry behavior for UNKNOWN responses.
  • Added a new unit test in test_processor.py to specifically cover UNKNOWN status retry logic.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

Open in Cursor Open in Web


Note

Low Risk
Small, localized change to retry classification plus test updates; primary risk is altered behavior for UNKNOWN responses potentially causing extra retries in edge cases.

Overview
ResponseProcessor.process_response now treats HttpStatus.UNKNOWN as a retryable response, pushing affected events back to storage instead of immediately invoking callbacks/logging an error.

Tests are updated/added to verify UNKNOWN responses increment event.retry, requeue events, and only trigger callbacks after a subsequent successful send; the worker multithreading test also replaces a busy-wait with a wait_for_workers_idle() helper to reduce flakiness.

Written by Cursor Bugbot for commit 2666568. This will update automatically on new commits. Configure here.

cursoragent and others added 2 commits February 9, 2026 23:46
Co-authored-by: Chris Leonavicius <crleona@gmail.com>
Co-authored-by: Chris Leonavicius <crleona@gmail.com>
@cursor
Copy link

cursor bot commented Feb 9, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@macroscopeapp
Copy link

macroscopeapp bot commented Feb 9, 2026

Route UNKNOWN HTTP responses to immediate retry in ResponseProcessor.process_response with push_to_storage(events, 0, res) per Issue 69 suggestion

Extend failure handling to treat HttpStatus.UNKNOWN like TIMEOUT and FAILED in processor.py; add unit tests covering unknown status retry in test_processor.py and worker behavior in test_worker.py.

📍Where to Start

Start with the conditional in ResponseProcessor.process_response in processor.py.


Macroscope summarized 62998b3. (Automatic summaries will resume when PR exits draft mode or review begins).

@crleona crleona changed the title Issue 69 suggestion fix: treat HttpStatus.UNKNOWN as retryable Feb 9, 2026
Co-authored-by: Chris Leonavicius <crleona@gmail.com>
@crleona crleona requested a review from Copilot February 13, 2026 23:41
@cursor cursor bot marked this pull request as ready for review February 13, 2026 23:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the SDK’s retry behavior so that HttpStatus.UNKNOWN (e.g., -1 / transient network failures) is treated as retryable, aligning it with TIMEOUT and FAILED handling to reduce event loss on ambiguous transport/server errors.

Changes:

  • Treat HttpStatus.UNKNOWN as retryable in ResponseProcessor.process_response.
  • Update worker tests to assert retry + eventual success flow for UNKNOWN responses.
  • Add a focused unit test ensuring UNKNOWN does not trigger callbacks and increments event.retry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/amplitude/processor.py Adds HttpStatus.UNKNOWN to the retryable status set.
src/test/test_worker.py Updates the unknown-status worker test to validate retry behavior; introduces a helper to wait for worker idleness in the multithreading test.
src/test/test_processor.py Adds a unit test for ResponseProcessor retry behavior on UNKNOWN.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@crleona
Copy link
Contributor Author

crleona commented Feb 13, 2026

bugbot run

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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Co-authored-by: Chris Leonavicius <crleona@gmail.com>
@crleona
Copy link
Contributor Author

crleona commented Feb 14, 2026

Bugbot run

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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Copy link
Contributor

@sojingle sojingle left a comment

Choose a reason for hiding this comment

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

LGTM!

@crleona crleona merged commit 3e1db08 into main Feb 17, 2026
13 of 14 checks passed
@crleona crleona deleted the cursor/issue-69-suggestion-cce7 branch February 17, 2026 17:14
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.

3 participants

Comments