Repository navigation
fix(dashboard): remap Kimi Code API-key save to admitted managed id (#10096) - #10417
Merged
Merged
Conversation
…10096) The unified Kimi Code card's API-key branch posted provider: "kimi-coding" to POST /api/providers. "kimi-coding" is an OAuth-primary managed id, not an admitted API-key/dual-auth connection id, so the backend correctly rejected it with 400 "Invalid provider" even though key validation passed. Add resolveApiKeySaveProviderId() in useApiKeySave.ts to remap the posted provider id to the dedicated, admitted managed API-key id "kimi-coding-apikey" for the API-key save flow only. The OAuth flow (handleOAuthSuccess in ProviderDetailPageClient.tsx) never calls this hook and keeps posting "kimi-coding" unchanged. Regression test: tests/unit/bug-10096-kimi-coding-apikey-save.test.ts
Owner
Author
|
Fix requested: the new helper remaps only the single-entry POST in useApiKeySave.ts. The unified Kimi card's bulk tab remains enabled, and AddApiKeyModal.tsx still posts provider: "kimi-coding" directly to /api/providers/bulk. At the PR head, that route rejects the ID because isManagedProviderConnectionId("kimi-coding") is false, while "kimi-coding-apikey" is admitted. Please remap or disable bulk for this card and add a regression test for the chosen path. The focused probe was run outside the PR head, so this finding is marked PLAUSIBLE. |
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
HouMinXi
pushed a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Aug 20, 2026
…iegosouzapw#10096) (diegosouzapw#10417) * fix(dashboard): remap Kimi Code API-key save to admitted managed id (diegosouzapw#10096) The unified Kimi Code card's API-key branch posted provider: "kimi-coding" to POST /api/providers. "kimi-coding" is an OAuth-primary managed id, not an admitted API-key/dual-auth connection id, so the backend correctly rejected it with 400 "Invalid provider" even though key validation passed. Add resolveApiKeySaveProviderId() in useApiKeySave.ts to remap the posted provider id to the dedicated, admitted managed API-key id "kimi-coding-apikey" for the API-key save flow only. The OAuth flow (handleOAuthSuccess in ProviderDetailPageClient.tsx) never calls this hook and keeps posting "kimi-coding" unchanged. Regression test: tests/unit/bug-10096-kimi-coding-apikey-save.test.ts * fix(dashboard): remap Kimi Code bulk API-key save Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: adevwithpurpose <adevwithpurpose@users.noreply.github.com>
giauphan
pushed a commit
to giauphan/OmniRoute
that referenced
this pull request
Aug 20, 2026
…iegosouzapw#10096) (diegosouzapw#10417) * fix(dashboard): remap Kimi Code API-key save to admitted managed id (diegosouzapw#10096) The unified Kimi Code card's API-key branch posted provider: "kimi-coding" to POST /api/providers. "kimi-coding" is an OAuth-primary managed id, not an admitted API-key/dual-auth connection id, so the backend correctly rejected it with 400 "Invalid provider" even though key validation passed. Add resolveApiKeySaveProviderId() in useApiKeySave.ts to remap the posted provider id to the dedicated, admitted managed API-key id "kimi-coding-apikey" for the API-key save flow only. The OAuth flow (handleOAuthSuccess in ProviderDetailPageClient.tsx) never calls this hook and keeps posting "kimi-coding" unchanged. Regression test: tests/unit/bug-10096-kimi-coding-apikey-save.test.ts * fix(dashboard): remap Kimi Code bulk API-key save Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: adevwithpurpose <adevwithpurpose@users.noreply.github.com>
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…iegosouzapw#10096) (diegosouzapw#10417) * fix(dashboard): remap Kimi Code API-key save to admitted managed id (diegosouzapw#10096) The unified Kimi Code card's API-key branch posted provider: "kimi-coding" to POST /api/providers. "kimi-coding" is an OAuth-primary managed id, not an admitted API-key/dual-auth connection id, so the backend correctly rejected it with 400 "Invalid provider" even though key validation passed. Add resolveApiKeySaveProviderId() in useApiKeySave.ts to remap the posted provider id to the dedicated, admitted managed API-key id "kimi-coding-apikey" for the API-key save flow only. The OAuth flow (handleOAuthSuccess in ProviderDetailPageClient.tsx) never calls this hook and keeps posting "kimi-coding" unchanged. Regression test: tests/unit/bug-10096-kimi-coding-apikey-save.test.ts * fix(dashboard): remap Kimi Code bulk API-key save Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: adevwithpurpose <adevwithpurpose@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10096
Root cause
The unified Kimi Code dashboard card's API-key branch posted
provider: "kimi-coding"toPOST /api/providers."kimi-coding"is an OAuth-primary managed provider id — it is not an admitted API-key/dual-auth connection id (isManagedProviderConnectionId("kimi-coding")isfalse), so the backend correctly rejected the create with400 {"error":"Invalid provider"}, even though the key-validation check passed. The dedicated managed API-key idkimi-coding-apikeyis admitted (src/shared/constants/providers/apikey/regional.ts,hiddenFromDashboard: true), which is why the documented workaround (opening/dashboard/providers/kimi-coding-apikeydirectly) worked.This is a regression from #7531 (unified Kimi Code card), which folded OAuth + API-key auth under one card but kept the API-key save path posting the OAuth id.
Fix
Added
resolveApiKeySaveProviderId()insrc/app/(dashboard)/dashboard/providers/[id]/hooks/useApiKeySave.tsto remap the POST payload'sproviderfield to"kimi-coding-apikey"specifically for the API-key save flow, leaving every other provider id untouched. The OAuth flow (handleOAuthSuccessinProviderDetailPageClient.tsx) does not go through this hook and continues posting"kimi-coding"unchanged (verified no other reference to"kimi-coding"exists inProviderModalsPanel.tsxoutside the OAuth branch at line 242).This matches the reporter's preferred option 2 (dashboard remap) — lower risk than admitting
kimi-codingintoDUAL_AUTH_PROVIDER_IDS, and keeps the existingkimi-coding-apikeyconnection model intact.Regression test (Hard Rule #18 — TDD)
tests/unit/bug-10096-kimi-coding-apikey-save.test.ts:resolveApiKeySaveProviderId("kimi-coding") === "kimi-coding-apikey", and the remapped id is admitted byisManagedProviderConnectionId.resolveApiKeySaveProviderIdleaves"openai","kimi-coding-apikey", and"qoder"untouched (no regression for other providers).Gates run
npm run typecheck:core— exit 0npx eslint --suppressions-location config/quality/eslint-suppressions.jsonon changed files — exit 0, no findingsnode scripts/check/check-file-size.mjs— no new failures reported for touched filescheck-complexity/check-cognitive-complexity/check-test-discoverygates and the fullnpm run test:unitsuite were still running at hand-off time due to extreme host contention from a 13-way parallel session fan-out (load avg >200); the diff is a 2-line pure remap function plus wrapping an existingJSON.stringifypayload, so risk to those ratchets is judged negligible, but CI will independently confirm.