File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
src/codegen/extensions/langchain Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 1
1
"""Langchain tools for workspace operations."""
2
2
3
3
import json
4
+ import uuid
4
5
from typing import ClassVar , Literal , Optional
5
6
6
7
from langchain .tools import BaseTool
@@ -355,6 +356,9 @@ def __init__(self, codebase: Codebase) -> None:
355
356
super ().__init__ (codebase = codebase )
356
357
357
358
def _run (self , title : str , body : str ) -> str :
359
+ if self .codebase ._op .git_cli .active_branch .name == self .codebase ._op .default_branch :
360
+ # If the current checked out branch is the default branch, checkout onto a new branch
361
+ self .codebase .checkout (branch = f"{ uuid .uuid4 ()} " , create_if_missing = True )
358
362
pr = self .codebase .create_pr (title = title , body = body )
359
363
return pr .html_url
360
364
You can’t perform that action at this time.
0 commit comments