Skip to content

fix(tasks): GitLab items and project-view dialogs act on the twin host that returned them - #31271

Merged
nwparker merged 1 commit into
mainfrom
nwparker/twin-work-item-owner
Oct 20, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/twin-work-item-owner

Conversation

@nwparker

@nwparker nwparker commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​126 $\color{#cf222e}{\Huge{\mathbf{−}}}$​31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​95
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61 $\color{#cf222e}{\Huge{\mathbf{−}}}$​49 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12

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

  • Before: with a twin project, a GitLab item's "Create workspace", detail page and dialog rebuilt the project with repoMap.get(item.repoId) / selectedRepos.find(id), which returns whichever copy is listed last/first. The GitHub Projects board dialog did the same with repos.find(id), so its edits could route to the wrong machine.
  • After: GitLab task items are stamped with the host of the row that fetched them (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-only getGitHubWorkItemRepo, 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.
  • GitLab list rows are keyed by host too, so the two twins' copies of one MR are separate rows.

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: repoHostId is an optional renderer-only field on GitLabWorkItem; 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

  • I manually tested these changes locally
  • Automated tests added/updated

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

  • Not applicable.

Notes

Not covered here (separate PRs): main-side validateRegisteredRepo id-only lookup, and work-item cache keys ignoring connectionId. The composer's eligibleRepos.find(id) fallback in github-provider-selection.ts / gitlab-provider-selection.ts only runs when no repo is selected and is left as is.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A visual proof with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Lint, typecheck and focused tests pass locally

…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.
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d8a6f246-accb-4d09-acb3-513d3907606f
📥 Commits

Reviewing files that changed from the base of the PR and between 6d7e542 and 199eb78.

📒 Files selected for processing: 16
  • src/renderer/src/components/github-project/project-dialog-state.test.ts
  • src/renderer/src/components/github-project/project-dialog-state.ts
  • src/renderer/src/components/github-project/project-view-wrapper-source-context-boundary.test.ts
  • src/renderer/src/components/github-project/project-work-item.ts
  • src/renderer/src/components/github-project/useProjectRowActions.ts
  • src/renderer/src/components/task-page/github/Rows.tsx
  • src/renderer/src/components/task-page/gitlab/ItemList.tsx
  • src/renderer/src/components/use-task-page-github-detail.ts
  • src/renderer/src/components/use-task-page-github-list-projection.ts
  • src/renderer/src/components/use-task-page-gitlab-loading.test.tsx
  • src/renderer/src/components/use-task-page-gitlab-loading.ts
  • src/renderer/src/components/use-task-page-workspace-actions-twin-host.test.tsx
  • src/renderer/src/components/use-task-page-workspace-actions.ts
  • src/renderer/src/lib/work-item-repo-row.test.ts
  • src/renderer/src/lib/work-item-repo-row.ts
  • src/shared/gitlab-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The change adds repoHostId to GitLab work items and uses shared host-aware repository resolution across task-page and workspace flows. GitLab fetch results retain repository objects. GitHub project dialog state now returns the resolved repository, and project work items carry its execution-host ID.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 199eb

This change makes GitLab items and Project-view dialogs act on the host that returned them when the same project exists on several hosts. The reported unit tests cover the changed paths. I found no actionable merge-blocking risk. A live twin-host setup was not exercised.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description covers the change, rationale, testing, visual proof, scope, and checklist. However, the required Linked Issue section does not provide an actual linked issue and explicitly states "No … Add an actual linked issue in the Linked Issue section, such as a GitHub issue URL or a valid Fixes #<issue-number> reference. If this is an internal maintainer change, attach a pre-existing issue as required by the template.
Docstring Coverage Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 16 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: routing GitLab items and project-view dialogs to the twin host that returned them.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description covers the change, rationale, testing, visual proof, scope, and checklist. However, the required Linked Issue section does not provide an actual linked issue and explicitly states "No issue," which conflicts with the repository template.

Resolution

Add an actual linked issue in the Linked Issue section, such as a GitHub issue URL or a valid Fixes #&lt;issue-number&gt; reference. If this is an internal maintainer change, attach a pre-existing issue as required by the template.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit ae58ca0 into main Oct 20, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant