Repository navigation
fix(auth): name the start URL, region and control planes when an IdC profile lookup fails - #35620
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Backend Tests reds on eddab8a are inherited from main, not this diff: main's own CI at 2df02ab (run 43105640841) fails the same shards. test_updates_handlers_facade is fixed by #35614 and test_wait_discipline_ratchet (test/test_update_boot_apply.py:335) by #35625, both from #35088. This PR waits for those to merge, then rebases. No override. |
Code change approver recommendation: ApproveWhy: the decider estimates a 5% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. This PR changes one log line. When an IdC profile lookup is refused, the warning now names the start URL, the region and the control-plane hosts that were asked. The host list comes from the new helper control_plane_urls, which list_available_profiles now loops over too, so the order is unchanged and the line only names hosts that were called. ControlPlaneError is only raised after every host has been asked, so "asked" is accurate. The start URL and region are configuration and already appear in the no-profile line on main. The token is not passed to the helper, and the new test asserts it is absent from the line. The test drives the real poll path and would fail without the change. Return codes and behaviour are unchanged. 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 |
eddab8a to
65a9720
Compare
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. This adds diagnostic context to one log line, and the log names the hosts from the same helper the lookup loops over. [DESIGN-REVIEWED] 590e144 Description read[DESCRIPTION-READ] 0834b4d27102cfab736d984a405b6d7bdf045d57525da514624ec76dccd35976 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. One log line gets longer, the test fails on base, and the new helper has two real consumers. Notes
What this change shipsInventory (3 items) — 2 justifiedIntent: when a company SSO profile lookup is refused, an operator can tell from the gateway log which start URL and region were used. FIX.
[FIRST-PRINCIPLES-REVIEWED] 590e144 Description read[DESCRIPTION-READ] e9dfa93e65e80cebad4215fa54068d621a87ef9e1902d022f67edffbf609cd60 That sha256 names the PR description this verdict read. Recompute it with |
65a9720 to
dd8854d
Compare
|
Backend Tests (3.12, 2) red on dd8854d is inherited from main, not this diff: test/test_cloud_launch_customize.py::TestAmiArchitectureCheck::test_matching_architecture_proceeds_to_deploy fails since #35010 and fails locally on this tree, which touches no cloud code. Tracked in #35745, fix in #35746. This PR waits for #35746, then rebases. No override. |
dd8854d to
cb2de4d
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approve at cb2de4d. Both failed IdC profile lookup log lines (profile_lookup_failed and no_kiro_profile) now name the start URL, the IdC region and the control planes asked, in the order sign-in asks them. That is enough to tell a wrong start URL or region from a browser approved as another user. control_plane_urls is the same dict.fromkeys list list_available_profiles already built, now shared. None of the logged values is a credential, and the test checks that the token stays out of the line. No regex added, no behaviour change beyond the log text, and nothing is live red.
Heads-up: #29398 rewrites the same no_kiro_profile warning in auth/service.py, so whichever of the two lands second will need a small rebase there.
cb2de4d to
ed6de61
Compare
|
Rebased onto main ed6de61 to resolve the conflict with #29398, which already adds start URL, region, hosts and pages to the no-profile warning. This PR keeps main's no-profile line and now changes only the refused-lookup line ('could not resolve IdC profile ARN'), plus the shared control_plane_urls helper. Its test is narrowed to that path. CI is re-running. |
ed6de61 to
56ec85a
Compare
56ec85a to
a4d7a00
Compare
…profile lookup fails
a4d7a00 to
590e144
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On head 590e144 the review checked these points. The control_plane_urls() extraction asks the same hosts in the same order as before. The refused-lookup warning names only the start URL, the region and the fixed control plane hosts, never the access token. Both return codes and the no-profile line are unchanged. The new test passed in 5 out of 5 repeat runs and the whole test file passed (81 tests). The new test goes red when either production change is reverted.
Done well: the lookup loop and the log suffix both read from one control_plane_urls(region), so on this head the log names exactly the hosts the lookup asked. The test also drives eu-west-1 to check the region-first host order.
Optional:
- Whichever of #36242 or #36188 lands after this PR should send its override or viewer host through
control_plane_urls(). Otherwise this warning would name hosts the lookup never asked. - In
test_poll_idc_refused_profile_lookup_logs_what_it_asked, keep the session and assert[u for u, _ in session.calls[1:]] == [_EU_CPS, _US_CPS]. That ties the logged list to the requests that were actually sent. - The First-principles note on the host list has no reply yet. One rebuttal is the case where one host refuses and another answers empty. The empty host is logged nowhere else.
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.
Problem / Motivation
Goal: When a company SSO (IAM Identity Center) sign-in ends with no Kiro profile, the gateway log says which start URL, region and Kiro control planes the lookup used, so the cause can be read from the log.
An Identity Center sign-in that finds no Kiro profile leaves one line in the log:
IdC login has no available Kiro profiles. The line looks the same whether the browser approved the device code as a different Identity Center user, the start URL pointed at another organisation, or the region sent the lookup to the wrong control plane. A user who hit this six times in one morning had a log that could not tell those causes apart. A refused lookup (could not resolve IdC profile ARN) has the same gap.Why it matters
Each of those causes has a different fix: sign in as the right user, use the right start URL, or pick the right region. With no start URL or region in the log, support has to ask the user to reproduce the failure and describe what they typed. The token is thrown away on these paths, so the log line is the only record of the attempt.
Not a goal
no_kiro_profileandprofile_lookup_failedcodes stay as they are.What changed (motivation → approach → change)
A refused profile lookup now ends with the start URL, the region and the control-plane hosts that were asked, in the order they were asked:
The no-profile line (
IdC login has no available Kiro profiles) already carries the same context on main, so it is left alone. That leaves the refused-lookup line as the one terminal failure that still said nothing about what was asked.The host list comes from one new helper in
auth/login/control_plane.py,control_plane_urls(region).list_available_profilesloops over that same list, so the log can't name hosts the lookup didn't call.auth/service.pybuilds the suffix from the pending login. All three values are configuration, and the access token is never put in the line.Backwards compatibility
Compatible: only the text of one warning log line grows, and nothing parses it. The lookup's behaviour and return codes are unchanged.
Removes nothing: the diff adds context to one log line and pulls an existing expression out into a helper. No path, key, record or check is taken away.
Tests
test_poll_idc_refused_profile_lookup_logs_what_it_askedruns an eu-west-1 sign-in where every host refuses. It checks that the final warning names the start URL, the region and both hosts in lookup order (Frankfurt first), and that the access token is not in the line.Proof: PROVEN test/test_kas_login_service.py::test_poll_idc_refused_profile_lookup_logs_what_it_asked (head 590e144)
test/test_kas_login_service.pyandtest/test_kas_auth_whoami.pypass (100 tests), along with isort, flake8, mypy, the repository semgrep rules and the flake-pattern ratchet.Manual verification
N/A — unit coverage is enough: the change is the text of one log line, and the test drives the real poll path with fake control-plane answers.
Related Issues
None. No tracking issue was opened for this change.
Sibling sweep
Swept: git grep -n "list_available_profiles|no available Kiro profiles|could not resolve IdC" -- src/
Sibling: src/kiro_crew/auth/service.py:682 -- changed here
Sibling: src/kiro_crew/auth/login/control_plane.py:192 -- not affected -- the per-host refusal line already names its host
Pattern harvest
Not generalizable: the gap is specific to the lookup that throws away a redeemed token, where the log line is the only record of what was asked.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)