Repository navigation
fix(usage): show an account-type-only sign-in without another user's balance - #17784
jeeshofone wants to merge 1 commit into
Conversation
4121e8c to
e78e8cc
Compare
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check one thing: a credit reading that has an account type but no email or account name now shows a "Signed in with …" badge instead of "Account details unavailable". Not justified as shipped
What this change shipsInventory (8 items) — 6 justifiedIntent: let an external identity provider sign-in see which provider it used and get a plain "no balance available" message, never another user's balance. This is a FIX (#17710).
[FIRST-PRINCIPLES-REVIEWED] 7e233a2 Description read[DESCRIPTION-READ] 7c45dab53ce147d3d8b59ad96a880706140df864f830d6157e7a5a087a73f884 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The Company SSO notice is a permanent dead end with no next step, and no first-time reader has seen the modal or the pill's new info mark. Watch
Suggestions
[UX-REVIEWED] 7e233a2 Description read[DESCRIPTION-READ] 705ccc22a208f78c8f5e05f260dcd6fa6cad02d6166a085561b0d82f21cdbd2b That sha256 names everything this verdict read: the PR description, plus the 7 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 |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that a working ExternalIdP sign-in with [DESIGN-REVIEWED] 7e233a2 Description read[DESCRIPTION-READ] be5caeb98fb842c0823b27214faaf3a7af39ea84e26f5b4d6eb33c05f8aab6a8 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 |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
e78e8cc to
89c4a0a
Compare
|
ai-review-disposition target=gpt head=89c4a0abbaf2bf87bddb86079ef7eb28d944bc32 F1 A type now publishes nothing on its own. The
Your sequence, ExternalIdP A → ExternalIdP B between the two whoami reads, is |
|
ai-review-disposition target=first-principles head=89c4a0abbaf2bf87bddb86079ef7eb28d944bc32 Item 4 (a type change under a matching email refuses the reading): accepted and removed on The early The same push adds an account fingerprint check on the |
|
ai-review-disposition target=design head=89c4a0abbaf2bf87bddb86079ef7eb28d944bc32 Watch 1 (owning spec no longer matches the code): fixed on Watch 2 (the "type only while signed in" premise is unverified): resolved by not depending on it. The docstring no longer asserts it. A type alone now publishes nothing: the scrape needs an equal account fingerprint read from kiro-cli's own store on both sides. The spec records the premise as an assumption the rule does not rely on. If a signed-out kiro-cli did print a type, the worst case is the provider pill with no balance. |
|
ai-review-disposition target=opus head=89c4a0abbaf2bf87bddb86079ef7eb28d944bc32 Advisory, |
|
ai-review-disposition target=ux head=89c4a0abbaf2bf87bddb86079ef7eb28d944bc32 Watch (the pill is the account's only identity; "IdP" is an unexpanded acronym): holding position, asking a maintainer for the cold read. The lane names its own smallest fix as a first-time reader checking the pill on a branch in this repository, which a fork author cannot run. The label comes from the account type kiro-cli reports, humanized with acronyms kept whole. Expanding one type would mean a per-provider label and new strings in every catalog, which this PR rules out under Not a goal. New on |
|
CI on the previous head
|
|
Watch 1 (two names for one sign-in: the pill says "Company SSO", the notice says "organization sign-ins"): fixed on b34d8e5, with a different wording than the suggestion. The notice now reads "Balance isn't available for this sign-in." and the pill title "Kiro credit usage — balance isn't available for this sign-in". It points at the provider pill directly above it and names no category, so there is one name on the screen. I did not reuse "Company SSO" in the sentence: that label is the sign-in flow's name for Identity Center sign-ins too, and those do show a balance, so "…for Company SSO sign-ins" would be false for them. All 12 catalogs plus en-XA carry the new wording; the i18n style suite passes with the base ref set. The two modal stills are re-shot at this head, light and dark. Watch 2 (the pill dash looks like the other dashes): held. The dash is the shared terminal-state glyph, and the modal opened by the same click states the reason. A distinct glyph for one state is a separate design decision for a maintainer. Suggestion (say where else the balance can be seen): held. Nothing in this change verifies that any surface shows a balance for this sign-in, so naming one would be a guess. |
|
New head b34d8e5: one commit, rebased onto main 640abeb, no merge conflicts. The only changes since c84e09b are the two lane fixes answered above:
Gates run on this head: CI on c84e09b, outside this diff: |
|
Holding on both Watch items on this head. Neither has an author-side change that makes it go away.
A maintainer who wants either changed can say so, and it is a one-string follow-up. |
|
New head 9acef09, a pure rebase of b34d8e5 onto main 0a47021. Why it exists: the reds on b34d8e5 were fixed on main after that head was built.
Local gates on this head: UX CONCERNS: unchanged, and the answer on this head is the disposition above this one (the one on b34d8e5). Both Watch items are held with evidence. The hover text is covered by |
|
Disposition for the UX Review CONCERNS on 9acef09, fixed in head 1aecc0b (rebased onto current main, one commit):
E2E (stub ACP backend, offline) on 9acef09: not this PR. Every spec passed ( Local on 1aecc0b: pytest First-pass check: R1-R8 OK. |
|
Disposition for the UX Review CONCERNS on 1aecc0b, head c48a14c:
E2E (stub ACP backend, offline) on 1aecc0b: the same #18185 overshoot as the previous head ( Local on c48a14c: vitest First-pass check: R1-R8 OK. |
|
Disposition for the UX Review CONCERNS on c48a14c, head 5982143 (one commit, rebased onto current main):
Local on 5982143: pytest First-pass check: R1-R8 OK. |
|
Dispositions for 5982143, fixed in 8ad75c4 (one commit, rebased onto current main; range-diff Design Review Watch, "the sign-in check is skipped too": fixed. The ExternalIdP early return no longer skips UX Review Watch 1, notice copy explains the mechanism: fixed. The notice now reads "Credit balance isn't shown for this Company SSO sign-in, and signing in again won't change that. Manage account below opens your Kiro account settings in your browser." The provider is interpolated from the badge's own label, so the notice and badge agree. It says a fresh sign-in won't help (true now that a lapsed credential takes the sign-in path above) and says what the link opens. Updated in all 12 catalogs plus en-XA. The modal stills under UX Review Watch 2, no blind read of the top-bar tooltip: held. No author-side change can satisfy it. It asks for a cold read by someone without the diff in mind, and headless Chromium does not draw a native E2E (stub ACP backend, offline): not ours. Gates run on 8ad75c4: pytest First-pass check: R1-R8 OK. |
|
SF-1 (no_credential alone produced "Sign in again" with no corroboration): fixed in 06e9fea. In the ExternalIdP branch, only To avoid a second spawn path, the scrape's wrap and spawn are factored into two nested helpers ( Tests in
On 8ad75c4 the working-scrape and failing-scrape cases fail on behaviour. The First-pass check: R1-R8 OK. |
|
SF-2 (PR title described the earlier design): fixed. The title now matches the commit subject: "fix(usage): show an account-type-only sign-in without another user's balance". I changed it together with the body before pushing 06e9fea. |
|
N-1 (an exception or timeout in the branch left the "no reading yet" state): fixed in 06e9fea. Both outer handlers ( Tests:
The first two fail on 8ad75c4. Mutations: the handlers always ordinary (2 failed); the adjacent whoami ignored (1). |
|
N-2 (the degraded-API WARN claimed a text-scrape fallback): fixed in 06e9fea. |
|
N-3 (the notice hard-coded the ExternalIdP label): fixed in 06e9fea. The notice now takes its provider from |
|
Design and First Principles, "check before merge" on the |
|
UX Review Watch (blind read of the pill's native UX Suggestion (the notice's third sentence repeats the link): declined. The lane's fix depends on the account page actually showing the balance for this sign-in, which this PR cannot verify. The sentence is accurate, because the Manage account link always renders below the notice. No UI or copy changed this round (N-3 only changes where the provider label comes from), so the committed stills under E2E (stub ACP backend, offline), if it shows: main-side, #18185 and #18632. Independent review: left to the loop. |
|
Head
Fix: one nested Tests: Other reds: E2E is the main-side failure tracked in #18185 / #18632. First Principles and UX NEUTRAL items wait on a maintainer ruling, unchanged. First-pass check: R1-R8 OK (R8: the spawn audit is the gate this round missed, since a refactor moved a spawn into a new function key without running |
|
Dispositions for head 67f4235 (rebased onto current main, d06b611). First Principles item 5 (the Also in this head:
Held, unchanged from earlier dispositions:
Gates on 67f4235: the PR's test file (33 passed); usage files, First-pass check: R1-R8 OK. AUTOSDE rules matching this round's files: |
|
Dispositions for head e95ebe2 (one commit, rebased onto current main e4270cf). Opus BLOCKING (tests-are-deterministic,
Sweep of this PR's other new tests for wall-clock races: none found. The Python tests use no sleep or deadline other than this one (the stub's First Principles "check one thing" (a Design "check one thing" (does kiro-cli store anything per-user for ExternalIdP?): copy softened. We cannot verify kiro-cli's storage from here, so the notice no longer claims that signing in again won't change anything. It now says only what this branch checks: "Credit balance isn't shown for this {{provider}} sign-in, because kiro-cli doesn't report which user is signed in." UX suggestion: taken. The "Manage account below opens your Kiro account settings in your browser." sentence is cut, because we cannot verify that the account page shows this sign-in's balance. The Manage account link stays below the notice. UX Watch (the top-bar info mark needs a cold read): held for a maintainer, as before. A first-time read is not something we can provide from our side. Gates on e95ebe2: the PR's test file (33 passed), plus First-pass check: R1-R8 OK. |
|
Head 93591fc is a pure rebase of e95ebe2 onto main c50003c. UX Watch 1 (the info mark looks like its own button): held for a maintainer cold read, as on the earlier heads. The mark is part of the pill's single click target, and a click anywhere on the pill opens the modal that states the reason in words. Removing it brings back the earlier finding that the bare dash reads as a failed read. Only a person seeing the pill without the diff in mind can settle which shape is right. UX Watch 2 (the notice offers no next step): held, and the reversal is named. On 67f4235 the same lane's own suggestion asked to cut the "Manage account below…" sentence, and this PR did. Adding a next step back would reverse that suggestion. kiro-cli exposes no user-level fix for this state, so there is no honest next step to name, and the notice does not claim the account page shows a balance because nothing here verifies it. Run locally on 93591fc: |
|
Head 7d48b20 is the previous head rebased onto main 2e69397, plus two test-only changes. It has no conflicts, and the PR body was edited before the push. This answers every lane item as numbered in the UX, Design and First Principles verdicts on 93591fc. Fixed in 7d48b20 (tests only). UX Watch 1 (the pill's hover text is in no still): held. The hover text is a native UX Watch 2 (the notice offers no next step): held as written on 93591fc. kiro-cli offers no user-level fix for this state, and an earlier round of this lane asked for the Manage account sentence to be cut. UX Suggestion (copy "for Company SSO sign-ins"): declined. The plural would be false. An ExternalIdP sign-in whose whoami carries an email still publishes a balance ( Design "check one cost" (the scrape on First Principles item 8 (Company SSO relabel undeclared): declared. The body now says that the badge's provider label reads Company SSO for every ExternalIdP sign-in, including ones that publish a reading. Main showed the humanized id "External Id P", and Company SSO is the sign-in flow's own name for that provider. CI on 93591fc. Backend Tests (Windows) (4) crashed with an access violation in Run locally on 7d48b20: this PR's test file (33 passed; the timeout test 15/15 in a loop); every |
|
Disposition for the lane comments as they read on
Non-green on
|
…balance
An external identity provider sign-in makes kiro-cli whoami report an
account type and nothing else ({"accountType":"ExternalIdP","email":""}).
The /usage scrape bracket demanded an email, start URL or profile ARN on
both sides, so every refresh ended in a bare "Credit usage unavailable",
and the Kiro Account modal hid the provider label it had computed because
no name was available.
A type names a provider, not a user, and nothing kiro-cli prints or
stores for this sign-in is evidenced to name the user: the stored
credential's stable claims (client_id, scopes) belong to the IdP
registration that every user of it shares. So a top-of-refresh whoami
with the ExternalIdP account type and no email, start URL or ARN ends the
refresh without publishing a reading: the cache names the account with
reason account_unproven and no balance, keeping nothing of an earlier
reading, and no number is read from the /usage scrape. The usage API
call still runs for its auth_state alone: a refused credential (401) ends
as signin_required. A missing credential is not proof on its own, as on
the ordinary path, so the /usage scrape runs once for its outcome only: a
parsed plan keeps account_unproven, no plan (or a parked scrape) ends as
signin_required. A timeout or error in this branch leaves the same
account_unproven marker while the adjacent whoami keeps this shape. A
corroborating scrape that parks the scrape reports the park to its
caller, as the ordinary path does. The once-per-process degraded-API
warning now says the API returned no reading, which is true on every
path, instead of naming a text-scrape fallback this branch never uses.
The modal labels the sign-in "Signed in with Company SSO", the sign-in
flow's existing name for the provider (providerLabelFromWire, moved into
its own module so the modal can share it; the notice names the provider
through the same mapping as the badge), and shows the identity block
(a name, a provider, or both) above a passive notice saying the balance
is not shown for this sign-in and that signing in again will not change
it, with no Refresh, since another read of the same sign-in answers the
same. The pill shows a terminal dash with that label.
The gate is scoped to ExternalIdP. A Builder ID or Identity Center
whoami that prints only its type takes the ordinary path and keeps its
"sign in again" remedy (reason signin_required).
Closes kirodotdev#17710
|
Disposition for the UX Review CONCERNS on Headline (no first-time reader has seen the modal or the pill's info mark): held for a maintainer. A cold read needs a person who has not seen the change, and the author cannot provide one by pushing. This is the same hold as on earlier heads. A maintainer cold read is welcome, and any wording it asks for is a one-string follow-up. Watch 1 (no way forward from the notice): held. This is the question answered in this earlier comment. Nothing verifies that any surface, "Manage account" included, shows the balance for this sign-in type, so the notice does not point users at one. The "Manage account" link renders directly under the notice. If a maintainer knows a surface that shows the balance for these sign-ins, the notice can name it in a follow-up. Watch 2 (the info mark is on this state and not on Suggestion (one verb, "isn't available" vs "isn't shown"): holding reply. Noted. It is a two-string change across the catalogs. It will land with the next push that has real work in it, and does not get a push of its own, because a push re-runs every lane. Earlier Watch answers, unchanged: the hover-text item and the kiro-cli naming item stay held as answered in this comment. This PR is not ready while the UX lane reads CONCERNS. The remaining items wait on a maintainer. |
|
Thanks for this fix. Please rebase onto current main. The head 7e233a2 no longer merges cleanly: main changed the same long line in What I checked on 7e233a2 (read, not run locally):
Two should-fix items, for the rebased head:
If either item is already covered by a test I missed, tell me which one and I will withdraw it. |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: Taking this over in #22861 since it has been idle; you are credited as co-author on the commits. Thanks for the groundwork. #22861 is this PR's change carried onto current main. The conflicts came from the |
|
Thanks @jeeshofone for this fix and the careful dispositions. Closing as superseded: this exact change was carried onto current main in #22861 (you are credited as co-author), which merged on 2026-10-21 as 2de262e and closed #17710. |
Problem / Motivation
Goal: An account whose
kiro-cli whoamireports only an account type shows the provider it signed in with in the Kiro Account modal, and is told plainly that its balance is not available, never showing a balance that may belong to another user.On an external identity provider sign-in,
kiro-cli whoami --format jsonanswers{"accountType":"ExternalIdP","email":""}: no email, nostartUrl, noProfile:ARN. Today every reading is discarded asunproven, so the modal shows "Credit usage unavailable" forever and hides the provider.Why it matters
Every such account sees a dead end.
What changed (motivation → approach → change)
ExternalIdP accounts with no per-user claim show no balance. #17710 is fixed for identity display: the provider is shown and the state explained. A balance follows once a per-user field is shown to exist (asked on #17710).
_fetch_usage_bg(dashboard/handlers/sessions.py) gains one early return, next to the existing API-key one. When the top-of-refresh whoami reports theExternalIdPaccount type and no email, start URL or profile ARN (_account_type_only), the refresh publishes{available:false, reason:"account_unproven"}plus that whoami's identity fields, and stops. No earlier reading is kept and no scrape number is read. The API call still runs, for itsauth_stateonly (its reading is never published).signin_requiredneeds evidence the sign-in is broken:rejected(a 401) alone, orno_credentialcorroborated by one/usagescrape run for its outcome only (a plan →account_unproven, no plan or a parked scrape →signin_required; it feeds the back-off as usual).no_credentialalone is not proof. A timeout or error in this branch leaves the sameaccount_unprovenmarker while the adjacent whoami is still this shape. A corroborating scrape that parks the scrape returns the parked marker to its caller, as the ordinary path does. The degraded-API WARN now says only that the API returned no reading, true on every path. Every other shape takes the existing path.Scope of the gate: ExternalIdP only. A type-only Builder ID or Identity Center whoami has lapsed; it takes the existing path and ends as
signin_required(TestOtherTypesKeepTheirRemedy).Why no reading is published for this shape. Only per-user claims (sub, user id, email, account id) can prove continuity. Under the existing claim allowlist, what kiro-cli stores for this sign-in is
client_idandscopes, and both belong to the IdP registration that every user of it shares. A switch from user A to user B of one registration leaves them identical. The previous head digested them anyway and could publish A's balance under B.TestASwitchWithinOneRegistrationreproduces it on a real SQLite store.Why not decode the token's
sub? It digests secret material through a second auth-store reader.account_unprovenUI. An account configuration (like API-key auth), not a failed read. The modal shows "Signed in with Company SSO" above a passive info notice, "Credit balance isn't shown for this Company SSO sign-in, because kiro-cli doesn't report which user is signed in.", with no Refresh. The copy states only the cause_account_type_onlychecks. The pill shows the muted dash plus an info mark, labelled "Kiro credit usage — balance isn't available for this sign-in" (no provider named). Two new keys, in every catalog plus en-XA. The badge's provider label now reads Company SSO for every ExternalIdP sign-in, including ones that publish a reading (main showed the humanized id "External Id P"), because that is the sign-in flow's own name for it.providerLabelFromWiremoved fromKasLoginGate.tsxtocomponents/kasProviderLabel.tsfor the modal.Reader:
_fetch_usage_bgcalls_account_type_only;KiroAccountModalandkiroUsageSegmentreadKiroAccountOnly, which carries onlyaccountType.Not a goal
Backwards compatibility
Every shape that published before still publishes.
account_unprovenis a newreason; an older client reads it as no reading.fetch_usage_limitskeeps its signature; only the degraded WARN's wording changes.Tests
test/test_session_usage_account_type_identity_17710.pydrives_fetch_usage_bgwith the issue's exact whoami bytes: the API only forauth_state, its reading never published (spied, not just the final cache), the account with no balance;rejected→signin_requiredwith no scrape;no_credential+ a working scrape →account_unproven(number unpublished), + a failing scrape →signin_required(back-off counted), + a parked scrape →signin_requiredwith no spawn; an error or a deadline timeout in the branch →account_unproven(the deadline fires only once the hung call is entered), a named adjacent whoami → the ordinary path; every payload published while the scrape runs carries only the marker's keys (a spy on_publish_usage, so a number published and then overwritten still fails); a corroborating scrape that parks reports the park; an email on both sides still publishes; an A → B switch within one registration never publishes;TestOtherTypesKeepTheirRemedyfor type-onlyBuilderId/IamIdentityCenter. Each mutation of these rules turns a test red.KiroAccountModal.test.tsx:account_unprovenparses to exactly{accountOnly, accountType}and shows "Signed in with Company SSO" (forExternalIdP,ExternalIdp,External-IdP) and the notice naming the cause, the Manage account link below it, no Refresh, no alert; the notice names the provider through the badge's ownaccountProviderLabel; with no type the notice still names Company SSO; a refresh out offailedinto it adds no outcome notice.App.creditPillError.test.tsx: the dash plus the info mark, hover text equal to its accessible name.test/*usage*.py,test_kiro_usage_api.pyandtest_spawn_audit.py(708 passed); vitestKiroAccountModal,App.creditPillError,KiroSignInCard,KasLoginGate,i18nGateTable,i18nStrictRule(116 passed);tsc -b, eslint, i18n-check, i18n-strings, pseudolocale (no diff), mypy, black gate, isort, flake8, comment-history, docs-lint, Semgrep 1.78.0 withsemgrep/and the registry packs on changed files (0 on this PR's lines).Manual verification
Built SPA behind the stub API with the
account_unprovenpayload, light and dark (stills below). The pill's hover text is a nativetitle, asserted inApp.creditPillError.test.tsx.Screenshots / video
Related Issues
Closes #17710
Pattern harvest
Rule candidate: review-prompt
Pattern: an identity gate weighing only optional fields is unsatisfiable for a payload carrying none of them; neither an account type nor a registration-level claim (an OAuth client id) is per-user continuity.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)