From de194370e61afa668d8067e06d848a03331fdf66 Mon Sep 17 00:00:00 2001 From: laily Date: Mon, 12 Oct 2026 13:32:35 +0800 Subject: [PATCH] fix(agent-runtime): resolve imported Orca worktrees --- skills/agent-runtime/scripts/agent.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/skills/agent-runtime/scripts/agent.py b/skills/agent-runtime/scripts/agent.py index 2e54b39..7f7cf37 100755 --- a/skills/agent-runtime/scripts/agent.py +++ b/skills/agent-runtime/scripts/agent.py @@ -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