fix: update openhands local runtime to handle provider tokens correctly (#9915)

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
greese-insight
2025-07-31 15:21:33 -04:00
committed by GitHub
parent b9abdf10ce
commit d88e68eb49
2 changed files with 46 additions and 14 deletions

View File

@@ -24,6 +24,7 @@ from openhands.core.setup import (
create_memory,
create_runtime,
generate_sid,
get_provider_tokens,
initialize_repository_for_runtime,
)
from openhands.events import EventSource, EventStreamSubscriber
@@ -103,11 +104,14 @@ async def run_controller(
# when the runtime is created, it will be connected and clone the selected repository
repo_directory = None
if runtime is None:
# In itialize repository if needed
repo_tokens = get_provider_tokens()
runtime = create_runtime(
config,
sid=sid,
headless_mode=headless_mode,
agent=agent,
git_provider_tokens=repo_tokens,
)
# Connect to the runtime
call_async_from_sync(runtime.connect)
@@ -116,6 +120,7 @@ async def run_controller(
if config.sandbox.selected_repo:
repo_directory = initialize_repository_for_runtime(
runtime,
immutable_provider_tokens=repo_tokens,
selected_repository=config.sandbox.selected_repo,
)