Skip to content

[0.64.1] Route Kimi through selected region - #599

Open
Finesssee wants to merge 10 commits into
mainfrom
codex/port-0.64.1-kimi-regions
Open

Finesssee wants to merge 10 commits into
mainfrom
codex/port-0.64.1-kimi-regions

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Ports the Windows-relevant Kimi regional routing from upstream v0.64.1 (7618b4fdd, a0feb78fd, 1caaeb883). Settings can now select China (kimi.com, default) or International (kimi.ai), and the Code API, web membership calls, browser/Desktop cookie lookup, dashboard URL, and request Origin/Referer move together. Unscoped Kimi Code CLI credentials remain China-only because their credential file does not identify an issuing host.

This PR is stacked on #598, whose base contains prerequisite PRs #586 and #587.

Validation:

  • cargo test --manifest-path rust/Cargo.toml providers::kimi --lib (55 passed)
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml kimi_region (2 passed)
  • cargo clippy --manifest-path rust/Cargo.toml --lib --tests -- -D warnings
  • cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check
  • Fresh Windows desktop build: pnpm --dir apps/desktop-tauri run tauri:build:debug
  • CUA Driver proof: selected Kimi in CODEXBAR_PROOF_MODE=settings:providers; the live Region combobox rendered China (kimi.com). Screenshot: C:\Users\mac\AppData\Local\Temp\wcb-kimi-region-selected.png.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 357f477c-8c3e-4386-904c-5ca47a9fb2d1

📥 Commits

Reviewing files that changed from the base of the PR and between b585d48 and 0f759e6.

📒 Files selected for processing (19)
  • apps/desktop-tauri/src-tauri/src/commands/mod.rs
  • apps/desktop-tauri/src-tauri/src/commands/provider_detail.rs
  • apps/desktop-tauri/src-tauri/src/commands/provider_settings.rs
  • apps/desktop-tauri/src-tauri/src/commands/system.rs
  • apps/desktop-tauri/src-tauri/src/commands/tests.rs
  • apps/desktop-tauri/src/hooks/useTrayPanelLayout.sizing.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/RegionSection.tsx
  • rust/src/providers/chutes/mod.rs
  • rust/src/providers/claude/accounts/login.rs
  • rust/src/providers/kimi/code_api.rs
  • rust/src/providers/kimi/desktop_token.rs
  • rust/src/providers/kimi/mod.rs
  • rust/src/providers/kimi/region.rs
  • rust/src/providers/kimi/web.rs
  • rust/src/providers/minimax/coding_plan_html.rs
  • rust/src/providers/mod.rs
  • rust/src/providers/perplexity/mod.rs
  • rust/src/settings.rs
  • rust/src/settings/tests.rs

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.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Thermo-nuclear code-quality review

Verdict: FINDINGS

Medium — centralize settings-aware dashboard resolution

apps/desktop-tauri/src-tauri/src/commands/provider_detail.rs:82 and apps/desktop-tauri/src-tauri/src/commands/system.rs:208

The Kimi region-to-console URL decision is implemented independently in provider-detail construction and dashboard opening. MiniMax already has the same duplication, and adding Kimi grows parallel provider-specific condition chains that can drift: the UI can advertise one URL while the command opens another.

Please extract one settings-aware dashboard resolver taking ProviderId and &Settings, with provider metadata as the fallback, and reuse it from both paths. This deletes both duplicated special-case blocks and gives future regional providers one canonical extension point.

The new KimiRegion module itself is cohesive: endpoint, cookie-domain, display, and persisted-value decisions are centralized. No under-1k file crosses 1k in this patch.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Applied the two test corrections already reviewed, validated in CircleCI, and merged in #607. They remove the shared tray-layout timing failure and unrelated Claude fixture-startup timeout; the current head is 0f759e624376f905d3047f5f39bc698b6f54939d.

The earlier thermo finding about duplicated regional dashboard resolution is addressed: provider detail and dashboard opening now use the shared provider_dashboard_url resolver. A fresh CircleCI run is validating the updated branch. This PR remains stacked on #598, which depends on the corrected #587; it is not yet integrated into main.

@Finesssee
Finesssee changed the base branch from codex/port-0.64.0-kimi-cookie-policy to main September 23, 2026 13:54
@Finesssee

Copy link
Copy Markdown
Collaborator Author

Thermo source closeout: PASS at 0f759e624376f905d3047f5f39bc698b6f54939d, independently reviewed against #598.

One typed KimiRegion mapping supplies hosts, console URLs, and cookie domains. Fetch resolves that configured region once; both provider detail and dashboard opening use the shared dashboard resolver. This closes the earlier duplicated-routing finding. Region normalization and validation remain at the settings boundary.

The recorded fresh Windows/CUA proof shows the region picker with China (kimi.com) selected. It proves the visible setting, while the routing tests/source establish endpoint selection; it does not claim a live authenticated request to the China service.

CircleCI passes at this head. This PR now targets main, and its exact commit is included in #610 with the corrected #587 prerequisite. Final landing requires the full Windows gate on the combined revision.

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.

1 participant