Skip to content

feat(command-code): add managed credential profiles - #13275

Closed
rp0927 wants to merge 13 commits into
stablyai:mainfrom
rp0927:feat/command-code-managed-accounts
Closed

rp0927 wants to merge 13 commits into
stablyai:mainfrom
rp0927:feat/command-code-managed-accounts

Conversation

@rp0927

@rp0927 rp0927 commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Orca can now manage isolated Command Code credential profiles by importing only auth.json from a user-selected Command Code home into an owner-marked private store. Main validates a bounded regular JSON file and extracts the required apiKey without returning the key or any credential path to renderer code.

The selected profile is applied as COMMAND_CODE_API_KEY only to new local-host Command Code PTYs. System default, SSH, WSL, remote, and reattached sessions keep their existing environment and cannot receive a host-managed credential.

This PR is stacked on #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.

Screenshots

Not attached yet because this is a dependency-gated draft. Before marking it ready, I will capture the Command Code account settings section against the rebased branch.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions

Focused validation:

  • Focused Vitest suite covering auth import/validation, ownership, launch isolation, IPC/settings registration, and account UI — 58 tests passed.
  • pnpm run build:desktop — passed.
  • git diff --check — passed.

Local environment note: the repository requests Node 24, while this workstation currently exposes Node 25.8.1. The desktop build completed; its development CLI install step reported the expected permission warning for /usr/local/bin/orca-dev without failing the build.

AI Review Report

The review checked the provider's documented credential surface before limiting the adapter to auth.json and COMMAND_CODE_API_KEY. It traced import, secret extraction, account snapshots, selection, new PTY launch, and deletion, and verified that no unsupported whole-home override is inferred.

Regression tests cover bounded/malformed/symlink auth files, owner-only storage, source-home immutability, profile switching, local launch pinning, system default behavior, remote/WSL/reattach exclusion, secret-free IPC responses, and owned-copy deletion.

Cross-platform review:

  • Managed profiles are local-host only; WSL, SSH, and remote launches never receive a host API key.
  • Running and reattached sessions keep their original process environment when selection changes.
  • Hook and AI Vault session roots intentionally remain on the provider's system-default path because Command Code does not expose a supported whole-home override.

Security Audit

  • Import accepts only a bounded regular auth.json; symlinks, oversized files, malformed JSON, and missing API keys are rejected.
  • The API key is read in main and injected only into a new local Command Code child process.
  • Renderer models, preload APIs, IPC results, errors, and logs contain neither the API key nor managed/source paths.
  • Deletion requires the ownership marker and removes only Orca's private copy; source and ~/.commandcode remain unchanged.
  • Sessions, taste, skills, MCP tokens, and settings are never copied.
  • Dependencies are unchanged.

Notes

@rp0927
rp0927 force-pushed the feat/command-code-managed-accounts branch from 74b66a5 to e756e46 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.

@rp0927
rp0927 marked this pull request as ready for review August 13, 2026 14:19
@rp0927
rp0927 requested a review from brennanb2025 as a code owner August 13, 2026 14:19
@greptile-apps

greptile-apps Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

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

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

@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

Walkthrough

The change adds managed Kimi and Command Code account lifecycle operations, account-scoped Codex launches, provider-account routing through PTY and agent-session flows, account-attributed Codex usage, inactive Kimi usage, and PTY-scoped Codex model discovery. It also adds IPC, preload, renderer settings, launch menus, usage filters, localization, validation, persistence, and test coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% 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 summarizes the primary change: adding managed Command Code credential profiles.
Description check ✅ Passed The description thoroughly covers the change, rationale, testing, security, and platform behavior, but it omits the required linked issue and checklist sections.
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 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Caution

CodeRabbit couldn't update its existing comment. The review summary may be out of date.

Error details
Validation Failed: {"resource":"IssueComment","code":"custom","field":"body","message":"body is too long (maximum is 65536 characters)"} - https://docs.github.com/rest/issues/comments#update-an-issue-comment

@rp0927
rp0927 force-pushed the feat/command-code-managed-accounts branch 3 times, most recently from 11054c0 to be16021 Compare August 14, 2026 03:49

@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

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

Validate persisted models in the selected PTY scope.

