fix(agent-runtime): resolve imported Orca worktrees
This commit is contained in:
@@ -259,12 +259,20 @@ def location_host(location: dict[str, Any]) -> str:
|
||||
def worktree_for(binding_value: dict[str, Any]) -> dict[str, Any]:
|
||||
location = binding_value["location"]
|
||||
environment = str(location["environment"])
|
||||
project_ids = {str(location["project"])}
|
||||
projects = orca_json(["project", "list"], environment).get("projects", [])
|
||||
for project in projects:
|
||||
if not isinstance(project, dict):
|
||||
continue
|
||||
if str(project.get("id")) == str(location["project"]) or str(project.get("displayName")) == str(location["project"]):
|
||||
project_ids.update(str(repo_id) for repo_id in project.get("sourceRepoIds", []) if repo_id)
|
||||
result = orca_json(["worktree", "list"], environment)
|
||||
candidates = []
|
||||
for item in result.get("worktrees", []):
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
if str(item.get("projectId")) != str(location["project"]):
|
||||
item_project_ids = {str(item.get("projectId")), str(item.get("repoId"))}
|
||||
if not project_ids.intersection(item_project_ids):
|
||||
continue
|
||||
if str(item.get("path")) != str(location["path"]):
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user