Repository navigation
fix(tasks): GitLab items and project-view dialogs act on the twin host that returned them - #31271
Conversation
…t that returned them GitLab task items now carry the host of the repo row that fetched them, and the project-view dialog stamps the row its slug matched. Both resolve through one provider-neutral helper (getWorkItemRepo, generalized from #31252's GitHub-only getGitHubWorkItemRepo), so a repo id published by two hosts never routes an action to the other host's row.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
ELI5
Orca can show the same project twice when it lives on two machines (for example on this laptop and on an SSH box). Those two copies share one project id. When you clicked a GitLab merge request or issue, or an item in a GitHub Project board, Orca looked the project up by id alone and could pick the other machine's copy. Now each item remembers which machine's copy fetched it, and every action goes back to that copy.
What Changed
repoMap.get(item.repoId)/selectedRepos.find(id), which returns whichever copy is listed last/first. The GitHub Projects board dialog did the same withrepos.find(id), so its edits could route to the wrong machine.repoHostId, renderer-only, optional), and the Project-board dialog stamps the row its repository slug matched. Both resolve through one provider-neutral helper,getWorkItemRepo(generalized from fix(github): a twin project's PR cards, rows and dialogs act on the host that returned the item #31252's GitHub-onlygetGitHubWorkItemRepo, which it replaces). If the stamped host's row disappears while its twin stays, the Project dialog closes instead of falling back to the twin.Why
#31252 already fixed GitHub task items this way (stamp at fetch, one lookup). Reusing and generalizing that helper keeps one "item to owning repo row" rule for every provider instead of per-provider copies. Alternatives considered: re-deriving the host from the selected-repo list at click time (still ambiguous for twins), or keying everything by path (twins can share a path).
No wire change:
repoHostIdis an optional renderer-only field onGitLabWorkItem; main and remote hosts never see it.Linked Issue
Follow-up to #31252 (twin-project class). No issue.
Visual Proof
N/A: routing-only change, no visual difference.
Testing
Tests that fail on main and pass here:
use-task-page-gitlab-loading.test.tsx: each twin's GitLab items carry the host that returned them.use-task-page-workspace-actions-twin-host.test.tsx: "Create workspace" on a GitLab MR from a twin opens the composer for the host that returned it.project-dialog-state.test.ts: the Project dialog resolves the slug-matched twin regardless of list order, and closes when that row leaves while its twin stays.project-view-wrapper-source-context-boundary.test.ts: project work items carry the matched row's host.Ran the task-page, github-project and helper test folders (82 files) single-worker,
pnpm tc, and the full static job locally. Verified in unit tests only; no live twin setup was exercised.Review
Codex (gpt-6.1-sol, high): no findings. Independent Opus review: see thread.
Agent skill upstream boundary
Notes
Not covered here (separate PRs): main-side
validateRegisteredRepoid-only lookup, and work-item cache keys ignoringconnectionId. The composer'seligibleRepos.find(id)fallback ingithub-provider-selection.ts/gitlab-provider-selection.tsonly runs when no repo is selected and is left as is.Checklist