Line 63 searches every PTY entry for the agent. A model available only for account A can then validate a persisted selection when launching account B. The selected account can receive an unsupported model.

Add host and PTY scope inputs to resolveNativeChatLaunchSessionOptions. Read only the matching enrichment entry before retaining an authoritative persisted model.

src/main/runtime/rpc/methods/agent-session.ts (1)

224-244: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject provider account references that do not match the new agent.

CreateAgentSessionParams accepts a Codex account reference for a non-Codex agent. It also accepts a non-Codex provider for agent: 'codex'. These requests pass RPC validation and invoke createAgentSession.

Apply the same agent/provider check that ExplicitEnsure uses at Lines 175-184. Add dispatcher tests for both mismatch cases.

Proposed fix
   .superRefine((value, context) => {
+    if (
+      value.providerAccountRef &&
+      (value.agent !== 'codex' || value.providerAccountRef.provider !== 'codex')
+    ) {
+      context.addIssue({
+        code: z.ZodIssueCode.custom,
+        path: ['providerAccountRef', 'provider'],
+        message: 'Account reference must match the launched agent'
+      })
+    }
     if (value.providerAccountRef?.runtime === 'host' && value.providerAccountRef.wslDistro != null) {
🧹 Nitpick comments (11)
src/cli/specs/core.ts (1)

237-240: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

List the allowed flags as literals.

Every other spec in this file lists flags as separate string literals. The .split(' ') form widens the values to string and hides a typo until runtime validation.

♻️ Proposed refactor
-    allowedFlags: [
-      ...GLOBAL_FLAGS,
-      ...'worktree command title agent account account-runtime wsl-distro focus'.split(' ')
-    ],
+    allowedFlags: [
+      ...GLOBAL_FLAGS,
+      'worktree',
+      'command',
+      'title',
+      'agent',
+      'account',
+      'account-runtime',
+      'wsl-distro',
+      'focus'
+    ],
src/main/command-code-accounts/launch-environment.test.ts (1)

18-40: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add a non-Command-Code launch agent case.

The isolation table covers SSH, WSL, and reattach. It does not cover a different launchAgent. Add a case such as launchAgent: 'codex' that asserts the same identity result and that getSelectedApiKey is not called. This locks the credential to Command Code PTYs only.

src/main/codex-accounts/runtime-home-service.test.ts (1)

399-408: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Assert no settings write after the null-account call too.

expect(store.updateSettings).not.toHaveBeenCalled() runs before the accountId: null call. Repeat the assertion after line 406 so the system-default path is also covered by the no-global-mutation guarantee.

src/main/kimi-accounts/managed-login-provisioning.ts (1)

88-99: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Duplicated rollback redaction can leak resolved managed paths. Both rollback handlers redact only the literal pendingRoot, accountRoot, and managed-accounts-root strings. An error raised by an external process can contain the resolved form of the same path, for example /private/var/... instead of /var/... on macOS, so the managed home path reaches the caller.

  • src/main/kimi-accounts/managed-login-provisioning.ts#L88-L99: extract the rollback and redaction into one shared function, and redact the realpathSync form of each root as well.
  • src/main/kimi-accounts/service.ts#L258-L270: call that shared function instead of repeating the replaceAll chain.
src/main/kimi-accounts/service.test.ts (1)

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

Restore the source permissions in a finally block.

Lines 123-124 restore 0o700/0o600 only when all assertions pass. If an assertion fails, the afterEach cleanup tries to delete a directory with mode 0o500 and fails, so one failure produces a second unrelated error. Wrap the assertions in try/finally and restore the modes in finally.

src/main/kimi-accounts/service.ts (1)

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

Hook installation order differs from the login path.

importHome renames the pending root to accountRoot at line 234 and installs hooks afterwards. provisionKimiManagedLogin installs hooks into the pending home and renames afterwards. Install the hooks into pendingHome here too, so the promoted directory is always complete and the rollback never has to remove a promoted accountRoot.

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

470-484: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift

Confirm the full-cycle refetch on Kimi account switch is intentional.

refreshForKimiAccountChange calls this.fetchAll({ force: true }). This refetches Claude, Codex, Gemini, OpenCode-Go, and MiniMax in addition to Kimi.

The Codex and Claude equivalents (refreshForCodexAccountChange, refreshForClaudeAccountChange) call a dedicated single-provider fetch (fetchCodexOnly, fetchClaudeOnly) specifically to avoid this. A comment in refreshForCodexAccountChange states that re-probing every account on a switch can spawn Codex in each credential home and endanger rotating refresh tokens. The same risk class applies here: a Kimi account switch now also forces a Claude auth-preparation cycle and a Codex account/home resolution cycle, neither of which the user asked for.

Confirm this is an accepted interim trade-off (there is no fetchKimiOnly cycle yet) rather than an oversight. If not, add a dedicated runFetchKimiOnlyCycle/fetchKimiOnly following the Codex/Claude pattern.

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

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

Extract the duplicated Kimi/Command Code env-application block.

The applyKimiManagedHomeToLaunchEnv + applyCommandCodeManagedCredentialToLaunchEnv calls at lines 4637-4652 and 6357-6372 are identical in shape and parameters. Both apply the same five arguments (env, launchAgent, connectionId, a derived runtime, reattached, and the corresponding selector) to the same two functions.

Extract a small local helper (for example applyManagedAccountLaunchEnv(env, args, codexSelectionTarget, preAdoptedStablePane)) and call it from both the runtime-controller spawn and the pty:spawn IPC handler. This removes the duplication and prevents the two paths from drifting if a parameter changes in the future.

♻️ Proposed helper extraction
+function applyManagedAccountLaunchEnv(
+  env: Record<string, string> | undefined,
+  ctx: {
+    launchAgent?: TuiAgent
+    connectionId?: string | null
+    isWsl: boolean
+    reattached: boolean
+  },
+  options?: {
+    getSelectedKimiHomePath?: GetSelectedKimiHomePath
+    getSelectedCommandCodeApiKey?: GetSelectedCommandCodeApiKey
+  }
+): Record<string, string> | undefined {
+  let next = applyKimiManagedHomeToLaunchEnv({
+    env,
+    launchAgent: ctx.launchAgent,
+    connectionId: ctx.connectionId,
+    runtime: ctx.isWsl ? 'wsl' : 'host',
+    reattached: ctx.reattached,
+    getSelectedManagedHomePath: options?.getSelectedKimiHomePath
+  })
+  next = applyCommandCodeManagedCredentialToLaunchEnv({
+    env: next,
+    launchAgent: ctx.launchAgent,
+    connectionId: ctx.connectionId,
+    runtime: ctx.isWsl ? 'wsl' : 'host',
+    reattached: ctx.reattached,
+    getSelectedApiKey: options?.getSelectedCommandCodeApiKey
+  })
+  return next
+}

Then replace both call sites with:

-      env = applyKimiManagedHomeToLaunchEnv({
-        env,
-        launchAgent: args.launchAgent,
-        connectionId: args.connectionId,
-        runtime: codexSelectionTarget.runtime === 'wsl' ? 'wsl' : 'host',
-        reattached: Boolean(preAdoptedStablePane),
-        getSelectedManagedHomePath: options?.getSelectedKimiHomePath
-      })
-      env = applyCommandCodeManagedCredentialToLaunchEnv({
-        env,
-        launchAgent: args.launchAgent,
-        connectionId: args.connectionId,
-        runtime: codexSelectionTarget.runtime === 'wsl' ? 'wsl' : 'host',
-        reattached: Boolean(preAdoptedStablePane),
-        getSelectedApiKey: options?.getSelectedCommandCodeApiKey
-      })
+      env = applyManagedAccountLaunchEnv(
+        env,
+        {
+          launchAgent: args.launchAgent,
+          connectionId: args.connectionId,
+          isWsl: codexSelectionTarget.runtime === 'wsl',
+          reattached: Boolean(preAdoptedStablePane)
+        },
+        options
+      )

Also applies to: 6357-6372

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

1955-1965: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the repeated visibility gate.

Both new entries repeat the same three conditions. Hoist them into one boolean so the two sections cannot drift apart later.

♻️ Proposed refactor
+  // Why: Kimi and Command Code credentials are host-local; remote scope and the web client own no such homes.
+  const showLocalHostAccountSections =
+    !isRemoteAccountScope && !isWebClientLocation() && accountRuntime.runtime === 'host'
-    !isRemoteAccountScope &&
-    !isWebClientLocation() &&
-    accountRuntime.runtime === 'host' &&
-    matchesSettingsSearch(searchQuery, getAccountsKimiSearchEntries()) ? (
+    showLocalHostAccountSections &&
+    matchesSettingsSearch(searchQuery, getAccountsKimiSearchEntries()) ? (
       <KimiAccountsSection key="kimi" />
     ) : null,
-    !isRemoteAccountScope &&
-    !isWebClientLocation() &&
-    accountRuntime.runtime === 'host' &&
-    matchesSettingsSearch(searchQuery, getAccountsCommandCodeSearchEntries()) ? (
+    showLocalHostAccountSections &&
+    matchesSettingsSearch(searchQuery, getAccountsCommandCodeSearchEntries()) ? (
       <CommandCodeAccountsSection key="command-code" />
     ) : null
src/renderer/src/store/slices/usage-provider-slices.ts (1)

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

Avoid faking a T['snapshot'] for the disabled-state reset.

mapSnapshotExtras({ accountOptions: [] } as T['snapshot']}) only works today because Codex's mapSnapshotExtras reads a single field. If a future provider's mapSnapshotExtras reads other snapshot fields, this call passes them as undefined, and the as T['snapshot'] cast hides the mismatch at compile time.

Add an explicit resetSnapshotExtras hook to UsageProviderConfig instead of reusing mapSnapshotExtras with a synthetic value.

♻️ Proposed fix using a dedicated reset hook
   getExtraSnapshotArgs?: (state: AppState) => Record<string, unknown>
   mapSnapshotExtras?: (snapshot: T['snapshot']) => Partial<AppState>
+  resetSnapshotExtras?: () => Partial<AppState>
 }
-        if (config.mapSnapshotExtras) {
-          set({
-            ...config.mapSnapshotExtras({
-              accountOptions: []
-            } as T['snapshot'])
-          })
-        }
+        if (config.resetSnapshotExtras) {
+          set(config.resetSnapshotExtras())
+        }
   getExtraSnapshotArgs: (state) => ({ accountFilter: state.codexUsageAccountFilter }),
   mapSnapshotExtras: (snapshot) => ({
     codexUsageAccountOptions: snapshot.accountOptions ?? []
-  })
+  }),
+  resetSnapshotExtras: () => ({ codexUsageAccountOptions: [] })
 })
src/renderer/src/components/settings/CommandCodeAccountsSection.test.tsx (1)

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

Assert the confirmed delete path in both account sections.

The tests verify that opening the confirmation dialog does not delete, but neither test verifies that confirming calls remove with the selected account id. Add the confirmation click and assert remove({ accountId: 'account-a' }) for both Command Code and Kimi account sections.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4781ea5-42f9-4a9f-b59d-d87f703722ec

📥 Commits

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

📒 Files selected for processing (138)
  • 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/kimi-accounts.test.ts
  • src/main/ipc/kimi-accounts.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/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.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.test.tsx
  • src/renderer/src/components/settings/CommandCodeAccountsSection.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.test.tsx
  • src/renderer/src/components/settings/KimiAccountsSection.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/login-runner.ts Resolved
Comment thread src/main/runtime/orca-runtime.ts Resolved
Comment thread src/shared/types.ts Outdated
Comment on lines +2645 to +2650
export type KimiManagedAccountSummary = Omit<KimiManagedAccount, 'managedHomePath'>

export type KimiManagedAccountsState = {
accounts: KimiManagedAccountSummary[]
activeAccountId: string | null
}

@coderabbitai coderabbitai Bot Aug 14, 2026 •

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.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find producers and consumers of wslLinuxHomePath and the Kimi summary type.
rg -n -C4 'wslLinuxHomePath' --type=ts --type=tsx
rg -n -C4 'KimiManagedAccountSummary|KimiManagedAccountsState' --type=ts --type=tsx

Repository: stablyai/orca

Length of output: 215


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- wslLinuxHomePath references ---'
rg -n -C 4 'wslLinuxHomePath' -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx' . || true

printf '%s\n' '--- Kimi summary/state references ---'
rg -n -C 4 'KimiManagedAccountSummary|KimiManagedAccountsState' -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx' . || true

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- shared type definitions ---'
sed -n '2625,2652p' src/shared/types.ts

printf '%s\n' '--- Kimi state producer ---'
sed -n '40,75p' src/main/kimi-accounts/service.ts

printf '%s\n' '--- renderer Kimi account property access ---'
rg -n 'account\.[A-Za-z0-9_]+' src/renderer/src/components/settings/KimiAccountsSection.tsx
rg -n 'wslLinuxHomePath|managedHomePath|managedHomeRuntime|wslDistro' src/renderer src/preload -g '*.ts' -g '*.tsx' || true

printf '%s\n' '--- Kimi preload bridge and IPC handlers ---'
rg -n -C 5 'kimiAccounts|KimiManagedAccountsState' src/preload src/main -g '*.ts' -g '*.tsx' | head -n 240

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from pathlib import Path

types = Path("src/shared/types.ts").read_text()
service = Path("src/main/kimi-accounts/service.ts").read_text()
renderer = Path("src/renderer/src/components/settings/KimiAccountsSection.tsx").read_text()
preload_types = Path("src/preload/api-types.ts").read_text()

assert "export type KimiManagedAccountSummary = Omit<KimiManagedAccount, 'managedHomePath'>" in types
assert "accounts: accounts.map(({ managedHomePath: _managedHomePath, ...summary }) => summary)" in service
assert "wslLinuxHomePath" not in renderer
assert "list: () => Promise<KimiManagedAccountsState>" in preload_types

print("Kimi summary retains wslLinuxHomePath, the main process returns it, and the renderer has no consumer for it.")
PY

Repository: stablyai/orca

Length of output: 260


Omit wslLinuxHomePath from KimiManagedAccountSummary. The preload API returns this summary directly, and the renderer does not use the field. Keep managed-home locations out of the renderer-facing state.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed on this stack: KimiManagedAccountSummary is Omit<KimiManagedAccount, 'managedHomePath' | 'wslLinuxHomePath'> in src/shared/managed-account-types.ts. The renderer never receives the WSL path.

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- managed-account type exports ---'
ast-grep outline src/shared/managed-account-types.ts --items all --type type --match 'KimiManagedAccount|KimiManagedAccountSummary|KimiManagedAccountsState'
rg -n -C 3 'type KimiManagedAccount(Summary|sState)?\b|KimiManagedAccountSummary' src/shared/managed-account-types.ts

printf '%s\n' '--- Kimi account state projection ---'
ast-grep outline src/main/kimi-accounts/service.ts --items all --type method --match 'listAccounts'
rg -n -C 5 'managedHomePath: _managedHomePath|listAccounts\s*\(' src/main/kimi-accounts/service.ts

Length of output: 999


🏁 Script executed:

#!/bin/bash
set -euo pipefail

type_file="$(fd -t f '^managed-account-types\.ts$' src/shared | head -n 1)"
service_file="$(fd -t f '^service\.ts$' src/main/kimi-accounts | head -n 1)"

test -n "$type_file"
test -n "$service_file"

printf '%s\n' '--- Kimi renderer-facing types ---'
rg -n -C 4 'export type KimiManagedAccount\b|export type KimiManagedAccountSummary\b|export type KimiManagedAccountsState\b' "$type_file"

printf '%s\n' '--- Kimi account-service state projection ---'
rg -n -C 6 'listAccounts\s*\(|managedHomePath:\s*_managedHomePath|wslLinuxHomePath:\s*_wslLinuxHomePath' "$service_file"

Length of output: 4832


@rp0927, the inspected stack does not contain that change.

KimiManagedAccountSummary omits only managedHomePath. It still includes wslLinuxHomePath. KimiAccountService.listAccounts() removes only managedHomePath, so the IPC response can still expose the WSL home path.

Please update the type and projection on this stack before resolving the finding.

You are interacting with an AI system.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This PR's head predates the omit. On later stack commits (5615a1999 and tip 82763dc2f / #13276), KimiManagedAccountSummary is Omit<KimiManagedAccount, 'managedHomePath' | 'wslLinuxHomePath'> and listAccounts() strips wslLinuxHomePath from the IPC payload.

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.

@rp0927, thanks for the clarification.

The later-stack change resolves the renderer exposure in #13276. The reviewed commit for #13275 still exposes wslLinuxHomePath, so this finding remains valid for this PR snapshot. I will keep the thread open here.

You are interacting with an AI system.

@rp0927
rp0927 force-pushed the feat/command-code-managed-accounts branch 2 times, most recently from f2f70b3 to 240b5ea 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 575dc9a7-cc2f-4cc6-be69-6351587ed3d4

📥 Commits

Reviewing files that changed from the base of the PR and between cb42b60 and 240b5eaf9bd457a25f7fed2de431dba9d3026a10.

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

lastAuthenticatedAt: number
}

export type KimiManagedAccountSummary = Omit<KimiManagedAccount, 'managedHomePath'>

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Do not expose the WSL managed-home path in the summary.

Line 109 omits managedHomePath, but it retains wslLinuxHomePath. KimiAccountsApi.list can then expose the managed credential-home path to the renderer. Exclude both path fields from KimiManagedAccountSummary.

Proposed fix
-export type KimiManagedAccountSummary = Omit<KimiManagedAccount, 'managedHomePath'>
+export type KimiManagedAccountSummary = Omit<
+  KimiManagedAccount,
+  'managedHomePath' | 'wslLinuxHomePath'
+>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export type KimiManagedAccountSummary = Omit<KimiManagedAccount, 'managedHomePath'>
export type KimiManagedAccountSummary = Omit<
KimiManagedAccount,
'managedHomePath' | 'wslLinuxHomePath'
>

@rp0927
rp0927 force-pushed the feat/command-code-managed-accounts branch 2 times, most recently from 98abafa to 1426c52 Compare August 15, 2026 06:37
@coderabbitai

coderabbitai Bot commented Aug 15, 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 force-pushed the feat/command-code-managed-accounts branch from 1426c52 to f02346d Compare August 15, 2026 08:47
@coderabbitai

coderabbitai Bot commented Aug 15, 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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b4eb2dd-4778-4c37-9bd5-bc7c325bf7f9

📥 Commits

Reviewing files that changed from the base of the PR and between 5b7f442 and f02346d36e17c738e4ae53fd28e081d095a07966.

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

Comment thread src/main/kimi-accounts/login-runner.ts Resolved
Comment on lines +806 to +808
const fresh = await fetchKimiRateLimits({
home: { runtime: 'host', wslDistro: null, path: account.managedHomePath }
})

@coderabbitai coderabbitai Bot Aug 15, 2026 •

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- fetchKimiRateLimits signature and options ---'
rg -n -C 20 'export (async )?function fetchKimiRateLimits' --glob '*.ts'

echo '--- Kimi home type ---'
rg -n -C 8 'KimiHomeResolver|type KimiHome|runtime: .wsl.' --glob '*kimi*.ts'

echo '--- inactive Kimi account producers ---'
rg -n -C 8 'setInactiveKimiAccountsResolver|managedHomePath' --glob '*kimi*'

Repository: stablyai/orca

Length of output: 201


🏁 Script executed:

set -euo pipefail

echo '--- candidate Kimi files ---'
git ls-files | rg -i 'kimi|rate-limit|rate_limits'

echo '--- fetchKimiRateLimits references ---'
rg -n -C 12 'fetchKimiRateLimits' --glob '*.{ts,tsx,js,jsx}'

echo '--- managed Kimi home references ---'
rg -n -C 10 'managedHomePath|InactiveKimiAccountInfo|inactiveKimi' --glob '*.{ts,tsx,js,jsx}'

Repository: stablyai/orca

Length of output: 6104


🏁 Script executed:

set -euo pipefail

echo '--- Kimi fetcher structure ---'
ast-grep outline src/main/rate-limits/kimi-fetcher.ts

echo '--- Kimi fetcher implementation and option types ---'
rg -n -C 25 'fetchKimiRateLimits|AbortSignal|signal|home:' src/main/rate-limits/kimi-fetcher.ts

echo '--- service call sites and account types ---'
rg -n -C 18 'fetchKimiRateLimits|InactiveKimiAccountInfo|managedHomePath|wslDistro|runtime' src/main/rate-limits/service.ts src/main/rate-limits/*.ts

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

set -euo pipefail

echo '--- Kimi fetcher declarations ---'
rg -n '^(export )?(type|interface|async function|function)|fetchKimiRateLimits|AbortSignal|runtime|wslDistro' src/main/rate-limits/kimi-fetcher.ts | head -n 160

echo '--- Kimi fetcher relevant sections ---'
sed -n '1,180p' src/main/rate-limits/kimi-fetcher.ts
sed -n '180,360p' src/main/rate-limits/kimi-fetcher.ts

echo '--- service Kimi account declarations and resolver wiring ---'
rg -n -C 12 'inactiveKimi|InactiveKimi|setInactiveKimi|managedHomePath' src/main/rate-limits/service.ts src/main/ipc/kimi-accounts.ts src/main/kimi-accounts/*.ts

Repository: stablyai/orca

Length of output: 50369


Thread cancellation through the Kimi fetcher.

fetchKimiRateLimits does not accept signal, so stopping the service cannot cancel an in-flight credentials read or request. Add signal support to the fetcher and pass it through to both operations. WSL accounts are excluded by getInactiveManagedAccountsForUsage(), so the host runtime is correct here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Already covered on the stack tip. 965f68b4a added signal support to fetchKimiRateLimits and threads it through both the credentials read and the request; service.ts:806-809 passes the fetch-cycle signal for every inactive account.

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- cited commit ---'
git show --stat --oneline 965f68b4a
git show --format=fuller --find-renames --find-copies 965f68b4a -- \
  src/main/rate-limits/kimi-fetcher.ts \
  src/main/rate-limits/service.ts

echo '--- current Kimi fetcher API and signal forwarding ---'
ast-grep outline src/main/rate-limits/kimi-fetcher.ts --items all
rg -n -C 12 'fetchKimiRateLimits|signal' src/main/rate-limits/kimi-fetcher.ts

echo '--- current inactive Kimi fetch call ---'
rg -n -C 10 'fetchInactiveKimiAccountsOnOpen|fetchKimiRateLimits\(' src/main/rate-limits/service.ts

Length of output: 1115


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- checkout identity ---'
git rev-parse --short HEAD
git branch --show-current

echo '--- Kimi fetcher structure ---'
ast-grep outline src/main/rate-limits/kimi-fetcher.ts --items all

echo '--- Kimi fetcher signal handling ---'
rg -n -C 14 'fetchKimiRateLimits|AbortSignal|signal' src/main/rate-limits/kimi-fetcher.ts

echo '--- inactive Kimi fetch signal propagation ---'
rg -n -C 12 'fetchInactiveKimiAccountsOnOpen|fetchKimiRateLimits\(' src/main/rate-limits/service.ts

Length of output: 10910


@rp0927, the available checkout is f02346d3 and does not include 965f68b4a. In this revision, fetchKimiRateLimits does not accept a caller-provided signal, and fetchInactiveKimiAccountsOnOpen does not pass its fetch-cycle signal.

Verification against the stack tip is inconclusive. Please retry after the checkout includes 965f68b4a.

You are interacting with an AI system.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Correct for the checkout you have — f02346d3 is this PR's head, and every follow-up fix on this stack lands on the tip branch feat/grok-gemini-managed-accounts (#13276), which sits above this PR. The ancestor branches stay parked at their original feature commits, so 965f68b4a cannot appear here.

At the tip (db8e1b1e0), fetchKimiRateLimits takes the signal and forwards it to both operations — src/main/rate-limits/kimi-fetcher.ts:

export async function fetchKimiRateLimits(options?: {
  home?: KimiHomeResolution
  signal?: AbortSignal
}): Promise<ProviderRateLimits> {
  if (options?.signal?.aborted) {
    // …bail before the credentials read

and for the request itself:

    const requestSignal = options?.signal
      ? AbortSignal.any([options.signal, AbortSignal.timeout(API_TIMEOUT_MS)])
      : AbortSignal.timeout(API_TIMEOUT_MS)

fetchInactiveKimiAccountsOnOpen passes its fetch-cycle signal per account (src/main/rate-limits/service.ts):

          const fresh = await fetchKimiRateLimits({
            home: { runtime: 'host', wslDistro: null, path: account.managedHomePath },
            signal
          })

Please re-verify against #13276.

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="stablyai/orca"
commit="db8e1b1e0"

echo '--- pull request `#13276` ---'
gh pr view 13276 --repo "$repo" --json number,headRefName,headRefOid,url

echo '--- cited commit ---'
gh api "repos/$repo/commits/$commit" --jq '{sha: .sha, message: .commit.message, parents: [.parents[].sha]}'

echo '--- Kimi fetcher changes in cited commit ---'
gh api "repos/$repo/commits/$commit" --jq '.files[] | select(.filename == "src/main/rate-limits/kimi-fetcher.ts") | .patch'

echo '--- service changes in cited commit ---'
gh api "repos/$repo/commits/$commit" --jq '.files[] | select(.filename == "src/main/rate-limits/service.ts") | .patch'

echo '--- tip versions: Kimi fetcher signal handling ---'
gh api "repos/$repo/contents/src/main/rate-limits/kimi-fetcher.ts?ref=$commit" \
  --jq '.content' | base64 --decode | rg -n -C 12 'fetchKimiRateLimits|signal|fetchKimiCredentials|fetchKimiUsage'

echo '--- tip versions: inactive Kimi signal forwarding ---'
gh api "repos/$repo/contents/src/main/rate-limits/service.ts?ref=$commit" \
  --jq '.content' | base64 --decode | rg -n -C 10 'fetchInactiveKimiAccountsOnOpen|fetchKimiRateLimits\('

Length of output: 7959


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="stablyai/orca"
commit="db8e1b1e079d587e3f4cdf7596dc0e62366e212f"

gh api "repos/$repo/contents/src/main/rate-limits/kimi-fetcher.ts?ref=$commit" \
  --jq '.content' | base64 --decode > /tmp/kimi-fetcher.ts

echo '--- credential reader declaration and implementation ---'
rg -n -C 20 '\b(readCredentials|readFile)\b' /tmp/kimi-fetcher.ts

echo '--- all readCredentials call sites ---'
rg -n -C 4 '\breadCredentials\s*\(' /tmp/kimi-fetcher.ts

Length of output: 6984


@rp0927, I rechecked #13276 at db8e1b1e0.

The request path is fixed. fetchKimiRateLimits passes the combined signal to net.fetch. fetchInactiveKimiAccountsOnOpen also passes its fetch-cycle signal.

The credential-read wait is not fixed. fetchKimiRateLimits calls readCredentials(home.path) without signal. readCredentials waits only on AbortSignal.timeout(CREDENTIALS_READ_TIMEOUT_MS). Therefore, stop() cannot end the caller's wait for an in-progress credential read before that timeout.

Please combine the caller signal with the credential-read timeout and pass it to SharedAuthFilesystemOperation.wait(...). The underlying filesystem operation can remain shared and non-cancellable.

You are interacting with an AI system.

@rp0927
rp0927 force-pushed the feat/command-code-managed-accounts branch 2 times, most recently from 6fce35b to 9e2d0dc Compare August 15, 2026 13:23
@rp0927

rp0927 commented Aug 15, 2026

Copy link
Copy Markdown
Author

Restacked onto current origin/main (c0a775454); force-pushed with --force-with-lease. New head: 9e2d0dc34.

The stack was also restructured so each PR is green on its own head — previously every follow-up fix landed on the tip (#13276), which meant ancestor heads failed typecheck/oxlint standalone and reviewers (including CodeRabbit) were reading a snapshot without the fixes. Details in #13276 (comment).

This head was verified standalone: typecheck:node, typecheck:web, typecheck:cli, oxlint all pass.

@rp0927
rp0927 force-pushed the feat/command-code-managed-accounts branch from 9e2d0dc to db8a904 Compare August 15, 2026 13:35
@rp0927

rp0927 commented Aug 15, 2026

Copy link
Copy Markdown
Author

Formatting follow-up; new head db8a90436. Same treatment as #13274 — the oxfmt reflow in src/main/command-code-accounts/service.ts is folded into the feature commit, so this head is oxfmt --check clean on its own. No behavior change; typecheck (node/web/cli) and oxlint still pass standalone.

rp0927 and others added 12 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
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.

4 participants