orca/src/main/rate-limits
Neil 597c84f36c
fix(rate-limits): read Kimi usage credentials from the configured WSL runtime (#12475)
* fix(rate-limits): read Kimi usage credentials from the configured WSL runtime

Kimi's usage fetch always read the Windows host's ~/.kimi-code, so a Kimi CLI running inside WSL rotated only the WSL-side token and the status bar was stuck on 'Run Kimi to refresh'.

Resolve the Kimi home from the local-account runtime target (mirroring Codex's getDefaultWslDistro()/getWslHome() UNC pattern), pinned to host off Windows, and keep KIMI_CODE_HOME host-only.

Fixes #12370

Co-authored-by: Orca <help@stably.ai>

* fix(rate-limits): bound and offload the Kimi credentials read for WSL homes

Adopted from @cengiz-io's #12372: read credentials through
createAuthFilesystemOperation (async, per-path dedup, AbortSignal bound) so a
stopped distro degrades to an error instead of parking Electron main on a UNC
read. ENOTDIR joins ENOENT as "not signed in" to keep existsSync parity, and the
WSL runtime target is now probed with the async wsl.exe helpers.

Co-authored-by: Orca <help@stably.ai>

* test(rate-limits): build Kimi credential-path expectations with path.join

The host-home assertions hardcoded POSIX separators, so they only passed on
a POSIX runner — on a Windows dev machine `join` emits backslashes and all
four cases failed (three assertion mismatches plus a WSL-suite fixture whose
map key never matched the path the fetcher read).

---------

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: OrcaWin <alpha-eng@stably.ai>
2026-08-07 18:59:42 -07:00
..
account-runtime-target-sync.test.ts fix(accounts): follow the runtime for WSL provider account detection (#9537) (#9611) 2026-07-20 18:35:14 -07:00
account-runtime-target-sync.ts fix(accounts): follow the runtime for WSL provider account detection (#9537) (#9611) 2026-07-20 18:35:14 -07:00
auth-filesystem-operation.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
auth-filesystem-operation.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
claude-fetcher.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
claude-fetcher.ts fix(quality): enforce performance-safe lint baseline (#11074) 2026-07-27 20:54:02 -07:00
claude-oauth-usage-error.test.ts fix(rate-limits): unstick Claude "Limited" usage — respect Retry-After and feed live usage from session statuslines (#9617) 2026-07-21 00:36:42 -07:00
claude-oauth-usage-error.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
claude-pty-reset-parser.ts fix(rate-limits): keep Codex PTY reset text for weekly-only plans (#8643) 2026-07-24 16:26:55 -07:00
claude-pty.test.ts Harden rate-limit PTY working directory and abort background usage probes on stop (#7403) 2026-07-04 22:50:43 -07:00
claude-pty.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
claude-rate-limit-target.test.ts fix(accounts): follow the runtime for WSL provider account detection (#9537) (#9611) 2026-07-20 18:35:14 -07:00
claude-rate-limit-target.ts fix(accounts): follow the runtime for WSL provider account detection (#9537) (#9611) 2026-07-20 18:35:14 -07:00
claude-usage-error-classification.test.ts Improve Claude usage refresh fallback behavior (#5995) 2026-06-21 13:10:25 -07:00
claude-usage-error-classification.ts Improve Claude usage refresh fallback behavior (#5995) 2026-06-21 13:10:25 -07:00
claude-usage-refresh-plan.test.ts Improve Claude usage refresh fallback behavior (#5995) 2026-06-21 13:10:25 -07:00
claude-usage-refresh-plan.ts Improve Claude usage refresh fallback behavior (#5995) 2026-06-21 13:10:25 -07:00
claude-usage-window.ts fix(rate-limits): unstick Claude "Limited" usage — respect Retry-After and feed live usage from session statuslines (#9617) 2026-07-21 00:36:42 -07:00
codex-auth-presence.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
codex-auth-presence.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
codex-fetcher-auth-errors.test.ts fix(codex): make quota probes credential-safe (#12145) 2026-08-02 19:06:43 -07:00
codex-fetcher-backend.test.ts fix(codex): restore five-hour usage window (#11415) 2026-07-29 15:53:42 -07:00
codex-fetcher-probe-shutdown.test.ts fix(codex): make quota probes credential-safe (#12145) 2026-08-02 19:06:43 -07:00
codex-fetcher-pty-settle.test.ts fix(rate-limits): keep Codex PTY reset text for weekly-only plans (#8643) 2026-07-24 16:26:55 -07:00
codex-fetcher-session-supplement.test.ts fix(codex): make quota probes credential-safe (#12145) 2026-08-02 19:06:43 -07:00
codex-fetcher.test.ts fix(codex): recover interrupted state DB backfills (#12617) 2026-08-07 14:06:29 -07:00
codex-fetcher.ts fix(codex): recover interrupted state DB backfills (#12617) 2026-08-07 14:06:29 -07:00
codex-probe-termination.test.ts fix(codex): make quota probes credential-safe (#12145) 2026-08-02 19:06:43 -07:00
codex-probe-termination.ts fix(codex): make quota probes credential-safe (#12145) 2026-08-02 19:06:43 -07:00
codex-rate-limit-target.test.ts fix(accounts): follow the runtime for WSL provider account detection (#9537) (#9611) 2026-07-20 18:35:14 -07:00
codex-rate-limit-target.ts fix(accounts): follow the runtime for WSL provider account detection (#9537) (#9611) 2026-07-20 18:35:14 -07:00
codex-rate-limit-window-classification.test.ts fix(codex): restore five-hour usage window (#11415) 2026-07-29 15:53:42 -07:00
codex-rate-limit-window-classification.ts fix(codex): restore five-hour usage window (#11415) 2026-07-29 15:53:42 -07:00
gemini-bucket-formatting.test.ts
gemini-bucket-formatting.ts lint(unicorn): enable prefer-number-properties, prefer-array-find, prefer-array-index-of (#7516) 2026-07-05 23:56:37 -07:00
gemini-cli-oauth-extractor.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
gemini-oauth-sources.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
gemini-usage-fetcher.fallback.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
gemini-usage-fetcher.test-fixtures.ts
gemini-usage-fetcher.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
gemini-usage-fetcher.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
grok-auth.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
grok-auth.ts chore(dead-code): drop ~2k lines of unreachable exports and orphan modules (#12077) 2026-08-02 00:33:57 -07:00
grok-fetcher.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
grok-fetcher.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
hidden-pty-cleanup.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
hidden-pty-cleanup.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
hidden-rate-limit-pty-cwd.ts Harden rate-limit PTY working directory and abort background usage probes on stop (#7403) 2026-07-04 22:50:43 -07:00
kimi-fetcher-wsl-home.test.ts fix(rate-limits): read Kimi usage credentials from the configured WSL runtime (#12475) 2026-08-07 18:59:42 -07:00
kimi-fetcher.test.ts fix(rate-limits): read Kimi usage credentials from the configured WSL runtime (#12475) 2026-08-07 18:59:42 -07:00
kimi-fetcher.ts fix(rate-limits): read Kimi usage credentials from the configured WSL runtime (#12475) 2026-08-07 18:59:42 -07:00
minimax-fetcher.test.ts refactor(net): use AbortSignal.timeout for fetch timeouts, fix fork-sync clobbered cancel (#7504) 2026-07-05 23:09:14 -07:00
minimax-fetcher.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
minimax-request-context.test.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
minimax-request-context.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
opencode-go-page-scraper.ts
opencode-go-request-session.ts fix(rate-limits): authenticate OpenCode Go through a session cookie jar (#8047) 2026-07-22 17:21:30 -07:00
opencode-go-usage-fetcher.test.ts fix(rate-limits): authenticate OpenCode Go through a session cookie jar (#8047) 2026-07-22 17:21:30 -07:00
opencode-go-usage-fetcher.ts Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
project-runtime-rate-limit-target.ts
service.test.ts fix(rate-limits): read Kimi usage credentials from the configured WSL runtime (#12475) 2026-08-07 18:59:42 -07:00
service.ts fix(rate-limits): read Kimi usage credentials from the configured WSL runtime (#12475) 2026-08-07 18:59:42 -07:00
time-zone-wall-clock.ts Include Claude Fable reset countdown 2026-07-03 19:36:10 -07:00