Fix linear-related mypy type errors and make Manager.start_job async (#13189)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Rohit Malhotra
2026-03-03 19:00:53 -05:00
committed by GitHub
parent 0ae9128ed7
commit 222e8bd03d
9 changed files with 20 additions and 7 deletions

View File

@@ -318,7 +318,7 @@ class GithubManager(Manager[GithubViewType]):
logger.warning('Unsupported location')
return
async def start_job(self, github_view: GithubViewType):
async def start_job(self, github_view: GithubViewType) -> None:
"""Kick off a job with openhands agent.
1. Get user credential

View File

@@ -170,7 +170,7 @@ class GitlabManager(Manager[GitlabViewType]):
f'[GitLab] Unsupported view type: {type(gitlab_view).__name__}'
)
async def start_job(self, gitlab_view: GitlabViewType):
async def start_job(self, gitlab_view: GitlabViewType) -> None:
"""
Start a job for the GitLab view.

View File

@@ -257,7 +257,7 @@ class JiraManager(Manager[JiraViewInterface]):
return jira_user, saas_user_auth
async def start_job(self, view: JiraViewInterface):
async def start_job(self, view: JiraViewInterface) -> None:
"""Start a Jira job/conversation."""
# Import here to prevent circular import
from server.conversation_callback_processor.jira_callback_processor import (

View File

@@ -353,7 +353,7 @@ class JiraDcManager(Manager[JiraDcViewInterface]):
logger.error(f'[Jira DC] Error in is_job_requested: {str(e)}')
return False
async def start_job(self, jira_dc_view: JiraDcViewInterface):
async def start_job(self, jira_dc_view: JiraDcViewInterface) -> None:
"""Start a Jira DC job/conversation."""
# Import here to prevent circular import
from server.conversation_callback_processor.jira_dc_callback_processor import (

View File

@@ -343,7 +343,7 @@ class LinearManager(Manager[LinearViewInterface]):
logger.error(f'[Linear] Error in is_job_requested: {str(e)}')
return False
async def start_job(self, linear_view: LinearViewInterface):
async def start_job(self, linear_view: LinearViewInterface) -> None:
"""Start a Linear job/conversation."""
# Import here to prevent circular import
from server.conversation_callback_processor.linear_callback_processor import (

View File

@@ -152,6 +152,9 @@ class LinearExistingConversationView(LinearViewInterface):
self.conversation_id, conversation_init_data, user_id
)
if agent_loop_info.event_store is None:
raise StartingConvoException('Event store not available')
final_agent_observation = get_final_agent_observation(
agent_loop_info.event_store
)

View File

@@ -25,7 +25,7 @@ class Manager(ABC, Generic[ViewT]):
raise NotImplementedError
@abstractmethod
def start_job(self, view: ViewT) -> None:
async def start_job(self, view: ViewT) -> None:
"""Kick off a job with openhands agent.
Args:

View File

@@ -303,7 +303,7 @@ class SlackManager(Manager[SlackViewInterface]):
return True
async def start_job(self, slack_view: SlackViewInterface):
async def start_job(self, slack_view: SlackViewInterface) -> None:
# Importing here prevents circular import
from server.conversation_callback_processor.slack_callback_processor import (
SlackCallbackProcessor,

View File

@@ -523,6 +523,11 @@ async def get_current_workspace_link(request: Request):
try:
user_auth = cast(SaasUserAuth, await get_user_auth(request))
user_id = await user_auth.get_user_id()
if not user_id:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail='User not authenticated',
)
user = await linear_manager.integration_store.get_user_by_active_workspace(
user_id
@@ -576,6 +581,11 @@ async def unlink_workspace(request: Request):
try:
user_auth = cast(SaasUserAuth, await get_user_auth(request))
user_id = await user_auth.get_user_id()
if not user_id:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail='User not authenticated',
)
user = await linear_manager.integration_store.get_user_by_active_workspace(
user_id