Repository navigation
fix(secrets): return 404 when the user has no token for the requested provider - #1563
Draft
dylan-openhands wants to merge 1 commit into
Draft
dylan-openhands wants to merge 1 commit into
dylan-openhands wants to merge 1 commit into
Conversation
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
This branch has not been deployed
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.
HUMAN:
AGENT:
Why
When a sandbox asks
GET /api/v1/webhooks/secretsfor a provider token the user never connected,get_latest_tokenhitsself.provider_tokens[provider]inProviderHandler.get_serviceand raisesKeyError, so the endpoint returns 500 instead of its existing404 No such provider. In prod on 1.99.0 that's ~1,100KeyError: ProviderType.BITBUCKET500s in 5 hours, from agent-servers retrying the lookup. They keep the SaaS 5xx monitor in alert.Summary
AuthUserContext.get_latest_tokenreturnsNonewhen the provider type has no token, which matches itsstr | Nonesignature.get_secretthen returns 404.Issue Number
N/A
How to Test
pytest tests/unit/test_auth_user_context.py -k unconnected: fails with the prodKeyErrorbefore the change and passes after it.Video/Screenshots
N/A
Type
Notes
The guard goes in
get_latest_token, notget_service. Every other caller already treatsNoneas "no token", and the org secret path already checksprovider_type in provider_tokensbefore calling it.Enterprise server image for this PR: