Repository navigation
Conversation
|
[operator: bolichen97] Continuing this in #32445; thanks for the start. |
Resolves conflicts with main's control-plane discovery (kirodotdev#32445), sign-in error codes (kirodotdev#33590) and paginated profile listing (kirodotdev#29398). Keeps main's paginated per-host listing and its refusal rule, routes the host walk through _discovery_hosts, and keeps the eu-west-1 -> eu-central-1 entry.
|
Merged How the conflicts were resolved:
|
Code change approver recommendation: A person should decideWhy: the decider raised 2 possible problems and estimates a 55% chance that this change introduces a defect; a person should check them. The code only moves the existing every-host profile probing (already on main) into a _discovery_hosts helper and adds tests, so behaviour is unchanged. The description says the eu-west-1 -> eu-central-1 row is removed and that eu-west-1 logins probe us-east-1 first, and it claims to fix a sign-in failure; the code does none of this. The row is still there and EU is probed first. The author should either make the described change with tests, or restate the PR as a refactor plus tests. Things to check (possible problems the decider raised; at this confidence many turn out to be fine):
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
Resolves the conflict with main's control_plane_urls (kirodotdev#35620), which does what this branch's _discovery_hosts did: the host walk and its test now use main's public helper.
|
Merged |
Resolves the docstring conflict with main's relay viewer control plane (kirodotdev#36188) by taking main's docstring.
|
Merged |
|
Closing as part of the stale-PR cleanup. The sign-in fix this PR describes is already on main: #32445 (merge commit 90d19e3) made sign-in ask every Kiro control plane, the login region's first, and #35620 added the public |
Problem / Motivation
Goal: An IAM Identity Center user signs in from the dashboard and reaches their Kiro profile wherever it is served, instead of a silent "no available Kiro profiles" failure.
The dashboard Kiro sign-in (Settings -> Agent Harness) depends on the login region to decide which Kiro control plane (CPS) serves the user's profile. That mapping is wrong: the IAM Identity Center region a user signs in with is independent of which control plane holds their profile. An eu-west-1 IdC login whose profile is served from Frankfurt resolves against the wrong host,
ListAvailableProfilesreturns zero, and sign-in stalls with "no available Kiro profiles" even though the browser authorization succeeded.Why it matters
Any IAM Identity Center user whose profile region does not match the one their login region maps to is blocked from Crew-owned auth, with a silent failure that looks like a successful sign-in (the vault is simply never written). The previously merged one-line map (
eu-west-1 -> eu-central-1, #26203) fixes eu-west-1-IdC / EU-profile users but regresses eu-west-1-IdC / us-east-1-profile users onto the Frankfurt control plane, where their profile is invisible - the same wall, moved to a different population. Some Kiro capabilities are us-east-1-only, so that combination is real and common.Not a goal
What changed (motivation -> approach -> change)
list_available_profileswas keyed on the login region via_CPS_ENDPOINTS, so it probed only one host. The mergedeu-west-1 -> eu-central-1row swaps which single host is wrong for whom; it does not remove the region-as-key assumption.list_available_profilesnow probes every known CPS host - the login region's own first as a latency hint - and returns the first non-empty result. A host that errors while another answers is logged and does not fail the resolution; a ControlPlaneError is raised only when every host errored and none returned a profile. An authenticated identity with no profile on any reachable host still returns[], which the caller surfaces as "no available Kiro profiles" exactly as before. The brittleeu-west-1region row is removed, since discovery no longer needs a region->host guess.control_plane_urlis retained for the post-sign-inenterprise_policy_fetchpath, which keys off the resolved ARN's own region and is authoritative.Backwards compatibility
Compatible: no input is rejected, renamed, or removed from any wire contract.
list_available_profileskeeps its signature (access_token,region=,session=);regionis now a probe-ordering hint rather than a hard host selector.control_plane_urlandprofile_regionare unchanged.Removes nothing externally; one internal behavior is intentionally changed: when every reachable control plane returns zero profiles, resolution now returns
[](surfaced as "no available Kiro profiles") rather than depending on which single host was mapped. Readers of the changed symbol:src/kiro_crew/auth/service.py:_poll_oidc-- entry: chat/dashboard sign-in poll -- unchanged: it already treats[] -> {"status": "error"}and a raisedControlPlaneError -> {"status": "error"}; both still hold. Locked bytest_poll_idc_with_no_profiles_is_error_and_saves_nothingandtest_poll_idc_control_plane_failure_is_error(updated to script one reply per probed host).src/kiro_crew/platform/enterprise_policy_fetch.py:161-- entry: post-sign-in enterprise policy fetch -- not affected: it callscontrol_plane_url(profile_region(arn)), keyed by the resolved ARN's own region, which this PR does not change.Tests
test_poll_idc_discovers_profile_on_second_control_plane(new): an eu-west-1 IdC login whose profile lives on the EU control plane - us-east-1 probed first (empty), then eu-central-1 returns the profile; asserts both hosts were probed in order and the EU profile ARN is stored. This is the case the region->host map got wrong.test_discovery_hosts_probe_every_control_plane_region_first(new):_discovery_hostsreturns every known CPS host exactly once, the region's own first, including for a region (eu-west-1) and an unknown region that have no dedicated host.test_poll_idc_with_no_profiles_is_error_and_saves_nothing,test_poll_idc_control_plane_failure_is_error(updated): one reply per probed host, since discovery now probes all of them.test_control_plane_url_is_the_regional_cps_host(updated): drops theeu-west-1 -> Frankfurtassertion (the behavior being removed) and reframes the function as the post-sign-in, ARN-region-keyed path.Proof: PROVEN test/test_kas_login_service.py::test_poll_idc_discovers_profile_on_second_control_plane (head 1071595)
Manual verification
Verified end to end against a live IAM Identity Center instance in eu-west-1 whose Kiro profile is served from the us-east-1 control plane - the exact combination the merged
eu-west-1 -> eu-central-1map (#26203) would route to the wrong control plane. With this change the dashboard Kiro sign-in discovers the profile (us-east-1 probed first, answers), completes, and writes the vault; before it, the same login stalled with "no available Kiro profiles". The mirror case (eu-west-1 IdC with an EU-served profile) is covered bytest_poll_idc_discovers_profile_on_second_control_plane.Screenshots / video
N/A - no user-visible frontend surface changes. The fix is in the auth backend; the sign-in card is unchanged by this PR.
Related Issues
Part of #26201 also related #28904
Sibling sweep
Swept:
git grep -nE "list_available_profiles|control_plane_url|_CPS_ENDPOINTS" -- 'src/**/*.py'src/kiro_crew/auth/service.py:612-- not affected -- the one login-time caller; the defect lived entirely insidelist_available_profiles, which this PR fixes, so the call site needs no changesrc/kiro_crew/platform/enterprise_policy_fetch.py:161-- not affected -- keyed byprofile_region(arn)(the resolved ARN's own region), which authoritatively names the control plane, so no region guess is involvedPattern harvest
Rule candidate: review-prompt
Pattern: keying a service host off an incidental region value (the login/IdC region) instead of the value that authoritatively names the resource (the profile ARN's own region), so one host is probed where the correct one is unknown.