mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 12:43:16 +00:00
using sandbox api instead of failing
This commit is contained in:
parent
8ebc71266f
commit
8755933364
1 changed files with 15 additions and 1 deletions
|
|
@ -3,8 +3,10 @@ import logging
|
|||
from typing import Any
|
||||
|
||||
from langgraph.config import get_config
|
||||
from langgraph_sdk import get_client
|
||||
|
||||
from ..encryption import decrypt_token
|
||||
from ..server import _create_langsmith_sandbox
|
||||
from ..utils.github import (
|
||||
create_github_pr,
|
||||
get_github_default_branch,
|
||||
|
|
@ -21,6 +23,7 @@ from ..utils.github import (
|
|||
from ..utils.sandbox_state import SANDBOX_BACKENDS
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
client = get_client()
|
||||
|
||||
|
||||
def commit_and_open_pr(
|
||||
|
|
@ -128,7 +131,18 @@ def commit_and_open_pr(
|
|||
|
||||
sandbox_backend = SANDBOX_BACKENDS.get(thread_id)
|
||||
if not sandbox_backend:
|
||||
return {"success": False, "error": "Missing sandbox backend", "pr_url": None}
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
thread = loop.run_until_complete(client.threads.get(thread_id=thread_id))
|
||||
sandbox_id = thread.get("metadata", {}).get("sandbox_id")
|
||||
|
||||
if not sandbox_id:
|
||||
return {"success": False, "error": "No sandbox found for thread", "pr_url": None}
|
||||
|
||||
# Connect to existing sandbox
|
||||
sandbox_backend = _create_langsmith_sandbox(sandbox_id)
|
||||
SANDBOX_BACKENDS[thread_id] = sandbox_backend
|
||||
logger.info("Fetched sandbox %s for thread %s", sandbox_id, thread_id)
|
||||
|
||||
repo_dir = f"/workspace/{repo_name}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue