Repository navigation
Conversation
74b66a5 to
e756e46
Compare
|
Rebased onto current |
|
Too many files changed for review (137 files, 100 file limit). Bypass the limit by tagging |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe 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)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Caution CodeRabbit couldn't update its existing comment. The review summary may be out of date. Error details |
11054c0 to
be16021
Compare
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts (1)
63-71: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftValidate 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 winReject provider account references that do not match the new agent.
CreateAgentSessionParamsaccepts a Codex account reference for a non-Codex agent. It also accepts a non-Codex provider foragent: 'codex'. These requests pass RPC validation and invokecreateAgentSession.Apply the same agent/provider check that
ExplicitEnsureuses 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 valueList the allowed flags as literals.
Every other spec in this file lists flags as separate string literals. The
.split(' ')form widens the values tostringand 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 winAdd 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 aslaunchAgent: 'codex'that asserts the same identity result and thatgetSelectedApiKeyis 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 valueAssert no settings write after the null-account call too.
expect(store.updateSettings).not.toHaveBeenCalled()runs before theaccountId: nullcall. 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 winDuplicated 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 therealpathSyncform of each root as well.src/main/kimi-accounts/service.ts#L258-L270: call that shared function instead of repeating thereplaceAllchain.src/main/kimi-accounts/service.test.ts (1)
112-124: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRestore the source permissions in a
finallyblock.Lines 123-124 restore
0o700/0o600only when all assertions pass. If an assertion fails, theafterEachcleanup tries to delete a directory with mode0o500and fails, so one failure produces a second unrelated error. Wrap the assertions intry/finallyand restore the modes infinally.src/main/kimi-accounts/service.ts (1)
218-239: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winHook installation order differs from the login path.
importHomerenames the pending root toaccountRootat line 234 and installs hooks afterwards.provisionKimiManagedLogininstalls hooks into the pending home and renames afterwards. Install the hooks intopendingHomehere too, so the promoted directory is always complete and the rollback never has to remove a promotedaccountRoot.src/main/rate-limits/service.ts (1)
470-484: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy liftConfirm the full-cycle refetch on Kimi account switch is intentional.
refreshForKimiAccountChangecallsthis.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 inrefreshForCodexAccountChangestates 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
fetchKimiOnlycycle yet) rather than an oversight. If not, add a dedicatedrunFetchKimiOnlyCycle/fetchKimiOnlyfollowing the Codex/Claude pattern.src/main/ipc/pty.ts (1)
4637-4652: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated Kimi/Command Code env-application block.
The
applyKimiManagedHomeToLaunchEnv+applyCommandCodeManagedCredentialToLaunchEnvcalls at lines 4637-4652 and 6357-6372 are identical in shape and parameters. Both apply the same five arguments (env,launchAgent,connectionId, a derivedruntime,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-controllerspawnand thepty:spawnIPC 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 valueExtract 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" /> ) : nullsrc/renderer/src/store/slices/usage-provider-slices.ts (1)
233-239: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid faking a
T['snapshot']for the disabled-state reset.
mapSnapshotExtras({ accountOptions: [] } as T['snapshot']})only works today because Codex'smapSnapshotExtrasreads a single field. If a future provider'smapSnapshotExtrasreads other snapshot fields, this call passes them asundefined, and theas T['snapshot']cast hides the mismatch at compile time.Add an explicit
resetSnapshotExtrashook toUsageProviderConfiginstead of reusingmapSnapshotExtraswith 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 winAssert 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
removewith the selected account id. Add the confirmation click and assertremove({ 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.tssrc/cli/handlers/account.tssrc/cli/handlers/terminal.test.tssrc/cli/handlers/terminal.tssrc/cli/help.tssrc/cli/specs/core.tssrc/main/agent-hooks/server.test.tssrc/main/agent-hooks/server.tssrc/main/ai-vault/cached-session-list.test.tssrc/main/ai-vault/cached-session-list.tssrc/main/ai-vault/session-scanner-agent-sources.tssrc/main/ai-vault/session-scanner-kimi-managed.test.tssrc/main/ai-vault/session-scanner-types.tssrc/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/runtime-home-service.tssrc/main/codex-usage/codex-usage-provider.tssrc/main/codex-usage/scanner-paths.test.tssrc/main/codex-usage/scanner.tssrc/main/codex-usage/store-snapshot.benchmark.test.tssrc/main/codex-usage/store.test.tssrc/main/codex-usage/store.tssrc/main/codex-usage/types.tssrc/main/codex/codex-session-account-attribution.test.tssrc/main/codex/codex-session-account-attribution.tssrc/main/codex/codex-session-account-registry.test.tssrc/main/codex/codex-session-account-registry.tssrc/main/command-code-accounts/auth-file.tssrc/main/command-code-accounts/launch-environment.test.tssrc/main/command-code-accounts/launch-environment.tssrc/main/command-code-accounts/ownership.tssrc/main/command-code-accounts/service.test.tssrc/main/command-code-accounts/service.tssrc/main/index.tssrc/main/ipc/command-code-accounts.test.tssrc/main/ipc/command-code-accounts.tssrc/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/main/ipc/kimi-accounts.test.tssrc/main/ipc/kimi-accounts.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/rate-limits.test.tssrc/main/ipc/rate-limits.tssrc/main/ipc/register-core-handlers.test.tssrc/main/ipc/register-core-handlers.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/ipc/usage-provider-handlers.test.tssrc/main/ipc/usage-provider-handlers.tssrc/main/kimi-accounts/launch-environment.test.tssrc/main/kimi-accounts/launch-environment.tssrc/main/kimi-accounts/login-runner.test.tssrc/main/kimi-accounts/login-runner.tssrc/main/kimi-accounts/managed-home-copy.tssrc/main/kimi-accounts/managed-home-ownership.tssrc/main/kimi-accounts/managed-login-provisioning.tssrc/main/kimi-accounts/service.test.tssrc/main/kimi-accounts/service.tssrc/main/kimi/hook-service.test.tssrc/main/kimi/hook-service.tssrc/main/rate-limits/service.test.tssrc/main/rate-limits/service.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/ai-vault.test.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/main/text-generation/commit-message-agent-environment.test.tssrc/main/text-generation/commit-message-agent-environment.tssrc/main/usage/usage-event-aggregation.tssrc/main/usage/usage-provider-contract.tssrc/main/usage/usage-rollup-merge.tssrc/main/usage/usage-rollup-records.tssrc/main/window/attach-main-window-services.tssrc/preload/api-types.tssrc/preload/index.tssrc/preload/usage-provider-api.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.tssrc/renderer/src/components/native-chat/use-native-chat-session-options.tssrc/renderer/src/components/settings/AccountsPane.tsxsrc/renderer/src/components/settings/CommandCodeAccountsSection.test.tsxsrc/renderer/src/components/settings/CommandCodeAccountsSection.tsxsrc/renderer/src/components/settings/KimiAccountsSection.test.tsxsrc/renderer/src/components/settings/KimiAccountsSection.tsxsrc/renderer/src/components/settings/accounts-search.tssrc/renderer/src/components/stats/CodexUsagePane.tsxsrc/renderer/src/components/stats/codex-usage-account-filter.test.tssrc/renderer/src/components/stats/codex-usage-account-filter.tssrc/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsxsrc/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsxsrc/renderer/src/components/tab-bar/QuickLaunchButton.test.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/components/tab-bar/codex-launch-account-options.test.tssrc/renderer/src/components/tab-bar/codex-launch-account-options.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.test.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-client.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/store/slices/rate-limits.tssrc/renderer/src/store/slices/terminals.tssrc/renderer/src/store/slices/usage-provider-slices.tssrc/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/agent-session-host-authority.tssrc/shared/agent-session-option-catalog-claude-codex.tssrc/shared/agent-session-option-catalog.test.tssrc/shared/agent-session-option-catalog.tssrc/shared/codex-model-list-probe.test.tssrc/shared/codex-model-list-probe.tssrc/shared/codex-usage-account-filter-contract.test.tssrc/shared/codex-usage-account-filter-contract.tssrc/shared/codex-usage-types.tssrc/shared/commit-message-agent-spec.tssrc/shared/constants.tssrc/shared/protocol-version.tssrc/shared/provider-account-ref.test.tssrc/shared/provider-account-ref.tssrc/shared/rate-limit-types.tssrc/shared/types.ts
| export type KimiManagedAccountSummary = Omit<KimiManagedAccount, 'managedHomePath'> | ||
|
|
||
| export type KimiManagedAccountsState = { | ||
| accounts: KimiManagedAccountSummary[] | ||
| activeAccountId: string | null | ||
| } |
There was a problem hiding this comment.
🔒 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=tsxRepository: 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' . || trueRepository: 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 240Repository: 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.")
PYRepository: 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.
There was a problem hiding this comment.
Addressed on this stack: KimiManagedAccountSummary is Omit<KimiManagedAccount, 'managedHomePath' | 'wslLinuxHomePath'> in src/shared/managed-account-types.ts. The renderer never receives the WSL path.
There was a problem hiding this comment.
🧩 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.tsLength 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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.
f2f70b3 to
240b5ea
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
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.tssrc/cli/handlers/account.tssrc/cli/handlers/terminal.test.tssrc/cli/handlers/terminal.tssrc/cli/help.tssrc/cli/specs/core.tssrc/main/agent-hooks/server.test.tssrc/main/agent-hooks/server.tssrc/main/ai-vault/cached-session-list.test.tssrc/main/ai-vault/cached-session-list.tssrc/main/ai-vault/session-scanner-agent-sources.tssrc/main/ai-vault/session-scanner-kimi-managed.test.tssrc/main/ai-vault/session-scanner-types.tssrc/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/runtime-home-service.tssrc/main/codex-usage/codex-usage-provider.tssrc/main/codex-usage/scanner-paths.test.tssrc/main/codex-usage/scanner.tssrc/main/codex-usage/store-snapshot.benchmark.test.tssrc/main/codex-usage/store.test.tssrc/main/codex-usage/store.tssrc/main/codex-usage/types.tssrc/main/codex/codex-session-account-attribution.test.tssrc/main/codex/codex-session-account-attribution.tssrc/main/codex/codex-session-account-registry.test.tssrc/main/codex/codex-session-account-registry.tssrc/main/command-code-accounts/auth-file.tssrc/main/command-code-accounts/launch-environment.test.tssrc/main/command-code-accounts/launch-environment.tssrc/main/command-code-accounts/ownership.tssrc/main/command-code-accounts/service.test.tssrc/main/command-code-accounts/service.tssrc/main/index.tssrc/main/ipc/command-code-accounts.test.tssrc/main/ipc/command-code-accounts.tssrc/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/main/ipc/kimi-accounts.test.tssrc/main/ipc/kimi-accounts.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/rate-limits.test.tssrc/main/ipc/rate-limits.tssrc/main/ipc/register-core-handlers.test.tssrc/main/ipc/register-core-handlers.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/ipc/usage-provider-handlers.test.tssrc/main/ipc/usage-provider-handlers.tssrc/main/kimi-accounts/launch-environment.test.tssrc/main/kimi-accounts/launch-environment.tssrc/main/kimi-accounts/login-runner.test.tssrc/main/kimi-accounts/login-runner.tssrc/main/kimi-accounts/managed-home-copy.tssrc/main/kimi-accounts/managed-home-ownership.tssrc/main/kimi-accounts/managed-login-provisioning.tssrc/main/kimi-accounts/service.test.tssrc/main/kimi-accounts/service.tssrc/main/kimi/hook-service.test.tssrc/main/kimi/hook-service.tssrc/main/rate-limits/service.test.tssrc/main/rate-limits/service.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/ai-vault.test.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/main/text-generation/commit-message-agent-environment.test.tssrc/main/text-generation/commit-message-agent-environment.tssrc/main/usage/usage-event-aggregation.tssrc/main/usage/usage-provider-contract.tssrc/main/usage/usage-rollup-merge.tssrc/main/usage/usage-rollup-records.tssrc/main/window/attach-main-window-services.tssrc/preload/api-types.tssrc/preload/api/agent-account-api.tssrc/preload/api/agent-usage-api.tssrc/preload/api/git-inspection-api.tssrc/preload/api/pty-api.tssrc/preload/index.tssrc/preload/usage-provider-api.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.tssrc/renderer/src/components/native-chat/use-native-chat-session-options.tssrc/renderer/src/components/settings/AccountsPane.tsxsrc/renderer/src/components/settings/CommandCodeAccountsSection.test.tsxsrc/renderer/src/components/settings/CommandCodeAccountsSection.tsxsrc/renderer/src/components/settings/KimiAccountsSection.test.tsxsrc/renderer/src/components/settings/KimiAccountsSection.tsxsrc/renderer/src/components/settings/accounts-search.tssrc/renderer/src/components/stats/CodexUsagePane.tsxsrc/renderer/src/components/stats/codex-usage-account-filter.test.tssrc/renderer/src/components/stats/codex-usage-account-filter.tssrc/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsxsrc/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsxsrc/renderer/src/components/tab-bar/QuickLaunchButton.test.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/components/tab-bar/codex-launch-account-options.test.tssrc/renderer/src/components/tab-bar/codex-launch-account-options.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.test.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-client.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/store/slices/rate-limits.tssrc/renderer/src/store/slices/terminals.tssrc/renderer/src/store/slices/usage-provider-slices.tssrc/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/agent-session-host-authority.tssrc/shared/agent-session-option-catalog-claude-codex.tssrc/shared/agent-session-option-catalog.test.tssrc/shared/agent-session-option-catalog.tssrc/shared/codex-model-list-probe.test.tssrc/shared/codex-model-list-probe.tssrc/shared/codex-usage-account-filter-contract.test.tssrc/shared/codex-usage-account-filter-contract.tssrc/shared/codex-usage-types.tssrc/shared/commit-message-agent-spec.tssrc/shared/constants.tssrc/shared/global-settings-types.tssrc/shared/managed-account-types.tssrc/shared/protocol-version.tssrc/shared/provider-account-ref.test.tssrc/shared/provider-account-ref.tssrc/shared/rate-limit-types.tssrc/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'> |
There was a problem hiding this comment.
🔒 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.
| export type KimiManagedAccountSummary = Omit<KimiManagedAccount, 'managedHomePath'> | |
| export type KimiManagedAccountSummary = Omit< | |
| KimiManagedAccount, | |
| 'managedHomePath' | 'wslLinuxHomePath' | |
| > |
98abafa to
1426c52
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
1426c52 to
f02346d
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
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.tssrc/cli/handlers/account.tssrc/cli/handlers/terminal.test.tssrc/cli/handlers/terminal.tssrc/cli/help.tssrc/cli/specs/core.tssrc/main/agent-hooks/server.tssrc/main/ai-vault/cached-session-list.test.tssrc/main/ai-vault/cached-session-list.tssrc/main/ai-vault/session-scanner-agent-sources.tssrc/main/ai-vault/session-scanner-kimi-managed.test.tssrc/main/ai-vault/session-scanner-types.tssrc/main/codex-accounts/runtime-home-service.tssrc/main/codex-usage/codex-usage-provider.tssrc/main/codex-usage/scanner-paths.test.tssrc/main/codex-usage/scanner.tssrc/main/codex-usage/store-snapshot.benchmark.test.tssrc/main/codex-usage/store.tssrc/main/codex-usage/types.tssrc/main/codex/codex-session-account-attribution.test.tssrc/main/codex/codex-session-account-attribution.tssrc/main/codex/codex-session-account-registry.test.tssrc/main/codex/codex-session-account-registry.tssrc/main/command-code-accounts/auth-file.tssrc/main/command-code-accounts/launch-environment.test.tssrc/main/command-code-accounts/launch-environment.tssrc/main/command-code-accounts/ownership.tssrc/main/command-code-accounts/service.test.tssrc/main/command-code-accounts/service.tssrc/main/index.tssrc/main/ipc/command-code-accounts.test.tssrc/main/ipc/command-code-accounts.tssrc/main/ipc/filesystem.tssrc/main/ipc/kimi-accounts.test.tssrc/main/ipc/kimi-accounts.tssrc/main/ipc/pty.tssrc/main/ipc/rate-limits.test.tssrc/main/ipc/rate-limits.tssrc/main/ipc/register-core-handlers.test.tssrc/main/ipc/register-core-handlers.tssrc/main/ipc/settings.test.tssrc/main/ipc/settings.tssrc/main/ipc/usage-provider-handlers.test.tssrc/main/ipc/usage-provider-handlers.tssrc/main/kimi-accounts/launch-environment.test.tssrc/main/kimi-accounts/launch-environment.tssrc/main/kimi-accounts/login-runner.test.tssrc/main/kimi-accounts/login-runner.tssrc/main/kimi-accounts/managed-home-copy.tssrc/main/kimi-accounts/managed-home-ownership.tssrc/main/kimi-accounts/managed-login-provisioning.tssrc/main/kimi-accounts/service.test.tssrc/main/kimi-accounts/service.tssrc/main/kimi/hook-service.test.tssrc/main/kimi/hook-service.tssrc/main/rate-limits/service.tssrc/main/runtime/orca-runtime-agent-session-operation.test.tssrc/main/runtime/orca-runtime-git.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/main/runtime/rpc/methods/ai-vault.test.tssrc/main/runtime/rpc/methods/git-params.tssrc/main/runtime/rpc/methods/git.test.tssrc/main/runtime/rpc/methods/git.tssrc/main/text-generation/commit-message-agent-environment.test.tssrc/main/text-generation/commit-message-agent-environment.tssrc/main/usage/usage-event-aggregation.tssrc/main/usage/usage-provider-contract.tssrc/main/usage/usage-rollup-merge.tssrc/main/usage/usage-rollup-records.tssrc/main/window/attach-main-window-services.tssrc/preload/api-types.tssrc/preload/api/agent-account-api.tssrc/preload/api/agent-usage-api.tssrc/preload/api/git-inspection-api.tssrc/preload/api/pty-api.tssrc/preload/index.tssrc/preload/usage-provider-api.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-enrichment.tssrc/renderer/src/components/native-chat/use-native-chat-session-options.tssrc/renderer/src/components/settings/AccountsPane.tsxsrc/renderer/src/components/settings/CommandCodeAccountsSection.test.tsxsrc/renderer/src/components/settings/CommandCodeAccountsSection.tsxsrc/renderer/src/components/settings/KimiAccountsSection.test.tsxsrc/renderer/src/components/settings/KimiAccountsSection.tsxsrc/renderer/src/components/settings/accounts-search.tssrc/renderer/src/components/stats/CodexUsagePane.tsxsrc/renderer/src/components/stats/codex-usage-account-filter.test.tssrc/renderer/src/components/stats/codex-usage-account-filter.tssrc/renderer/src/components/tab-bar/CodexLaunchAccountMenu.test.tsxsrc/renderer/src/components/tab-bar/CodexLaunchAccountMenu.tsxsrc/renderer/src/components/tab-bar/QuickLaunchButton.test.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/components/tab-bar/codex-launch-account-options.test.tssrc/renderer/src/components/tab-bar/codex-launch-account-options.tssrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/runtime-agent-background-create.tssrc/renderer/src/runtime/remote-agent-session-launch.test.tssrc/renderer/src/runtime/remote-agent-session-launch.tssrc/renderer/src/runtime/runtime-git-client.test.tssrc/renderer/src/runtime/runtime-git-client.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/store/slices/rate-limits.tssrc/renderer/src/store/slices/terminals.tssrc/renderer/src/store/slices/usage-provider-slices.tssrc/renderer/src/store/slices/usage-snapshot-refresh.benchmark.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/agent-session-host-authority.tssrc/shared/agent-session-option-catalog-claude-codex.tssrc/shared/agent-session-option-catalog.test.tssrc/shared/agent-session-option-catalog.tssrc/shared/codex-model-list-probe.test.tssrc/shared/codex-model-list-probe.tssrc/shared/codex-usage-account-filter-contract.test.tssrc/shared/codex-usage-account-filter-contract.tssrc/shared/codex-usage-types.tssrc/shared/commit-message-agent-spec.tssrc/shared/constants.tssrc/shared/global-settings-types.tssrc/shared/managed-account-types.tssrc/shared/protocol-version.tssrc/shared/provider-account-ref.test.tssrc/shared/provider-account-ref.tssrc/shared/rate-limit-types.tssrc/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
| const fresh = await fetchKimiRateLimits({ | ||
| home: { runtime: 'host', wslDistro: null, path: account.managedHomePath } | ||
| }) |
There was a problem hiding this comment.
🩺 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/*.tsRepository: 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/*.tsRepository: 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
🧩 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.tsLength 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.tsLength 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.
There was a problem hiding this comment.
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 readand 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.
There was a problem hiding this comment.
🧩 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.tsLength 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.
6fce35b to
9e2d0dc
Compare
|
Restacked onto current 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 This head was verified standalone: |
9e2d0dc to
db8a904
Compare
|
Formatting follow-up; new head |
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
db8a904 to
208cc8f
Compare
Summary
Orca can now manage isolated Command Code credential profiles by importing only
auth.jsonfrom a user-selected Command Code home into an owner-marked private store. Main validates a bounded regular JSON file and extracts the requiredapiKeywithout returning the key or any credential path to renderer code.The selected profile is applied as
COMMAND_CODE_API_KEYonly 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 lintpnpm typecheckpnpm testpnpm buildFocused validation:
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-devwithout failing the build.AI Review Report
The review checked the provider's documented credential surface before limiting the adapter to
auth.jsonandCOMMAND_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:
Security Audit
auth.json; symlinks, oversized files, malformed JSON, and missing API keys are rejected.~/.commandcoderemain unchanged.Notes
@rp0927