Skip to content

Simplify Antigravity, Kimi, MiniMax and OpenCode providers - #803

Open
Finesssee wants to merge 32 commits into
simplify/provider-registryfrom
simplify/providers-agy-kimi-opencode
Open

Finesssee wants to merge 32 commits into
simplify/provider-registryfrom
simplify/providers-agy-kimi-opencode

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Lands after #795 (simplify/provider-registry). This PR is stacked on that branch; retarget to main once #795 merges.

Lane G2 of the behavior-preserving simplification program: antigravity, kimi, minimax, opencode, opencodego and openrouter providers. No persisted formats, serde names, CLI output, bridge DTOs, tab ids or user-facing strings change. No new dependencies.

Behavior summary

No intended behavior change. Each refactor commit was preceded by characterization pins where existing tests did not cover the code being merged. Bugs found along the way are listed under follow-ups and were not fixed here.

Dead code deleted

  • rust/src/providers/opencode/scraper.rs (PBG-01): no consumers. Its 6 tests go with it.
  • minimax::result_from_billing_summary (in PBG-37): prod-unused function.
  • openrouter::add_key_quota (in PBG-66): prod-unused helper.
  • kimi::KimiDesktopAuthToken::load() (in PBG-36, 47115d7): a pub fn that returned load_for_region(KimiRegion::China) and was documented as the "Production entry point". A base git grep -F 'DesktopAuthToken::load()' finds no callers; production (kimi/web.rs) uses load_for_region and the tests use load_from.

The module file was moved to the Recycle Bin from the W: worktree with ~/.claude/bin/trash, then git add -u.

rust/src/providers/minimax/local_storage.rs was deleted in e974e9b (PBG-03) and restored in dce376a; see "Validation fix round".

Levers

Commit Lever
3481c49 PBG-01 delete dead OpenCode scraper module
e974e9b PBG-03 delete dead MiniMax localStorage importer (reverted by dce376a)
0f76a5f PBG-23 share the OpenCode server-function request builder
c8927f6 PBG-66 table-drive OpenRouter key-meter and OpenCode parser tests
101d979 PBG-22 share the OpenRouter bearer JSON GET and spend-window table
8a5703b PBG-21 share OpenRouter and OpenCode Go error constructors
7aea531 PBG-20 share the OpenCode Go snapshot builder
0c24a44 PBG-48 extract OpenCode Go local window and month helpers
26cb94b split: OpenCode Go local reader tests into local/tests.rs (moves only; local.rs 1379 to 612)
200592d PBG-65 shared OpenCode Go local test fixtures (local/test_db.rs)
47115d7 PBG-36 share Kimi clock, integer and client helpers
82d75e6 PBG-35 settle Kimi web token attempts in one place
b3282b0 PBG-64 Kimi web snapshot and rate-limit test helpers
55674d5 PBG-08 share the MiniMax HTTP client, console GET and status mapping
df5e3ba PBG-37 share MiniMax row windows and the billing window table
a4f7826 PBG-13 table-drive MiniMax coding-plan lanes, reset text and clock rollover
1e5a7da PBG-64 MiniMax billing-record and base_resp test tables
cc822ef split: MiniMax provider tests into minimax/tests.rs (moves only)
f265576 split: MiniMax billing summary into minimax/billing.rs (moves plus pub(super); mod.rs 1266 to 729)
d7d72f2 clippy fix for 101d979 (type_complexity) and 47115d7 (excessive_precision)
91468aa, ff5bcf2, 38518c1 Antigravity characterization pins
ef7c32b PBG-17 share Antigravity SQLite row checks and schema inspector
1af8111 PBG-18 share Antigravity loopback client and user-status request
efd9893 PBG-46 share Antigravity group family, slug, version probe and proto checks
7d24f7a PBG-57 shared Antigravity protobuf test fixtures
1431553 PBG-58 shared Antigravity SQLite test database helpers
8c1d7ec PBG-59 table-drive Antigravity process, user-status and fallback tests
720d78b PBG-60 shared Antigravity session-reader, step and offline-reason test helpers
dce376a fix round: revert e974e9b (restore MiniMax localStorage importer)
b0fe165 fix round: pin MiniMax coding-plan page headers and the remains no-plan error

Disclosure: pushed commits 101d979 and 47115d7 failed clippy -D warnings until d7d72f2. The -9.223..e18 literal became i64::MIN as f64 (same value).

Skipped levers

  • PBG-20 balance join helper: the console and legacy joins differ.
  • PBG-36 jwt_exp on the shared jwt_payload: padding and URL_SAFE semantics differ.
  • PBG-37 unit_seconds merge: the float operation order would change.
  • PBG-17 Budget::exhaust: no line savings.
  • PBG-46 managed_step: cannot be pinned (it spawns agy), and the test-only resolve_managed_outcome Err branch diverges from production.
  • PBG-18 probe_api_port stays off local_post: it sets no per-request timeout and sends .body("{}").
  • PBG-58 synthetic SQLite tests: a shared expect_summary helper keeps the named scenarios instead of one table.
  • PBG-60 quota_summary partial table: the remaining tests assert different fields per case, and the group-family case is already a table.
  • The UserTier.id and quota_summary dead_code allows stay, because those fields really are unread.

