Repository navigation
fix(kiro): keep same-organization users as separate accounts (#6641) - #6981
Conversation
A Kiro organization (IAM Identity Center) profile ARN is shared by every user of that profile, yet the CLI import stored it as accountId and the account store upserted by accountId ?? email, so a second user of the same organization overwrote the first user's slot. Kiro account identity is now the profile ARN plus the email that same-session kiro-cli whoami reports. Without a reported user the ARN stays the identity, but a login is refused rather than replace an identified user of that profile unless the refresh token proves the same CLI session. Reauth and rotated-CLI recovery require the same user, Add account records the current CLI user on ARN-only rows through a fenced same-session bind, and stored rows keep matching the shape they were saved with.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The change separates users who share a Kiro organization profile and adds safeguards for cases where the user is unknown. No concrete merge-blocking problem was found. If the CLI does not report an email, users sharing a profile stay indistinguishable, as the PR notes. Pre-merge checks |
|
|
✅ Deterministic PR hygiene checks passed. |
Ingwannu
left a comment
There was a problem hiding this comment.
Focused correctness review of 5c5b58c0386a6668f928a2d03513a8f9526fa599, against trusted dev a0191a1b6fd921a6e5a9d12cb123c8df88b023e7 (nine-file diff).
I independently ran the complete new regression file: bun test --no-env-file --preload ./tests/preload.ts --isolate ./tests/providers/kiro/kiro-org-user-identity.test.ts --timeout 30000 — 18 passed, 0 failed, 57 assertions, Bun 1.4.0/Linux. This uses disposable SQLite homes, injected CLI runners, synthetic refresh responses and no-op configuration persistence; no real Kiro login, CLI process, account or provider request was used.
The reviewed implementation keeps the profile ARN in accountId and makes user email part of Kiro-specific matching rather than changing other providers' identity rules. The same-session legacy bind changes only email under the store mutation owner, and the fixtures cover unrelated legacy slots, identified-user reauth mismatch, CLI rollback after refusal, rotated-session recovery, cancellation and preserving an unidentified row alongside a different identified user. I did not find a concrete correctness blocker in those tested flows.
Please retain the qualification in the description when resolving #6641: this demonstrates conditional separation when same-session whoami supplies the user's email, not that CLI 2.27.1 actually supplies it for the reported IAM Identity Center login. The no-user fixture deliberately retains profile-only matching. A primary version-specific JSON shape or a reporter's minimal redacted field-shape confirmation (not tokens, a full credential file or live paid test) is needed to claim the original two-user scenario is resolved. Do not describe the modeled accountType/startUrl fixture as captured vendor output.
This is COMMENTED, not approval or the mandatory independent trust-boundary review. Current-head Cross-platform CI 38219702942 is queued, not complete; the author's wider suite/typecheck receipts are separate from my focused run. No sponsorship, workflow approval, scan or merge. Validation ran as ubuntu in one isolated worktree with fresh private homes, verified CPU75% / MemoryHigh1280MiB / MemoryMax1536MiB / swap0 / tasks64 / nice10 and a finite deadline. IOWeight20 was requested without an enforcement claim; protected runtime files were unchanged and the unit terminated successfully.
|
Maintainer integration into |
Preserve the Codex CLI update planning changes and client layout shard while incorporating the Kiro organization account identity fix from lidge-jun#6981. Co-authored-by: JUN <jun@lidgeai.com>
Preserve the desktop compatibility changes, locales and client layout shard while incorporating the Kiro organization account identity fix from lidge-jun#6981. Co-authored-by: JUN <jun@lidgeai.com>
Summary
Closes #6641.
Importing two different users of the same Kiro organization (IAM Identity Center) profile through the dashboard's Kiro CLI login kept only one account: the second user's login overwrote the first user's slot. The CLI import stored the resolved profile ARN as
accountId, and the account store matched slots byaccountId ?? email. An organization profile ARN is shared by every user of that profile, so it is not a user identity.Kiro account identity is now the profile ARN plus the email that same-session
kiro-cli whoami --format jsonreports (newsrc/oauth/kiro-account-identity.ts).accountIdstill holds the ARN, so request routing and persisted evidence keep reading it as the profile.OAuthReauthIdentityMismatchErrorAlready stored accounts. No row is rewritten on load, and every row keeps matching the shape it was saved with. ARN + email rows match their user's next import. ARN-only rows match ARN-only imports as before. Add account first records the current CLI user on an ARN-only row whose refresh token equals the live CLI session, through a serialized email-only bind that leaves tokens, plan, pause and health untouched. Another organization user is appended next to an ARN-only row and never overwrites it. While other rows share the profile, an unmatched Kiro login claims an identity-less active slot only as the same CLI session.
Evidence limits. No live Kiro login or
kiro-cliexecution was performed; behavior is pinned with fixtures and a fake CLI runner. OCX reads onlyemailand the profile ARN fields from whoami. TheaccountType/region/startUrlfields and theemail: nullshape for Builder ID in the fixtures come from web summaries of the Kiro CLI command reference and its Amazon Q CLI predecessor, not from captured CLI output. Whether Kiro CLI 2.27.1 fillsemailfor IAM Identity Center logins is not verified. If it does not, two users of the same org stay indistinguishable and the profile identity applies as before; the refusal only engages once one user of the profile is identified.Verification
bun run typecheck— pass (on the rebased head).bun run structure:check,bun run privacy:scan— pass.bun test tests/providers/kiro/ tests/oauth/ tests/ci-workflows/file-size-ratchet.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts— 1533 pass / 0 fail (85 files).tests/providers/kiro/kiro-org-user-identity.test.ts(18 tests): same-org two users, same-user reimport, personal / Builder ID, no-user legacy identity, refusal with CLI rollback, same-session no-user refresh, legacy ARN-only / ARN+email migration, Add-account pre-bind, reauth mismatch, rotated-recovery guards, cancellation. Against unmodifieddevsources, 8 of the original 14 cases fail; the 6 that pass are invariants that must not change.bun run test(pre-rebase head, concurrent worktree load, 702s): everything passed except 3 unrelated files (codex-inject-retained-table,client-link-relay,cli-access-audio-live), which pass alone (61/61).bun run test:changed(rebased head, while another worktree held CPU): 36475 pass / 36 fail across 1667 files; every failing file is outside this change (lab, service, native Codex/Grok toggles, live audio), and all 10 of them pass when run alone (419/419).Checklist
docs-site/.../cli/providers-accounts.md,structure/providers-and-adapters.md).Summary by CodeRabbit