Skip to content

feat(accounts): add managed Grok and Gemini homes - #13276

Closed
rp0927 wants to merge 29 commits into
stablyai:mainfrom
rp0927:feat/grok-gemini-managed-accounts
Closed

rp0927 wants to merge 29 commits into
stablyai:mainfrom
rp0927:feat/grok-gemini-managed-accounts

Conversation

@rp0927

@rp0927 rp0927 commented Aug 8, 2026 •

Copy link
Copy Markdown

Summary

Add isolated managed-account homes for Grok Build and Gemini CLI using each CLI's documented home override:

  • Grok: GROK_HOME
  • Gemini: GEMINI_CLI_HOME

Users can import an existing signed-in CLI home, assign a local label, select it for new local sessions, return to the system default, and remove only Orca's managed copy.

This PR is stacked on #13275, #13274, #13273, #13272, #13271, #13270, and #13183. Please review it after those PRs land; their changes will disappear from this diff as the stack advances.

AI Review Report

The review compared each adapter with the provider's documented home override and credential layout, then traced import, ownership, selection, new local launch, settings IPC, renderer summaries, and deletion. It also checked that unsupported login orchestration, identity inference, usage attribution, and Claude behavior are not claimed.

Cross-platform review:

  • Managed homes apply only to new local-host launches.
  • SSH, WSL, remote, web, running, and reattached sessions do not receive host credentials.
  • Path handling and credential validation remain in main; renderer code receives path-free summaries.

Scope and behavior

  • A successful import selects the new managed account for subsequent local host launches.
  • Existing, reattached, SSH, WSL, remote-server, and web sessions are unchanged.
  • The source home and system default are never modified.
  • Existing usage cards continue to describe the system-default account; this change does not claim per-account usage attribution.
  • Grok copies only bounded auth.json data.
  • Gemini copies bounded OAuth credential support files and reconstructs only the authentication-selection field from settings.json. MCP, tool, session, and temporary configuration are excluded.

Claude coordination

This change does not duplicate the open Claude account-pinning work in #6963, which already covers worktree-scoped CLAUDE_CONFIG_DIR, Keychain, daemon, and reattach behavior related to #6921 and #9496. A shared Claude account reference should follow the final upstream contract after that PR is resolved.

Security Audit

  • Renderer-facing account summaries omit managed paths and credential content.
  • Provider rosters and selections are main-owned and stripped from generic settings writes.
  • Import paths come from the main-process directory picker, not renderer input.
  • Credential files must be regular, non-symlink files no larger than 1 MB.
  • Token-shaped values are bounded and reject newlines and NUL bytes.
  • Managed homes require an exact account path and ownership marker before launch or deletion.
  • Managed directories use owner-only permissions where supported.
  • Gemini OAuth credentials are consumed only by Gemini CLI through its documented home override; Orca does not use them for direct Google API calls.

Testing

  • pnpm lint

  • pnpm typecheck

  • pnpm test

  • pnpm build

  • Added or updated high-quality tests that would catch regressions

  • Current focused rerun: 8 files, 65 tests passed.

  • Earlier expanded focused suite: 11 files, 85 tests passed.

  • pnpm typecheck

  • pnpm lint

  • pnpm run build:desktop

  • Native macOS build via env -u npm_execpath node config/scripts/build-native-for-platform.mjs

  • pnpm test fully green on this workstation

The full suite passed 48,518 tests. Two Git-environment failures passed after removing inherited Orca Git config variables. The remaining six local failures are the existing baseline in check-root-directory-entries.test.mjs and ssh-posix-command-wrapper.test.ts.

Screenshots

Posted in #13276 (comment) from an isolated Electron profile (production userData unused):

  1. Grok Accounts — system default selected
  2. Grok Accounts — one imported managed home + removal confirmation
  3. Gemini Accounts — system default selected
  4. Gemini Accounts — one imported managed home + removal confirmation

Rebased onto current main on 2026-08-13. Account-filter / managed-home behavior now rides the usage-provider IPC that landed on main. Localization keys from this stack were merged with newer settings copy.

Follow-ups intentionally excluded

  • Built-in Grok device-code or Gemini browser-login orchestration
  • Provider account enumeration without a documented stable contract
  • Per-account usage, billing, or session attribution
  • Claude account-ref changes before the upstream Claude implementation settles

Notes

@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from 8ae34ad to d73da52 Compare August 13, 2026 14:17
@rp0927

rp0927 commented Aug 13, 2026

Copy link
Copy Markdown
Author

Rebased onto current origin/main (392 commits). Conflict resolutions kept main’s usage-provider IPC/lifecycle and PTY cwd prevalidation, and ported account-filter / managed-home behavior onto those paths. Localization keys were merged rather than dropped. Stack branches were force-pushed with --force-with-lease. GitHub will not accept another fork branch as the base, so these PRs still target main and still contain the full stack below them — review bottom-up starting at #13183.
Screenshots for Grok/Gemini Accounts (system default, one imported account, removal confirmation) are still the remaining Ready gate.

@rp0927

rp0927 commented Aug 13, 2026

Copy link
Copy Markdown
Author

Accounts UI screenshots from an isolated Electron profile (ORCA_E2E_USER_DATA_DIR / ORCA_E2E_HOME_DIR only — production Orca userData was not used). Seeded one Grok Personal and one Gemini Personal account, then captured system-default, imported, and remove-confirm for each provider.

Grok

System default (Active)
Grok system default

Imported Personal account (Active)
Grok imported Personal

Remove confirmation
Grok remove confirmation

Gemini

Imported Personal account (Active)
Gemini imported Personal

Remove confirmation
Gemini remove confirmation

System default (Active)
Gemini system default

Source files: https://github.com/rp0927/orca/tree/pr-13276-screenshots

@rp0927
rp0927 marked this pull request as ready for review August 13, 2026 14:40
@greptile-apps

greptile-apps Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Too many files changed for review (167 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@rp0927
rp0927 requested a review from brennanb2025 as a code owner August 13, 2026 14:42
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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

<hidden_new_layer>
<cohort_id>provider-account-platform</cohort_id>
<insert_after_layer_id>shared-contracts-and-ui</insert_after_layer_id>

The change wires account services, runtime dependencies, IPC registration, launch environment handling, model discovery, settings propagation, and supporting tests across the application. range_e60da6876f23 range_a8f18bd12f0f range_4ee61ad9a05a range_ce4f9e911341 range_fb2e3a8579db range_c82dc8cddb98 range_ad605b6d4587 range_9b936cada65d range_699eb124f12d range_f57b7ecb43c1 range_8f62e047fc4f range_9e005f4751aa range_7bd1a4a4f034 range_b1a8e8f2d321 range_207e2e985849 range_76314f803e5a range_46135f0eb9af range_bdef2c200146 range_f02120377d3b range_11bff238ed21 range_a62f5bf95b3c range_354a35c62969 range_0fe1336839e4 range_382fbc1638ab range_85425f109dc5 range_da20d0e00137 range_54e6ff11fd13 range_3b0fed612c6b range_0c271c1ae6cc range_531fd1e3656d range_056619936f93 range_c9559faba0bc range_e60070dee173 range_45e56f18f07a range_c79f416183bf range_3ba69618df6d range_8685365ebd04 range_6265d9f06096 range_27b2681c8180 range_9876038a13db range_4aeabc40abf2 range_2c68235a6247 range_34dde092a9ac range_dfce4c1b4067 range_6a386bed747b range_2ddbf057a794 range_9b1dd138b8f1 range_fe18b23675d2 range_8ef0d45acd0e range_86cb65e72f6d range_0207d1dc0aa9 range_cc4160792a72 range_ff70dba6d686 range_73b0386b6fcf range_87640dbc0617 range_8e46d90135b9 range_49969edfe4ff range_a4a995df45a7 range_d17b63e9f518 range_4753db39f1a9 range_5ee3a41f73c4 range_af9775a42259 range_92dc1d7e64de range_f7d700fe9077 range_ed2139c36957 range_0632473077a3 range_4c25d6d79428 range_7c564c815394 range_8950d664316e range_a559ba59e67c range_bcd6233d5f83 range_ccd973487592 range_2f03466e0305 range_1c9804a9d6e3 range_efac87f83c7e range_16bb7bc0b4bc range_16e8e81bf575 range_461ebe429f68 range_23466fe2e862 range_7ceebd29638b range_621e10dcb5e9 range_476e49919b6d range_07e8f3ddbd35 range_19b5cefb3414 range_f47c39b1b6fe range_4bfad7f9a13b range_b4c1e1b7bf9c range_80b66e7b75e3 range_576dad6357d1 range_3ed2c7e37f93 range_f722dc9216a9 range_bcc2c434be9c range_0790bd3db492 range_581955b8e9b7 range_e521c454dee2 range_8409d74de899 range_9bb56a484405 range_cc4a86f6e8b6 range_d511f5c517d8 range_e8220509068f range_42ab58b592ea range_fce4fca672b0 range_4d5a4b58658c range_c421d1b70b52 range_a79f4711e3d0 range_d52f273a337d range_d534bbaecf90 range_b984948e5727 range_ad1cff66a123 range_10d1e2c732eb range_06a9fc15a5a5 range_8c0fb0202c88 range_c47c9e4ed1b3 range_f9741f745bd0 range_a52552ddcaa6 range_5d901caf7af2 range_09141f67255d range_52057630c5bb range_aa7e06c15434 range_0ea559aa10b9 range_e083d2281ee1 range_b6a2e44ac224 range_c725932be008 range_9b3878c5d187 range_89e8184e4b3e range_8aa0a3be3187 range_1ad4ba6d355e range_e89f3073900e range_f60e9d7af8fb range_aff30971ce74 range_87f2f149a835 range_00715ac964f8 range_264390556a4c range_b6733bb9da36 range_5c69a265d1d5 range_3dcda6649c2e range_77e1124ca136 range_712a8888ed08 range_7e9ba170642e range_c756dbeb50fc range_3088b2191353 range_522cd1f0ad0a range_b0c5fcf04e66 range_6a35f4338306 range_9bf90f8e07f7 range_4fe3783aa254 range_dfe5340e3f96 range_f093b817f6ee range_2c4e5873e396 range_2fc7793e449a range_d8a01396e10b range_6c2ac2be9ef1 range_cccd66822901 range_b98ff9d2fec4 range_3c35c399a745 range_7c7dbaec1330 range_9187b7ff693f range_85bb7c016128 range_102ab47b5ad6 range_0f8b0bf29e3d range_b659cefd8a36 range_5650ab465c17 range_af2cb1f0c47 range_0e7947d2f8fd range_38ddd6cb7f97 range_b9703b90e650 range_41c88b258cc6 range_f17eeb881657 range_0d639717148b range_9ace194591c4
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.82% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: adding managed Grok and Gemini homes.
Description check ✅ Passed The description clearly explains scope, behavior, security, testing, limitations, and visual proof, but it omits the required Linked Issue section.
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.

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: 11

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts (1)

63-71: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Keep model validation scoped to the selected account.

Line 63 accepts a persisted model when any settled PTY lists it. Codex PTYs can now have different account-specific model lists. A model available for pty-a can therefore remain selected for pty-b, even when pty-b does not support it.

Pass the launch discovery scope or account identity into this resolver. Validate the model only against that scope. Do not use another account's discovery result to approve the launch model.

src/renderer/src/runtime/runtime-git-client.ts (1)

698-713: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Validate PTY ownership before forwarding it to the runtime. Unknown handles fall back to prepareForCodexLaunch(), which can select the active account home. Reject local PTY IDs for remote targets and require scoped remote IDs to match the target environment before forwarding them.

🟡 Minor comments (10)
src/renderer/src/components/native-chat/use-native-chat-session-options.ts-228-237 (1)

228-237: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Apply cached models to the active surface.

A probe can settle between the render that creates surface and this effect. The subscription does not replay. This branch retires persisted state, but it leaves surface on seed models until another event occurs.

Call surface.replaceModels(cached) before retiring the persisted model.

Proposed fix
     if (cached) {
+      surface.replaceModels(cached)
       void retirePersistedModelMissingFromDiscovery(agent, cached).catch(() => undefined)
     }
src/renderer/src/components/settings/ManagedCliHomeAccountsControl.tsx-267-281 (1)

267-281: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Disable the destructive Remove button while another operation runs.

Every other button in this control passes disabled={action !== null}. The dialog Remove button does not. If a select or import operation is in flight, the user can still start a removal. Both operations then call setState with their own response, and the later response overwrites the earlier one. KimiAccountsSection.tsx guards the equivalent button at Line 356.

🛡️ Proposed fix
             <Button
               variant="destructive"
+              disabled={action !== null}
               onClick={() => {
src/renderer/src/components/settings/KimiAccountsSection.tsx-25-33 (1)

25-33: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Localize the fallback error message.

Line 31 returns a raw English string. This string reaches the UI through the role="alert" paragraph at Line 223. The sibling control ManagedCliHomeAccountsControl.tsx wraps the same fallback in translate(...). Use translate(...) here for consistency.

🌐 Proposed fix
-      .trim() || 'Kimi account update failed.'
+      .trim() ||
+    translate(
+      'auto.components.settings.KimiAccountsSection.updateFailed',
+      'Kimi account update failed.'
+    )

Add the new key to src/renderer/src/i18n/locales/en.json and run pnpm sync:localization-catalog.

Based on learnings, user-facing strings inside settings components must be localized with translate(...) and the key added to en.json.

Source: Learnings

src/renderer/src/components/settings/KimiAccountsSection.tsx-145-162 (1)

145-162: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the duplicated description paragraph.

The key 271d3f21b7 renders the same sentence twice: once as the SearchableSetting description and again in the <p> at Lines 157-162. The user sees the identical sentence two times. Drop the inner paragraph.

♻️ Proposed fix
         keywords={['kimi', 'account', 'credentials', 'config', 'switch']}
         className="space-y-3 py-2"
       >
-        <p className="text-xs text-muted-foreground">
-          {translate(
-            'auto.components.settings.KimiAccountsSection.271d3f21b7',
-            'Import config.toml and credentials from an existing Kimi Code home. Sessions and logs stay in the original home.'
-          )}
-        </p>
         <div className="space-y-2">

Note: KimiAccountsSection.test.tsx at Lines 95-99 asserts this sentence with getByText, which fails on duplicate matches today only if both nodes are rendered; verify the test still passes after the change.

src/cli/specs/core.ts-236-245 (1)

236-245: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document system-account runtime flags as system-only. Both usage strings imply that managed UUID accounts can use --account-runtime and --wsl-distro. The runtime rejects that combination because managed accounts already identify their runtime.

  • src/cli/specs/core.ts#L236-L245: split the UUID and system-account usage forms, or state that runtime flags require --account system.
  • src/cli/help.ts#L246-L246: apply the same system-only constraint in root help.
src/main/command-code-accounts/auth-file.ts-37-39 (1)

37-39: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Separate the empty-file case from the size-limit message.

The condition covers info.size <= 0, but the error text reports only the 1 MB limit. An empty auth.json produces a misleading message.

🐛 Split the two checks
-  if (info.size <= 0 || info.size > MAX_AUTH_FILE_BYTES) {
+  if (info.size <= 0) {
+    throw new Error('Command Code auth.json is empty.')
+  }
+  if (info.size > MAX_AUTH_FILE_BYTES) {
     throw new Error('Command Code auth.json exceeds the 1 MB safety limit.')
   }
src/main/command-code-accounts/launch-environment.ts-19-20 (1)

19-20: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle managed credential resolution failures. getSelectedApiKey is called without a catch on both local PTY launch paths. If the selected account or auth file is stale, the eligible command-code launch fails instead of using args.env. Catch the resolver error and treat it as no managed account selected.

src/main/rate-limits/service.ts-805-808 (1)

805-808: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Propagate the fetch abort signal through the Kimi fetcher.

fetchKimiRateLimits accepts only home, so the inactive-account call and fetchKimiWithResolvedHome drop signal. Add the option and combine it with the existing credential-read and request timeouts.

src/main/ipc/settings.ts-109-112 (1)

109-112: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Broadcast managed-account changes to other windows.

The sanitized settings:changed update removes account rosters and active IDs. Dedicated account handlers return state only to the invoking renderer, and account sections load only on mount. Add a managed-account change event or refetch account state when a window gains focus.

src/main/provider-managed-homes/ownership.ts (1)

33-41: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Handle missing managed roots before canonicalizing ownership paths. The ownership validators check the candidate path but canonicalize the managed root or expected home without first checking that those paths exist. A tampered or stale account can therefore produce a raw filesystem error instead of the intended ownership failure, and callers may expose an absolute managed path. Check the root and expected home first, then return the path-safe domain error.

🧹 Nitpick comments (13)
src/renderer/src/components/settings/ManagedCliHomeAccountsControl.test.tsx (1)

30-59: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use separate mocks per provider so provider routing is covered.

Line 34 assigns the same grokApi object to geminiAccounts. The gemini test at Line 50 therefore passes even if getApi routes a gemini request to window.api.grokAccounts. Credential homes are provider-scoped, so this routing deserves coverage. Add a distinct geminiApi mock.

💚 Proposed test change
 const grokApi = {
   list: vi.fn(),
   import: vi.fn(),
   select: vi.fn(),
   remove: vi.fn()
 }
+const geminiApi = {
+  list: vi.fn(),
+  import: vi.fn(),
+  select: vi.fn(),
+  remove: vi.fn()
+}
+
+const accountsState = {
+  accounts: [
+    {
+      id: 'grok-a',
+      provider: 'grok',
+      label: 'Work',
+      createdAt: 1,
+      updatedAt: 1,
+      lastAuthenticatedAt: 1
+    }
+  ],
+  activeAccountId: 'grok-a'
+}
 
 beforeEach(() => {
   vi.clearAllMocks()
-  grokApi.list.mockResolvedValue({
-    accounts: [
-      {
-        id: 'grok-a',
-        provider: 'grok',
-        label: 'Work',
-        createdAt: 1,
-        updatedAt: 1,
-        lastAuthenticatedAt: 1
-      }
-    ],
-    activeAccountId: 'grok-a'
-  })
+  grokApi.list.mockResolvedValue(accountsState)
+  geminiApi.list.mockResolvedValue(accountsState)
   Object.defineProperty(window, 'api', {
     configurable: true,
     value: {
       grokAccounts: grokApi,
-      geminiAccounts: grokApi
+      geminiAccounts: geminiApi
     }
   })
 })

Then assert geminiApi.import in the gemini test and add expect(grokApi.import).not.toHaveBeenCalled().

src/renderer/src/components/settings/ManagedCliHomeAccountsControl.tsx (1)

162-162: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Announce the error text to assistive technology.

The error paragraph has no live-region role. Screen readers do not announce the import or removal failure. KimiAccountsSection.tsx uses role="alert" at Line 223 for the same purpose.

♿ Proposed fix
-      {error ? <p className="text-xs text-destructive">{error}</p> : null}
+      {error ? (
+        <p role="alert" className="text-xs text-destructive">
+          {error}
+        </p>
+      ) : null}
src/renderer/src/runtime/runtime-git-client.test.ts (1)

746-763: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for a remote-form PTY id on the local path.

The two new tests cover a remote id on the remote path and a local id on the local path. The guard at runtime-git-client.ts Line 704 also drops a remote-form id when the target is local. Add a case that passes 'remote:env-1@@pty-account-b' with activeRuntimeEnvironmentId: null and asserts the local IPC payload contains no ptyId.

src/main/ipc/pty.test.ts (1)

2169-2202: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the agent-mismatch rejection.

registerPtyHandlers also throws agent_session_account_account_agent_mismatch-style errors when launchAgent is not codex or providerAccountRef.provider is not codex (pty.ts lines 6079-6084). No test exercises that branch. Add one case with launchAgent: 'claude' and a codex account reference.

src/main/ipc/pty.ts (1)

4716-4749: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the repeated managed-provider launch-env application.

The same four calls appear here and again at lines 6460-6493, each repeating launchAgent, connectionId, runtime: codexSelectionTarget.runtime === 'wsl' ? 'wsl' : 'host', and reattached. A single helper that takes the shared context and the selector callbacks would remove eight near-identical blocks and keep the two spawn paths in sync when a fifth provider is added.

♻️ Sketch of the shared helper
// new module, e.g. src/main/provider-managed-homes/apply-launch-env.ts
export function applyManagedProviderLaunchEnvs(
  env: Record<string, string> | undefined,
  ctx: {
    launchAgent?: TuiAgent
    connectionId?: string | null
    runtime: 'host' | 'wsl'
    reattached: boolean
  },
  selectors: {
    getSelectedKimiHomePath?: GetSelectedKimiHomePath
    getSelectedCommandCodeApiKey?: GetSelectedCommandCodeApiKey
    getSelectedGrokHomePath?: GetSelectedManagedProviderHomePath
    getSelectedGeminiHomePath?: GetSelectedManagedProviderHomePath
  }
): Record<string, string> | undefined {
  let next = applyKimiManagedHomeToLaunchEnv({
    env: next ?? env,
    ...ctx,
    getSelectedManagedHomePath: selectors.getSelectedKimiHomePath
  })
  // ...command-code, grok, gemini in the same order
  return next
}
src/main/provider-managed-homes/service.test.ts (1)

112-127: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for renameAccount and for ownership-marker rejection.

The suite covers import, select, remove, label and credential validation, and symbolic-link rejection. Two behaviors of the new service remain untested. renameAccount normalizes the label and stamps updatedAt. assertOwnedManagedProviderHome rejects a managed home whose marker content does not match the account ID; that check protects selection and removal. Add one rename case and one case that rewrites the marker file and expects getSelectedManagedHomePath() to throw.

src/main/provider-managed-homes/service.ts (1)

202-228: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Stop the rollback from deleting a home that settings already reference.

this.store.updateSettings(...) at line 215 persists the account, and this.listAccounts() at line 216 runs inside the same try. If any call after line 215 throws, the catch removes accountRoot. Settings then keep an account whose managed home no longer exists, and later selection fails with "does not exist on disk".

Track whether the account was persisted and skip the directory removal in that case.

♻️ Proposed reordering
+    let persisted = false
     try {
       mkdirSync(pendingRoot, { recursive: false, mode: 0o700 })
@@
       this.store.updateSettings(accountSettingsUpdate(this.provider, nextAccounts, id))
+      persisted = true
       return this.listAccounts()
     } catch (error) {
       rmSync(pendingRoot, { recursive: true, force: true })
-      rmSync(accountRoot, { recursive: true, force: true })
+      if (!persisted) {
+        rmSync(accountRoot, { recursive: true, force: true })
+      }
src/main/rate-limits/service.ts (2)

470-484: 🚀 Performance & Scalability | 🔵 Trivial

A Kimi account switch triggers a full provider refresh.

Line 482 calls this.fetchAll({ force: true }). Every Kimi account switch therefore re-reads Claude, Codex, Gemini, OpenCode Go, MiniMax, and Grok. The Codex and Claude switch handlers use dedicated lanes (fetchCodexOnly, fetchClaudeOnly) precisely to avoid spending other providers' request budget. Consider adding a Kimi-only cycle and queue flag that mirrors runFetchCodexOnlyCycle, so a switch refreshes only the Kimi bar.


770-842: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Consider one generic inactive-account lane.

fetchInactiveKimiAccountsOnOpen is the third copy of the same algorithm, after the Claude version at lines 595-670 and the Codex version at lines 672-768. The membership check, prune method, cache, fetching set, generation counter, debounce timestamp, and evict method are also triplicated. A single parameterized lane, keyed by a provider descriptor that supplies the resolver, the cache, and the fetch call, would keep the abort and generation guards in one place. Each new managed provider then adds a descriptor instead of about 120 lines.

Also applies to: 863-865, 899-926

src/main/kimi-accounts/launch-environment.test.ts (1)

18-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a case for a non-Kimi launchAgent.

The table covers SSH, WSL, and reattach. It omits the launchAgent !== 'kimi' guard. That guard prevents KIMI_CODE_HOME from entering launches of other agents, so it deserves coverage.

♻️ Proposed additional table case
   it.each([
     { name: 'SSH', connectionId: 'ssh-1', runtime: 'host' as const, reattached: false },
     { name: 'WSL', connectionId: null, runtime: 'wsl' as const, reattached: false },
-    { name: 'reattach', connectionId: null, runtime: 'host' as const, reattached: true }
+    { name: 'reattach', connectionId: null, runtime: 'host' as const, reattached: true },
+    {
+      name: 'other agent',
+      connectionId: null,
+      runtime: 'host' as const,
+      reattached: false,
+      launchAgent: 'claude'
+    }
   ])(
     'does not leak a host managed home into $name launches',
-    ({ connectionId, runtime, reattached }) => {
+    ({ connectionId, runtime, reattached, launchAgent = 'kimi' }) => {
       const resolver = vi.fn(() => '/managed/kimi/account-a/home')
       const env = { PATH: '/bin' }
 
       expect(
         applyKimiManagedHomeToLaunchEnv({
           env,
-          launchAgent: 'kimi',
+          launchAgent,
           connectionId,
src/main/kimi-accounts/managed-home-ownership.ts (1)

12-15: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

One duplicated isInside helper guards two separate security boundaries. Both files define the same path-containment function. Neither copy folds case on win32, unlike pathsEqual in src/main/kimi-accounts/managed-home-ownership.ts. A single shared implementation fixes the Windows behavior in both places and prevents the copies from drifting.

  • src/main/kimi-accounts/managed-home-ownership.ts#L12-L15: replace this copy with a shared import, and fold case on win32 so the system-home containment check at line 39 stays restrictive.
  • src/main/kimi-accounts/managed-home-copy.ts#L21-L24: replace this copy with the same shared import so the import-escape check at line 48 uses identical semantics.

Export the shared helper from the src/main/provider-managed-homes/ module that this cohort already adds.

src/main/ipc/register-core-handlers.ts (1)

124-127: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Use a named-options object for registerCoreHandlers. The function now accepts 22 positional parameters, including two adjacent services with the same type. Named properties would prevent provider-service swaps and simplify future changes.

src/main/ipc/usage-provider-handlers.ts (1)

18-38: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Type accountFilter per provider and retain Codex runtime validation.

CodexUsageStore already normalizes and rejects malformed filters before its query builders. Use a filter type parameter or a Codex-specific handler contract so Claude and OpenCode do not expose accountFilter.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e21df7c4-8a88-458e-a7a0-172155197e0e

📥 Commits

Reviewing files that changed from the base of the PR and between 9a81874 and d73da5211cbde771c0cbb148681df8bce5cee314.

📒 Files selected for processing (153)
  • src/cli/handlers/account.test.ts
  • src/cli/handlers/account.ts
  • src/cli/handlers/terminal.test.ts
  • src/cli/handlers/terminal.ts
  • src/cli/help.ts
  • src/cli/specs/core.ts
  • src/main/agent-hooks/server.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/ai-vault/cached-session-list.test.ts
  • src/main/ai-vault/cached-session-list.ts
  • src/main/ai-vault/session-scanner-agent-sources.ts
  • src/main/ai-vault/session-scanner-kimi-managed.test.ts
  • src/main/ai-vault/session-scanner-types.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/main/codex-accounts/runtime-home-service.ts
  • src/main/codex-usage/codex-usage-provider.ts
  • src/main/codex-usage/scanner-paths.test.ts
  • src/main/codex-usage/scanner.ts
  • src/main/codex-usage/store-snapshot.benchmark.test.ts
  • src/main/codex-usage/store.test.ts
  • src/main/codex-usage/store.ts
  • src/main/codex-usage/types.ts
  • src/main/codex/codex-session-account-attribution.test.ts
  • src/main/codex/codex-session-account-attribution.ts
  • src/main/codex/codex-session-account-registry.test.ts
  • src/main/codex/codex-session-account-registry.ts
  • src/main/command-code-accounts/auth-file.ts
  • src/main/command-code-accounts/launch-environment.test.ts
  • src/main/command-code-accounts/launch-environment.ts
  • src/main/command-code-accounts/ownership.ts
  • src/main/command-code-accounts/service.test.ts
  • src/main/command-code-accounts/service.ts
  • src/main/index.ts
  • src/main/ipc/command-code-accounts.test.ts
  • src/main/ipc/command-code-accounts.ts
  • src/main/ipc/filesystem.test.ts
  • src/main/ipc/filesystem.ts
  • src/main/ipc/gemini-accounts.ts
  • src/main/ipc/grok-accounts.ts
  • src/main/ipc/kimi-accounts.test.ts
  • src/main/ipc/kimi-accounts.ts
  • src/main/ipc/provider-managed-home-handlers.test.ts
  • src/main/ipc/provider-managed-home-handlers.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/ipc/rate-limits.test.ts
  • src/main/ipc/rate-limits.ts
  • src/main/ipc/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/ipc/usage-provider-handlers.test.ts
  • src/main/ipc/usage-provider-handlers.ts
  • src/main/kimi-accounts/launch-environment.test.ts
  • src/main/kimi-accounts/launch-environment.ts
  • src/main/kimi-accounts/login-runner.test.ts
  • src/main/kimi-accounts/login-runner.ts
  • src/main/kimi-accounts/managed-home-copy.ts
  • src/main/kimi-accounts/managed-home-ownership.ts
  • src/main/kimi-accounts/managed-login-provisioning.ts
  • src/main/kimi-accounts/service.test.ts
  • src/main/kimi-accounts/service.ts
  • src/main/kimi/hook-service.test.ts
  • src/main/kimi/hook-service.ts
  • src/main/provider-managed-homes/credential-scope.ts
  • src/main/provider-managed-homes/launch-environment.test.ts
  • src/main/provider-managed-homes/launch-environment.ts
  • src/main/provider-managed-homes/ownership.test.ts
  • src/main/provider-managed-homes/ownership.ts
  • src/main/provider-managed-homes/service.test.ts
  • src/main/provider-managed-homes/service.ts
  • src/main/rate-limits/service.test.ts
  • src/main/rate-limits/service.ts
  • src/main/runtime/orca-runtime-agent-session-operation.test.ts
  • src/main/runtime/orca-runtime-git.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/agent-session.test.ts
  • src/main/runtime/rpc/methods/agent-session.ts
  • src/main/runtime/rpc/methods/ai-vault.test.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/main/runtime/rpc/methods/git.test.ts
  • src/main/runtime/rpc/methods/git.ts
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/main/usage/usage-event-aggregation.ts
  • src/main/usage/usage-provider-contract.ts
  • src/main/usage/usage-rollup-merge.ts
  • src/main/usage/usage-rollup-records.ts
  • src/main/window/attach-main-window-services.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/preload/usage-provider-api.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
  • src/renderer/src/components/native-chat/use-native-chat-session-options.ts
  • src/renderer/src/components/settings/AccountsPane.test.tsx
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.test.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.tsx
  • src/renderer/src/components/settings/GrokAccountsSection.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.tsx
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.test.tsx
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.tsx
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/stats/CodexUsagePane.tsx
  • src/renderer/src/components/stats/codex-usage-account-filter.test.ts
  • src/renderer/src/components/stats/codex-usage-account-filter.ts
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsx
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/tab-bar/codex-launch-account-options.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/lib/launch-agent-web-host-tab.ts
  • src/renderer/src/lib/runtime-agent-background-create.ts
  • src/renderer/src/runtime/remote-agent-session-launch.test.ts
  • src/renderer/src/runtime/remote-agent-session-launch.ts
  • src/renderer/src/runtime/runtime-git-client.test.ts
  • src/renderer/src/runtime/runtime-git-client.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/renderer/src/store/slices/rate-limits.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/renderer/src/store/slices/usage-provider-slices.ts
  • src/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/agent-session-host-authority.ts
  • src/shared/agent-session-option-catalog-claude-codex.ts
  • src/shared/agent-session-option-catalog.test.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/codex-model-list-probe.test.ts
  • src/shared/codex-model-list-probe.ts
  • src/shared/codex-usage-account-filter-contract.test.ts
  • src/shared/codex-usage-account-filter-contract.ts
  • src/shared/codex-usage-types.ts
  • src/shared/commit-message-agent-spec.ts
  • src/shared/constants.ts
  • src/shared/protocol-version.ts
  • src/shared/provider-account-ref.test.ts
  • src/shared/provider-account-ref.ts
  • src/shared/rate-limit-types.ts
  • src/shared/types.ts

Comment thread src/main/index.ts Resolved
Comment thread src/main/kimi-accounts/service.ts Resolved
Comment thread src/main/runtime/orca-runtime.ts Resolved

@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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4af6de0-75d1-4156-9581-3818e2e17bb9

📥 Commits

Reviewing files that changed from the base of the PR and between d73da5211cbde771c0cbb148681df8bce5cee314 and 255db1de159a168b73a550a0b68cdf3b2e964b0f.

📒 Files selected for processing (24)
  • src/cli/help.ts
  • src/cli/specs/core.ts
  • src/main/command-code-accounts/service.test.ts
  • src/main/command-code-accounts/service.ts
  • src/main/index.ts
  • src/main/kimi-accounts/login-runner.test.ts
  • src/main/kimi-accounts/login-runner.ts
  • src/main/kimi-accounts/managed-login-provisioning.ts
  • src/main/kimi-accounts/service.test.ts
  • src/main/kimi-accounts/service.ts
  • src/main/provider-managed-homes/credential-scope.ts
  • src/main/provider-managed-homes/service.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/provider-account-workspace-scope.test.ts
  • src/main/runtime/provider-account-workspace-scope.ts
  • src/main/runtime/rpc/methods/agent-session.ts
  • src/main/usage/usage-event-aggregation.test.ts
  • src/main/usage/usage-event-aggregation.ts
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
  • src/renderer/src/components/tab-bar/codex-launch-account-options.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.ts
  • src/renderer/src/store/slices/usage-provider-account-filter.test.ts
  • src/renderer/src/store/slices/usage-provider-slices.ts
  • src/shared/types.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
🚧 Files skipped from review as they are similar to previous changes (16)
  • src/cli/help.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.test.ts
  • src/main/kimi-accounts/service.test.ts
  • src/cli/specs/core.ts
  • src/main/provider-managed-homes/credential-scope.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.ts
  • src/shared/types.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/provider-managed-homes/service.test.ts
  • src/main/runtime/rpc/methods/agent-session.ts
  • src/main/command-code-accounts/service.ts
  • src/main/kimi-accounts/managed-login-provisioning.ts
  • src/main/usage/usage-event-aggregation.ts
  • src/renderer/src/store/slices/usage-provider-slices.ts
  • src/main/kimi-accounts/service.ts
  • src/main/index.ts

Comment thread src/main/kimi-accounts/login-runner.ts Resolved
Comment thread src/main/kimi-accounts/login-runner.ts Resolved
@euclodius

Copy link
Copy Markdown

Cross-linking #13839 for coordination. That PR fixes Grok Usage auth resolution for Orca's configured Windows host/WSL runtime. It does not change managed-home launch selection or claim per-managed-account usage attribution.

#13276 and #13839 touch some of the same Grok account/IPC/service wiring but have separate responsibilities. Please keep the runtime-aware system-default Usage path intact if this managed-home stack lands first.

@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from 4356a77 to 3979378 Compare August 14, 2026 03:32
@rp0927

rp0927 commented Aug 14, 2026

Copy link
Copy Markdown
Author

Rebased onto current origin/main (64 commits) to clear the merge conflicts.

@euclodius thanks for the #13839 pointer. This stack still does not claim per-managed-account Grok usage attribution. grokAccounts:getStatus continues to call getGrokAccountStatus() unchanged, and managed Grok homes are used only for new local-launch GROK_HOME selection. The runtime-aware system-default Usage/auth path from #13839 can land independently.

Conflict resolutions in this rebase kept main's Codex effort-ceiling catalog and newer settings copy, and added the stacked account-home/IPC pieces on top. Localization keys were merged rather than dropped.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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.

@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

♻️ Duplicate comments (1)
src/main/codex-accounts/runtime-home-service.ts (1)

297-307: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Seed the shared mirror from the system default for explicit host system-default launches.

When accountId === null and the real-home lane is unavailable, syncForCurrentSelection({ runtime: 'host' }) returns through the globally selected self-contained managed account path. The shared mirror therefore keeps stale managed or missing auth while this branch returns its path.

🧹 Nitpick comments (3)
src/main/ipc/kimi-accounts.ts (1)

5-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated isBoundedText validator in two new account IPC modules. Both files define the same bounded-text rule for IPC input, so the two copies can drift and a fix applied to one file leaves the other unprotected. Extract one implementation into a concretely named module, for example src/main/ipc/account-input-validation.ts.

  • src/main/ipc/kimi-accounts.ts#L5-L13: remove the local definition and import the shared validator.
  • src/main/ipc/provider-managed-home-handlers.ts#L4-L12: remove the local definition and import the same shared validator.
src/main/provider-managed-homes/service.test.ts (1)

86-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the credential non-disclosure assertion effective for Gemini.

Line 90 asserts that the serialized state does not contain secret. Only the Grok fixture writes a value containing secret (Line 39). For Gemini the fixture tokens are access and refresh, so the assertion cannot fail and gives no coverage. Assert the provider's own secret markers.

♻️ Proposed test change
-    expect(JSON.stringify(state)).not.toContain('secret')
+    const secretMarkers = provider === 'grok' ? ['grok-secret'] : ['access', 'refresh']
+    for (const marker of secretMarkers) {
+      expect(JSON.stringify(state)).not.toContain(marker)
+    }
src/main/rate-limits/service.ts (1)

770-842: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Extract the inactive-account fetch, prune, and evict machinery into one provider-parameterized helper.

fetchInactiveKimiAccountsOnOpen is the third near-identical copy of this loop, after fetchInactiveClaudeAccountsOnOpen (Lines 595-670) and fetchInactiveCodexAccountsOnOpen (Lines 672-768). pruneInactiveKimiState (Lines 899-913) and evictInactiveKimiCache (Lines 922-926) repeat the same pattern again. The differences per provider are small: the cache, the fetching set, the generation counter, the debounce timestamp, the optional stagger delay, and the fetch call.

Group the per-provider state into one record and drive the shared loop from it. This removes three copies of the abort, generation, membership, and cleanup checks, where a fix currently must be applied three times.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c30e7cd0-2ad4-4b40-992d-665294a6aed1

📥 Commits

Reviewing files that changed from the base of the PR and between 400321e and 3979378856f80c34730c421b84e3005e3ceccf69.

📒 Files selected for processing (157)
  • src/cli/handlers/account.test.ts
  • src/cli/handlers/account.ts
  • src/cli/handlers/terminal.test.ts
  • src/cli/handlers/terminal.ts
  • src/cli/help.ts
  • src/cli/specs/core.ts
  • src/main/agent-hooks/server.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/ai-vault/cached-session-list.test.ts
  • src/main/ai-vault/cached-session-list.ts
  • src/main/ai-vault/session-scanner-agent-sources.ts
  • src/main/ai-vault/session-scanner-kimi-managed.test.ts
  • src/main/ai-vault/session-scanner-types.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/main/codex-accounts/runtime-home-service.ts
  • src/main/codex-usage/codex-usage-provider.ts
  • src/main/codex-usage/scanner-paths.test.ts
  • src/main/codex-usage/scanner.ts
  • src/main/codex-usage/store-snapshot.benchmark.test.ts
  • src/main/codex-usage/store.test.ts
  • src/main/codex-usage/store.ts
  • src/main/codex-usage/types.ts
  • src/main/codex/codex-session-account-attribution.test.ts
  • src/main/codex/codex-session-account-attribution.ts
  • src/main/codex/codex-session-account-registry.test.ts
  • src/main/codex/codex-session-account-registry.ts
  • src/main/command-code-accounts/auth-file.ts
  • src/main/command-code-accounts/launch-environment.test.ts
  • src/main/command-code-accounts/launch-environment.ts
  • src/main/command-code-accounts/ownership.ts
  • src/main/command-code-accounts/service.test.ts
  • src/main/command-code-accounts/service.ts
  • src/main/index.ts
  • src/main/ipc/command-code-accounts.test.ts
  • src/main/ipc/command-code-accounts.ts
  • src/main/ipc/filesystem.test.ts
  • src/main/ipc/filesystem.ts
  • src/main/ipc/gemini-accounts.ts
  • src/main/ipc/grok-accounts.ts
  • src/main/ipc/kimi-accounts.test.ts
  • src/main/ipc/kimi-accounts.ts
  • src/main/ipc/provider-managed-home-handlers.test.ts
  • src/main/ipc/provider-managed-home-handlers.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/ipc/rate-limits.test.ts
  • src/main/ipc/rate-limits.ts
  • src/main/ipc/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/ipc/usage-provider-handlers.test.ts
  • src/main/ipc/usage-provider-handlers.ts
  • src/main/kimi-accounts/launch-environment.test.ts
  • src/main/kimi-accounts/launch-environment.ts
  • src/main/kimi-accounts/login-runner.test.ts
  • src/main/kimi-accounts/login-runner.ts
  • src/main/kimi-accounts/managed-home-copy.ts
  • src/main/kimi-accounts/managed-home-ownership.ts
  • src/main/kimi-accounts/managed-login-provisioning.ts
  • src/main/kimi-accounts/service.test.ts
  • src/main/kimi-accounts/service.ts
  • src/main/kimi/hook-service.test.ts
  • src/main/kimi/hook-service.ts
  • src/main/provider-managed-homes/credential-scope.ts
  • src/main/provider-managed-homes/launch-environment.test.ts
  • src/main/provider-managed-homes/launch-environment.ts
  • src/main/provider-managed-homes/ownership.test.ts
  • src/main/provider-managed-homes/ownership.ts
  • src/main/provider-managed-homes/service.test.ts
  • src/main/provider-managed-homes/service.ts
  • src/main/rate-limits/service.test.ts
  • src/main/rate-limits/service.ts
  • src/main/runtime/orca-runtime-agent-session-operation.test.ts
  • src/main/runtime/orca-runtime-git.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/provider-account-workspace-scope.test.ts
  • src/main/runtime/provider-account-workspace-scope.ts
  • src/main/runtime/rpc/methods/agent-session.test.ts
  • src/main/runtime/rpc/methods/agent-session.ts
  • src/main/runtime/rpc/methods/ai-vault.test.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/main/runtime/rpc/methods/git.test.ts
  • src/main/runtime/rpc/methods/git.ts
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/main/usage/usage-event-aggregation.test.ts
  • src/main/usage/usage-event-aggregation.ts
  • src/main/usage/usage-provider-contract.ts
  • src/main/usage/usage-rollup-merge.ts
  • src/main/usage/usage-rollup-records.ts
  • src/main/window/attach-main-window-services.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/preload/usage-provider-api.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
  • src/renderer/src/components/native-chat/use-native-chat-session-options.ts
  • src/renderer/src/components/settings/AccountsPane.test.tsx
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.test.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.tsx
  • src/renderer/src/components/settings/GrokAccountsSection.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.tsx
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.test.tsx
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.tsx
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/stats/CodexUsagePane.tsx
  • src/renderer/src/components/stats/codex-usage-account-filter.test.ts
  • src/renderer/src/components/stats/codex-usage-account-filter.ts
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsx
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/tab-bar/codex-launch-account-options.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/lib/launch-agent-web-host-tab.ts
  • src/renderer/src/lib/runtime-agent-background-create.ts
  • src/renderer/src/runtime/remote-agent-session-launch.test.ts
  • src/renderer/src/runtime/remote-agent-session-launch.ts
  • src/renderer/src/runtime/runtime-git-client.test.ts
  • src/renderer/src/runtime/runtime-git-client.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/renderer/src/store/slices/rate-limits.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/renderer/src/store/slices/usage-provider-account-filter.test.ts
  • src/renderer/src/store/slices/usage-provider-slices.ts
  • src/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/agent-session-host-authority.ts
  • src/shared/agent-session-option-catalog-claude-codex.ts
  • src/shared/agent-session-option-catalog.test.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/codex-model-list-probe.test.ts
  • src/shared/codex-model-list-probe.ts
  • src/shared/codex-usage-account-filter-contract.test.ts
  • src/shared/codex-usage-account-filter-contract.ts
  • src/shared/codex-usage-types.ts
  • src/shared/commit-message-agent-spec.ts
  • src/shared/constants.ts
  • src/shared/protocol-version.ts
  • src/shared/provider-account-ref.test.ts
  • src/shared/provider-account-ref.ts
  • src/shared/rate-limit-types.ts
  • src/shared/types.ts
🚧 Files skipped from review as they are similar to previous changes (149)
  • src/cli/handlers/account.test.ts
  • src/cli/specs/core.ts
  • src/shared/codex-usage-account-filter-contract.test.ts
  • src/main/codex-usage/codex-usage-provider.ts
  • src/main/ai-vault/session-scanner-types.ts
  • src/main/usage/usage-provider-contract.ts
  • src/shared/rate-limit-types.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/renderer/src/components/stats/codex-usage-account-filter.test.ts
  • src/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.ts
  • src/main/ipc/gemini-accounts.ts
  • src/main/ai-vault/session-scanner-kimi-managed.test.ts
  • src/main/codex/codex-session-account-registry.test.ts
  • src/renderer/src/runtime/runtime-git-client.test.ts
  • src/shared/provider-account-ref.test.ts
  • src/main/agent-hooks/server.test.ts
  • src/main/runtime/rpc/methods/ai-vault.test.ts
  • src/main/ipc/usage-provider-handlers.test.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/main/usage/usage-event-aggregation.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/main/ai-vault/cached-session-list.ts
  • src/main/agent-hooks/server.ts
  • src/main/kimi/hook-service.test.ts
  • src/main/codex-usage/types.ts
  • src/main/usage/usage-rollup-merge.ts
  • src/renderer/src/components/settings/GrokAccountsSection.tsx
  • src/main/command-code-accounts/auth-file.ts
  • src/shared/commit-message-agent-spec.ts
  • src/main/ipc/settings.ts
  • src/main/runtime/rpc/methods/git.ts
  • src/renderer/src/components/settings/AccountsPane.test.tsx
  • src/main/runtime/rpc/methods/git.test.ts
  • src/main/usage/usage-event-aggregation.ts
  • src/main/ipc/command-code-accounts.test.ts
  • src/main/provider-managed-homes/ownership.test.ts
  • src/shared/codex-model-list-probe.test.ts
  • src/shared/codex-usage-account-filter-contract.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/renderer/src/lib/runtime-agent-background-create.ts
  • src/renderer/src/store/slices/rate-limits.ts
  • src/shared/provider-account-ref.ts
  • src/main/provider-managed-homes/launch-environment.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.test.ts
  • src/cli/help.ts
  • src/shared/agent-session-option-catalog.ts
  • src/main/runtime/provider-account-workspace-scope.test.ts
  • src/main/runtime/orca-runtime-git.ts
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsx
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/main/codex-usage/store-snapshot.benchmark.test.ts
  • src/shared/protocol-version.ts
  • src/main/ai-vault/cached-session-list.test.ts
  • src/main/codex/codex-session-account-attribution.test.ts
  • src/renderer/src/components/stats/codex-usage-account-filter.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/renderer/src/components/settings/CommandCodeAccountsSection.test.tsx
  • src/main/runtime/provider-account-workspace-scope.ts
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.tsx
  • src/shared/agent-session-host-authority.ts
  • src/main/kimi-accounts/login-runner.test.ts
  • src/main/command-code-accounts/service.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/main/ipc/usage-provider-handlers.ts
  • src/renderer/src/runtime/remote-agent-session-launch.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.ts
  • src/main/codex-usage/scanner.ts
  • src/main/ipc/grok-accounts.ts
  • src/renderer/src/components/settings/KimiAccountsSection.tsx
  • src/main/kimi-accounts/launch-environment.test.ts
  • src/main/rate-limits/service.test.ts
  • src/main/kimi-accounts/managed-home-copy.ts
  • src/main/ipc/command-code-accounts.ts
  • src/main/command-code-accounts/ownership.ts
  • src/main/command-code-accounts/launch-environment.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.test.tsx
  • src/main/codex-usage/scanner-paths.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/main/command-code-accounts/launch-environment.test.ts
  • src/shared/agent-session-option-catalog-claude-codex.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/cli/handlers/terminal.test.ts
  • src/main/ipc/register-core-handlers.test.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/main/window/attach-main-window-services.ts
  • src/renderer/src/runtime/remote-agent-session-launch.ts
  • src/shared/codex-usage-types.ts
  • src/main/kimi-accounts/launch-environment.ts
  • src/shared/constants.ts
  • src/main/usage/usage-rollup-records.ts
  • src/main/codex-usage/store.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
  • src/renderer/src/runtime/runtime-git-client.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.ts
  • src/renderer/src/components/settings/CommandCodeAccountsSection.tsx
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/filesystem.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
  • src/main/command-code-accounts/service.test.ts
  • src/renderer/src/lib/launch-agent-web-host-tab.ts
  • src/main/provider-managed-homes/launch-environment.ts
  • src/main/ipc/filesystem.test.ts
  • src/main/ipc/pty.test.ts
  • src/main/runtime/orca-runtime-agent-session-operation.test.ts
  • src/main/provider-managed-homes/ownership.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/shared/codex-model-list-probe.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/provider-managed-homes/credential-scope.ts
  • src/main/kimi-accounts/managed-home-ownership.ts
  • src/main/runtime/rpc/methods/agent-session.test.ts
  • src/renderer/src/components/stats/CodexUsagePane.tsx
  • src/main/ipc/provider-managed-home-handlers.test.ts
  • src/cli/handlers/terminal.ts
  • src/main/kimi-accounts/service.test.ts
  • src/main/codex/codex-session-account-registry.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts
  • src/main/ipc/rate-limits.test.ts
  • src/renderer/src/store/slices/usage-provider-account-filter.test.ts
  • src/main/provider-managed-homes/service.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/shared/types.ts
  • src/main/ipc/kimi-accounts.test.ts
  • src/preload/usage-provider-api.ts
  • src/preload/index.ts
  • src/main/ipc/register-core-handlers.ts
  • src/preload/api-types.ts
  • src/shared/agent-session-option-catalog.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/main/codex-usage/store.ts
  • src/main/kimi/hook-service.ts
  • src/main/runtime/rpc/methods/agent-session.ts
  • src/main/ai-vault/session-scanner-agent-sources.ts
  • src/renderer/src/components/native-chat/use-native-chat-session-options.ts
  • src/renderer/src/store/slices/usage-provider-slices.ts
  • src/main/ipc/pty.ts
  • src/main/kimi-accounts/service.ts
  • src/main/kimi-accounts/managed-login-provisioning.ts
  • src/main/index.ts
  • src/main/ipc/rate-limits.ts
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsx

Comment thread src/main/rate-limits/service.ts Resolved
@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from 3979378 to 68edfab Compare August 14, 2026 03:45
@rp0927

rp0927 commented Aug 14, 2026

Copy link
Copy Markdown
Author

Rebased again onto current origin/main after #14397 split src/shared/types.ts into per-domain modules. The stacked Kimi / Command Code / Grok / Gemini account types now live in src/shared/managed-account-types.ts and are re-exported from the barrel. Settings fields went into src/shared/global-settings-types.ts.

Also added the #13272 CodeRabbit coverage for empty/null workspace labels on orca account list.

@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from 68edfab to 5923fc5 Compare August 14, 2026 03:49
@rp0927

rp0927 commented Aug 14, 2026

Copy link
Copy Markdown
Author

Follow-up: restacked again onto 583ab1601 after #14437 moved worktree/github/linear modules into folders. providerAccountRef now lives on src/shared/worktree/launch-types.ts. Stack is mergeable against current main.

@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from e7697b8 to 13fd22c Compare August 14, 2026 03:56
@rp0927

rp0927 commented Aug 14, 2026

Copy link
Copy Markdown
Author

Latest CodeRabbit full reviews (the 03:56 notification batch) are addressed on tip 99fca34fc.

Applied on this push:

  • Kimi Usage abort signal through fetchKimiRateLimits (inactive accounts + main cycle)
  • Deleted/missing Codex usage-filter option stays selectable
  • Empty Command Code auth.json error, localized Kimi/Command Code fallbacks
  • Independent workspace-scope rejection tests, login StringDecoder, Gemini secret-marker coverage, shared isBoundedText

Already on 13fd22cf0 and called out in the review threads: hook try/catch, create-session agent/provider match, writeRegistry persist result, realpathSync guard.

Left as-is, with thread replies:

  • Extracting duplicated Kimi provisioning / inactive-account fetch (no remaining behavioral bug)
  • Native-chat persisted-model validation scoped to the selected PTY (larger native-chat change)
  • SearchableSetting description + visible <p> (search-only vs rendered copy)

Stack still targets main and is mergeable. CI remains unstable until a stablyai/orca admin Approves and runs the fork workflows.

@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from 99fca34 to 82763dc Compare August 14, 2026 10:56
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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.

@rp0927

rp0927 commented Aug 14, 2026

Copy link
Copy Markdown
Author

Restacked onto current origin/main (cb42b6084) after #14447 dropped the src/shared/types.ts barrel and later main commits dirtied #13271–#13276.

Conflict resolutions kept main’s per-module type imports. Managed-account types stay in src/shared/managed-account-types.ts / src/shared/global-settings-types.ts; leftover shared/types imports from this stack were remapped. The barrel was not reintroduced.

Also addressed the latest CodeRabbit login-runner follow-up on tip 82763dc2f: separate UTF-8 decoders for stdout and stderr, plus a non-ASCII split-path test.

All eight PRs are mergeable against current main. CI remains gated until a stablyai/orca admin Approves and runs the fork workflows.

@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

🧹 Nitpick comments (1)
src/main/rate-limits/kimi-fetcher.test.ts (1)

196-204: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prove caller cancellation reaches the request signal.

The assertion at Line 199 also passes when the implementation uses only the timeout signal. Abort controller after net.fetch receives init.signal. Then assert that init.signal.aborted becomes true.

Suggested test update
+    const controller = new AbortController()
     netFetchMock.mockImplementationOnce((_url, init?: RequestInit) => {
       expect(init?.signal).toBeInstanceOf(AbortSignal)
+      expect(init?.signal?.aborted).toBe(false)
+      controller.abort()
+      expect(init?.signal?.aborted).toBe(true)
       return jsonResponse(USAGE_RESPONSE)
     })
-
-    const controller = new AbortController()

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 72c3c26a-0c04-4a0c-8db3-dca50f7e2758

📥 Commits

Reviewing files that changed from the base of the PR and between cb42b60 and 82763dc2f44e6e58a4e9c3df6822359fa2d2ba16.

📒 Files selected for processing (166)
  • src/cli/handlers/account.test.ts
  • src/cli/handlers/account.ts
  • src/cli/handlers/terminal.test.ts
  • src/cli/handlers/terminal.ts
  • src/cli/help.ts
  • src/cli/specs/core.ts
  • src/main/agent-hooks/server.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/ai-vault/cached-session-list.test.ts
  • src/main/ai-vault/cached-session-list.ts
  • src/main/ai-vault/session-scanner-agent-sources.ts
  • src/main/ai-vault/session-scanner-kimi-managed.test.ts
  • src/main/ai-vault/session-scanner-types.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/main/codex-accounts/runtime-home-service.ts
  • src/main/codex-usage/codex-usage-provider.ts
  • src/main/codex-usage/scanner-paths.test.ts
  • src/main/codex-usage/scanner.ts
  • src/main/codex-usage/store-snapshot.benchmark.test.ts
  • src/main/codex-usage/store.test.ts
  • src/main/codex-usage/store.ts
  • src/main/codex-usage/types.ts
  • src/main/codex/codex-session-account-attribution.test.ts
  • src/main/codex/codex-session-account-attribution.ts
  • src/main/codex/codex-session-account-registry.test.ts
  • src/main/codex/codex-session-account-registry.ts
  • src/main/command-code-accounts/auth-file.ts
  • src/main/command-code-accounts/launch-environment.test.ts
  • src/main/command-code-accounts/launch-environment.ts
  • src/main/command-code-accounts/ownership.ts
  • src/main/command-code-accounts/service.test.ts
  • src/main/command-code-accounts/service.ts
  • src/main/index.ts
  • src/main/ipc/bounded-account-text.ts
  • src/main/ipc/command-code-accounts.test.ts
  • src/main/ipc/command-code-accounts.ts
  • src/main/ipc/filesystem.test.ts
  • src/main/ipc/filesystem.ts
  • src/main/ipc/gemini-accounts.ts
  • src/main/ipc/grok-accounts.ts
  • src/main/ipc/kimi-accounts.test.ts
  • src/main/ipc/kimi-accounts.ts
  • src/main/ipc/provider-managed-home-handlers.test.ts
  • src/main/ipc/provider-managed-home-handlers.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/ipc/rate-limits.test.ts
  • src/main/ipc/rate-limits.ts
  • src/main/ipc/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/main/ipc/usage-provider-handlers.test.ts
  • src/main/ipc/usage-provider-handlers.ts
  • src/main/kimi-accounts/launch-environment.test.ts
  • src/main/kimi-accounts/launch-environment.ts
  • src/main/kimi-accounts/login-runner.test.ts
  • src/main/kimi-accounts/login-runner.ts
  • src/main/kimi-accounts/managed-home-copy.ts
  • src/main/kimi-accounts/managed-home-ownership.ts
  • src/main/kimi-accounts/managed-login-provisioning.ts
  • src/main/kimi-accounts/service.test.ts
  • src/main/kimi-accounts/service.ts
  • src/main/kimi/hook-service.test.ts
  • src/main/kimi/hook-service.ts
  • src/main/provider-managed-homes/credential-scope.ts
  • src/main/provider-managed-homes/launch-environment.test.ts
  • src/main/provider-managed-homes/launch-environment.ts
  • src/main/provider-managed-homes/ownership.test.ts
  • src/main/provider-managed-homes/ownership.ts
  • src/main/provider-managed-homes/service.test.ts
  • src/main/provider-managed-homes/service.ts
  • src/main/rate-limits/kimi-fetcher.test.ts
  • src/main/rate-limits/kimi-fetcher.ts
  • src/main/rate-limits/service.test.ts
  • src/main/rate-limits/service.ts
  • src/main/runtime/orca-runtime-agent-session-operation.test.ts
  • src/main/runtime/orca-runtime-git.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/provider-account-workspace-scope.test.ts
  • src/main/runtime/provider-account-workspace-scope.ts
  • src/main/runtime/rpc/methods/agent-session.test.ts
  • src/main/runtime/rpc/methods/agent-session.ts
  • src/main/runtime/rpc/methods/ai-vault.test.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/main/runtime/rpc/methods/git.test.ts
  • src/main/runtime/rpc/methods/git.ts
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/main/usage/usage-event-aggregation.test.ts
  • src/main/usage/usage-event-aggregation.ts
  • src/main/usage/usage-provider-contract.ts
  • src/main/usage/usage-rollup-merge.ts
  • src/main/usage/usage-rollup-records.ts
  • src/main/window/attach-main-window-services.ts
  • src/preload/api-types.ts
  • src/preload/api/agent-account-api.ts
  • src/preload/api/agent-usage-api.ts
  • src/preload/api/git-inspection-api.ts
  • src/preload/api/pty-api.ts
  • src/preload/index.ts
  • src/preload/usage-provider-api.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
  • src/renderer/src/components/native-chat/use-native-chat-session-options.ts
  • src/renderer/src/components/settings/AccountsPane.test.tsx
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.test.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.tsx
  • src/renderer/src/components/settings/GrokAccountsSection.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.tsx
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.test.tsx
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.tsx
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/stats/CodexUsagePane.tsx
  • src/renderer/src/components/stats/codex-usage-account-filter.test.ts
  • src/renderer/src/components/stats/codex-usage-account-filter.ts
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsx
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/tab-bar/codex-launch-account-options.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/lib/launch-agent-web-host-tab.ts
  • src/renderer/src/lib/runtime-agent-background-create.ts
  • src/renderer/src/runtime/remote-agent-session-launch.test.ts
  • src/renderer/src/runtime/remote-agent-session-launch.ts
  • src/renderer/src/runtime/runtime-git-client.test.ts
  • src/renderer/src/runtime/runtime-git-client.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/renderer/src/store/slices/rate-limits.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/renderer/src/store/slices/usage-provider-account-filter.test.ts
  • src/renderer/src/store/slices/usage-provider-slices.ts
  • src/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/agent-session-host-authority.ts
  • src/shared/agent-session-option-catalog-claude-codex.ts
  • src/shared/agent-session-option-catalog.test.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/codex-model-list-probe.test.ts
  • src/shared/codex-model-list-probe.ts
  • src/shared/codex-usage-account-filter-contract.test.ts
  • src/shared/codex-usage-account-filter-contract.ts
  • src/shared/codex-usage-types.ts
  • src/shared/commit-message-agent-spec.ts
  • src/shared/constants.ts
  • src/shared/global-settings-types.ts
  • src/shared/managed-account-types.ts
  • src/shared/protocol-version.ts
  • src/shared/provider-account-ref.test.ts
  • src/shared/provider-account-ref.ts
  • src/shared/rate-limit-types.ts
  • src/shared/worktree/launch-types.ts
🚧 Files skipped from review as they are similar to previous changes (147)
  • src/main/ai-vault/session-scanner-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/main/codex/codex-session-account-attribution.test.ts
  • src/main/usage/usage-rollup-merge.ts
  • src/main/agent-hooks/server.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/runtime/remote-agent-session-launch.test.ts
  • src/main/ipc/provider-managed-home-handlers.test.ts
  • src/main/kimi/hook-service.test.ts
  • src/main/ipc/gemini-accounts.ts
  • src/renderer/src/runtime/runtime-git-client.test.ts
  • src/preload/usage-provider-api.ts
  • src/main/ipc/grok-accounts.ts
  • src/renderer/src/components/settings/GrokAccountsSection.tsx
  • src/main/ipc/usage-provider-handlers.ts
  • src/main/command-code-accounts/launch-environment.ts
  • src/main/ipc/usage-provider-handlers.test.ts
  • src/main/kimi-accounts/launch-environment.test.ts
  • src/main/kimi-accounts/launch-environment.ts
  • src/shared/rate-limit-types.ts
  • src/shared/constants.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/main/runtime/orca-runtime-git.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/main/ai-vault/cached-session-list.ts
  • src/main/ai-vault/session-scanner-kimi-managed.test.ts
  • src/main/ipc/provider-managed-home-handlers.ts
  • src/shared/provider-account-ref.test.ts
  • src/main/ipc/kimi-accounts.test.ts
  • src/renderer/src/store/slices/rate-limits.ts
  • src/renderer/src/components/settings/AccountsPane.test.tsx
  • src/main/ipc/rate-limits.ts
  • src/main/ai-vault/cached-session-list.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/codex-usage/store-snapshot.benchmark.test.ts
  • src/cli/specs/core.ts
  • src/main/usage/usage-event-aggregation.test.ts
  • src/main/codex-usage/scanner-paths.test.ts
  • src/main/usage/usage-provider-contract.ts
  • src/shared/codex-usage-account-filter-contract.test.ts
  • src/main/provider-managed-homes/ownership.test.ts
  • src/main/ipc/settings.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/main/ipc/kimi-accounts.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.tsx
  • src/main/kimi-accounts/service.test.ts
  • src/cli/help.ts
  • src/shared/codex-usage-account-filter-contract.ts
  • src/main/ipc/command-code-accounts.ts
  • src/main/provider-managed-homes/launch-environment.test.ts
  • src/main/command-code-accounts/auth-file.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.test.tsx
  • src/main/codex/codex-session-account-registry.test.ts
  • src/renderer/src/components/settings/ManagedCliHomeAccountsControl.test.tsx
  • src/main/ipc/rate-limits.test.ts
  • src/main/runtime/rpc/methods/agent-session.test.ts
  • src/renderer/src/store/slices/usage-provider-account-filter.test.ts
  • src/main/codex-usage/scanner.ts
  • src/main/runtime/orca-runtime-agent-session-operation.test.ts
  • src/renderer/src/runtime/runtime-git-client.ts
  • src/main/runtime/provider-account-workspace-scope.test.ts
  • src/main/codex/codex-session-account-attribution.ts
  • src/main/window/attach-main-window-services.ts
  • src/main/ai-vault/session-scanner-agent-sources.ts
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
  • src/main/codex-usage/codex-usage-provider.ts
  • src/shared/agent-session-option-catalog.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/renderer/src/lib/launch-agent-web-host-tab.ts
  • src/main/codex-usage/store.test.ts
  • src/renderer/src/runtime/remote-agent-session-launch.ts
  • src/main/kimi/hook-service.ts
  • src/main/codex-usage/types.ts
  • src/main/runtime/rpc/methods/git.ts
  • src/main/kimi-accounts/service.ts
  • src/main/usage/usage-event-aggregation.ts
  • src/main/ipc/filesystem.ts
  • src/shared/agent-session-option-catalog-claude-codex.ts
  • src/cli/handlers/terminal.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/renderer/src/components/settings/accounts-search.ts
  • src/cli/handlers/account.test.ts
  • src/main/runtime/rpc/methods/git.test.ts
  • src/main/provider-managed-homes/ownership.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/shared/protocol-version.ts
  • src/shared/codex-model-list-probe.test.ts
  • src/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.ts
  • src/main/runtime/rpc/methods/ai-vault.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.test.ts
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/lib/runtime-agent-background-create.ts
  • src/main/rate-limits/service.test.ts
  • src/shared/commit-message-agent-spec.ts
  • src/main/runtime/provider-account-workspace-scope.ts
  • src/renderer/src/components/stats/CodexUsagePane.tsx
  • src/shared/agent-session-option-catalog.test.ts
  • src/main/ipc/filesystem.test.ts
  • src/renderer/src/components/tab-bar/codex-launch-account-options.ts
  • src/renderer/src/components/native-chat/use-native-chat-session-options.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
  • src/main/provider-managed-homes/service.ts
  • src/main/runtime/orca-runtime.ts
  • src/shared/provider-account-ref.ts
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsx
  • src/main/ipc/command-code-accounts.test.ts
  • src/main/codex/codex-session-account-registry.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
  • src/main/kimi-accounts/managed-home-copy.ts
  • src/shared/codex-usage-types.ts
  • src/main/command-code-accounts/service.test.ts
  • src/main/command-code-accounts/ownership.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsx
  • src/shared/codex-model-list-probe.ts
  • src/main/provider-managed-homes/credential-scope.ts
  • src/main/usage/usage-rollup-records.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/main/ipc/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/codex-accounts/runtime-home-service.ts
  • src/cli/handlers/terminal.ts
  • src/renderer/src/components/settings/CommandCodeAccountsSection.tsx
  • src/preload/index.ts
  • src/main/agent-hooks/server.ts
  • src/main/command-code-accounts/service.ts
  • src/renderer/src/components/settings/KimiAccountsSection.tsx
  • src/main/ipc/settings.ts
  • src/main/provider-managed-homes/service.test.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/main/provider-managed-homes/launch-environment.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts
  • src/main/ipc/pty.test.ts
  • src/main/codex-usage/store.ts
  • src/main/ipc/pty.ts
  • src/shared/agent-session-host-authority.ts
  • src/main/rate-limits/service.ts
  • src/main/index.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.ts
  • src/renderer/src/store/slices/usage-provider-slices.ts
  • src/main/command-code-accounts/launch-environment.test.ts

@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from 82763dc to 2a1bb58 Compare August 14, 2026 21:07
@rp0927

rp0927 commented Aug 14, 2026

Copy link
Copy Markdown
Author

Restacked onto current origin/main (9bb8836bb) to clear the merge conflicts on #13274–#13276.

Latest leftover CodeRabbit findings from the post-restack full reviews are addressed on tip 2a1bb587d:

  • Reject PTY-scoped remote model discovery instead of returning the unscoped catalog (feat(codex): scope model discovery to pinned PTY accounts #13270)
  • Validate Kimi credential contents (empty / invalid JSON / missing token) before promotion
  • Wait for the Kimi login child to exit (with a bounded force-kill) before rejecting timeout/cancel
  • Keep rollback cleanup from replacing the redacted login error
  • Localize the Kimi usage label through the existing usage-percentage helper
  • Disable Kimi account actions until the initial list resolves so a stale load cannot overwrite an operation

wslLinuxHomePath stays omitted from KimiManagedAccountSummary, hook prep stays best-effort, and the duplicated workspace-scope checks stay in assertProviderAccountRefForWorkspace.

@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from 2a1bb58 to 0a1661c Compare August 15, 2026 06:37
rp0927 and others added 26 commits August 16, 2026 07:51
launch-agent-in-new-tab.test.ts grew past the 800-line budget once the
account-scoped cases landed; move those cases to their own file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvdKNvkWoiVSxqbw7DKmgm
main dropped the shared/types barrel, so the CLI terminal handler and the
launch account options resolved neither import.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvdKNvkWoiVSxqbw7DKmgm
`unknown` for accountFilter broke parameter contravariance against each
provider store, and the slice file passed its max-lines budget once the
account-scoped state landed; split the factory out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvdKNvkWoiVSxqbw7DKmgm
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvdKNvkWoiVSxqbw7DKmgm
Keep explicit Codex hook prep best-effort, hide leftover managed-home
path fragments, omit WSL homes from Kimi summaries, reject symlink
credential directories, fail closed on mixed usage attribution, and
ignore superseded usage-filter fetches.
Use the worker mock in the Kimi AI Vault scan test, fall back to current
Codex selection when a stale PTY record throws, and route explicit host
system-default launches through the shared mirror when the real-home lane
is unavailable.
CodeRabbit asked for null and whitespace-only workspaceLabel cases so the
email fallback and UUID stay covered.
Reject create-session account refs that do not match the agent, skip
managed hook writes on the real ~/.codex lane, apply already-cached
native-chat models after subscribe, surface registry persist failures,
keep afterTabId launches account-scoped, and bound Kimi delete/login
leak paths.
Propagate the Usage abort signal through Kimi fetches, keep deleted account
filters selectable, and close the leftover empty-file, localization, and
workspace-scope test gaps from the latest full reviews.
Keep stdout/stderr login decoders separate so a UTF-8 split cannot mix
streams, remap leftover shared/types imports to domain modules, and add
the non-ASCII split-path coverage CodeRabbit asked for.
Reject PTY-scoped remote model discovery instead of returning the
unscoped catalog, validate Kimi credential contents before promotion,
wait for login exit before rollback, and keep the settings list from
racing a later account operation.
Keep Command Code, Grok, and Gemini settings from applying an initial
list result after a newer import, select, or remove has already landed.
Strip ANSI sequences and control characters from workspace labels so a
crafted name cannot inject extra lines or escape sequences into `orca
account list`.
Move the stack's pane-scoped model discovery cases onto the split
filesystem and runtime-home suites so they survive main's max-lines
test-file split.
Also assert the scoped PTY resolver call in the Codex fallback test so the
case cannot pass when PTY resolution is skipped entirely.
- thread the provider account filter type through the usage IPC and renderer
  contracts instead of `unknown`, which broke parameter contravariance
- split the usage provider slice factory and the account-scoped launch tests
  out of files that had grown past their max-lines budget
- move terminal control stripping into the shared ANSI module so the CLI no
  longer needs an inline control regex
- drop the redundant `TuiAgent | string` unions in the launch env guards
The account-attribution commit changed the Codex usage schema version, added
agentType to provider-session fanout, and threaded an abort signal into the
Kimi usage fetch, but left three suites asserting the previous shape.
… lane rules

prepareForCodexAccountLaunch skipped the custom-CODEX_HOME exclusion that
prepareForCodexLaunch applies, so an explicit system-default launch could run
against a home Orca never hooks.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvdKNvkWoiVSxqbw7DKmgm
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KvdKNvkWoiVSxqbw7DKmgm
@rp0927
rp0927 force-pushed the feat/grok-gemini-managed-accounts branch from afb91aa to 8b463eb Compare August 15, 2026 22:59
@rp0927

rp0927 commented Aug 15, 2026

Copy link
Copy Markdown
Author

Restacked onto current origin/main (d2ffe1f36, 4 commits ahead of the previous base). All eight branches force-pushed with --force-with-lease. Tip is 8b463eb1a.

One conflict: src/cli/handlers/terminal.test.ts, where #14608 appended a describe('terminal send CLI') block at the same place #13272 appends describe('terminal create account selection'). Both blocks are kept in full; details on #13272.

New heads — each re-verified standalone (typecheck:node / typecheck:web / typecheck:cli, oxlint, oxfmt --check):

PR head
#13183 065a4d807
#13270 afee41535
#13271 d4d3e6e99
#13272 4a8301b3b
#13273 90ba2a3fe
#13274 59c93ac40
#13275 208cc8fba
#13276 8b463eb1a

The tip also passes the full pnpm run lint gate and the unit suite (53,000 passing; the same 10 environment-dependent files fail here at upstream main too). No PR is in a conflicted state.

Still blocked on the same external condition: Actions have never run on these fork PRs — check-runs is 0 on every head — so an admin still needs to approve the workflows.

@nwparker nwparker removed the P2 label Aug 19, 2026
@rp0927 rp0927 closed this Sep 13, 2026
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.

5 participants