Repository navigation
fix(review): PR reads and actions follow the ownership table - #27248
Conversation
…ess task source A GitHub task source without a runtime host used to spread activeRuntimeEnvironmentId: null over the repo owner's settings, so assignee, reviewer, label, status and merge cells for a runtime-owned repo ran on this desktop. Every PR read and action site now routes through getGitHubRepoRoutingSettings (renamed from the merge-only helper), and the store's source-scoped routing defers to the repo owner the same way. Focus is never a fallback. Fixes #7623
Duplicate repo ids across hosts made the host-less source fallback pick a server owner by focus (UI) or by first row (store), so a local item could read or write on a paired server. The owner is now inherited only from the single row with that id; ambiguity stays on the source's own host.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬆️ High Severity of issue fixed: High Merge Risk: 🟡 Moderate · up to Repository routing can return work items from a previous host or send some requests to the wrong host. Resolve these routing paths before merging. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
49e762e1-b9bd-414d-a7d5-71e56dd663bf
📒 Files selected for processing (27)
src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsxsrc/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsxsrc/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-panel.tsxsrc/renderer/src/components/github/PRAssigneesPanel.tsxsrc/renderer/src/components/github/github-work-item-edit-mutations.tssrc/renderer/src/components/pull-request-page/actions/panel.tsxsrc/renderer/src/components/pull-request-page/conversation/tab.tsxsrc/renderer/src/components/pull-request-page/edit/section.tsxsrc/renderer/src/components/pull-request-page/reviewers/panel.tsxsrc/renderer/src/components/task-page/github/AssigneesCell.tsxsrc/renderer/src/components/task-page/github/MergeCell.tsxsrc/renderer/src/components/task-page/github/ReviewCell.tsxsrc/renderer/src/components/task-page/github/StatusCell.tsxsrc/renderer/src/components/use-task-page-github-issue-draft.tssrc/renderer/src/lib/github-source-runtime-context.test.tssrc/renderer/src/lib/github-source-runtime-context.tssrc/renderer/src/lib/repo-runtime-owner.tssrc/renderer/src/store/github/check-actions.tssrc/renderer/src/store/github/comment-fetch-actions.tssrc/renderer/src/store/github/comment-mutation-actions.tssrc/renderer/src/store/github/conversation-comment-actions.tssrc/renderer/src/store/github/issue-actions.tssrc/renderer/src/store/github/review-thread-actions.tssrc/renderer/src/store/github/work-item-aggregate-actions.tssrc/renderer/src/store/github/work-item-fetch-actions.tssrc/renderer/src/store/github/work-item-routing.test.tssrc/renderer/src/store/github/work-item-routing.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.
| newIssueTargetRepo.id | ||
| const target = getActiveRuntimeTarget( | ||
| getGitHubRepoRoutingSettings( | ||
| { repos: [newIssueTargetRepo], settings }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Pass the complete repository list to the routing helper.
If a local and runtime repository share newIssueTargetRepo.id, [newIssueTargetRepo] hides the duplicate from getHostlessSourceRepoOwnerEnvironmentId. For a hostless GitHub source and a selected runtime row, the new-issue form then selects that runtime instead of applying the duplicate-ID local fallback. Pass repos as the routing state’s repository list; keep newIssueTargetRepo.id as the requested ID. (raw.githubusercontent.com)
| state.settings, | ||
| sourceHost?.kind === 'runtime' | ||
| ? sourceHost.environmentId | ||
| : getHostlessSourceRepoOwnerEnvironmentId(state.repos, repo?.id) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
set -e
printf '%s\n' '--- routing diff ---'
git diff --find-renames 3e7ab3f5a10a322a73a15aa37dd61c63af711dec d180cc66be67b3a189f7855824f421a5344a16e6 -- src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- fetch action references ---'
rg -n -F --glob '*.ts' -- 'ownerHostId' src/renderer/src/store/github src/renderer/src | head -120
printf '%s\n' '--- work-item fetch actions ---'
sed -n '1,280p' src/renderer/src/store/github/work-item-fetch-actions.ts
printf '%s\n' '--- routing helper ---'
sed -n '1,220p' src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- cache and invalidation references ---'
rg -n -F --glob '*.ts' -- 'workItem' src/renderer/src/store/github src/renderer/src/store | head -240
rg -n --glob '*.ts' 'invalidate|clear.*cache|cache.*clear|abort|cancel' src/renderer/src/store/github | head -240
printf '%s\n' '--- repository owner fields and updates ---'
rg -n --glob '*.ts' 'executionHostId|connectionId|ownerHostId|repoOwner|repository owner' src/renderer/src/store src/renderer/src/lib | head -300Repository: stablyai/orca
Length of output: 41900
🏁 Script executed:
set -e
printf '%s\n' '--- routing diff ---'
git diff --find-renames 3e7ab3f5a10a322a73a15aa37dd61c63af711dec d180cc66be67b3a189f7855824f421a5344a16e6 -- src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- fetch action references ---'
rg -n -F --glob '*.ts' -- 'ownerHostId' src/renderer/src/store/github src/renderer/src | head -120
printf '%s\n' '--- work-item fetch actions ---'
sed -n '1,320p' src/renderer/src/store/github/work-item-fetch-actions.ts
printf '%s\n' '--- routing helper ---'
sed -n '1,240p' src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- cache and invalidation references ---'
rg -n -F --glob '*.ts' -- 'workItem' src/renderer/src/store/github src/renderer/src/store | head -240
rg -n --glob '*.ts' 'invalidate|clear.*cache|cache.*clear|abort|cancel' src/renderer/src/store/github | head -240
printf '%s\n' '--- repository owner fields and updates ---'
rg -n --glob '*.ts' 'executionHostId|connectionId|ownerHostId|repoOwner|repository owner' src/renderer/src/store src/renderer/src/lib | head -300Repository: stablyai/orca
Length of output: 42484
🌐 Web query:
site:github.com/stablyai/orca d180cc66be67b3a189f7855824f421a5344a16e6 work-item-fetch-actions.ts ownerHostId
💡 Result:
I couldn’t verify that commit or locate `work-item-fetch-actions.ts` with `ownerHostId` in the available search results. The results point to Orca’s repository, but don’t establish what the file contains at commit `d180cc66be67b3a189f7855824f421a5344a16e6`. ([github.com](https://github.com/stablyai/orca?utm_source=openai))
The exact commit’s file contents remain unresolved.
Citations:
- 1: https://github.com/stablyai/orca?utm_source=openai
🏁 Script executed:
set -e
printf '%s\n' '--- fetch action core ---'
sed -n '70,205p' src/renderer/src/store/github/work-item-fetch-actions.ts
printf '%s\n' '--- routing host/cache helpers ---'
sed -n '100,210p' src/renderer/src/store/github/work-item-routing.ts
printf '%s\n' '--- cache identity ---'
sed -n '1,220p' src/renderer/src/store/github/cache-identity.ts
printf '%s\n' '--- invalidation references and implementations ---'
rg -n -C 8 --glob '*.ts' 'workItemsInvalidationNonce|invalidateWorkItems|clearWorkItems|workItemsCache' src/renderer/src/store/github src/renderer/src/store/repos src/renderer/src/store/slices
printf '%s\n' '--- repository update owner transition ---'
sed -n '90,225p' src/renderer/src/store/repos/repo-update.tsRepository: stablyai/orca
Length of output: 42401
Invalidate hostless-source work-item caches when repository ownership changes.
getGitHubWorkItemSourceSettings now routes a hostless source to its repository owner, but the cache scope and ownerHostId still use the unchanged source context. A fresh cache entry can therefore be returned for the previous host, and an older in-flight request can write into the same cache key after the owner changes. The current-host guard does not detect this transition because both values remain hostless.
When the effective owner changes, clear the source-scoped cache and advance the invalidation nonce before allowing new requests. This must also prevent older in-flight requests from repopulating that cache.
| return settingsForGitHubTaskSource(state, repo, sourceContext) | ||
| } | ||
| return settingsForGitHubFocusedRepoOwner(settings, repo) | ||
| return settingsForGitHubFocusedRepoOwner(state.settings, repo) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not use the focused runtime for an unowned work-item repository.
If sourceContext is absent and repo has no recorded owner, settingsForGitHubFocusedRepoOwner returns state.settings unchanged. When the active server is selected, getGitHubWorkItemRequestContext can then target that server for a local repository. Resolve an unowned repository to activeRuntimeEnvironmentId: null on this branch. The PR’s routing rule explicitly excludes the active server as a fallback. (raw.githubusercontent.com)
ELI5
When you look at a pull request that belongs to a project living on another Orca server, every panel on that page should talk to that server. Some panels (assignees, reviewers, labels, status, merge and review cells on the task page, the new-issue form) instead asked this computer, because the "where is this list coming from" setting said "this computer" and that overwrote the project's real owner.
What Changed
Before: a pull request or issue for a repo owned by a remote Orca server, opened through a GitHub source that has no server attached (a "this computer" source), had its assignee / reviewer / label pickers, the PR page conversation and edit panels, and the task-page status, merge, review and assignee cells run their GitHub calls on this desktop. They showed empty or stale lists, and writes from the task-page cells could fail with "unknown repository path". The PR page's own merge button already went to the right server, so reads and actions on the same page disagreed.
After: all of those panels, plus the store paths that fetch issues, comments, checks and review threads for a source, route the same way the merge button does:
Mechanism: the ten components each had their own copy of
{ ...repoOwnerSettings, ...getTaskSourceRuntimeSettings(sourceContext) }.getTaskSourceRuntimeSettingsalways returnsactiveRuntimeEnvironmentId, set tonullfor a host-less source, so the spread replaced the owner with "local". Every copy now calls one helper,getGitHubRepoRoutingSettings(the existing merge helper, renamed because reads use it too). The store'sgetGitHubRepoSourceSettings/getGitHubWorkItemSourceSettingsfollow the same rule. For a source with no server attached, both usegetHostlessSourceRepoOwnerEnvironmentId, which takes the owner only from the single repo row with that id.Why
The issue's suggested direction was one shared helper so merge and read paths cannot drift. The merge helper already encoded exactly the right rule and was tested, so reusing it removes ten duplicated blocks (net −45 lines) instead of adding an eleventh variant. A guard test fails if anyone spreads a task source over owner settings again.
One deliberate behavior change: for a repo with no recorded owner, these panels used to follow the "Active Server" menu. They now treat it as local, the same as the merge button. Server rows are always stamped with their owner on arrival, so only genuinely local rows lack one.
Linked Issue
Fixes #7623
Visual Proof
N/A. This only changes which machine handles the request. Nothing on screen looks different, apart from the lists now loading.
Testing
src/renderer/src/store/github/work-item-routing.test.ts(new): a server-owned repo viewed through a host-less source stays on its owner, a server source still overrides, and a local source never follows the "Active Server" menu, and a repo id that exists on both a server and this computer stays local for a local source. The two owner tests fail onorigin/main(they gotnull) and pass here.src/renderer/src/lib/github-source-runtime-context.test.ts: added a guard that no renderer file spreadsgetTaskSourceRuntimeSettings(...). It fails onorigin/mainand lists the 12 files.pnpm tc, oxlint,pnpm run check:code-quality:changed, the owner-routing ratchet, and the store/github, task-page, pull-request-page, github-item-dialog and github component test folders (756 files, 7551 tests).Not tested by hand in the app. SSH: SSH-owned repos still use this desktop's credentials, as before.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
No wire change. Renderer-only routing, the same on macOS, Linux and Windows. SSH repos and folder workspaces keep desktop credentials. GitHub Projects boards with no repo (the
projectOriginpaths) are left to a later change that adds an explicit source picker.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)