Skip to content

fix(auth): find an IdC profile on any Kiro control plane at sign-in - #32445

Merged
bolichen97 merged 1 commit into
mainfrom
fix/28904-cps-profile-discovery
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/28904-cps-profile-discovery

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An IAM Identity Center user whose Kiro profile is served by another region's control plane signs in from the dashboard or kirocrew kas login instead of failing with "no available Kiro profiles".

The browser approval succeeds, then the dashboard shows "Sign-in failed / Something went wrong while waiting for approval" and the log says IdC login has no available Kiro profiles. The reporter's Identity Center lives in us-east-1; their Kiro profile is served from eu-central-1. kiro-cli signs the same account in fine.

Why it matters

Every Identity Center account whose Kiro profile sits on a different control plane than its Identity Center region cannot use Kiro Crew's own sign-in at all, and every retry fails the same way. Entering the profile's region in the form instead sends the SSO-OIDC calls to a region where the Identity Center does not live, so there is no workaround.

Not a goal

  • A profile picker when an account has several profiles; the first one still wins, and with profiles on both control planes the first host that lists one wins.
  • Asking the other control plane after a connection failure; that still ends the poll as it does today.
  • A separate profile-region field on the sign-in form or on kas login.
  • A more specific error message in the sign-in card.
  • Following nextToken past the first page of ListAvailableProfiles.

What changed (motivation → approach → change)

Sign-in asked only one Kiro control plane for the account's profiles: the one picked from the Identity Center region. That region does not say where the profile is served, and the profile ARN that would say it is exactly what the call is looking for.

list_available_profiles in auth/login/control_plane.py now asks every control-plane host in _CPS_ENDPOINTS, the login region's own host first, and keeps the first answer that lists a profile. An account whose profile is in its own region still costs one call. A host that refuses or sends an unreadable answer is logged as a warning and skipped; ControlPlaneError is raised only when every host refused, and zero profiles everywhere still ends the login as "no available Kiro profiles". The region table, control_plane_url and the post-sign-in policy fetch are unchanged.

The kas-auth spec describes the lookup.

Backwards compatibility

Compatible: the function keeps its signature and its outcomes (a profile list, an empty list, or ControlPlaneError); a sign-in that worked before gets the same answer from the same first host.

Removes nothing: no input, key, host or caller is taken away; a login that failed on the first host now also asks the other one.

Tests

  • test_poll_idc_finds_a_profile_on_another_regions_control_plane (new, four cases): a us-east-1 or eu-west-1 sign-in whose own control plane answers no profiles, or refuses, stores the profile the other control plane lists, and the login region's own host is asked first.
  • test_control_plane_url_is_the_regional_cps_host: comment only, the eu-west-1 row now orders the hosts.
  • test_poll_idc_with_no_profiles_is_error_and_saves_nothing and test_poll_idc_control_plane_failure_is_error script one answer per host, since both hosts are now asked before the login ends.
  • test_poll_idc_resolves_profile_arn (unchanged) still sees a single control-plane call when the first host has the profile.

Proof: PROVEN test/test_kas_login_service.py::test_poll_idc_finds_a_profile_on_another_regions_control_plane[no-profiles-us-east-1-https://management.us-east-1.kiro.dev/-https://management.eu-central-1.kiro.dev/], test/test_kas_login_service.py::test_poll_idc_finds_a_profile_on_another_regions_control_plane[no-profiles-eu-west-1-https://management.eu-central-1.kiro.dev/-https://management.us-east-1.kiro.dev/], test/test_kas_login_service.py::test_poll_idc_finds_a_profile_on_another_regions_control_plane[refused-us-east-1-https://management.us-east-1.kiro.dev/-https://management.eu-central-1.kiro.dev/], test/test_kas_login_service.py::test_poll_idc_finds_a_profile_on_another_regions_control_plane[refused-eu-west-1-https://management.eu-central-1.kiro.dev/-https://management.us-east-1.kiro.dev/] (head 54f75e6)

Determinism: the new and changed tests (with test_control_plane_url_is_the_regional_cps_host) passed 20 runs at -n0 and 10 runs at -n 4 --dist loadgroup --max-worker-restart=2 beside test_kas_auth_whoami.py and test_enterprise_policy_fetch.py; the whole test_kas_login_service.py passed in a shuffled order (seed 10467).

Manual verification

N/A — unit coverage sufficient: the fix is in which hosts one HTTP call goes to, and the tests script both control planes' answers through the real poll path. No live Identity Center with a cross-region profile was available here.

Screenshots / video

N/A — no frontend change.

Related Issues

Closes #28904

Builds on #29049 by @Skripd, which takes the same approach; this keeps the eu-west-1 row of the region table, which the post-sign-in policy fetch still reads.

Sibling sweep

Swept: git grep -nE "list_available_profiles|control_plane_url|ListAvailableProfiles" -- src/

  • Sibling: src/kiro_crew/auth/service.py:643 -- not affected -- the one sign-in caller; the host choice lives inside the function this PR changes
  • Sibling: src/kiro_crew/platform/enterprise_policy_fetch.py:170 -- not affected -- picks the host from the stored profile ARN's own region, which does name the control plane
  • Sibling: src/kiro_crew/dashboard/handlers/kiro_usage_api.py:602 -- not affected -- picks the runtime host from the expected profile ARN, not from a sign-in region

Pattern harvest

Rule candidate: review-prompt
Pattern: a service host chosen from an incidental region (the sign-in region) when the value that names the resource's region is not known yet.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

An IAM Identity Center sign-in asked only the control plane picked from
the Identity Center region for the account's Kiro profiles. That region
does not say where the profile is served, so a us-east-1 instance whose
profile lives on the eu-central-1 control plane got zero profiles and
every sign-in ended with "no available Kiro profiles".

Ask every known control-plane host, the login region's own first, and
keep the first answer that lists a profile. A host that refuses is
logged and skipped; the login fails only when every host refused or
none lists a profile.

Closes #28904
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: home-region profiles still resolve with one call to the same host, so the extra lookup only changes logins that already failed.

Notes

[DESIGN-REVIEWED] 54f75e6

Description read

[DESCRIPTION-READ] ab3e1355ceb3375189c0a6f38f9e18061a85414f1b2a924a28c0948ae8d96601

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix asks the other control plane only after the login region's own host returns nothing or refuses. A sign-in that works today makes the same first call and gets the same answer.

Not checked: whether a us-east-1 IdC bearer token is accepted by the eu-central-1 control plane (#28904 reporter's account).

What this change ships

Inventory (4 items) — 4 justified

Intent: let an Identity Center user whose Kiro profile lives on another region's control plane finish signing in. This is a FIX.

  1. If the login region's own control plane lists no profiles, sign-in now asks the other control plane and keeps the first profile it lists — justified
  2. A control plane that refuses or sends an unreadable answer is logged and skipped, and sign-in fails only when every host refused — justified
  3. The original single-host request is split out into a private _list_profiles_at helper (no change in behaviour) — justified
  4. The kas-auth spec now describes the cross-region lookup, and the comments that described the old single-host fallback are updated — justified

[FIRST-PRINCIPLES-REVIEWED] 54f75e6

Description read

[DESCRIPTION-READ] 89781a8eeddb1ee42786b16e3defad8c4fee1db30406e37e66ed93409452f70a

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 15:44
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 54f75e6

Verdict parsed from the review's SHA-scoped output markers for commit 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 54f75e6

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 54f75e64a2de885fc17dbb3cd1528bedaa0a2d9e false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 7, 2026

@buluoray buluoray 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.

Reviewed on 54f75e6: sign-in asks the two fixed first-party control-plane hosts for the profile, home host first; accounts that already worked see the same single call. Non-blocking: no test covers the all-hosts-refuse branch.

@bolichen97
bolichen97 merged commit 90d19e3 into main Nov 7, 2026
98 checks passed
@bolichen97
bolichen97 deleted the fix/28904-cps-profile-discovery branch November 7, 2026 18:48
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray pushed a commit that referenced this pull request Nov 7, 2026
…32445)

An IAM Identity Center sign-in asked only the control plane picked from
the Identity Center region for the account's Kiro profiles. That region
does not say where the profile is served, so a us-east-1 instance whose
profile lives on the eu-central-1 control plane got zero profiles and
every sign-in ended with "no available Kiro profiles".

Ask every known control-plane host, the login region's own first, and
keep the first answer that lists a profile. A host that refuses is
logged and skipped; the login fails only when every host refused or
none lists a profile.

Closes #28904

(cherry picked from commit 90d19e3)
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.

IdC sign-in fails with "no available Kiro profiles" when the Kiro profile is in a different region than the Identity Center instance

2 participants