From b0a9938e6c0b4a9beea3596b6ca4c9b18429ebbd Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Tue, 22 Apr 2025 13:43:20 -0400 Subject: [PATCH] Always run git init in SaaS mode regardless of workspace_base setting (#8014) Co-authored-by: openhands --- openhands/runtime/base.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/openhands/runtime/base.py b/openhands/runtime/base.py index 1ab43bf012..fb065647bd 100644 --- a/openhands/runtime/base.py +++ b/openhands/runtime/base.py @@ -317,18 +317,20 @@ class Runtime(FileEditRuntimeMixin): repository_provider: ProviderType = ProviderType.GITHUB, ) -> str: if not selected_repository: - if self.config.workspace_base: + # In SaaS mode (indicated by user_id being set), always run git init + # In OSS mode, only run git init if workspace_base is not set + if self.user_id or not self.config.workspace_base: + logger.debug( + 'No repository selected. Initializing a new git repository in the workspace.' + ) + action = CmdRunAction( + command='git init', + ) + self.run_action(action) + else: logger.info( 'In workspace mount mode, not initializing a new git repository.' ) - return '' - logger.debug( - 'No repository selected. Initializing a new git repository in the workspace.' - ) - action = CmdRunAction( - command='git init', - ) - self.run_action(action) return '' provider_domains = {