Skip to content

fix(models): restore Kimi K3 1M context#4481

Merged
Hmbown merged 1 commit into
mainfrom
agent/091-kimi-k3-context
Jul 17, 2026
Merged

fix(models): restore Kimi K3 1M context#4481
Hmbown merged 1 commit into
mainfrom
agent/091-kimi-k3-context

Conversation

@Hmbown

@Hmbown Hmbown commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • add the direct Moonshot kimi-k3 model to both bundled offline catalogs
  • carry its 1,048,576-token context and 131,072-token output limit into runtime route budgeting
  • keep the tier-dependent Kimi Code k3 identity and OAuth compatibility path separate

This closes the current mismatch where live model discovery can display K3 at 1M context, but the runtime resolver falls back to the unknown-model 128K floor.

Official model reference: https://platform.kimi.ai/docs/guide/kimi-k3-quickstart

Verification

  • JSON parsing and bundled snapshot validation
  • cargo fmt --all --check
  • git diff --check
  • cargo test -p codewhale-config (386 passed)
  • focused TUI model metadata test (1 passed)
  • focused TUI route-runtime tests (8 passed)

Only the known macOS __eh_frame linker warning appeared.

Checklist

  • Added regression coverage for bundled catalog hydration and runtime budgeting
  • Kept provider/model identity boundaries explicit
  • No publishing or deployment performed

Seed the Moonshot kimi-k3 offering in both bundled metadata catalogs so offline and runtime resolution carry its 1,048,576-token context and 131,072-token output limit instead of falling back to 128K.

Keep the tier-dependent Kimi Code k3 identity separate from the direct API route.

Signed-off-by: Hunter B <hmbown@gmail.com>
Copilot AI review requested due to automatic review settings July 17, 2026 18:13
@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Hmbown Hmbown added this to the v0.9.1 milestone Jul 17, 2026
@claude

claude Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Hmbown's task in 2m 12s —— View job


Reviewing PR #4481

  • Gather context (PR body, diff stat)
  • Read full diff
  • Check provider/model/route safety invariant
  • Check correctness, tests, reuse
  • Post final review

Summary

Clean, well-scoped fix. kimi-k3 is added to both bundled catalogs with the documented 1,048,576 context / 131,072 output limits, and the runtime resolution paths (context_window_for_model, max_output_tokens_for_model, model_supports_reasoning in crates/tui/src/models.rs, plus RouteResolver in route_runtime.rs) all check the catalog (crate::model_catalog::resolved_* / bundled models_dev.bundled.json) before falling back to hard-coded heuristics — so this new model flows through existing catalog-driven plumbing without any new special-casing. No provider/model inference from prefixes or freeform text is introduced; kimi-k3 is added as an explicit, distinct wire id alongside (not conflated with) the tier-gated kimi-for-coding (Kimi Code/OAuth) identity, which is untouched. Good adherence to the EPIC #2608 invariant.

Tests are appropriately placed at each layer: catalog hydration (catalog/tests.rs), route resolution (route/tests.rs), TUI model metadata (models.rs), and a new runtime-route budgeting test (route_runtime.rs) that exercises route_context_window_tokens end-to-end. That last test is a nice touch — it verifies the value actually reaches the budgeting layer, not just the resolver.

Minor observations (non-blocking)

  1. crates/config/assets/models_dev.bundled.json — the new kimi-k3 entry uses "family": "kimi-k3", while its siblings (kimi-k2.7-code, kimi-k2.6) use "family": "kimi". family doesn't appear to drive any routing/grouping logic today (spot-checked model_reference.rs, provider_lake.rs, model_profile.rs — all just pass it through or assert it in tests), so this is cosmetic, but worth double-checking it's intentional rather than a copy/paste artifact.
  2. Neither bundled catalog entry carries pricing (cost / input_usd_per_million/output_usd_per_million) for kimi-k3, so it'll surface as PricingSku::UnknownOrStale. That matches the documented "no fabricated pricing" policy, just flagging in case Moonshot's public K3 pricing is available and was simply omitted rather than deliberately withheld.
  3. crates/tui/src/model_registry.rs's SEED_MODEL_IDS (explicitly documented as a curated, not-yet-consumed registry — #![allow(dead_code)]) doesn't include kimi-k3. Since unseeded ids still resolve correctly via the models.rs/catalog fallback used elsewhere in this PR, this has no behavioral effect today; only relevant once that registry becomes a real call site.

No correctness bugs, no provider-prefix inference issues, and no missing test coverage found. Nice, focused fix.

@Hmbown
Hmbown merged commit 69088b4 into main Jul 17, 2026
20 checks passed
@Hmbown
Hmbown deleted the agent/091-kimi-k3-context branch July 17, 2026 18:34
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