Skip to content

feat(kas-auth): say which account Kiro Agent runs as on the sign-in card - #36324

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/kiro-sign-in-card-names-the-account
Nov 14, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/kiro-sign-in-card-names-the-account

Conversation

@buluoray

@buluoray buluoray commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • With nothing stored in Kiro Crew and Kiro CLI signed in, sessions already run on the Kiro CLI sign-in, but the card only showed the sign-in chooser. It read as "you still have to sign in".
  • A person who then signed in on the card with another account ran every session as that account. The Kiro CLI sign-in was still there and no longer used, and nothing on the card said so.
  • The one log warning about two different accounts compared profile ARNs only. A Builder ID sign-in stores no profile ARN, so that case was never flagged.

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

  • Which sign-in a session uses does not change.
  • No new sign-in method and no new provider on the card.
  • The LTS build's refusal of two different accounts is unchanged.
  • No change to the account popup beyond sharing its account-label helper.

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.

Part Change
GET /api/kas-login/sources (dashboard/handlers/kas_login_sources.py) New read. Reports both stored sign-ins by presence, which one a new session uses, and whether they are one account. Names an account by its kind, its portal host and, for Kiro CLI and the dashboard owner only, the e-mail kiro-cli whoami reports. No token, ARN or other identifier.
src/kiro_crew/lts_sign_in.py (stored_sign_ins, same_account) Read both stores without picking. Two profile ARNs decide; without both, a sign-in of a different kind is a different account. The oss log warning uses the same verdict, so a Builder ID beside another Kiro CLI account is warned about.
src/kiro_crew/acp/kas_route.py (relay_runs_on_kiro_cli_sign_in) Says whether a session would really run on Kiro CLI's sign-in, so the card never promises what a spawn would not do.
Card (KiroSignInCard.tsx, KiroSignInSources.tsx) Nothing stored here and Kiro CLI signed in: "Using your Kiro CLI sign-in" with the account. Both stored and not provably one account: names both and offers Use the Kiro CLI account, which asks once in place, then runs the card's own sign-out. Signing in here again undoes it.

kiro-cli whoami can 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 gets kasLoginSources with its types (website/src/api/client/onboarding.ts). docs/system-specs/modules/kas-auth.md and docs/feature-map/README.md describe 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; humanizeProviderId and accountProviderLabel move from KiroAccountModal.tsx to kasProviderLabel.ts with 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 for GET /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:

Card says Kiro Agent is using the Kiro CLI sign-in and names the account

Two different accounts, after Use the Kiro CLI account:

Card names both accounts and asks before removing the sign-in stored here

Other states

Two different accounts:

Card names both accounts and offers Use the Kiro CLI account

Cannot tell whether they are one account:

Card says it cannot tell whether the two sign-ins are the same account

Kiro CLI account name could not be read:

Card says Kiro Agent uses the Kiro CLI sign-in without naming the account

Fresh shots from head 33adf1cae4bff3fd2085bc4e09bbcd2ce26a0934. Component render, not the live page: the real KiroSignInCard with only kasLoginStatus and kasLoginSources stubbed, from a website/capture entry that is not committed.

Cannot tell whether they are one account (title, quota line, and the line under the button):

Component render: "These may be different accounts", the quota consequence, and "Removes the sign-in stored here." under Use the Kiro CLI account

Both sides read "Builder ID", so each sign-in is named by where it lives:

Component render: notice says "the sign-in stored in Kiro Crew" and "the Kiro CLI sign-in" and leads with the quota

More fresh states (component render, not the live page)

Two different accounts, with the line under the button:

Component render: Two different accounts are signed in, Use the Kiro CLI account, Removes the sign-in stored here.

Kiro CLI account name could not be read:

Component render: error notice "Could not read the Kiro CLI account name", sign-in controls unchanged

Shots from head 65cacd1321eae4028e5a235cd32bd0d84beee65b. Component render, not the live page: the real KiroSignInCard from this head in compact mode, with only kasLoginStatus, kasLoginSources, kasLoginLogout and kasLoginPoll mocked. The earlier shots above come from older heads.

Folded card, Kiro CLI sign-in in use:

Component render: folded heading reads Kiro sign-in · Using your Kiro CLI sign-in

Kiro CLI account name could not be read (inline line, not a banner):

Component render: Using your Kiro CLI sign-in with the inline line Could not read the Kiro CLI account name

Removing the sign-in failed:

Component render: Could not sign out HTTP 500 notice under Remove this sign-in, sign-in summary unchanged

More states from 65cacd1 (component render, not the live page)

Account name still loading:

Component render: Using your Kiro CLI sign-in while the account name is still being read

The sources request failed:

Component render: Could not check which account Kiro Agent uses

