Skip to content

[bug] KAS secret store rejects the engine's "kiro-path-client" key kind, so every remote MCP OAuth sign-in fails ("key is outside the MCP sign-in namespace") #39486

Closed as duplicate

Description

@Igor-Ivaniuk

Existing issues

  • I searched open issues and this is not already reported.

KiroCrew version

0.13.0

Release channel

Stable

How is it installed?

Desktop app

Platform

Not platform-specific

What happened

Title: KAS secret store rejects the engine's "kiro-path-client" key kind, so every remote MCP OAuth sign-in fails ("key is outside the MCP sign-in namespace")

Environment

  • Kiro Crew 0.13.0 (desktop app, darwin-arm64, macOS 26.7.3)
  • Harness: Kiro Agent (KAS) via kiro-cli relay, agent.acp_backend = kas, agent.kas_bundle = false
  • kiro-cli 3.5.0, KAS engine 0.66.119 (kas.server.starting in kiro-chat.log)
  • agent.kas_persist_mcp_sign_in = true (default)
  • Custom agent in ~/.kiro/agents with a remote MCP server:
    "awsevents": { "type": "http", "url": "https://api.awsevents.com/mcp",
    "oauth": { "clientId": "...", "redirectUri": "http://127.0.0.1:8976",
    "oauthScopes": ["openid", "email", "events/access"] } }

Steps to reproduce

  1. Start a chat on the custom agent. The MCP report shows awsevents as "waiting for sign-in"
    and the notice "awsevents (an MCP server you added) needs you to sign in ... Send a message
    that names awsevents" appears.
  2. Send the message "Sign in to awsevents" (as its own turn, agent idle).

Expected

  • Crew sends _kiro/mcp/resetServer with startOAuth, the lock banner with the Authorize link
    appears, tokens land in <data_home>/kas/mcp-grants/.vault/.

Actual

  • No banner. The server flips to: awsevents: failed: key is outside the MCP sign-in namespace
  • The grant vault only ever holds the ".client" entry for the server's connection hash,
    never ".tokens".

Root cause (from reading both sides)

  • kiro_crew/acp/kas_secret_storage.py line 89:
    _KEY_RE = r"\Akiro.mcp.[0-9a-f]{64}.(client|tokens|verifier|discovery)\Z"
    Any other key is refused at line 227 with SecretStorageRefused("key is outside the MCP
    sign-in namespace"). The failure is not logged with the key, so it is invisible in
    gateway.log.
  • KAS 0.66.119 (@kiro/agent dist/server/acp-server.js, class CredentialStorageManager) uses
    five kinds: ["client", "kiro-path-client", "tokens", "verifier", "discovery"].
    clientKind = "kiro-path-client" when the oauth config has no redirectUri, no clientId and
    no clientMetadataUrl; otherwise "client".
  • On startOAuth the engine calls oauthProvider.invalidateCredentials("all"), which runs
    clearCredentials("all") = Promise.all(delete over all five kinds). The delete of
    kiro.mcp..kiro-path-client is refused by Crew, the Promise.all rejects, and the
    sign-in fails with Crew's refusal text as the server error.
  • For a remote OAuth server WITHOUT a pre-registered client the primary kind is
    kiro-path-client, so the very first readStored() is refused and the server fails before
    any sign-in.
  • The engine also keys enterprise IdP sessions as kiro.mcp.idp..session (IdpSessionStore
    storageKey()), which the regex rejects as well.
  • mcp_grant_kas.py notes the key scheme was checked against KAS 2.36.0 and 2.37.1; the
    0.66.x engine added the new kind.

Suggested fix

  • Accept the new kind in _KEY_RE (and in mcp_grant_kas's presence check):
    (client|kiro-path-client|tokens|verifier|discovery)
    and decide how kiro.mcp.idp..session should be handled (persist like client/tokens,
    or memory like verifier/discovery).
  • Log the refused key's kind (never the value) so a namespace mismatch is diagnosable.
  • Optionally: when a delete is refused, the engine's clear-all should not abort the whole
    sign-in; that part is on the KAS side.

Workaround confirmed in code (not yet applied here)

  • agent.kas_persist_mcp_sign_in = false: Crew stops declaring the secret store, the engine keeps
    grants in memory and the sign-in flow works, at the cost of re-signing in per session.

Related log lines

  • Every KAS process start logs:
    [WARN] [mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage
    or provider not round-tripping the value).
  • gateway.log: "kas backend: installed kiro-cli 3.5.0 is newer than the releases the KAS
    tool-name tables were verified on (2.24.0, 2.24.1, 2.27.1)"

Steps to reproduce

kirocrew-diagnostics-20261119-141432-e30e0e26.zip

Relevant log output

Anything else

Diagnostics bundle: kirocrew-diagnostics-20261119-141432-e30e0e26.zip

0 secret(s) auto-redacted and 137 path(s) collapsed to ~ or host name(s) replaced before packaging.

kiro-cli: kiro-cli 3.5.0
Host: macOS-26.7.3-arm64-arm-64bit

Activity

  1. bolichen97 commented on Nov 19, 2026

    @bolichen97
    Contributor

    [operator: bolichen97] #39425 reports the same refusal of the kiro.mcp.<hash>.kiro-path-client key with kiro-cli 3.5.0, also names the kiro.mcp.idp.<hash>.session key and the missing log detail, and its comments cover the delete refused during a sign-in reset; the open fix there checks get, store and delete the same way. Your engine-side analysis and the agent.kas_persist_mcp_sign_in = false workaround are useful input for that issue. This is the same report as #39425, so we track it there and close this one.

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

    bugSomething is not workingchannel: stableReported from a stable release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions