mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-10 23:38:08 -05:00
Remove AuthenticationError handling from integration managers
The AuthenticationError exception occurs when we don't have access to a repo (e.g., user token lacks permissions, repo moved to different org). In this situation, we cannot reliably send a message back to the user because: 1. The error happens when trying to fetch issue/PR data using the user's token 2. Sending messages requires the GitHub App installation token for the repo 3. If we don't have access to the repo, the installation token likely won't work either (especially if repo moved to different org) 4. Setting a helpful message that we can't actually deliver is deceptive Instead, let AuthenticationError fall through to the generic exception handler, which will: - Log the full error with stack trace for debugging - Attempt to send the generic 'Uh oh!' error message (which may also fail) - At least be honest that we can't help the user in this scenario This reverts the AuthenticationError handling from GitHub, GitLab, and Slack integration managers. Addresses review feedback from @neubig on PR #11473.
This commit is contained in:
@@ -30,7 +30,6 @@ from server.utils.conversation_callback_utils import register_callback_processor
|
||||
|
||||
from openhands.core.logger import openhands_logger as logger
|
||||
from openhands.integrations.provider import ProviderToken, ProviderType
|
||||
from openhands.integrations.service_types import AuthenticationError
|
||||
from openhands.server.types import LLMAuthenticationError, MissingSettingsError
|
||||
from openhands.storage.data_models.secrets import Secrets
|
||||
from openhands.utils.async_utils import call_sync_from_async
|
||||
@@ -337,13 +336,6 @@ class GithubManager(Manager):
|
||||
|
||||
msg_info = f'@{user_info.username} please set a valid LLM API key in [OpenHands Cloud]({HOST_URL}) before starting a job.'
|
||||
|
||||
except AuthenticationError as e:
|
||||
logger.warning(
|
||||
f'[GitHub] Authentication error for user {user_info.username}: {str(e)}'
|
||||
)
|
||||
|
||||
msg_info = f'@{user_info.username} Authentication failure: The OpenHands app is not authenticated to do work on this repo. Please travel to [{HOST_URL}]({HOST_URL}) and add the repo. If you still encounter issues, contact support.'
|
||||
|
||||
msg = self.create_outgoing_message(msg_info)
|
||||
await self.send_message(msg, github_view)
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ from server.utils.conversation_callback_utils import register_callback_processor
|
||||
from openhands.core.logger import openhands_logger as logger
|
||||
from openhands.integrations.gitlab.gitlab_service import GitLabServiceImpl
|
||||
from openhands.integrations.provider import ProviderToken, ProviderType
|
||||
from openhands.integrations.service_types import AuthenticationError
|
||||
from openhands.server.types import LLMAuthenticationError, MissingSettingsError
|
||||
from openhands.storage.data_models.secrets import Secrets
|
||||
|
||||
@@ -250,13 +249,6 @@ class GitlabManager(Manager):
|
||||
|
||||
msg_info = f'@{user_info.username} please set a valid LLM API key in [OpenHands Cloud]({HOST_URL}) before starting a job.'
|
||||
|
||||
except AuthenticationError as e:
|
||||
logger.warning(
|
||||
f'[GitLab] Authentication error for user {user_info.username}: {str(e)}'
|
||||
)
|
||||
|
||||
msg_info = f'@{user_info.username} Authentication failure: The OpenHands app is not authenticated to do work on this repo. Please travel to [{HOST_URL}]({HOST_URL}) and add the repo. If you still encounter issues, contact support.'
|
||||
|
||||
# Send the acknowledgment message
|
||||
msg = self.create_outgoing_message(msg_info)
|
||||
await self.send_message(msg, gitlab_view)
|
||||
|
||||
@@ -27,7 +27,7 @@ from storage.slack_user import SlackUser
|
||||
|
||||
from openhands.core.logger import openhands_logger as logger
|
||||
from openhands.integrations.provider import ProviderHandler
|
||||
from openhands.integrations.service_types import AuthenticationError, Repository
|
||||
from openhands.integrations.service_types import Repository
|
||||
from openhands.server.shared import config, server_config
|
||||
from openhands.server.types import LLMAuthenticationError, MissingSettingsError
|
||||
from openhands.server.user_auth.user_auth import UserAuth
|
||||
@@ -352,13 +352,6 @@ class SlackManager(Manager):
|
||||
|
||||
msg_info = f'@{user_info.slack_display_name} please set a valid LLM API key in [OpenHands Cloud]({HOST_URL}) before starting a job.'
|
||||
|
||||
except AuthenticationError as e:
|
||||
logger.warning(
|
||||
f'[Slack] Authentication error for user {user_info.slack_display_name}: {str(e)}'
|
||||
)
|
||||
|
||||
msg_info = f'@{user_info.slack_display_name} Authentication failure: The OpenHands app is not authenticated to do work on this repo. Please travel to [{HOST_URL}]({HOST_URL}) and add the repo. If you still encounter issues, contact support.'
|
||||
|
||||
except StartingConvoException as e:
|
||||
msg_info = str(e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user