The Kiro CLI sign-in store could not be read:

Component render: Could not check the Kiro CLI sign-in

The sign-in stored in Kiro Crew could not be read:

Component render: Could not check the sign-in stored in Kiro Crew

Related Issues

Closes #36237

Overlaps open #33787, which moves the same humanizeProviderId / accountProviderLabel helpers into website/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-out onSuccess that this PR moves into useKiroSignOut. #36888 renames that hook's query key. Whichever lands second carries the other's change into useKiroSignOut.

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

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 13, 2026 02:39
@buluoray
buluoray requested a review from mbriones98 November 13, 2026 02:39
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 13, 2026
@buluoray
buluoray enabled auto-merge (squash) November 13, 2026 02:40
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

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

  • A failed whoami reading stays cached until the stored Kiro CLI entry changes (marked "shortcut" in _kiro_cli_name). So someone whose first read timed out sees no account name for the life of the gateway process. A short retry window would fix that without changing the design.
  • relay_runs_on_kiro_cli_sign_in re-checks the spawn route separately instead of reusing resolve_kas_route's decision. If the spawn logic changes later and this check isn't updated, the card can end up saying something a session doesn't actually do.

[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 .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 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d431ba1afa6bd501970314207552a249cd8009e1 — 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

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

  • Item 10 — one consumer, generalized: _lazy_kas(handler_name, module_name="kas_login") now takes a module name, and only one caller (/api/kas-login/sources) passes anything other than the default (counted in routes/realtime.py). Subtraction: drop the module_name parameter and importlib, and register the one sources route with its own direct lazy import.

What this change ships

Inventory (10 items) — 8 justified

Intent: 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.

  1. With nothing stored in Kiro Crew and Kiro CLI signed in, the card says "Using your Kiro CLI sign-in" and names the account — justified
  2. With both sign-ins stored and not provably one account, the card names both — justified
  3. A Use the Kiro CLI account button with an in-place confirm, which runs the existing sign-out — justified
  4. A new read-only route, GET /api/kas-login/sources — justified
  5. kiro-cli whoami runs in the background and its answer is cached per gateway process until the Kiro CLI entry changes — justified
  6. The Kiro CLI e-mail is shown to the dashboard owner only — justified
  7. The oss log warning now also fires for sign-ins of different kinds (a Builder ID beside another account) — rides along; it is in the description's Problem list
  8. The account popup's label helper moved to the shared kasProviderLabel.ts — justified
  9. A sign-in landing on the gate refreshes the sources reading — justified
  10. _lazy_kas takes a module-name parameter — undeclared; one consumer, generalized

[FIRST-PRINCIPLES-REVIEWED] d431ba1

Description read

[DESCRIPTION-READ] cc54effa3e0268b44fe064e2b742ba58c0f5eca0c654ed57b73f0f5e27699ef6

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.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

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

  • The remove-failed error is titled could_not_sign_out ("Could not sign out"), but the button pressed was "Remove this sign-in" (shot 12). The reader asked "how 'Sign out' differs from 'Remove this sign-in'". Pick one verb for both: rename the button "Sign out here", or give this error its own title, "Could not remove this sign-in".
  • could_not_read_sources shows the raw sourcesError.message ("HTTP 500: Internal Server Error") with no next step (shot 14). Store-unreadable errors 15 and 16 have no next step either, and the reader could not tell them apart. Add a retry, or a line saying what to do.
  • In maybe_two_accounts_body_by_place, "The Kiro CLI sign-in is also there" is vague; the reader asked where "there" is. Say what it is instead: "Kiro CLI is signed in too".

[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 .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 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d431ba1

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

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

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d431ba1

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

@buluoray
buluoray force-pushed the crew/slack/kiro-sign-in-card-names-the-account branch from a657bcc to 3086632 Compare November 13, 2026 03:02
@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: 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 kiro-cli whoami off the request path with a per-stamp cache. Kind detection from kiro-cli store keys matches identity_stores.AUTH_TOKEN_KEYS, and vault kinds match KNOWN_IDENTITIES. The LTS refusal is unchanged; the oss warning only widens. The relay check calls the real relay_unusable_reason and _resolve_kiro_bin signatures and fails closed. Tests cover the card states, edition rules, account lock, owner-only e-mail, auth refusal and the oss warning. Nothing blocking: the failing CI checks are API rate-limit failures, and about a dozen checks had no result yet at decision time.

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 d431ba1afa · 2592 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
@buluoray
buluoray force-pushed the crew/slack/kiro-sign-in-card-names-the-account branch from 3086632 to eba8f72 Compare November 13, 2026 08:36
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 13, 2026
@buluoray
buluoray force-pushed the crew/slack/kiro-sign-in-card-names-the-account branch from eba8f72 to 30d4421 Compare November 13, 2026 09:49
@buluoray
buluoray force-pushed the crew/slack/kiro-sign-in-card-names-the-account branch from 30d4421 to 7359a9b Compare November 13, 2026 19:24
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

1. GPT F1 -- website/src/pages/developer/KiroSignInCard.tsx:195 (security-class, fenced)

fixed in 7359a9b

F1 fixed: every completed sign-in now invalidates ['kas-login-sources'], not only an authenticated toggle.
KasLoginGate.tsx invalidateSignInCaches runs on poll authorized and on a cancel whose status read finds the credential stored.
Tests: switch account refetches sources even when authenticated and the status fields stay the same; a switch completed during cancellation refetches sources while authenticated stays true (both red with the invalidation removed).

@buluoray

Copy link
Copy Markdown
Contributor Author

2. GPT F2 -- website/src/pages/developer/KiroSignInCard.tsx:189

fixed in 7359a9b

F2 fixed: the card reads the sources query's error and renders it through ErrorNotice ("Could not check which account Kiro Agent uses"), above the sign-in controls.
No hand-off button: the embedded Company SSO form can hold an unsaved portal URL and region.
Test: a failed sources read renders an error notice and keeps sign-in controls working (signed in and signed out; red with the notice removed).

@buluoray

Copy link
Copy Markdown
Contributor Author

3. UX Blocker -- "Use the Kiro CLI account" gives no reason to click (shot-04)

target=ux

fixed in 7359a9b

The "cannot tell" state now has a bold title, "These may be different accounts".
Its body ends with the stake: "If these are different accounts, Kiro Agent is not using your Kiro CLI account's quota."
Under the button, before the first click: "Removes the sign-in stored here."
Tests: the uncertain-account notice explains its title / stakes / removal before a click.
New strings in all 12 locales and en-XA; npm run i18n:check passes.

UX Notes bullets (confirm-button name, repeated grey line, unreadable-name hint) need no reply and are not changed.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
@buluoray
buluoray force-pushed the crew/slack/kiro-sign-in-card-names-the-account branch from 7359a9b to 33adf1c Compare November 13, 2026 22:18
@buluoray

Copy link
Copy Markdown
Contributor Author

span=29c945e3dfb4

  • Two labels for one action, and the main button scares the reader off

Rebutted, no code change on this head: "Use the Kiro CLI account" and "Remove this sign-in" are one action in two steps, not two actions. The first press opens an in-place confirmation, and the second runs the existing sign-out; the label pair is that confirmation, not a second copy of "Sign out".
The no-name case is already guarded: the button is offered only when the Kiro CLI sign-in is eligible and the account lock allows it (can_use_kiro_cli, lts_sign_in.profile_eligible / account_lock_allows), and an unreadable name renders as the inline ErrorNotice line, not a banner.
Shot 09 predates this head: it shows the old boxed banner, which 5f1c4af replaced with the inline variant, so the reader's reaction to the red box is to a state this head no longer renders.
Relabelling the confirm button (e.g. "Sign out here and use the Kiro CLI account") and the Notes' wording points are copy choices outside this PR's frozen goal; they are deferred to a follow-up so this card stops changing under review.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=f0a7c76bd4c5

  • Equal social profile ARNs do not prove the same account (src/kiro_crew/lts_sign_in.py:556)

fixed in 65cacd1: same_account() now runs the kind check (_kinds_can_match), the named account-type check and the portal check before it compares ARNs, so any of those mismatches returns False even when the ARNs are equal.
When both sides are social sign-ins and the ARNs are equal it returns None (unknown), because different people can share one social profile ARN; unequal ARNs and equal non-social ARNs keep their answers, and the Builder ID branch is unchanged. Both callers already handle None.
Tests (test_lts_sign_in.py::test_equal_arns_respect_kind_names_and_portals, 8 cases): all 8 failed on 5f1c4af (assert True is None / assert True is False) and pass now; 134/134 across the three sign-in test files on 3 runs and 1 shuffled run.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. The code review on head 65cacd1 found no code defect, but one evidence gap blocks merge.

  1. 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 / accountProviderLabel helpers 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_cli without 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 with owner would hide that dead-end button.
  • same_account in 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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 14, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

Thanks @KiroCrewCaptain. The evidence gap is closed with a body-only edit (no push, head still 65cacd1321eae4028e5a235cd32bd0d84beee65b). The body now carries seven component renders from this head, each labelled "Component render, not the live page":

  1. the folded heading in the using_kiro_cli state ("· Using your Kiro CLI sign-in");
  2. the using_kiro_cli notice while the name is pending;
  3. the same notice when the name cannot be read (the inline line);
  4. could_not_read_sources;
  5. could_not_check_kiro_cli;
  6. could_not_check_kiro_crew;
  7. kiro-sign-in-remove-error.

The real KiroSignInCard is rendered with only kasLoginStatus, kasLoginSources, kasLoginLogout and kasLoginPoll mocked. I'll rerun the UX lane on this head.

On the optional notes:

  • feat(relay-viewer): name the signed-in account kind on the crews list #33787: the body now names it and the merge order: whichever of the two lands second drops its copy of the kasProviderLabel helpers and imports the other's.
  • Owner check on can_use_kiro_cli: fair point. I'm keeping it out of this head to avoid restarting review; I'll take it as a follow-up.
  • same_account for Identity Center / External IdP with equal ARNs: agreed. As you say, the result there is a missing notice, not a wrong one. I'll add the docstring line and a test that pins it in the same follow-up.

@buluoray
buluoray force-pushed the crew/slack/kiro-sign-in-card-names-the-account branch from 65cacd1 to 077fb77 Compare November 14, 2026 11:59
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  1. 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's expires_at, so live is False.
    • Outcome: _read_stores asks relay_runs_on_kiro_cli_sign_in() only when live is True, so relay is False. With nothing stored in Kiro Crew, the route answers active: "none" and the card shows the bare sign-in chooser. With a Kiro Crew sign-in for another account, usable and can_use_kiro_cli are False, so sourcesNotice returns null: no two-accounts warning and no "Use the Kiro CLI account" button. The relay itself decides on presence (kiro_cli_signed_out in kas_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 .live precondition before relay_runs_on_kiro_cli_sign_in(), or keep it only under the LTS policy, which the handler already picks. For usable and can_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 update test_a_lapsed_kiro_cli_sign_in_is_not_the_one_in_use, the live=False row of test_the_store_read_asks_only_what_the_stores_call_for, and the matching sentence in kas-auth.md.

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 only live, the three backend test files still pass. One handler test with no vault, a live Kiro CLI entry and relay False, expecting active == "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/sources in its endpoints cell.
  • Open #34267 adds closeRelayCrews() to the inline sign-out onSuccess that this PR moves into useKiroSignOut, 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
@buluoray
buluoray force-pushed the crew/slack/kiro-sign-in-card-names-the-account branch from 077fb77 to d431ba1 Compare November 14, 2026 14:09
@buluoray

Copy link
Copy Markdown
Contributor Author

Reply to review 5904718682 (on 077fb77). Fixed on d431ba1.

1. Expired Kiro CLI access token hides the notice: fixed.
I checked the mechanism and it was right. _CliEntry.live() reads only expires_at, while the relay decides by presence (kas_route.kiro_cli_signed_out), and kiro-cli renews its own token.

  • kas_login_sources._kiro_cli_usable() now applies the liveness rule only on LTS (edition.is_lts()), where the gate presents the stored token and Kiro Crew never renews it. On oss a stored sign-in counts, the same rule the relay uses.
  • _read_stores (the relay ask) and kiro_cli.usable both use it. can_use_kiro_cli depends on relay, so it follows too.
  • Tests: test_a_lapsed_kiro_cli_sign_in_is_in_use_only_where_it_is_renewed (replaces the old lapsed test, runs on lts and oss, with and without a Kiro Crew sign-in), and new oss/lts rows in test_the_store_read_asks_only_what_the_stores_call_for. The handler fixture now runs the real _read_stores and stubs only what it reads. These tests were red before the fix, and they go red again when the .live precondition is put back.
  • kas-auth.md: the sentence now says what "usable" means on each edition.

Optional items: all done.

Checks run: test_kas_login_sources.py 38 passed, KiroSignInCard.sources.test.tsx 37 passed. black, isort, flake8, mypy, line cap, comment-history, brand and flake-ratchet are all clean.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_usable applies the liveness rule only on LTS and counts a stored sign-in on oss. It now decides the relay question, usable and can_use_kiro_cli. Changing it back to entry.live turns 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 lists GET /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 humanizeProviderId and accountProviderLabel to 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_entry changes 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".

@buluoray
buluoray merged commit c59120d into main Nov 14, 2026
155 of 168 checks passed
@buluoray
buluoray deleted the crew/slack/kiro-sign-in-card-names-the-account branch November 14, 2026 16:20
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 14, 2026
buluoray added a commit that referenced this pull request Nov 14, 2026
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.
buluoray added a commit that referenced this pull request Nov 14, 2026
…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.
buluoray added a commit that referenced this pull request Nov 15, 2026
…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)
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.

Kiro sign-in card does not say which account Kiro Agent runs as

2 participants