fix(oauth): keep the Kiro profileArn on IAM Identity Center logins - #10725
Merged
diegosouzapw merged 1 commit intoAug 20, 2026
Merged
diegosouzapw merged 1 commit into
diegosouzapw merged 1 commit into
Conversation
A Kiro connection added through "Your organization (AWS IAM Identity Center)" was persisted as a Builder ID one, so providerSpecificData carried no profileArn. Every CodeWhisperer usage call was then made unbound to the Q Developer profile and AWS answered 403 "User is not authorized to make this call" — the quota card showed "Kiro quota API rejected the current token. Chat may still work." while chat itself kept working, and the plan badge stayed Unknown. requestDeviceCode already marks IdC logins with _authMethod: "idc" when a startUrl is present, but OAuthModal copied only _clientId/_clientSecret/_region into the poll request. pollToken therefore fell back to "builder-id", postExchange returned early without running the ListAvailableProfiles lookup, and mapTokens stored the connection with neither the right authMethod nor a profileArn. Builder ID logins are unaffected: they have no profile and the lookup is still skipped.
This was referenced Aug 27, 2026
alvinveroy
added a commit
to alvinveroy/OmniRoute
that referenced
this pull request
Sep 3, 2026
Resolves the PR's dirty merge state: keeps upstream's Kiro IDC profileArn PROJECT_ROUTE_ERROR block (diegosouzapw#10725) ahead of the Sentinel/Turnstile check and retains this branch's diegosouzapw#8813 comment refinement on the Sentinel block.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…iegosouzapw#10725) Merged via merge-train (release/v3.8.50, batch1 2026-08-20) — static gates (typecheck/file-size/complexity/cognitive/changelog) green on the combined tree; test:unit reds observed in the boarded run were verified pre-existing on the pure release tip (unrelated flake), not caused by this PR. Thanks for the contribution!
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.
A Kiro connection added through "Your organization (AWS IAM Identity Center)" now keeps its Q Developer
profileArn. Before this it was persisted as a Builder ID connection with no ARN, and every usage lookup for it returned 403.The symptom
On an instance with 8 Kiro connections, only the ones added through the IdC flow failed:
GET /api/usage/<id>returns{"message":"Kiro quota API rejected the current token. Chat may still work.","quotas":{}}.Connections added through AWS Builder ID on the same instance returned
plan: "KIRO POWER"with credits, so the failure looked account-specific rather than flow-specific. It is not: subscription tier, plan source, IdC application assignment and user attributes were all identical to the working accounts.Why it happens
Checked directly against CodeWhisperer with the account's own SSO token:
ListAvailableProfilesGetUsageLimitswithoutprofileArnAccessDeniedException: User is not authorized to make this call.GetUsageLimitswithprofileArnsubscriptionTitle: "KIRO POWER"An IdC token has to be bound to the Q Developer profile; a Builder ID token does not need one. That is why only IdC connections break, and why the failure surfaces at the quota call rather than at login — the profile lookup itself succeeds without an ARN, so registration looks healthy.
The ARN was never stored because
_authMethodwas dropped between the device-code request and the poll:requestDeviceCodemarks the login_authMethod: "idc"when astartUrlis present.OAuthModalforwarded only_clientId/_clientSecret/_regioninto the poll request.pollTokenfell back to"builder-id".postExchangereturns early for"builder-id", soListAvailableProfilesnever ran.mapTokensstored the connection with the wrongauthMethodand noprofileArn.The fix
Forward
_authMethodalongside the other device-code fields. Builder ID logins are unaffected — they have no profile and the lookup is still skipped, so no extra region probes are added for them.authMethod: "builder-id", noprofileArnauthMethod: "idc"with the discoveredprofileArnVerification
TDD —
tests/unit/kiro-idc-profilearn-extradata.test.tsfails on the base commit withand passes with the fix (5/5). It pins the whole chain, so a future edit that drops any link in it fails the suite rather than silently downgrading IdC logins again.
Real environment — reproduced on a running instance, then confirmed the mechanism by writing the ARN into the affected connection by hand:
Checks run
node --import tsx/esm --test tests/unit/kiro-idc-profilearn-extradata.test.tsoauth-modal-typescript-regressions+oauth-modal-grok-cli-paste-7610+kiro-iam-profilearn-usagenpx eslinton the changed filesnpm run typecheck:coreopen-sse/services/compression/**(omniglyphexports), none in the changed filesNote for reviewers
release/v3.8.50was already red when this branch was cut.