Repository navigation
fix(github): load issue details and mutations from the selected issue source - #24379
Katsuma-Takehisa wants to merge 2 commits into
Conversation
🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (13)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughIssue detail reads, issue updates, and issue comments now resolve the GitHub repository using the configured issue source preference. An explicit repository override remains in effect for comments. Runtime and IPC routes pass the preference to issue mutations, while pull request comments omit it. Tests cover origin selection, default upstream selection, repository overrides, and comment type routing. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Issue details, edits, and comments now follow the selected Upstream or Origin source, and the default upstream-first behavior is unchanged. No merge-blocking risk was found. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Data-routing fix so the issue-source selector (origin / upstream / auto) governs issue details reads and issue mutations, not just list/open.
- Issue details follow the selector —
getWorkItemDetailsresolves the issue's body/comments/assignees/timeline repo throughresolveIssueGitHubApiRepositorySource(preference)instead of the upstream-firstgetIssueGitHubApiRepository, matching whatgetWorkItemalready used. - Issue mutations follow the selector —
addIssueComment/updateIssuetake a trailing optionalpreferenceand resolve through the same resolver; an explicitownerRepoOverride(prRepo) onaddIssueCommentstill wins. - IPC + runtime threading —
gh:updateIssue/gh:addIssueCommentand the runtimeupdateRepoIssue/addRepoIssueCommentforwardrepo.issueSourcePreference;addRepoIssueCommentgains an optionaltypeand skips preference fortype: 'pr'so PR comments keep their own resolution. - RPC + renderer
typeforwarding —github.addIssueCommentforwardsparams.typewhen set, and the renderer runtime path now sendstype; the local IPC path already did.
What I verified
- The two new suites are genuine: reverted
work-item-details.ts,issue-update.ts,issue-comment.tsto base744e772locally and both fail there (details assertsowner=upstream-owner; the mutation suite gets{ ok: false }and the resolver is never called). Restored afterward. - Ran the targeted suites plus all of
src/main/github(775 tests) — all pass. - Consistency across a selector toggle holds: the details cache key includes
issueSourcePreference, andsetIssueSourcePreferenceevicts the repo'sworkItemsCacheentries and bumps the invalidation nonce, so both list and dialog refetch. - Fail-closed is preserved: explicit
originwith no resolvable origin makesgetWorkItemreturn null (issue branch), sogetWorkItemDetailsreturns null and mutations return "Could not resolve GitHub owner/repo…" rather than falling back to ambientgh. - Remote wire compatibility is safe:
typealready existed on theIssueCommentschema, the added field is optional, and the host owns the preference resolution, so both skew directions behave as before — no opcode or capability negotiation needed.
The remaining asymmetry — getIssue (linked-issue lookups by worktree-persisted number) stays on the heuristic while mutations now follow the selector — is called out in the PR description and needs the number's own repo identity; I found no mutation affordance on that read-only surface.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Keeps a fork issue’s details, metadata and edits bound to the repository the user opened, including same-number issues in fork and upstream. Repairs selected-assignee leakage and delayed failed edits repainting another issue. Fixes #24378 Incorporates and cross-reviews contributor PR #24379, including its source-resolver correction and regression material. Covers the contributor PR’s Project-row identity and retained-dialog mutation findings. The final published head passes focused tests, hidden macOS rendering and current CI; the callback-timing bot thread has an evidence-based response. Co-authored-by: Katsuma Takehisa <[email protected]>
|
Superseded by merged #24729 ( The final review compared this PR at
The merged implementation has the source/mounted controls, hidden macOS before/after proof and current green CI recorded in #24729. Closing this duplicate after the credited implementation has merged. The original branch is retained. |

