Fix: Reduce log noise for optional org-level .openhands repositories (#12456)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Graham Neubig
2026-01-15 18:27:34 -05:00
committed by GitHub
parent 6e4ac8e2ce
commit f5315887ec
6 changed files with 26 additions and 8 deletions

View File

@@ -465,7 +465,9 @@ async def _get_org_repository_url(
Authenticated Git URL if successful, None otherwise
"""
try:
remote_url = await user_context.get_authenticated_git_url(org_openhands_repo)
remote_url = await user_context.get_authenticated_git_url(
org_openhands_repo, is_optional=True
)
return remote_url
except AuthenticationError as e:
_logger.debug(

View File

@@ -63,9 +63,13 @@ class AuthUserContext(UserContext):
self._provider_handler = provider_handler
return provider_handler
async def get_authenticated_git_url(self, repository: str) -> str:
async def get_authenticated_git_url(
self, repository: str, is_optional: bool = False
) -> str:
provider_handler = await self.get_provider_handler()
url = await provider_handler.get_authenticated_git_url(repository)
url = await provider_handler.get_authenticated_git_url(
repository, is_optional=is_optional
)
return url
async def get_latest_token(self, provider_type: ProviderType) -> str | None:

View File

@@ -21,7 +21,9 @@ class SpecifyUserContext(UserContext):
async def get_user_info(self) -> UserInfo:
raise NotImplementedError()
async def get_authenticated_git_url(self, repository: str) -> str:
async def get_authenticated_git_url(
self, repository: str, is_optional: bool = False
) -> str:
raise NotImplementedError()
async def get_provider_tokens(self) -> PROVIDER_TOKEN_TYPE | None:

View File

@@ -23,8 +23,16 @@ class UserContext(ABC):
"""Get the user info."""
@abstractmethod
async def get_authenticated_git_url(self, repository: str) -> str:
"""Get the provider tokens for the user"""
async def get_authenticated_git_url(
self, repository: str, is_optional: bool = False
) -> str:
"""Get an authenticated git URL for a repository.
Args:
repository: Repository name (owner/repo)
is_optional: If True, logs at debug level instead of error level
when repository is not found. Use for optional repositories.
"""
@abstractmethod
async def get_provider_tokens(self) -> PROVIDER_TOKEN_TYPE | None: