Repository navigation
Conversation
kiro-cli 3.5.0 stores the client registration of a server whose oauth config sets no client id, redirect uri or client-metadata url under kiro.mcp.<hash>.kiro-path-client. The vault refused the key, so a remote OAuth server failed with a secret-store read error and never reached the sign-in prompt. The vault now serves the key and persists it with client and tokens. Disconnect and the custody hand-over delete it with the other two.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem / Motivation
Goal: A remote OAuth MCP server on the KAS backend reaches its sign-in prompt again with kiro-cli 3.5.0.
kiro-cli 3.5.0 added a fifth key kind,
kiro.mcp.<hash>.kiro-path-client, for the client registration of a server whose oauth config sets no client id, redirect uri or client-metadata url. The grant vault accepts onlyclient,tokens,verifieranddiscovery, so it refuses the new key. The engine reports the refusal as a failed secret-store read. The server then shows as failed, not as needing sign-in, and no Authorize banner appears. A server declared as a plain{ "url": ... }entry withagent.kas_persist_mcp_sign_inon (the default) hits this.Why it matters
Every remote OAuth server declared as a plain URL fails to sign in on KAS with kiro-cli 3.5.0. Retrying gives the same result. The only workarounds are turning off
agent.kas_persist_mcp_sign_in(sign-ins are then lost on every engine restart) or pinning kiro-cli to 3.4.0.Not a goal
kiro.mcp.idp.<hash>.sessionkey the vault also refuses. It is a different feature and I have not tested it.What changed (motivation → approach → change)
The vault checks every request key against
_KEY_REinacp/kas_secret_storage.py, and anything outside the list raisesSecretStorageRefused. The engine's own kind list in 3.5.0 isclient,kiro-path-client,tokens,verifieranddiscovery. The engine readskiro-path-clientfirst and falls back toclient, so serving the new kind is enough to restore the sign-in prompt.kiro-path-clientis a client registration, so it is stored likeclient: it persists in the grant vault. If it stayed in memory, every engine restart would register a new client and invalidate the saved tokens.mcp_grant_kas.pygetsPERSISTED_KINDS(tokens,client,kiro-path-client) andkas_saved_sign_in_namesreturns one entry name per kind.kas_secret_storage.pybuilds_KEY_REand_PERSISTED_KINDSfrom that tuple plusverifieranddiscovery. The key check is still an anchored allowlist.mint_kas.forget_kas_sign_in) and Crew taking custody of a URL (forget_kas_grant) delete every persisted kind, so a stale client registration is not left behind.acp-clientandconnectionsspecs name the new kind.I read the engine side from the installed kiro-cli 3.5.0 bundle (
acp-server.js): the kind list, the rule that pickskiro-path-client, and the read order. I did not run it against a live OAuth server.Backwards compatibility
Compatible: the vault accepts one more kind and refuses nothing it accepts today. Disconnect and the custody hand-over also delete the new entry, which only exists once the vault has accepted it.
Removes nothing: no accepted key, field or function is removed or narrowed. The change adds one accepted kind and deletes the matching entry along with the two already deleted.
Tests
test_every_engine_key_kind_is_served_and_only_the_grants_persisttries all five engine kinds, asserts none is refused, and asserts that after a restart onlyclient,kiro-path-clientandtokenssurvive.test_a_client_registration_moves_to_the_path_client_keyfollows the engine's migration: readclient, storekiro-path-client, deleteclient, withtokensuntouched.test_forget_kas_grant_deletes_only_that_urls_entriesandtest_forgetting_a_sign_in_removes_the_path_client_registration_tooplant the literalkiro-path-clientname and assert Disconnect and custody remove it and leave another URL's entries alone.Proof: PROVEN test/test_connections_mint_kas.py::test_forgetting_a_sign_in_removes_the_path_client_registration_too, test/test_crew_oauth_dcr.py::test_forget_kas_grant_deletes_only_that_urls_entries, test/test_kas_mcp_secret_storage.py::test_every_engine_key_kind_is_served_and_only_the_grants_persist (head 789b1bd)
Manual verification
Before and after, a probe called
SecretStorageServer.answerwith agetonkiro.mcp.<hash>.clientand onkiro.mcp.<hash>.kiro-path-client. On main the first returned{}and the second raisedSecretStorageRefused: key is outside the MCP sign-in namespace. With the change both return{}.Real-machine verification
Not run. It needs a real OAuth MCP server and kiro-cli 3.5.0 on the KAS backend. Steps for a reviewer with that setup. Before (main): add
{ "mcpServers": { "example": { "url": "https://mcp.example.com/mcp" } } }, start a chat that sayssign in to example, and the server shows failed with "The sign-in could not be read from the secret store". After (this head): the same steps show the Authorize banner.Related Issues
Closes #39425
Sibling sweep
Swept: git grep -nE "kiro.mcp|_CLIENT_KIND|kas_saved_sign_in_names|forget_kas_grant" -- src docs
Sibling: src/kiro_crew/mcp_grant_kas.py:139 -- changed here
Sibling: src/kiro_crew/connections/mint_kas.py:216 -- changed here
Pattern harvest
Not generalizable: the vault's key list is a hand-copied mirror of an engine internal, and it is now built from one tuple that Disconnect also reads.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.