Skip to content

Port upstream 0.64.1: honor saved Kimi API region in CLI and serve fetch contexts - #737

Draft
Finesssee wants to merge 96 commits into
mainfrom
port/micro-0.64.1-kimi-cli-region
Draft

Finesssee wants to merge 96 commits into
mainfrom
port/micro-0.64.1-kimi-cli-region

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Port upstream 0.64.1 Kimi CLI region parity (steipete#3712 follow-up, GAP-28):

  • Saved per-provider API region now reaches every fetch context: codexbar usage CLI runs, serve /usage responses, and dashboard snapshot fetches populate FetchContext.api_region from provider settings via the new populate_api_region_from_settings helper (explicit context values keep precedence; empty/unset regions leave the context untouched).
  • Claude token-account rows build their fetch context up front and also get the saved region, so per-account overrides no longer reset region selection.
  • New module rust/src/cli/fetch_context.rs (declared in cli/mod.rs) owns the helper plus unit tests covering: saved international region populates the context, empty/unset leaves it missing, an explicit caller value wins, and KimiRegion::from_settings("international") selects the api.kimi.ai / www.kimi.ai domains.

Validation (at a6ba165 + lint companion cf4bac8, toolchain clippy 1.96):

  • cargo fmt --all — pass.
  • cargo test --manifest-path rust/Cargo.toml — full suite pass, 0 failed / 1 ignored (includes the four new fetch-context region tests).
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings — pass. The companion commit fixes three pre-existing lint sites (alibabatokenplan manual_range_contains, kiro + openai nonminimal_bool) that clippy 1.96 flags identically on origin/main; no behavior change.
  • Pushed port/micro-0.64.1-kimi-cli-region cf4bac8. CLI/serve fetch-context wiring only; dashboard frontend untouched — browser-use UI proof not applicable.

Finesssee and others added 30 commits September 22, 2026 00:34
Port the remaining upstream 0.63.0 fd2414d conditions: the legacy weekly
counters must be reliable, counters are integers (an invalid used falls
back to a valid remaining balance), and the replacement window is built
from those counters. Translate the upstream KimiRatioPoolTests cases.
@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Validated 2026-10-01 at cf4bac8 (port content) + a6ba165 (feature commit):

  • cargo fmt --all — pass.
  • cargo test --manifest-path rust/Cargo.toml — full workspace suite pass, 0 failed / 1 ignored; includes the four new fetch-context region tests (saved international region populates, empty/unset leaves missing, explicit caller value wins, KimiRegion::International → api.kimi.ai / www.kimi.ai domains) and the CLI/serve/dashboard region-population wiring.
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings — pass. Companion commit cf4bac8 fixes three pre-existing lint sites (alibabatokenplan manual_range_contains, kiro + openai nonminimal_bool) that the local clippy 1.96 flags identically on origin/main — no behavior change.
  • Pushed port/micro-0.64.1-kimi-cli-region (new branch); ls-remote head matches local cf4bac89.
  • CLI/serve fetch-context wiring only; dashboard frontend untouched — no browser-use UI proof applicable.

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.

2 participants