Test changes

  • Table rows keep every input and expected value. Some merged rows now assert more fields than the original tests: the PBG-59 user-status rows also check primary, secondary and sorted extra titles, the PBG-64 MiniMax base_resp Other row checks the message, and the PBG-60 offline_detail_for helper checks source_label == "offline" at every call site.
  • The Antigravity TLS loopback fetch path has no test, because there is no TLS test server. That gap existed before this PR.
  • Five multi-line SQL literals in the moved opencodego tests changed only in whitespace inside the string: CREATE TABLE message (...) three times and the message + part pair twice (now in local/test_db.rs). Nothing reads the sql column: prod opencodego checks the schema only through SELECT 1 FROM sqlite_master WHERE type='table' AND name=?1, and nothing hashes or compares DDL text.

Validation fix round

From the #803 validation (findings F1, F2, F3, F5, F6; the F4 nits are left as is):

  • F1, dce376a: git revert e974e9bd7. minimax/local_storage.rs is landed port work: GAP-33 / 0.66.0 row 23 landed through Port upstream 0.66.0: MiniMax browser storage discovery (stacked on #646) #651 (7515992, f37043a), upstream v0.70.0 still ships MiniMaxLocalStorageImporter, and browser/storage_discovery.rs had no consumer without it. The revert applied cleanly: the file is byte-identical to base 733d69a (same blob and mode), the mod.rs re-export is back with its reason = "imports needed for future MiniMax provider wiring" allow, and its 5 tests run again.
  • F2, b0fe165: new mockito pin minimax::http_tests::coding_plan_page_request_sends_html_accept_without_the_xhr_marker covers console_get with xhr=false. It matches the HTML Accept literal and Matcher::Missing on x-requested-with, plus the shared cookie and browser headers. The HTML Accept string moved into const HTML_ACCEPT in minimax/mod.rs (same bytes). The pin covers console_get's xhr=false branch, and the shared const covers the Accept value fetch_coding_plan_with_cookie sends. That caller's false flag is not wire-pinned, because region.coding_plan_url() cannot be pointed at a mock server. Flipping the pin's own argument to xhr=true fails it.
  • F3, b0fe165: cookie_remains_request_parses_a_json_body now asserts Err(ProviderError::Other("no plan")); parse_remains returns status_msg for a non-auth base_resp. It used to check only is_err().
  • LOC: restoring the importer (+466 lines) and the new pin turn the total against Simplify provider registry: spec table, derived defaults, shared helpers #795 from -379 at 720d78b to +129 at b0fe165. Prod still drops by 865 lines; the total rises because of test growth. The LOC table below shows the b0fe165 numbers.
  • F5 and F6: this body now lists KimiDesktopAuthToken::load() with the other removed items and describes the five whitespace-changed SQL literals.

LOC (loc.py, raw lines)

Ref Total Prod Test
733d69a (#795 head) 319654 198240 121414
this PR, b0fe165 319783 197375 122408
delta vs #795 +129 -865 +994
merge-base with main, 3226d2f 321490 200063 121427
delta vs merge-base (includes #795) -1707 -2688 +981
origin/main 603681a 324299 201409 122890

origin/main (603681a) is 15 commits past the merge-base and is not an ancestor of this branch, so a delta against it would mix in main's own changes; the merge-base row is the comparable one.

loc.py counts two test-only pieces as prod: opencodego/local/test_db.rs (83 lines) and the #[cfg(test)] pub(super) mod test_fixtures block in antigravity/local_proto.rs (32 lines). With those counted as test, the change against #795 is about -980 prod and +1109 test. Test lines grow because of the characterization pins (MiniMax http_tests.rs, coding_plan, coding_plan_html, Kimi web); the module moves are close to line-neutral.

Test inventory

cargo test -p codexbar -- --list (lib plus bin) goes from 3763 to 3758 tests: 46 removed and 41 added. In the six lane directories it goes from 422 to 417. Outside them nothing changed. The module splits keep their test paths (providers::minimax::tests, providers::opencodego::local::tests).

Removed (46), each with its reason:

  • Dead module, deleted with the code (6): opencode::scraper::tests::{test_looks_signed_out, test_normalize_workspace_id_direct, test_normalize_workspace_id_invalid, test_normalize_workspace_id_url, test_parse_subscription_json, test_parse_workspace_ids} (PBG-01). The 5 minimax::local_storage::tests are back after dce376a.
  • Merged into table rows, every input and expected value kept (40):
    • openrouter::tests::{server_remaining_replaces_lifetime_usage_for_meter, negative_server_remaining_reads_exhausted, above_limit_server_remaining_reads_zero, reset_window_usage_is_the_preferred_fallback, cumulative_usage_is_the_last_fallback, no_usable_quota_source_hides_the_meter} into key_meter_prefers_server_remaining_then_reset_window_then_cumulative_usage (PBG-66).
    • opencode::tests::{parses_weekly_only_json_without_rolling, parses_rolling_only_json_without_weekly, parses_nested_data_subscription_shape, parses_five_hour_and_week_aliases, sub_one_percent_computed_used_limit_is_not_rescaled_to_100, direct_fractional_usage_percent_still_scales} into parse_usage_json_window_shapes (PBG-66).
    • kimi::tests::oversized_integral_usage_amount_is_not_saturated_to_i64_max into the 2^63 row of kimi::ratio_pool::tests::integer_counter_accepts_exact_integers_only (PBG-64).
    • minimax::coding_plan::tests::{base_resp_1004_is_auth_required, base_resp_status_msg_login_is_auth_required, base_resp_other_status_is_other_error} into base_resp_status_maps_to_errors (PBG-64).
    • antigravity::tests::{parses_current_language_server_process, parses_language_server_without_extension_server_port, parses_language_server_without_any_port_arg, parses_equals_form_args, detects_agy_exe_cli_process_with_empty_csrf, detects_quoted_agy_exe_cli_process, detects_bare_agy_command, detects_antigravity_cli_command, ide_match_preferred_over_agy_cli_when_both_running, agy_cli_matches_when_only_cli_running, non_antigravity_process_without_csrf_is_not_matched} into parse_process_info_matches_ide_servers_and_the_agy_cli (PBG-59).
    • antigravity::tests::{is_agy_cli_command_matches_known_names, is_agy_cli_command_rejects_unrelated_names} into is_agy_cli_command_matches_only_cli_names (PBG-59).
    • antigravity::tests::{test_parse_user_status_standard, antigravity_extra_windows_preserve_all_unselected_configs, test_parse_user_status_thinking_skipped, test_parse_user_status_fallback_first, test_noisy_models_do_not_drive_summary_windows, multiple_unselected_models_with_same_reading_remain_visible, models_in_distinct_quota_buckets_keep_separate_lanes} into parse_user_status_selects_summary_windows_and_keeps_the_rest (PBG-59).
    • antigravity::tests::{user_tier_resolves_google_ai_ultra_plan_name, user_status_falls_back_to_plan_status_when_user_tier_is_absent} into user_tier_name_wins_over_the_plan_status_name, and antigravity::tests::{plan_name_fallback_skips_blank_user_tier_name, plan_name_fallback_skips_blank_display_name} into plan_name_fallback_skips_blank_names (PBG-59).

Added (41): the 9 merged tables above, plus 32 characterization pins (31 written before the refactors they cover, and minimax::http_tests::coding_plan_page_request_sends_html_accept_without_the_xhr_marker from the fix round). These are in minimax http_tests, coding_plan, coding_plan_html, remains_api, token_plan and tests; kimi web and tests; opencode and opencodego console and local::tests; openrouter activity and tests; and antigravity local_sqlite, quota_summary and tests.

Files: inv-G2-before.txt and inv-G2-after.txt in the simplification log directory.

Commands run

All cargo commands ran one at a time from the worktree with toolchain 1.98.0 and a private target directory.

  • cargo fmt --all --check: pass
  • cargo clippy --workspace --all-targets -- -D warnings: pass
  • cargo test -p codexbar: 3756 passed, 1 ignored (lib); 1 passed (bin); 0 (integration) at b0fe165
  • cargo test -p codexbar-desktop-tauri: 639 passed at b0fe165
  • Per lever: cargo clippy -p codexbar --all-targets -- -D warnings and the focused cargo test -p codexbar --lib -- providers::<name>
  • python loc.py <ref> --areas 60 at HEAD, 733d69a and origin/main

scripts/local-check.ps1 was not run: the local no-permanent-delete hook blocks it on this machine. I ran the Rust commands above instead; they match the fmt, workspace clippy and test steps of -Slice ci. Its pnpm steps (install, lint, anti-slop, frontend tests, build) were not run. No frontend files changed, and grep rust/src apps/desktop-tauri/src shows no frontend test reading a file this PR touches.

Follow-ups (not fixed here)

  • MiniMax format_count(-123) renders -,123.
  • MiniMax next_time_today rolls to now + 24h.
  • MiniMax parse_resets_at_from_time_range treats h as an hour window.
  • MiniMax usage_count is used as the remaining count.
  • minimax/coding_plan.rs is 1176 lines; several Antigravity files are over the size bar. Not split here (out of scope).
  • Antigravity resolve_managed_outcome is test-only and diverges from production.
  • The 30s credentialed client builder and the 401/403 status check repeat across providers (Lane A).

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 30bfac1d-a473-4c9e-a106-6509c2bf16a0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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