mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-01 12:03:14 +00:00
19 lines
577 B
Python
19 lines
577 B
Python
|
|
from typing import Any
|
||
|
|
|
||
|
|
from langgraph.config import get_config
|
||
|
|
|
||
|
|
|
||
|
|
def get_branch_name() -> dict[str, Any]:
|
||
|
|
"""Return the git branch name for this thread.
|
||
|
|
|
||
|
|
Returns the branch_name from thread metadata if set,
|
||
|
|
otherwise falls back to open-swe/{thread_id}.
|
||
|
|
"""
|
||
|
|
config = get_config()
|
||
|
|
metadata = config.get("metadata", {})
|
||
|
|
branch_name = metadata.get("branch_name")
|
||
|
|
if not branch_name:
|
||
|
|
thread_id = config.get("configurable", {}).get("thread_id", "unknown")
|
||
|
|
branch_name = f"open-swe/{thread_id}"
|
||
|
|
return {"branch_name": branch_name}
|