fix(agent-runtime): resolve imported Orca worktrees

This commit is contained in:
2026-10-12 13:32:35 +08:00
parent 299f6dd9b2
commit de194370e6
+9 -1
View File
@@ -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