Repository navigation
feat(kas-auth): say which account Kiro Agent runs as on the sign-in card - #36324
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the route is read-only and adds to what exists, the button reuses the existing sign-out, and screenshots are attached. Notes
[DESIGN-REVIEWED] d431ba1 Description read[DESCRIPTION-READ] 7b272e84f88409ac09461cf05736d0d3d9d8846a43c78ee3950065ff2ba6fcc3 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 Every item answers the stated harm: people did not know which account their sessions run as. Which sign-in a session uses is unchanged, and the new button reuses the existing sign-out. Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: let a person see which Kiro account their Kiro Agent sessions run as, and switch back to the Kiro CLI account in one step. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] d431ba1 Description read[DESCRIPTION-READ] cc54effa3e0268b44fe064e2b742ba58c0f5eca0c654ed57b73f0f5e27699ef6 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: every new state has a screenshot, and the blind reader read "Use the Kiro CLI account" and its in-place confirm correctly and would use them. Notes
[UX-REVIEWED] d431ba1 Description read[DESCRIPTION-READ] ded5f2310dac827c6e894535e3186233746e16df6f0376866192f5a868391842 That sha256 names everything this verdict read: the PR description, plus the 19 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 — ✅ 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: |
a657bcc to
3086632
Compare
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 15% chance that this change introduces a defect, above the 12% limit for approving on its own. Adds a read-only GET /api/kas-login/sources route and card notices saying which stored sign-in Kiro Agent sessions run as, plus a 'Use the Kiro CLI account' button that reuses the existing owner-only, audited sign-out. The route sits beside GET /api/kas-login with the same dashboard auth, publishes only bounded account type, portal host and owner-only e-mail, and runs 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 |
3086632 to
eba8f72
Compare
eba8f72 to
30d4421
Compare
30d4421 to
7359a9b
Compare
1. GPT F1 -- website/src/pages/developer/KiroSignInCard.tsx:195 (security-class, fenced)fixed in 7359a9b
|
2. GPT F2 -- website/src/pages/developer/KiroSignInCard.tsx:189fixed in 7359a9b
|
3. UX Blocker -- "Use the Kiro CLI account" gives no reason to click (shot-04)target=ux fixed in 7359a9b
UX Notes bullets (confirm-button name, repeated grey line, unreadable-name hint) need no reply and are not changed. |
7359a9b to
33adf1c
Compare
|
span=29c945e3dfb4
|
5f1c4af to
65cacd1
Compare
|
span=f0a7c76bd4c5
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for this. The code review on head 65cacd1 found no code defect, but one evidence gap blocks merge.
- Missing screenshots for this head (KiroSignInCard.tsx:403, KiroSignInSources.tsx).
- Trigger: the UX review on 65cacd1 says it cannot evaluate this head. It is missing the folded card heading this PR adds ("· Using your Kiro CLI sign-in"), the "Using your Kiro CLI sign-in" notice while the account name is still loading and when it cannot be read, and the error notices (could_not_read_sources, could_not_check_kiro_cli, could_not_check_kiro_crew, kiro-sign-in-remove-error). CI recorded it as a pass only because the verdict had no Trigger and Outcome lines. A lane that cannot reach a verdict for lack of evidence still counts as a block.
- Outcome: the newest shots in the body come from 33adf1c, an earlier head, and the body itself says shot 09 predates the inline-notice change. No shot shows the folded heading or any error state. As it stands, these states would merge without anyone having seen them rendered.
- Smallest fix: no code change. Attach screenshots rendered from 65cacd1 of the folded heading in the using_kiro_cli state, the using_kiro_cli notice while the name is pending and when it is unreadable, and each error notice. Then re-run the UX lane.
Optional, not blocking:
- Open PR #33787 moves the same
humanizeProviderId/accountProviderLabelhelpers into kasProviderLabel.ts. Please name it in the body and state the merge order, so the PR that lands second can drop its copy. - kas_login_sources.py:182 computes
can_use_kiro_cliwithout the owner check, so a teammate who is not the owner sees "Use the Kiro CLI account" and then gets a 403 from logout. Combining it withownerwould hide that dead-end button. same_accountin lts_sign_in.py still returns True when two Identity Center or External IdP profiles have the same ARN, and that ARN can be shared across one organization. The result is a missing notice, not a wrong one. A docstring line or a test that pins the intent would help.
|
Thanks @KiroCrewCaptain. The evidence gap is closed with a body-only edit (no push, head still
The real On the optional notes:
|
65cacd1 to
077fb77
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for closing the screenshot gap. This review re-read the code on 077fb77 and found one defect that blocks merge.
Earlier request, item 1 (missing screenshots for the new states): fixed. The body now carries renders of the folded heading, the pending and unreadable notices, and each error notice. The UX review on this head passes.
- An expired Kiro CLI access token hides the notice, but sessions still run on that sign-in (
kas_login_sources.py:93,kas_login_sources.py:205,KiroSignInSources.tsx:68).- Trigger: a person signs in to the Kiro CLI and then does not run it for longer than its access-token lifetime, about an hour. That is the normal state.
_CliEntry.live()(lts_sign_in.py:378) checks only the access token'sexpires_at, soliveis False. - Outcome:
_read_storesasksrelay_runs_on_kiro_cli_sign_in()only whenliveis True, sorelayis False. With nothing stored in Kiro Crew, the route answersactive: "none"and the card shows the bare sign-in chooser. With a Kiro Crew sign-in for another account,usableandcan_use_kiro_cliare False, sosourcesNoticereturns null: no two-accounts warning and no "Use the Kiro CLI account" button. The relay itself decides on presence (kiro_cli_signed_outinkas_route.py:132), so a session still runs on the Kiro CLI sign-in, and the Kiro CLI renews its own token. In the second case nothing in Kiro Crew renews that token, so the notice this PR adds is gone about an hour after the person last ran the Kiro CLI directly. Both halves of the goal miss in the common case. The premise "an expired sign-in is not an account anything could run as" holds for LTS, where the gate presents the stored token and never renews it. It does not hold for the oss relay. - Smallest fix: decide "in use" the way the route decides it, on presence. Drop the
.liveprecondition beforerelay_runs_on_kiro_cli_sign_in(), or keep it only under the LTS policy, which the handler already picks. Forusableandcan_use_kiro_cli, either count an expired access token that has a refresh token as usable, or apply the liveness rule only on LTS. Then updatetest_a_lapsed_kiro_cli_sign_in_is_not_the_one_in_use, thelive=Falserow oftest_the_store_read_asks_only_what_the_stores_call_for, and the matching sentence in kas-auth.md.
- Trigger: a person signs in to the Kiro CLI and then does not run it for longer than its access-token lifetime, about an hour. That is the normal state.
Optional, not blocking:
- No test pins
elif relay:(kas_login_sources.py:173) on the side that loosens it. With that line changed to test onlylive, the three backend test files still pass. One handler test with no vault, a live Kiro CLI entry andrelayFalse, expectingactive == "none", would pin it. - The Kiro sign-in row in docs/feature-map/README.md lists the new handler but not
GET /api/kas-login/sourcesin its endpoints cell. - Open #34267 adds
closeRelayCrews()to the inline sign-outonSuccessthat this PR moves intouseKiroSignOut, and #36888 renames its query key. Please name both in the overlap note, so the PR that lands second carries the other's change into the hook.
A Kiro Agent session uses the sign-in stored in Kiro Crew when there is one, and Kiro CLI's sign-in only when there is none. The Kiro sign-in card did not say so. With nothing stored here it read as "you still have to sign in", and a person who then signed in with another account ran every session as that account without being told. The card now reads a new read-only route, GET /api/kas-login/sources, behind the same dashboard auth as GET /api/kas-login. With nothing stored here and Kiro CLI signed in, the card says Kiro Agent is using the Kiro CLI sign-in and names the account. With both stored and not provably one account, it names both and offers "Use the Kiro CLI account", which asks once and then removes the sign-in stored here; signing in again undoes it. Which sign-in a session uses does not change. The account check treats a sign-in of a different kind as a different account, so a Builder ID stored here beside another Kiro CLI account is flagged too, including in the one log warning. Closes #36237
077fb77 to
d431ba1
Compare
|
Reply to review 5904718682 (on 077fb77). Fixed on d431ba1. 1. Expired Kiro CLI access token hides the notice: fixed.
Optional items: all done.
Checks run: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks. This review re-read the code on d431ba1 and found nothing that blocks merge.
Earlier requests from this account:
- Review on 65cacd1, item 1 (missing screenshots for the new states): fixed. The body has renders of every state, and the UX review passes on this head.
- Review on 077fb77, item 1 (an expired Kiro CLI token hides the notice): fixed.
_kiro_cli_usableapplies the liveness rule only on LTS and counts a stored sign-in on oss. It now decides the relay question,usableandcan_use_kiro_cli. Changing it back toentry.liveturns 2 tests red. Making it presence-only turns the LTS rows red. - The optional items from that review are done. A test now pins
elif relay:, the feature map listsGET /api/kas-login/sources, and the body names #34267 and #36888.
What this review checked on this head: test_kas_login_sources.py, test_kas_login_sources_auth.py and test_lts_sign_in.py pass in a scratch checkout. Mutating any of these turns tests red: the relay check, the owner-only e-mail, the LTS refuse condition, or the account lock. LTS behaviour is unchanged. profile_eligible and account_lock_allows are the same rules that _select and the gate's _check used inline. Done well: the card offers "Use the Kiro CLI account" only when those same two functions would accept that sign-in. So it cannot offer a switch the gate would then refuse.
Security: the new route sits beside /api/kas-login, behind the same dashboard token auth (test_kas_login_sources_auth.py pins this). App tokens stay deny-by-default. The payload is built from an allowlist of three length-capped fields, so no token, ARN or stamp reaches the browser. The e-mail is added only for the dashboard owner. The button reuses the existing owner-only, audited POST /api/kas-login/logout. The store reads and the account lock check run through asyncio.to_thread, and nothing new runs at gateway boot.
The design is signed off under the standing maintainer sign-off for changes by team members.
Optional:
- #33787 adds the same
humanizeProviderIdandaccountProviderLabelto kasProviderLabel.ts. Add one line to the body that names which PR owns the move. Then the other PR's rebase is mechanical. - On oss, a Kiro Crew sign-in with no profile ARN now reads the Kiro CLI store on every resolve, and audits that read. That includes the spawn path. One sentence under Backwards compatibility would say so.
test_the_stamp_changes_with_the_stored_entrychanges only the ARN. Also rewrite the entry with a new expiry and assert that the stamp differs. That would pin "a renewed token starts a new read".
The sign-in card offered "Use the Kiro CLI account" to any dashboard viewer, but the sign-out it runs is owner-only, so anyone else got a 403. can_use_kiro_cli now requires the owner. Also states in same_account's docstring, and pins with a test, that equal Identity Center or External IdP profile ARNs count as one account: the cost is a missing two-accounts notice, never a wrong one. Follow-up to #36324 review notes.
…37275) The sign-in card offered "Use the Kiro CLI account" to any dashboard viewer, but the sign-out it runs is owner-only, so anyone else got a 403. can_use_kiro_cli now requires the owner. Also states in same_account's docstring, and pins with a test, that equal Identity Center or External IdP profile ARNs count as one account: the cost is a missing two-accounts notice, never a wrong one. Follow-up to #36324 review notes.
…ard (#36324) A Kiro Agent session uses the sign-in stored in Kiro Crew when there is one, and Kiro CLI's sign-in only when there is none. The Kiro sign-in card did not say so. With nothing stored here it read as "you still have to sign in", and a person who then signed in with another account ran every session as that account without being told. The card now reads a new read-only route, GET /api/kas-login/sources, behind the same dashboard auth as GET /api/kas-login. With nothing stored here and Kiro CLI signed in, the card says Kiro Agent is using the Kiro CLI sign-in and names the account. With both stored and not provably one account, it names both and offers "Use the Kiro CLI account", which asks once and then removes the sign-in stored here; signing in again undoes it. Which sign-in a session uses does not change. The account check treats a sign-in of a different kind as a different account, so a Builder ID stored here beside another Kiro CLI account is flagged too, including in the one log warning. Closes #36237 (cherry picked from commit c59120d)
Problem / Motivation
Goal: The Kiro sign-in card tells a person which account Kiro Agent sessions run as when Kiro CLI is signed in too, and lets them go back to the Kiro CLI account in one step.
A Kiro Agent session uses the sign-in stored in Kiro Crew when there is one, and Kiro CLI's sign-in only when there is none. The card on the Kiro Agent row did not say so:
Why it matters
People land on a different account, with a different quota, than the one they think they are using, and nothing in the product tells them why. The only fix today is knowing that signing out of the card hands sessions back to Kiro CLI.
Not a goal
What changed (motivation → approach → change)
The card already knows what Kiro Crew stores. It did not know what Kiro CLI stores, or which of the two a session uses. A small read-only route answers that, and the card says it in plain words.
GET /api/kas-login/sources(dashboard/handlers/kas_login_sources.py)kiro-cli whoamireports. No token, ARN or other identifier.src/kiro_crew/lts_sign_in.py(stored_sign_ins,same_account)src/kiro_crew/acp/kas_route.py(relay_runs_on_kiro_cli_sign_in)KiroSignInCard.tsx,KiroSignInSources.tsx)kiro-cli whoamican take many seconds, so it never runs inside the request. The first answer says the name is still being read, the card shows the state without the name, and the reading is kept for the gateway process until the stored Kiro CLI entry changes. A slow or failed read names nothing and is never read as "signed out": that answer comes from the store read alone.The card's text is in all 12 languages (
website/src/i18n/locales/), and the client getskasLoginSourceswith its types (website/src/api/client/onboarding.ts).docs/system-specs/modules/kas-auth.mdanddocs/feature-map/README.mddescribe the new card states and route.builder-security checked: no new listener, port or bind; the route is a read on the existing dashboard listener behind the same token check as
GET /api/kas-login, and the remove button reuses the existing owner-only, audited sign-out.Backwards compatibility
Compatible: one new read-only route and one new card notice; every existing route, field and card state is unchanged. The oss log warning fires in more cases (a different kind of sign-in), and still only once per pair of accounts.
Removes nothing: no route, field, key or function is removed or narrowed;
humanizeProviderIdandaccountProviderLabelmove fromKiroAccountModal.tsxtokasProviderLabel.tswith the same behaviour, and the popup imports them from there.Tests
test/test_kas_login_sources.py: every card state from the route; the first answer does not wait for the name; a failed or missing name read is unknown, never signed out; a changed Kiro CLI entry is read again; the payload carries only the named fields (no token, ARN or profile id); the e-mail goes to the owner only and into no log; the button is offered only where Kiro CLI's sign-in would run.test/test_kas_login_sources_auth.py: a request with no dashboard credential, or a bad one, is refused before the handler runs, for the new route and forGET /api/kas-login.test/test_lts_sign_in.py: the account verdict over each kind pair; both stores read apart; an unreadable store is unknown; nothing printed carries a token or ARN; the oss warning fires once for a Builder ID beside another account; the LTS refusal still needs two differing ARNs.website/src/test/KiroSignInCard.sources.test.tsx: each card state, the in-place confirm (focus on Keep it, nothing removed until Remove this sign-in), the name arriving late, the compact fold opening for two accounts, a failed read leaving the card as it was.Breaking each new guard turns a test red: the kind check, the Builder ID beside a named profile, the oss warning's kind path, the whoami kind comparison, the owner-only e-mail, the relay check for "in use" and the relay check for the button (7 of 7). The new backend tests pass in 3 shuffled orders (106 tests) and 5 repeats. Run locally, single process: 328 backend tests and 1,622 frontend tests across the touched and neighbouring files; black, isort, flake8, mypy, tsc, eslint and the i18n check are clean.
Proof: not provable -- other: a feature PR; the mutations above stand in for prove.py.
Manual verification
Each card state was rendered on an isolated pod built from this branch, with the two sign-in reads answered by fixed example data so no real account appears. Not run against two real accounts end to end.
Screenshots / video
Nothing stored here, Kiro CLI signed in:
Two different accounts, after Use the Kiro CLI account:
Other states
Two different accounts:
Cannot tell whether they are one account:
Kiro CLI account name could not be read:
Fresh shots from head
33adf1cae4bff3fd2085bc4e09bbcd2ce26a0934. Component render, not the live page: the realKiroSignInCardwith onlykasLoginStatusandkasLoginSourcesstubbed, from awebsite/captureentry that is not committed.Cannot tell whether they are one account (title, quota line, and the line under the button):
Both sides read "Builder ID", so each sign-in is named by where it lives:
More fresh states (component render, not the live page)
Two different accounts, with the line under the button:
Kiro CLI account name could not be read:
Shots from head
65cacd1321eae4028e5a235cd32bd0d84beee65b. Component render, not the live page: the realKiroSignInCardfrom this head in compact mode, with onlykasLoginStatus,kasLoginSources,kasLoginLogoutandkasLoginPollmocked. The earlier shots above come from older heads.Folded card, Kiro CLI sign-in in use:
Kiro CLI account name could not be read (inline line, not a banner):
Removing the sign-in failed:
More states from 65cacd1 (component render, not the live page)
Account name still loading:
The sources request failed:
The Kiro CLI sign-in store could not be read:
The sign-in stored in Kiro Crew could not be read:
Related Issues
Closes #36237
Overlaps open #33787, which moves the same
humanizeProviderId/accountProviderLabelhelpers intowebsite/src/components/kasProviderLabel.ts. Whichever of the two lands second drops its copy and imports the other's.Also overlaps open #34267 and #36888. #34267 adds
closeRelayCrews()to the inline sign-outonSuccessthat this PR moves intouseKiroSignOut. #36888 renames that hook's query key. Whichever lands second carries the other's change intouseKiroSignOut.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement