Repository navigation
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 6f2acc1a275f5694b68532ea0cc4ab66bd3cfc86 and ef934e4. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughAdds repository-scoped GitHub account bindings across persistence, GitHub CLI execution, IPC/RPC, preload APIs, runtime routing, and repository settings. Bound tokens are resolved from Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The reviewed changes do not show a concrete unresolved risk requiring changes before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Most coding requirements in Resolution Apply the repository binding to Project View's repository-scoped Full details: Docstring CoverageExplanation Docstring coverage is 35.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 71 functions across 59 files. (5 skipped: 5 unsupported.)
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.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/main/git/runner.ts (1)
1497-1512: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winReject or host-qualify attached
-Rvalues.GitHub CLI accepts
-Rhost/owner/repoand-R=host/owner/repo. These forms bypasscollectGhArgvHostSignalsand remain unchanged inapplyGhHostToArgs, so a bound call can target another host with the bound token. Handle both forms in the host parsers, or reject them before spawn. Add regression cases insrc/main/git/runner-gh-account-binding.test.ts.src/main/runtime/orca-runtime.ts (1)
18939-18966: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winRemove
ghAccountfrom thePick<Repo, ...>list
Repo.ghAccountdoes not includenull, so the duplicate intersection collapses the effective type toGhAccountBinding | undefined. This rejects theghAccount: nullclear sentinel handled byupdateRepo. KeepghAccountonly in the intersected object.src/renderer/src/store/slices/repos.ts (1)
130-142: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
ghAccountis declared in both thePick<...>union and the nullable intersection member, sonullis not assignable. Both update types list'ghAccount'insidePartial<Pick<Repo, ...>>and again asghAccount?: Repo['ghAccount'] | null. TypeScript intersects the two property types, producingGhAccountBinding | undefined, which drops thenullclear signal.sourceControlAiandexternalWorktreeDiscoverySuppressedAtshow the correct pattern: they appear only in the intersection member.
src/renderer/src/store/slices/repos.ts#L130-L142: remove| 'ghAccount'from thePickunion inRepoUpdateand keep the nullable member on Line 142.src/preload/api-types.ts#L1270-L1282: remove| 'ghAccount'from thePickunion inrepos.updateand keep the nullable member on Line 1282.
🧹 Nitpick comments (3)
src/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsx (1)
5-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a mismatched-binding case and split the assertions into separate tests.
The current test covers exact match, missing echo, clear-with-no-echo, and clear-with-echo. It does not cover the case where
echoedholds a different account thanrequested, which is the main mixed-version symptom the helper detects. It also does not cover case differences, even though the title mentions "normalized" bindings.Separate
itblocks also report which case failed instead of stopping at the first assertion.🧪 Suggested additional cases
+ it('rejects a binding the host echoed as a different account', () => { + expect( + isGhAccountBindingEnforced( + { host: 'github.com', user: 'Alice' }, + { host: 'github.com', user: 'Bob' } + ) + ).toBe(false) + expect( + isGhAccountBindingEnforced( + { host: 'github.com', user: 'Alice' }, + { host: 'ghe.example.com', user: 'Alice' } + ) + ).toBe(false) + })src/renderer/src/components/settings/RepositoryGitHubAccountSection.tsx (2)
79-129: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDo not reassign the
nextparameter; use a separate constant.Line 108 reassigns the
nextparameter with the validated binding. The reassignment makes the value passed toupdateRepoon Line 110 and toisGhAccountBindingEnforcedon Line 121 depend on control flow above it. A dedicated constant states the intent directly.♻️ Proposed refactor
- const applyBinding = async (next: GhAccountBinding | null) => { + const applyBinding = async (requested: GhAccountBinding | null) => { if (saving) { return } setSaving(true) setError(null) setNotEnforced(false) try { - if (next) { - const validation = await validateRepositoryGhAccountBinding(runtimeTarget, repo, next) + let resolved = requested + if (requested) { + const validation = await validateRepositoryGhAccountBinding(runtimeTarget, repo, requested) if (!validation.ok) { ... return } - next = validation.binding + resolved = validation.binding } - const result = await Promise.resolve(updateRepo(repo.id, { ghAccount: next })) + const result = await Promise.resolve(updateRepo(repo.id, { ghAccount: resolved }))
191-229: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the existing shadcn
Selectprimitive for this account control. It supports disabled items and matches the settings style guide and focus behavior.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b641d137-f0eb-44c3-9af8-5da7a35a8949
📥 Commits
Reviewing files that changed from the base of the PR and between c0c893d and d2d2d6e65adff135ec02a85e9413ea8a7dd8a313.
📒 Files selected for processing (35)
src/main/git/runner-gh-account-binding.test.tssrc/main/git/runner.tssrc/main/github/client.tssrc/main/github/gh-account-binding-inventory.tssrc/main/github/gh-account-token.test.tssrc/main/github/gh-account-token.tssrc/main/github/gh-capability-state.test.tssrc/main/github/gh-capability-state.tssrc/main/github/github-repository-identity.gh-account.test.tssrc/main/github/github-repository-identity.tssrc/main/github/project-view/internals.tssrc/main/github/rate-limit.tssrc/main/github/work-item-details.tssrc/main/ipc/github.tssrc/main/ipc/repos.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/github.tssrc/main/runtime/rpc/methods/repo-update-schema.tssrc/main/runtime/rpc/methods/repo.test.tssrc/main/source-control/hosted-review-git-options.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsxsrc/renderer/src/components/settings/RepositoryGitHubAccountSection.tsxsrc/renderer/src/components/settings/RepositoryPane.tsxsrc/renderer/src/components/settings/repository-github-account.tssrc/renderer/src/components/settings/repository-search.tssrc/renderer/src/store/slices/repos.tssrc/renderer/src/web/web-preload-api.tssrc/shared/github-account-binding.test.tssrc/shared/github-account-binding.tssrc/shared/github-auth-types.tssrc/shared/types.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/settings/RepositoryGitHubAccountSection.tsx (1)
161-172: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAdd the missing
githubAccountKeywordlocale key to the catalog.The keyword entry uses the key
auto.components.settings.repository.search.githubAccountKeyword.en.json'srepository.searchnamespace definesgithubAccountandgithubAccountDescription, but notgithubAccountKeyword. This key is missing from the catalog.Run the localization sync script to add this key, or add it manually to
en.jsonunderauto.components.settings.repository.search.Run the following script to confirm the key is absent from the catalog:
#!/bin/bash # Description: Check whether githubAccountKeyword exists under repository.search in en.json. python3 - <<'PY' import json with open("src/renderer/src/i18n/locales/en.json") as f: data = json.load(f) section = data.get("auto", {}).get("components", {}).get("settings", {}).get("repository", {}).get("search", {}) print("repository.search keys:", sorted(section.keys())) print("githubAccountKeyword present:", "githubAccountKeyword" in section) PY🔧 Proposed fix
"projectRuntimeDescription": "Choose whether this project runs on Windows or WSL.", "githubAccount": "GitHub Account", - "githubAccountDescription": "Bind a keyring gh login for this project's GitHub API calls." + "githubAccountDescription": "Bind a keyring gh login for this project's GitHub API calls.", + "githubAccountKeyword": "github account"Source: Learnings
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ff7a0103-7ebf-4eeb-9527-c28f9bf085bd
📥 Commits
Reviewing files that changed from the base of the PR and between d2d2d6e65adff135ec02a85e9413ea8a7dd8a313 and f4772e9f83f5f42dc203b1f67f6e53ccbc9b2737.
📒 Files selected for processing (24)
src/main/git/runner.tssrc/main/github/auth-diagnose.tssrc/main/github/client.tssrc/main/github/gh-account-binding-inventory.tssrc/main/github/gh-account-token.test.tssrc/main/github/gh-account-token.tssrc/main/github/gh-capability-state.tssrc/main/github/work-item-details.tssrc/main/ipc/github.tssrc/main/ipc/repos.tssrc/main/persistence.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/repo-update-schema.tssrc/preload/api-types.tssrc/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsxsrc/renderer/src/components/settings/RepositoryGitHubAccountSection.tsxsrc/renderer/src/components/settings/RepositoryPane.tsxsrc/renderer/src/components/settings/repository-github-account.tssrc/renderer/src/components/settings/repository-search.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/store/slices/repos.tssrc/shared/github-account-binding.test.tssrc/shared/github-account-binding.tssrc/shared/github-auth-types.ts
🚧 Files skipped from review as they are similar to previous changes (15)
- src/renderer/src/components/settings/repository-search.ts
- src/main/ipc/repos.ts
- src/shared/github-account-binding.test.ts
- src/main/runtime/rpc/methods/repo-update-schema.ts
- src/shared/github-auth-types.ts
- src/renderer/src/components/settings/RepositoryPane.tsx
- src/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsx
- src/shared/github-account-binding.ts
- src/main/github/gh-account-token.test.ts
- src/main/github/gh-account-token.ts
- src/main/persistence.ts
- src/renderer/src/store/slices/repos.ts
- src/preload/api-types.ts
- src/main/github/gh-capability-state.ts
- src/main/runtime/orca-runtime.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
c745c19 to
1055eca
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
1055eca to
cf8d7dd
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
cf8d7dd to
ed738d6
Compare
|
This would be very helpful. I personally have separate work and personal accounts. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Note The previously reviewed commits are no longer reachable (likely due to a force-push or rebase), so CodeRabbit is performing a full review instead of an incremental one. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: fe82be50-7f2b-4814-8713-37b64bff35c5
📥 Commits
Reviewing files that changed from the base of the PR and between 7f8eb90 and 4d550cb30297adca740cce59c5a551e7647a646b.
📒 Files selected for processing (65)
src/main/git/command-runner/gh-bound-account-env.tssrc/main/git/command-runner/gh-exec-file.tssrc/main/git/command-runner/gh-host-args.tssrc/main/git/runner-gh-account-binding.test.tssrc/main/git/runner-gh-host-args.test.tssrc/main/github/auth-diagnose.tssrc/main/github/client/create/create-github-pull-request.tssrc/main/github/client/create/pull-request-template.tssrc/main/github/gh-account-binding-inventory.tssrc/main/github/gh-account-token.test.tssrc/main/github/gh-account-token.tssrc/main/github/gh-capability-state.test.tssrc/main/github/gh-capability-state.tssrc/main/github/github-repository-identity.gh-account.test.tssrc/main/github/github-repository-identity.tssrc/main/github/project-view/internals.tssrc/main/github/rate-limit.tssrc/main/ipc/github-account-handlers.tssrc/main/ipc/github-ipc-channel-parity.test.tssrc/main/ipc/github-repo-routing.tssrc/main/ipc/github.tssrc/main/ipc/hosted-review.test.tssrc/main/ipc/hosted-review.tssrc/main/ipc/repos/repo-update-handler.tssrc/main/persistence-update-repo.test.tssrc/main/persistence/loading-store/repo-lifecycle-operations.tssrc/main/persistence/tracking-repos/repo-hydration.tssrc/main/persistence/tracking-repos/repo-sanitization.tssrc/main/persistence/tracking-repos/repo-update-operations.tssrc/main/project-runtime-git-options.tssrc/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.tssrc/main/runtime/rpc/methods/github-account-binding-methods.tssrc/main/runtime/rpc/methods/github.tssrc/main/runtime/rpc/methods/repo-update-schema.tssrc/main/runtime/rpc/methods/repo.test.tssrc/main/runtime/runtime-github-issue-comment-commands.tssrc/main/runtime/runtime-github-repository-query-commands.tssrc/main/runtime/runtime-github-review-mutation-commands.tssrc/main/runtime/runtime-github-review-query-commands.tssrc/main/runtime/runtime-repository-command-surface.tssrc/main/runtime/runtime-repository-settings-controller.tssrc/main/source-control/hosted-review-git-options.tssrc/preload/api-types.tssrc/preload/api/gh-bridge-mutations-and-projects.tssrc/preload/api/github-account-api.tssrc/preload/api/repository-api.tssrc/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsxsrc/renderer/src/components/settings/RepositoryGitHubAccountSection.tsxsrc/renderer/src/components/settings/RepositoryPane.tsxsrc/renderer/src/components/settings/repository-github-account.tssrc/renderer/src/components/settings/repository-search.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/store/repos/repo-state.tssrc/renderer/src/store/repos/repo-update.tssrc/renderer/src/web/preload-api/web-github-api.tssrc/renderer/src/web/preload-api/web-github-routes.tssrc/renderer/src/web/web-preload-api-github.test.tssrc/shared/github/account-binding.test.tssrc/shared/github/account-binding.tssrc/shared/github/auth-types.tssrc/shared/repo-types.ts
🚧 Files skipped from review as they are similar to previous changes (20)
- src/main/ipc/hosted-review.test.ts
- src/renderer/src/components/settings/RepositoryGitHubAccountSection.tsx
- src/main/github/rate-limit.ts
- src/main/github/project-view/internals.ts
- src/main/github/github-repository-identity.gh-account.test.ts
- src/renderer/src/i18n/locales/en.json
- src/main/runtime/rpc/methods/repo.test.ts
- src/main/github/auth-diagnose.ts
- src/main/source-control/hosted-review-git-options.ts
- src/main/ipc/hosted-review.ts
- src/renderer/src/components/settings/repository-search.ts
- src/main/runtime/rpc/methods/repo-update-schema.ts
- src/renderer/src/components/settings/RepositoryPane.tsx
- src/main/github/gh-account-binding-inventory.ts
- src/main/github/gh-account-token.test.ts
- src/main/github/gh-account-token.ts
- src/renderer/src/components/settings/repository-github-account.ts
- src/main/github/gh-capability-state.ts
- src/main/project-runtime-git-options.ts
- src/main/github/gh-capability-state.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Ran your rebased head (6396a42) on Ubuntu 24.04 / WSL2, Node 24, gh 2.97, since CI hasn't been approved for this PR yet:
I had also rebased your previous head independently before you did; the two ports landed the hook, IPC, persistence, runtime and preload changes in the same modules, so the relocation looks right. Two things I noticed while reading the runner path, neither a blocker:
Happy to run the same checks on native Windows and a WSL-routed repo next and post the steps here. |
6396a42 to
31b4da1
Compare
|
Thanks for the WSL2 run and for reading the runner path closely — both points are right.
A native Windows and WSL-routed pass would be very welcome — the branch was rebased onto today's |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Adds per-project `Repo.ghAccount` so repo-scoped gh calls (create-worktree issue/PR search, work items, hosted-review reads and mutations) run as the bound account via ephemeral child-env token injection instead of the globally active gh login. Multi-account resolution is capability-gated (gh >= 2.40) and fails closed when the bound account or host is unavailable; Project View stays ambient by design. Repository settings gains a section for selecting or clearing a keyring-backed account (shadcn `Select`), with mixed-version "not enforced" handling for older remote runtimes. Attached `-Rhost/owner/repo` forms are covered by the host-drift guard and its tests; es/ja/ko/zh catalogs carry the section's strings. `getLocalProjectGhExecOptions` centralizes the binding lookup so every gh execution path picks it up, including the Electron `hostedReview:*` handlers that previously stayed on the ambient login. `gh auth token` (a keyring read) is exempt from the rate-limit breaker gate so a tripped bucket cannot turn a bound-token resolve into a false "unavailable". The `ghAccount` update field and the two binding RPC methods live in the shared RPC params contract; the generated catalog is regenerated. Fixes stablyai#13612 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_012B3QEP5iP4WGGEpPLtkHqA
6f2acc1 to
ef934e4
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Updated the GitHub account settings UX:
Validated with the focused component tests, typecheck, changed-code quality checks, and background Electron visual verification. |

ELI5
When a user is signed in to
ghwith both work and personal GitHub accounts, Orca used whichever account was globally active. A project could therefore search issues as the wrong account and show no results.This change lets each project use a selected GitHub login for its repository-scoped GitHub actions.
What changed
host+user), persisted through the desktop, runtime, preload, and web-client layers.ghcalls now resolve a short-lived token for the selected login and inject it into that child process only. AmbientGH_TOKEN,GH_HOST, andGH_REPOvalues are removed from bound calls.gh(2.40+). Capability state is scoped separately for native, WSL, and SSH hosts.Why
Fixes #13612. The previous behavior could silently query GitHub with the wrong identity. Per-child token injection keeps simultaneous project requests isolated, and fail-closed behavior prevents an unavailable binding from falling back to the wrong account.
Related: #16244 and #16294 (the same multi-account failure mode and clearer REST errors).
Related: #13347 (Tasks GitHub source account binding; Project View remains an ambient-login follow-up).
Visual proof
Settings → Repository in the macOS dev build. The screenshot shows the account picker with the low-emphasis refresh control beside Account.
Testing
pnpm tcpnpm run check:code-quality:changedManual platform coverage: macOS local and SSH-backed repository. Windows/WSL behavior is covered by the execution-host unit tests, but was not manually exercised here.
The automated checks cover the changed application paths, packaging, Windows boundaries, Git compatibility, and mobile compatibility gates. The final run passed typecheck, static analysis, all eight test shards, Linux packaging, Git compatibility, and mobile verification. Windows packaging passed after pinning
mobile/patches/*.patchto stable checkout bytes in.gitattributes. The readiness checklist scenarios that are not exercised by this PR are transport fault injections such as Wi-Fi sleep/resume, DNS or half-open TCP failures, SSH reconnects and mid-flight drops, relay restart ownership, FIDO2 fallback, and low-connectivity parity. Those remain broader transport residual risk; this PR does not claim zero regressions or full network fault coverage.Release recommendation
Roll this out in a canary cohort first. Monitor account-binding validation failures,
gh_bound_account_*errors, GitHub request failures, and support reports while comparing bound-project success rates with ambient-login projects. Expand only after the canary is clean; keep the prior build available for rollback. The binding is optional and unbound projects retain the existing ambient-login path.Review notes
ghprocess environment. Host and repository signals are checked against the binding.ghAccountis optional. Older remote runtimes that drop it are reported as "not enforced". No new stream opcode was added.gh, matching the existing GitHub integration.AI disclosure
Claude Opus 5 and Claude Fable 5.1 assisted with implementation, rebases, and review follow-ups.
Checklist
pnpm buildremains covered by CI)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.