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]:
|
def worktree_for(binding_value: dict[str, Any]) -> dict[str, Any]:
|
||||||
location = binding_value["location"]
|
location = binding_value["location"]
|
||||||
environment = str(location["environment"])
|
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)
|
result = orca_json(["worktree", "list"], environment)
|
||||||
candidates = []
|
candidates = []
|
||||||
for item in result.get("worktrees", []):
|
for item in result.get("worktrees", []):
|
||||||
if not isinstance(item, dict):
|
if not isinstance(item, dict):
|
||||||
continue
|
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
|
continue
|
||||||
if str(item.get("path")) != str(location["path"]):
|
if str(item.get("path")) != str(location["path"]):
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user