fix(hybrid): re-raise CancelledError in platform attempt walker - #511
Merged
Conversation
A disconnected caller raises asyncio.CancelledError, which derives from BaseException, so the broad catch meant to let non-Exception provider clients fall through to the next candidate instead classified the cancellation as an "unknown" upstream error, recorded an abandoned attempt against a provider that answered fine, and converted it into a provider-failure HTTP exception that suppressed the cancellation. Guard the broad catch with a re-raise, mirroring the standalone walker fix in #492. Add a unit test asserting the cancellation propagates and no abandoned-attempt row is recorded. Fixes #501
njbrake
temporarily deployed
to
integration-tests
August 5, 2026 21:20 — with
GitHub Actions
Inactive
Walkthrough
ChangesCancellation propagation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
njbrake
temporarily deployed
to
integration-tests
August 6, 2026 12:45 — with
GitHub Actions
Inactive
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
run_platform_attemptscatchesBaseExceptionaround each attempt so a provider client raising outside theExceptionhierarchy still falls through to the next candidate. That catch also swallowsasyncio.CancelledError, which a disconnected caller produces: it gets classified as anunknownupstream error, an abandoned attempt is recorded against a provider that answered fine, and it is raised as a provider-failure HTTP exception that suppresses the cancellation the server is waiting to unwind.This adds an
except asyncio.CancelledError: raiseguard ahead of the broad catch, mirroring the standalone walker fix from #492 (_attempts.py). A unit test asserts the cancellation propagates and no abandoned-attempt row is recorded.PR Type
Relevant issues
Fixes #501
Checklist
tests/unit,tests/integration).make lint,make typecheck,make test).uv run python scripts/generate_openapi.py).AI Usage
AI Model/Tool used: DeepSeek V4 Flash
Any additional AI details you'd like to share:
The fix and regression test mirror the standalone walker change in #492. Verified the new test fails without the guard and passes with it.
NOTE:
When responding to reviewer questions, please respond yourself rather than copy/pasting reviewer comments into an AI and pasting back its answer. We want to discuss with you, not your AI :)