ELI5
On a fork, the Tasks page lets you pick whether issues come from Upstream or Origin. When you pick Origin and open issue #N, Orca showed origin's title but loaded the comments and assignees from upstream's #N — and any comment you wrote went to upstream's #N too. This makes the issue dialog read and write the same repo the selector points at.
What Changed
Before: with Origin selected, opening origin#N showed origin#N's title with upstream#N's body, comments, assignees and timeline. Commenting, editing the body/title/labels/assignees or closing from Orca wrote to upstream#N.
After: details, comments and edits for an issue all target the repo the issue source selector resolves to (origin, upstream, or the existing upstream-first default when nothing is picked). PR comments are unchanged.
Mechanism:
getWorkItemDetailsalready fetched the item withgetWorkItem(..., preference), but then loaded the issue's body/comments/assignees/participants viagetIssueGitHubApiRepository()(upstream-first, preference-blind). It now usesresolveIssueGitHubApiRepositorySource(repoPath, preference, ...)— the same resolvergetWorkItemandlistWorkItemsuse — so both halves of the dialog come from one repo.updateIssueandaddIssueCommenttake an optional trailingpreferenceand resolve through the same resolver. An explicitownerRepoOverride(prRepo) onaddIssueCommentstill wins.gh:updateIssue/gh:addIssueCommentIPC and the runtimeupdateRepoIssue/addRepoIssueCommentcommands passrepo.issueSourcePreference. Comments withtype: 'pr'pass no preference, since the selector only scopes issues. Thegithub.addIssueCommentRPC forwardstypewhen set, and the renderer's runtime path now sends it.Not changed:
getIssue(linked-issue lookups by the number stored on a worktree) stays on the heuristic, because that number is persisted without a repo identity. That needs its own design.Why
getWorkItemwas already moved onto the selector ("open-by-number must share that preference so origin/upstream toggles cannot disagree"), but the details/mutation paths kept the older "mutations stay on the heuristic" rule. The result is the exact disagreement that comment warns about, inside a single dialog. Once the dialog's reads follow the selector, writes have to follow it too. Otherwise a reply typed under origin#N silently posts to upstream#N, which on a fork of a public repo means commenting on an unrelated upstream issue.The details cache is already keyed by
issueSourcePreference, so toggling the selector refetches the dialog. Reads and writes stay consistent across toggles.Alternative considered: deriving the target repo from each item's URL in the renderer and passing it as an override. That touches many renderer call sites (dialog, edit mutations, Status/Assignees cells) and duplicates the resolution the main process already owns, so I reused
resolveIssueGitHubApiRepositorySourceinstead.Linked Issue
Fixes #24378
Related: #8726
Visual Proof
Not attached. This is a main-process data-source fix with no layout change. Before: origin title + upstream comments/assignees. After: origin title + origin comments/assignees. I have not yet captured a before/after recording in a running build (see Testing).
Testing
New
src/main/github/work-item-details-issue-source.test.ts: withorigin= fork andupstream= parent,getWorkItemDetails(..., 'origin')must query GraphQL/timeline for the fork. It fails onmain(owner=upstream-owner) and passes with this change. A second case pins the upstream-first default when no preference is set.New
src/main/github/issue-mutation-source.test.ts:addIssueComment/updateIssuewith'origin'hit the fork (REST comment endpoint, PATCH,gh issue edit --repo fork/...); an explicit owner/repo override still wins; no preference keeps the default.src/main/ipc/github-issue-source-preference.test.ts: IPC passes'origin'toupdateIssue/addIssueCommentfor issues and no preference fortype: 'pr'comments.Updated exact-argument expectations in
github-wsl-runtime-routing.test.ts,hooks-and-hosted-review.spec.ts, andrpc/methods/github.test.ts.Ran on Linux (WSL):
vitestoversrc/main/github,src/main/ipc,src/main/runtime,src/renderer/src/components/github,src/renderer/src/web: 15,704 passed. The only failures are two real-PTY integration suites (orchestration-codex-real-pty,tui-idle-name-only-real-pty), which fail identically onmainin my environment becausepty.nodeis not built.tscfortsconfig.node.jsonandtsconfig.tc.web.jsonpasses;oxlint(both configs) andoxfmt --checkpass on changed files.Not yet exercised end to end in a running Orca build.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Investigation, fix, tests and this description were produced with Claude (claude-opus-5.5) via Kiro CLI, and reviewed by me.
Review
Self-review against the CONTRIBUTING checklist:
connectionIdandlocalGitOptionsare threaded unchanged into the same resolver used by list/open, so SSH and WSL projects resolve exactly aslistWorkItemsdoes. The runtime RPC path forwards the preference via the resolvedRepo.github.addIssueCommentRPC callsaddRepoIssueCommentwith the old 4-argument shape unlesstypeis sent.origin/upstreamremotes (or the existing explicit override). An explicit Origin pick with no resolvable origin fails closed ("Could not resolve GitHub owner/repo") instead of falling back to ambientgh.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Behavior change to call out: issue edits/comments now follow the selector. Previously they deliberately stayed on the heuristic (see the removed doc comments in
issue-update.ts/issue-comment.ts). That rule predatesgetWorkItemhonoring the selector and now produces split reads/writes within one dialog.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred). Ran typecheck, targeted lint/format and the affected test suites locally (see Testing); fullpnpm lint/pnpm buildleft to CI.