Skip to content

[Bug]: Kiro CLI import reports duplicate account for two different users in the same organization #6641

Closed

Description

@ethorxmomo777

Client or integration

OpenCodex dashboard

Area

Authentication and account pool

Summary

I am trying to keep two Kiro accounts belonging to two different users in the same organization in the OpenCodex account pool.

I used the dashboard's Kiro CLI import/login option and completed the second user's login using a different Chrome profile. OpenCodex reported a duplicate account during the import, and I could not retain the second user as a separate account. The duplicate message came from OCX's import flow, not the organization's login page.

I expected two distinct organization users to remain independently selectable in the Kiro account pool.

Reproduction

Steps from the observed attempt; a controlled second reproduction with before/after identity comparison has not yet been captured:

  1. Have one organization-backed Kiro account imported into OCX.
  2. Attempt to add the second user from the same organization through the dashboard's Kiro CLI option.
  3. Complete authentication using the second user's Chrome profile.
  4. Observe OCX report a duplicate during import rather than retain two distinct accounts.

The dashboard offers Kiro CLI, Builder ID, Google, and GitHub. The Builder ID path did not offer the organization login option I need, which is why I used Kiro CLI.

Version

OpenCodex 2.77.0
Kiro CLI 2.27.1

Operating system

macOS 27.0.1, arm64

Provider and model

Kiro — organization login / multi-account import. No inference model is involved in the failing step.

Logs or error output

The error was described as an account-duplicate message. I do not have its exact wording captured, so this report does not quote an invented error string.

Subsequent local inspection found one stored Kiro account. Its non-secret metadata shows:

  • credential source: local-cli
  • no stored email
  • an account ID and a Kiro profile ARN are present
  • the stored account ID equals the stored profile ARN

Code inspection / hypothesis, not a confirmed root cause

In the installed 2.77.0 source:

  • src/oauth/kiro.ts, oauthCredentialFromImported(), assigns the resolved profile ARN to credential.accountId.
  • src/oauth/store.ts, saveCredentialWithReceipt(), matches identities using accountId ?? email. A matching identity updates the existing slot rather than appending another account.

Could two different organization users share a profile ARN, or could CLI import resolve both logins to the same ARN? If so, this identity rule could conflate the users. I have not compared both users' imported ARNs, so neither shared ARN nor stale-session reuse is confirmed. Please also check whether this dashboard path imports an existing CLI session instead of obtaining the intended second user's identity.

Related: #4435 was fixed via #4482 for a leftover CLI profile ARN collapsing a second account. This report concerns the organization-user case on 2.77.0; I am not claiming it has the same root cause or is a confirmed regression.

Requested investigation

Please verify distinct-user handling in the organization/SSO Kiro CLI import path. If profile ARN is not a unique user identity for this case, account identity should be separated from request-routing profile metadata. Clear diagnostics should distinguish reimporting the same user from an identity collision between different users.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    account-pool
    on Oct 5, 2026
  2. Ingwannu commented on Oct 6, 2026

    @Ingwannu
    Owner

    The current dev import still assigns the resolved Kiro profile ARN to accountId, and the shared store uses accountId before email for its upsert identity. The import also checks that CLI whoami still belongs to the imported SQLite session; this guards one session-switch race but does not prove that an organization profile ARN identifies a distinct user.

    Please capture the exact redacted duplicate message and compare the two imports locally: report only whether the intended user identity, profile ARN and CLI session changed (same/different), not the actual ARN, email, tokens or credential-file contents. Also confirm whether the Kiro CLI itself reports the intended second user immediately before import; changing the browser profile alone does not establish which session is stored by the CLI.

    That will distinguish reimporting one active CLI session from a genuine distinct-user identity collision. Keeping this open without treating #4435/#4482 as proof of the same cause. No live login, credential import, store write or security scan was performed.

  3. lidge-jun commented on Oct 12, 2026

    @lidge-jun
    Owner

    #6981 is now on dev (8d12a3c). Kiro accounts are now identified by the profile ARN plus the email that the same CLI session's kiro-cli whoami --format json reports, so a second user of the same organization profile gets their own slot instead of overwriting the first.\n\nThis only helps if whoami actually reports the user's email for your IAM Identity Center login, and that has not been confirmed against Kiro CLI 2.27.1. Could you run kiro-cli whoami --format json for each of the two users and post only the field names and whether email is present and non-null? Please don't include the email values, tokens, ARNs or start URLs. If email is missing, the two users still look identical to OpenCodex, and we will need a different identity source. The issue stays open until that is confirmed.

  4. lidge-jun commented on Oct 13, 2026

    @lidge-jun
    Owner

    This was fixed on dev by #6981 (8d12a3c, "fix(kiro): keep same-organization users as separate accounts"). Kiro account identity is now the profile ARN plus the email that same-session kiro-cli whoami reports, so a second user of the same IAM Identity Center profile gets its own slot instead of being reported as a duplicate. It ships in the next release after 2.84.0.

    One caveat from that PR: the separation depends on whoami reporting the user's email for Identity Center logins. If your CLI does not report it and the import still collapses the two users, please reopen with the kiro-cli whoami output shape (keys only, values redacted).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolbug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions