Skip to content

Keep fork issue details and edits in the selected repository - #24729

Merged
nwparker merged 10 commits into
mainfrom
nwparker/sweep-24378-fork-issue-target
Oct 4, 2026
Merged

nwparker merged 10 commits into
mainfrom
nwparker/sweep-24378-fork-issue-target

Conversation

@nwparker

@nwparker nwparker commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2313 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2295
Prod 35 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​732 $\color{#cf222e}{\Huge{\mathbf{−}}}$​354 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​378

ELI5

Choosing Origin should open and edit the fork's issue, even when upstream has a different issue with the same number. An open conversation keeps that identity when the selector changes.

What Changed

Before: Origin #12 could show upstream's body, comments and assignee, and saving its description wrote to upstream #12. After: details and edits use the clicked repository. Changing the selector also keeps an open issue's picker choices and edits separate from the other repository's same-number list row.

A follow-up rendered check found that an edited assignee could remain selected after switching from upstream to the fork's same-number issue. A delayed failed edit could also restore the previous issue's assignees into the issue now open. The editor's local state now belongs to the opened repository's canonical host/owner/name and item type. Switching items replaces that local editor, so an earlier assignee edit cannot appear on the new issue. Mounted-lifetime checks also prevent a delayed failed label or status edit from changing the issue now open. The original repository's cache and Project-row rollback still run against their captured identities.

Issue reads and edits reuse the existing source resolver. The initial lookup carries its repository into conversation loading, explicit targets capture their host before fetching, and local dialogs retain that identity through reads, writes and cache selection. PR assignee changes carry the opened PR's repository too. Metadata requests keep the registered native/WSL execution route and add the opened repository; existing metadata and confirmed-state stores now distinguish repository identities. Two existing stores were moved into named modules to stay within the file-length gate, preserving one store for each purpose.

Why

Passing the identity already selected by the user keeps the list, conversation and write target consistent. Reusing the resolver and stores avoids a second selection rule or a separate cache authority; invalidating only on selector changes would still allow a retained conversation to target or patch the other repository.

Adapted relevant fix and regression material from active contributor PR #24379, then addressed the selector changes and independent review findings. Real contributor commit metadata supplies the preserved Co-authored-by credit: Katsuma Takehisa k.takehisa@nissogr.com. Its original commit IDs are not literal ancestors of this branch, and its PR and branch remain unchanged.

Linked Issue

Fixes #24378

Visual Proof

Fresh follow-up at parent d56ae9c and repaired 23d82d3: after an upstream assignee edit, reopening the fork's issue5 returned empty assignees from the actual issue-details handler but retained the upstream user on screen. The final source-bound hidden macOS Electron flow now shows the fork unassigned and restores upstream's own selected assignee when returning. Both captures use the same viewport and controlled provider contents. They use a fail-closed local forge executable; no live provider item was edited.

Before: fork retains upstream assignee After: fork shows its own empty assignees
Fork issue with leaked upstream assignee Fork issue correctly unassigned

Earlier source-linked proof follows with its original limits.

Hidden Electron/CDP on macOS with disposable profiles/repositories and a fake GitHub CLI; no real provider item was edited. Screenshots are attachments outside this PR's source changes.

Original issue: before Original issue: after
Origin issue showing upstream content Origin issue showing fork content

Captured description saves changed from PATCH repos/upstream-owner/widgets/issues/12 to PATCH repos/fork-owner/widgets/issues/12. Explicit dialog replies already targeted the fork at the reproduced baseline; that part of the report was not reproduced.

Retained fork edit: upstream row before/after

Before After
Before After

Opening upstream after Origin: picker before/after

Before After
Before After

Prior PR-panel control, seeded canonical details: add assignee before/after

Before After
Before After

Prior PR-panel control, seeded canonical details: remove assignee before/after

Before After
Before After

Fresh checks at the tested commit used real list/detail routing without seeding details. Closing the retained fork issue previously marked the upstream row Closed and patched its labels; after the fix it remains Open with its own labels. Opening upstream next previously reused fork picker choices; after the fix it fetches upstream choices. The reverse Upstream→Origin control also kept fork state/labels unchanged. Compiled main/preload hashes, source maps and native hidden/unfocused checks bind these runs to the recorded source.

A prior repair run separately checked PR assignee add/remove in both opposite-preference directions through the actual control, preload and main path. That panel proof seeded canonical PR details to isolate an existing full PR-page lookup gap; it verifies assignee targeting, not the unseeded page lookup. A host-less actual issue lookup also retained the original public title/body/comment/assignee and all three request hosts when the fixture changed Git remotes to an Enterprise host mid-response.

Testing

Follow-up published commit 23d82d3ac64cf0f9989836456440c1107eb812ca: 126 focused tests pass, including14 mounted lifecycle cases. The identical14 cases against the original parent runtime produce10 failures and4 passing controls. The final source passes Node/CLI/web typechecks, default/React Doctor/anti-slop lint, formatting, whitespace and every changed-code-quality scan across the four changed files. The editor props were moved verbatim into the existing types module to meet the file-size gate. Existing metadata probes now render the component instead of calling it as a plain function; all original repository/host assertions are unchanged.

A freshly built hidden Electron43.7.5 flow passes without retries through the actual renderer, preload, IPC, main handlers and owned offline forge executable. It holds and releases old fork metadata, checks repository-scoped label/assignee/body commands after preference changes, reopens the fork with no selected upstream user, and returns to upstream with its own assignee. Those native build input bytes exactly match the four published Git blobs. All owned app/daemon processes exited and the private profile was removed. Late label/status failure is proved by the mounted controls, not by that native screenshot flow.

The independent reviewer accepted the same committed tree 4d21ad69140238d94d8a043f4c89411e4faaef78. Its unchanged private parent-state controls reproduce two failures before the repair and pass4/4 afterward. They run the actual editor, mutation hook and state-authority registry with a modeled React parent, rather than the entire dialog tree. Live GitHub/GitLab writes and native Windows/Linux apps were not exercised. Current published-head CI is complete and green: PR Checks, CI and persistence. All five unit-test shards, typechecks, static analysis, Linux/Windows packaging and the selected Windows x64/ARM and Linux persistence jobs passed. Workflow-skipped rendered/native jobs are not claimed as feature proof; the separate hidden macOS flow is described above. The verified CI checkout f64081f includes both newly merged main and this feature head, with all four follow-up source blobs unchanged. Earlier CI below remains historical.

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

Original reproduction before product changes:

ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/github/work-item-details-issue-source.test.ts

Result: 1 failed / 1 passed, expected 'owner=upstream-owner' to be 'owner=fork-owner'.

Subsequent regressions use actual lookup/cache/state/metadata/mutation code with controlled provider responses. The config-change cases use a real disposable Git repository. Exact saved pre-repair production blobs fail the final permanent focused fixtures with 14 failures / 26 passing controls; the repaired fixtures pass, including both repository directions, same-host/account controls, host separation, Project metadata, omitted identity, rollback and invalid-identity rejection.

Example focused checks:

ORCA_BACKGROUND_LAUNCH=1 node node_modules/vitest/vitest.mjs run --config config/vitest.config.ts src/main/github/work-item-details-issue-source.test.ts src/main/github/work-item-details-config-change.test.ts config/scripts/github-pr-assignee-repository.test.ts config/scripts/github-opened-issue-repository.test.ts src/renderer/src/components/task-page-github-dialog-state-authority.test.ts src/main/ipc/github-issue-source-preference.test.ts src/main/ipc/github-wsl-runtime-routing.test.ts

At earlier 20c12b28440c1b2dc79ea962b00b6955b98aa3ab, 30 scoped suites / 338 tests passed, Node/web typechecks passed, all 55 changed paths passed the changed-code-quality and formatting gates, and whitespace checks passed. Exact commands, exits, source hashes and logs are recorded in the owner evidence packet. Existing binaries were used directly; the ordinary package-manager hook launcher failed in this environment, so the actual direct staged lint tasks passed before committing. No install or native dependency rebuild was performed.

Actually run: macOS unit tests and fresh hidden Electron checks with isolated homes/profiles. Windows-path and WSL routing were mocked; native Windows, Linux and WSL apps were not run. No live provider or SSH test was run. The deep isolated profile hit an existing Unix socket path-length error and local PTY fallback; terminal behavior is outside this proof. CI covers the full checks.

Review

Final merge review cross-checks contributor PR #24379 at b69781b against this final head 23d82d3. Its source-resolver correction, original reproduction cases and PR-comment type handling are incorporated with Katsuma Takehisa’s Co-authored-by credit. This implementation also covers that PR’s two bot findings: Project-row reads stay bound to the row repository, and retained-dialog edits keep the opened repository when the selector changes. The existing source, mounted and native controls above verify those identities. Issue #24378 lists only these two implementations. This PR merged as ce0778626618bb9a5197209f5189190f2d51545c with the contributor credit verified in the squash commit. Contributor PR #24379 was then closed as superseded; its original branch is retained. The final callback-timing bot thread now has the evidence-based response linked below.

Callback-timing review response.

Independent reviewer examined the complete 55-file change at 20c12b2, traced its production callers, and ran 10 suites / 90 passing cases including four additional reviewer controls. Final verdict CLEAN was independently verified and accepted by the coordinator; no native cross-platform or CI result is inferred from that review.

Authored independent report, complete source/command manifest and raw source and execution evidence ZIP. The ZIP scope lists included source/preimages, receipts, renderer/native captures and older seeded panel controls; profiles, credentials and dependencies are excluded. Earlier genuine REQUEST_CHANGES reports remain preserved; this is a new review of the full change.

An earlier CodeRabbit review has a nonblocking test-helper fidelity note: makeWorkItemDetailsLookupMock resolves the source after the mocked lookup, whereas production captures it before awaiting the issue fetch. Its six callers are test suites. The config-change regressions use the actual client lookup with a disposable Git repository and controlled provider responses, and cover the captured-target race independently of that adapter. Improving the adapter's fidelity can be handled separately; this note does not identify an introduced production defect.

A newer callback-timing comment identifies a general limitation of passive unmount cleanup. Two controls with an imperative modeled parent reproduce that concurrent-render gap. Four controls using actual React 19.2.8, the dialog's exact state-reset dependencies and the real Zustand subscription mechanism preserve the newly opened issue: ordinary Tasks navigation cleans up the old editor before the rejected mutation continues; the dialog's reset restores the new values in the concurrent control. These controls model the parent rather than mounting the entire dialog. Source inspection confirms the reviewed Tasks/store route uses that synchronous subscription path. This timing note is nonblocking for the reviewed routes and is not presented as a reproduced native Tasks failure.

Agent skill upstream boundary

  • Not applicable; no skill-installer material is included.

Notes

The branch includes main's existing #24785 workflow-contract correction; no unrelated workflow fix was authored here. At earlier head 20c12b28440c1b2dc79ea962b00b6955b98aa3ab, the required repository guard and verify jobs succeeded in PR Checks. Those checks cover that earlier commit. They do not certify the follow-up assignee repair; its own source, native flow and checks are recorded above.

Merge risk: low after the source-bound reproductions, retained baseline controls, independent committed review and current green CI. The reproduced selected-assignee and delayed-rollback failures are repaired. The follow-up cleanup-timing assessment above preserves the reviewed routes' new issue state. No other user-facing trade-off was observed in the scoped checks. Existing defaults, argument/return shapes and omitted identity behavior remain compatible; the optional native metadata identity is additive and remote messages are unchanged. No production Git commands, keyboard shortcuts or new platform branches were added. Remote/SSH issue work is outside this effort, and the existing unseeded PR-page lookup remains a documented gap.

Checklist

  • This PR is focused on issue repository selection and its directly related read/write/cache regressions
  • I explained the user-facing before/after, mechanism and why
  • Original and followup before/after screenshots attached
  • Self-reviewed for correctness, security and performance
  • Cross-platform, SSH/remote and path impact considered
  • Current published-head CI is complete (current-run links, earlier results and local/platform limits are listed above)

Reuse issue-source resolution for detail and mutation reads, and bind open
local conversations to their canonical repository across selector changes.

Co-authored-by: Katsuma Takehisa <k.takehisa@nissogr.com>
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Issue details, comments, and edits now use the selected or explicitly supplied repository identity. Renderer detail caches, metadata requests, and work-item cache patches distinguish repositories that share an issue number. Dialog matching also includes the work item URL. Tests cover repository selection, mutation routing, cache identity, host validation, and metadata request behavior.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to 23d82

Runtime issue edits can reach a different repository from the issue being viewed, so that routing should be fixed before merging. A brief navigation race can also restore stale edit values.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 23d82

The change improves separation between same-number issues in different repositories. However, ordinary issue edits in a connected environment can still lose the opened repository identity. Because those edits now follow the repository’s current source preference, changing that preference could redirect an edit to another repository.

Retained concerns

  • Medium · security · inferred: Ordinary environment issue edits discard the opened repository identity while newly resolving mutations through the registered repository’s source preference. If that preference changes after an issue is opened, a body, state, label or assignee edit can target the other repository’s same-number issue while optimistic state remains associated with the opened repository. The missing identity field predates this PR, but introducing preference-dependent mutation resolution makes the source-switch outcome newly possible for previously stable targets.
Security review details

Security Blast Radius

  • inferred — The identified exposure is an authenticated write to another repository’s same-number issue through the ordinary environment route. It requires credentials authorized to modify the destination. Issue bodies could be disclosed to that destination, while state, labels and assignees could be changed unintentionally; unrestricted cross-host or cross-environment reachability was not established.

Security Findings and Attack Paths

  • inferred — A user can open an upstream issue, retain its URL-qualified dialog identity, and later initiate an environment edit after the runtime repository preference changes to origin. The mutation request drops the opened identity and the sink follows the current preference. Base mutation resolution did not follow that preference. This is a conditional wrong-target integrity and confidentiality path, not a verified attacker-led exploit.

Trust Boundaries and Controls

  • observed — Renderer-supplied local targets cross IPC into privileged GitHub execution, but still pass registered-repository validation, slug validation and authenticated-host resolution. Invalid or unresolved explicit identities fail before mutation. These controls constrain target execution but do not repair the environment route’s missing opened-repository identity.

Resilience and Maintainability Implications

  • observed — Repository-qualified cache patches and state authority contain stale completion effects to their captured repository identity. GitHub updates remain separate state, body and field commands with aggregated errors rather than an atomic transaction; this execution model predates the PR and was not retained as a newly introduced concern.

Hardening Proposals

  • proposed — Make opened host/owner/repo identity an explicit environment mutation contract distinct from the execution-context selector. Validate it through the existing host and repository controls, and exercise preference changes during pending edits so the write target, optimistic state and recovery all retain the same identity.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.96% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 54 functions across 58 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR meets the coding requirements in [#24378]. Issue lookups carry the resolved repository into conversation loading. Issue details, comments, metadata, edits, and cache updates use the opened issu…
Out of Scope Changes check ✅ Passed The whole-PR changes support repository-correct issue reads, writes, metadata, and cache updates. PR assignee routing uses the same repository-identity mechanism for the shared mutation path. The meta…
Title check ✅ Passed The title clearly summarizes the main change: keeping issue details and edits in the selected repository.
Description check ✅ Passed The description explains the change and rationale, links issue #24378, provides visual proof, and documents testing, review, platform limits, and checklist items. It is detailed and mostly complete ag…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 2cda649c-31a2-4201-8798-4a90e2f63b3b

📥 Commits

Reviewing files that changed from the base of the PR and between 4e46969 and a99ca6c.

📒 Files selected for processing (27)
  • src/main/github/issue-comment.ts
  • src/main/github/issue-mutation-source.test.ts
  • src/main/github/issue-update.ts
  • src/main/github/work-item-details-issue-source.test.ts
  • src/main/github/work-item-details.ts
  • src/main/ipc/github-issue-mutation-handlers.ts
  • src/main/ipc/github-issue-source-preference.test.ts
  • src/main/ipc/github-work-item-handlers.ts
  • src/main/ipc/github-wsl-runtime-routing.test.ts
  • src/main/runtime/orca-runtime-tests/hooks-and-hosted-review.spec.ts
  • src/main/runtime/rpc/methods/github-issue-methods.ts
  • src/main/runtime/rpc/methods/github.test.ts
  • src/main/runtime/runtime-github-issue-comment-commands.ts
  • src/preload/api/github-work-item-api.ts
  • src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section-mutations.ts
  • src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx
  • src/renderer/src/components/github-item-dialog/load-item-details/use-github-item-dialog-details.ts
  • src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-cache.ts
  • src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-issue-target.test.ts
  • src/renderer/src/components/github/github-work-item-comment-mutations.ts
  • src/renderer/src/components/github/github-work-item-edit-mutations.ts
  • src/renderer/src/components/github/github-work-item-issue-target.test.ts
  • src/renderer/src/components/task-page-cache-selectors.test.ts
  • src/renderer/src/components/task-page-cache-selectors.ts
  • src/renderer/src/components/use-task-page-github-detail.ts
  • src/renderer/src/lib/github-work-item-source-lookup.test.ts
  • src/renderer/src/lib/github-work-item-source-lookup.ts

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run reviewed commit a2690cb ("Validate issue repository identities before host resolution"), the delta since the last review at a99ca6c1, and skimmed the full PR for context.

  • Hardened repository identity validation — isValidGitHubApiRepository now takes unknown and type-guards, requiring string owner/repo and string-or-undefined host before applying the slug regexes.
  • Validated overrides before host resolution — getWorkItemDetails rejects a malformed repositoryOverride and returns null before any lookup, instead of forwarding it to getWorkItemByOwnerRepo.
  • Regression coverage — new cases reject non-string hosts and malformed runtime identities, and the invalid-host details test asserts no lookup is attempted; both would fail on the pre-change code, so they pin the fix.
  • Project-row edit coverage — added renderer tests confirming body/state/label/assignee edits on a Project row target the row's repository and not the fork workspace.

The old body accepted host: 42 / { owner: 42 } because RegExp.test coerces its argument, letting a numeric host reach repository.host.trim(). The new checks close that hole, and an approving review reflects no new issues in this delta.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 220e986f-775f-4af1-808e-3945e0d38dae

📥 Commits

Reviewing files that changed from the base of the PR and between a99ca6c and aab4d86.

📒 Files selected for processing (5)
  • src/main/github/github-api-repository-validation.test.ts
  • src/main/github/github-api-repository-validation.ts
  • src/main/github/work-item-details-issue-source.test.ts
  • src/main/github/work-item-details.ts
  • src/renderer/src/components/github/github-work-item-issue-target.test.ts

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

Comment thread src/main/github/work-item-details.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the delta since the prior pullfrog review at a2690cb — the three new commits b7b1775, b2102877, 20c12b28 (and the intervening main merge aab4d863) — against the authoritative full-PR diff.

  • Pinned issue conversation reads to the fetched repository — added getWorkItemWithRepository returning { item, repository }, and getWorkItemDetails now feeds that repository into the GraphQL/REST conversation reads so a mid-read git remote set-url cannot retarget the conversation.
  • Preserved explicit issue hosts and opened PR assignee targets — the detail override is resolved once via resolveGitHubRepoExecution, and PRAssigneesPanel routes writes through the opened PR's prRepo.
  • Scoped opened-issue metadata to its repository — listLabels/listAssignableUsers accept a repositoryOverride, and the new useGitHubRepoMetadata module folds the repo identity into local label/assignee cache keys and IPC args.
  • Scoped cached edits and Task-list state to the repository — patchWorkItem filters by the item URL's repo identity, the detail cache key uses repo identity for local sources, findTaskPageDialogWorkItem matches on url, and lastConfirmed state is guarded by ownerRepo.
  • Added regression coverage — real-disposable-repo config-change tests, main-process comment/update source tests, and renderer edit/metadata/cache tests that pin the rejected and accepted repository directions.

The prior pullfrog review had no open threads, and the new commits introduce no defects I could confirm: the override paths fail closed on invalid identities, the invalid cases never reach credential-bearing lookups, and the new tests would fail against the pre-change code. Remote/SSH pinning and the pre-existing unseeded PR-page lookup remain explicitly out of scope.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/github/work-item-details-test-lookup.ts (1)

7-15: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Align issue-source resolution with production for non-PR lookups.

makeWorkItemDetailsLookupMock resolves the source after lookup, unlike getWorkItemWithRepository. A future lookup that changes the remote can then return different repository metadata and let a mocked test miss a pinning regression. This is a test-double fidelity improvement; the existing real-client tests cover the current configuration-change scenario.

Preserve the PR special case because production does not resolve an issue source for type === 'pr'.

Suggested fix
   return async (...args: Parameters<typeof getWorkItem>): Promise<WorkItemRepositoryLookup> => {
+    const source =
+      args[2] === 'pr'
+        ? null
+        : (await resolveIssueGitHubApiRepositorySource(args[0], args[5], args[3], args[4])).source
     const item = await lookup(...args)
     return {
       item,
-      repository:
-        item?.type === 'issue'
-          ? (await resolveIssueGitHubApiRepositorySource(args[0], args[5], args[3], args[4])).source
-          : null
+      repository: item?.type === 'issue' ? source : null
     }

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e796acd7-08c1-434c-bb55-918eebec6f45
📥 Commits

Reviewing files that changed from the base of the PR and between aab4d86 and 20c12b2.

📒 Files selected for processing (34)
  • config/scripts/github-opened-issue-repository.test.ts
  • config/scripts/github-pr-assignee-repository.test.ts
  • src/main/github/client.ts
  • src/main/github/client/fetch/get-work-item.ts
  • src/main/github/issue-field-options.ts
  • src/main/github/work-item-details-concurrency.test.ts
  • src/main/github/work-item-details-config-change.test.ts
  • src/main/github/work-item-details-enterprise-host.test.ts
  • src/main/github/work-item-details-file-viewed.test.ts
  • src/main/github/work-item-details-issue-source.test.ts
  • src/main/github/work-item-details-pr-files.test.ts
  • src/main/github/work-item-details-test-lookup.ts
  • src/main/github/work-item-details.test.ts
  • src/main/github/work-item-details.ts
  • src/main/ipc/github-issue-mutation-handlers.ts
  • src/main/ipc/github-issue-source-preference.test.ts
  • src/main/ipc/github-wsl-runtime-routing.test.ts
  • src/preload/api/github-work-item-api.ts
  • src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section-mutations.ts
  • src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx
  • src/renderer/src/components/github/PRAssigneesPanel.tsx
  • src/renderer/src/components/task-page-github-confirmed-client-values.ts
  • src/renderer/src/components/task-page-github-dialog-state-authority.test.ts
  • src/renderer/src/components/task-page-github-dialog-state-authority.ts
  • src/renderer/src/components/task-page-github-work-item-mutation-composition.ts
  • src/renderer/src/components/task-page-github-work-item-mutation-pages.ts
  • src/renderer/src/components/task-page-github-work-item-mutation-registry.ts
  • src/renderer/src/components/task-page-github-work-item-mutation-types.ts
  • src/renderer/src/components/task-page-github-work-item-quiet-adopt.ts
  • src/renderer/src/hooks/useGitHubRepoMetadata.ts
  • src/renderer/src/hooks/useIssueMetadata.ts
  • src/renderer/src/store/github/cache-model.ts
  • src/renderer/src/store/github/work-item-mutation-actions.ts
  • src/renderer/src/store/slices/github-work-item-cache-identity.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/github/work-item-details-issue-source.test.ts
  • src/main/github/work-item-details.ts

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

@nwparker

nwparker commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Regarding the nonblocking test-helper note in the current review: makeWorkItemDetailsLookupMock resolves the repository after its mocked lookup, so its timing differs from production. Production getWorkItemWithRepository captures the selected source before awaiting the issue fetch and returns that same source with the item.

All six adapter callers are test suites. work-item-details-config-change.test.ts uses the actual client lookup, a real disposable Git repository, and controlled provider responses; its typed and untyped cases change the remote during the issue request and verify that the original repository supplies the details. Those race controls bypass the adapter and pass in the recorded 338-test scoped run. The adapter's fidelity can be improved separately; the frozen production patch already retains the selected target.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the delta since the prior pullfrog review at 20c12b2 — the single new commit fd53834 ("test(github): verify fork metadata isolation for delayed replies") — against the authoritative full-PR diff.

  • Pinned delayed-reply isolation for the local metadata hooks — useIssueMetadata.test.tsx gains two renderer tests. Concurrent fork/upstream useRepoLabels reads sharing a repoId keep separate results when the fork reply settles late, and a late fork useRepoAssignees reply is ignored after the opened issue switches to upstream.
  • Confirmed the tests can fail — both depend on the repo identity folded into the cache key by githubRepoIdentityKey; with the pre-fix shared key the two label hooks would dedupe onto one in-flight fetch (one listLabels call, not two) and the stale assignee reply would overwrite the switched state. Ran the file: 7/7 pass.

The prior pullfrog reviews on this PR had no open threads, and this delta is test-only. No production behavior changed, so nothing new to flag.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run re-reviewed the delta since the prior pullfrog review at fd53834 — the single new commit 23d82d3 ("Keep issue editor state within the opened repository") — against the authoritative full-PR diff.

  • Reset the issue editor's local state on repository switch — GHEditSection is now a thin wrapper that derives an itemKey from repoId, canonical repository identity, item type, and id, and renders GHEditSectionItem with that key, so opening a same-number issue in another repository or host remounts the editor instead of reusing the previous repository's optimistic assignee and popover state.
  • Blocked late reverts from crossing the switch — the onStateChange/onLabelsChange callbacks handed to the edit mutations are wrapped with useMountedRef, so a failed in-flight edit on the old instance no longer overwrites the newly opened issue's parent-controlled state; the store rollback still runs, scoped to the captured repository.
  • Extracted the edit-section prop type — GitHubItemDialogEditSectionProps replaces the inline prop literal so the wrapper and item share one shape.
  • Added regression coverage — gh-edit-section.assignee-identity.test.tsx exercises 14 cases across fork/upstream navigation, different issue numbers, legacy-id reuse by a PR, Enterprise-host separation, canonical-URL variants, Project-row origins, and late failed assignee/label/state edits; the opened-issue config test now renders the real component tree via renderToStaticMarkup.

The prior pullfrog reviews on this PR had no open threads. I traced the wrapper key through both call sites and confirmed the new tests fail against the pre-commit code: the shared repoId \0 id assignee guard would keep the fork optimistic value on the upstream render, and an unguarded late revert would clobber the new parent selection. Ran both affected files (14/14 and 16/16), tc:web, and the changed-code-quality gate (0 findings). No new issues.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: def1e88e-80f4-4c53-80bf-0bd4b6125027
📥 Commits

Reviewing files that changed from the base of the PR and between d56ae9c and 23d82d3.

📒 Files selected for processing (4)
  • config/scripts/github-opened-issue-repository.test.ts
  • src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.assignee-identity.test.tsx
  • src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx
  • src/renderer/src/components/github-item-dialog/load-item-details/github-item-dialog-types.ts

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

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.

[Bug]: Issue details show upstream#N's comments/assignees when Origin is selected, and replies post to upstream#N

1 participant