Repository navigation
fix(connections): save a kas mcp sign-in where kas chats read it - #33737
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS No blockers: the blind reader correctly read both new per-row notes and the "Sign in again" action in shot-01. Notes
[UX-REVIEWED] 7d13e5f Description read[DESCRIPTION-READ] 0c695979aafe9f95594a570ce2e21f55deb571cba06d46ae53e59326a492f58c That sha256 names everything this verdict read: the PR description, plus the 7 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item supports the one fix: a dashboard sign-in now goes to the vault KAS chats read. The Test refusal also blocks providers whose kiro-cli grant still works, and it is justified only by symmetry. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: a dashboard MCP/Connections sign-in on KAS works in every KAS chat — FIX.
[FIRST-PRINCIPLES-REVIEWED] 7d13e5f Description read[DESCRIPTION-READ] 3349e7063d98d98eec5656a9109a074a6668367a6fa740de58d31513cd8ba93e That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The sign-in now writes to the vault that KAS chats already read, which fixes the cause rather than the symptom. The one removed helper has no readers left outside the patch. Notes
[DESIGN-REVIEWED] 7d13e5f Description read[DESCRIPTION-READ] dc0c844cfa38f7c7e9a271cfd2187cb918ffc2e90f399a576fd806c3c0542731 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
5bdd127 to
279a226
Compare
buluoray
left a comment
There was a problem hiding this comment.
Approved at 279a226. The earlier blocker is fixed: the 4 pid-reader sites in src/kiro_crew/connections/mint_kas.py now carry the owner marker, test/test_pid_reader_ratchet.py records 13, and Static Ratchet Gate and Fast Gate pass. The GPT finding at src/kiro_crew/connections/status.py:452-462, :510-512 is real but small: a grant stored only in the KAS vault shows Connected on a Kiro CLI card. It leaks nothing and matches the both-stores rule main already uses for server rows. It still needs a fix or an owner override before the GPT gate clears; this approval does not cover it.
279a226 to
128ede8
Compare
|
buluoray
left a comment
There was a problem hiding this comment.
Re-approved at 128ede8. The only change since the approved 279a226 fixes the earlier GPT finding: the card now counts the KAS vault only while chats run on KAS (src/kiro_crew/connections/status.py:520-528, :595-598), so a vault-only grant no longer reads Connected on Kiro CLI chats. test_connections_mint_kas.py::test_on_kiro_cli_chats_a_grant_only_the_kas_vault_holds_is_not_connected pins it and a mutation turns it red. GPT raised two new security-class findings on this head: F2 (the vault is counted for a header-bridged entry) is real but status-only and already present at 279a226; F1 needs a hand-made pair of paths that differ only by case. This approval does not cover them; they need a code fix or your own override before merge. Opus and Security Scope pass.
128ede8 to
418d051
Compare
|
|
buluoray
left a comment
There was a problem hiding this comment.
Approve on 418d051. The only change since our approved head 128ede8 fixes both GPT findings from that head: Disconnect now keeps a saved KAS sign-in that any surviving entry still reads, judged by the vault's own lowercase url identity, and the card no longer counts vault tokens for an entry with headers. 332 tests pass and 3 mutations each turn named tests red. GPT raised 2 new findings on this head. F1 (the sign-in watcher checks the registry url, not the mounted entry's url) is real but narrow. It was already in the code at 128ede8 and 279a226, which we approved: it needs a hand-made entry under a registry slug whose url differs only by a trailing slash, and its only effect is a false "timed out" label on a sign-in that did save. F2 (a two-tab race after the lock is released) is flagged by GPT's own adjudicator as an edge case. Both are left for Bolin to fix or override. Decisive lines: src/kiro_crew/connections/ownership.py _kas_sign_in_split (holders judged by kas_connection_hash), src/kiro_crew/dashboard/handlers/connections.py for grant_url in scope.kas_sign_in_urls:, src/kiro_crew/connections/mint_kas.py kas_chat_sign_in_urls (str(entry["url"]) if _sent_bare(entry) else None), src/kiro_crew/connections/status.py _grant_presence_maps (vault_url = vault_urls.get(slug))
418d051 to
16af9d3
Compare
buluoray
left a comment
There was a problem hiding this comment.
Approve on 16af9d3. The only change since our approved head 418d051 fixes both GPT findings we had named for Bolin there. F1: the sign-in watcher and tokens_before now read the vault at the mounted entry's url, not the registry url. F2: Disconnect now deletes the KAS sign-in inside the locked census-and-purge transaction, shielded, not after the lock is released. GPT and Opus report no findings on 16af9d3, and no [BLOCK-MERGE] comment exists on the PR. 159 targeted tests pass. 2 mutations each turn a named new test red. The 4 red Linux backend shards fail with the same tests on main's base commit ed80c1d. Decisive lines: src/kiro_crew/connections/mint_kas.py:387 _mounted_url and :488 grant_url = _mounted_url(entry, mcp_url) (used at :503 tokens_before and :547 watcher); src/kiro_crew/connections/ownership.py:806-818 (forget_kas_sign_in via _offload_config_write, inside async with _get_mcp_lock() from :669); src/kiro_crew/dashboard/handlers/connections.py:961-962 (handler only reports scope.kas_sign_ins_removed / kas_sign_ins_unproven)
- On KAS, Settings > MCP > Sign in and a Connections card Connect now run on a KAS engine of their own and save the tokens in the grant vault KAS chats read. They ran a kiro-cli mint whose grant landed in kiro-cli's cache, so a remote OAuth server read Signed in yet stayed signed out, with no tools, in every KAS chat. The new route applies while agent.kas_persist_mcp_sign_in is on and the engine is sent the server as its bare url. Pre-registered providers, entries with an oauth block or headers, persistence off and other backends keep the kiro-cli mint. The engine's consent URL passes the same credential gate, and an attempt it ends unconsented reads as a timed-out sign-in. Connect skips kiro-cli warm adoption for these providers, the card's grant verdict reads the vault too while chats run on KAS, at the url of an entry those chats read it with, and Disconnect removes each saved sign-in no surviving entry reads, judged by the vault's own url identity. Test runs on kiro-cli's grant, which such a Connect does not write, so the card hides it and the endpoint refuses it with 409 kas_sign_in_test_unsupported. The MCP tab's KAS caveat is now per row: "chat" while a row still signs in on kiro-cli, "again" when the grant it holds is kiro-cli's only. Fixes #24693
16af9d3 to
7d13e5f
Compare
Problem / Motivation
Goal: On the KAS chat backend, signing in to a remote OAuth MCP server from Settings > MCP or a Connections card makes that server usable in every KAS chat.
On KAS, the default chat backend, Settings > MCP > Sign in and a Connections card's Connect both finish and the row reads Signed in. Every KAS chat still has the server signed out: the chat's MCP report lists it as
failedAuthorization, with no tools. The user is told the server is ready, and it is not.Why it matters
Anyone on the default backend who signs in to a remote OAuth MCP server from the dashboard hits this. The dashboard says Signed in while every chat says signed out, so the sign-in the dashboard offers does nothing for the chats people actually use. The only path that works is naming the server in each chat and approving its Authorize card.
Not a goal
kas/mcp-grantsvault, the one KAS chats read on main. Keeping it per authenticated user is Persisted KAS MCP grants must be isolated per authenticated user #24643.oauthblock (KAS backend drops a remote MCP server's oauth block, so a pre-registered OAuth client can never sign in #27711), so their Connect keeps the kiro-cli sign-in.oauthblock, or withagent.kas_persist_mcp_sign_inoff. All keep the kiro-cli sign-in.What changed (motivation → approach → change)
A sign-in made on KAS from Settings or a Connections card is saved where KAS chats look for it. Both buttons ran a kiro-cli process, so the grant went to kiro-cli's own cache. A KAS chat never reads that cache: it reads Kiro Crew's grant vault (
<data_home>/kas/mcp-grants) over_kiro/secret/*, and nothing copied one into the other.While chats run on KAS and
agent.kas_persist_mcp_sign_inis on (the default), the sign-in runs on a KAS engine process of its own (connections/mint_kas.py), started on the same one-server mint spec. What the engine stores lands in the vault every KAS chat reads. Its consent URL passes the same credential check a kiro-cli URL passes. The row turns granted only once the vault holds the server's tokens, and an attempt the engine ends before consent reads as a timed-out sign-in. Everything outside that rule keeps the kiro-cli sign-in (see Not a goal).dashboard/handlers/connections.py)connections/status.py)mint_kas.kas_chat_sign_in_urls), so either holding the grant is Signed in; an entry with headers, and any other backend, get kiro-cli's cache alone, because those chats never read the vaultconnections/ownership.py)tokensandclientvault entries (mcp_grant_kas.py) for each owned url no surviving entry reads, judged in the same locked census by the vault's own url identity, not kiro-cli's; a sign-in kept for another entry names it ingrantSharedWithcrewHeld); the endpoint answers 409kas_sign_in_test_unsupportedmcp_probe.py,McpTab.tsx,McpRowSignIn.tsx)kasChatSignInfield (types/index.capabilities.ts):chatwhile the row still signs in on kiro-cli,againwhen only kiro-cli's cache holds its grant; one new string,sign_in_kas_chat_again_note, ini18n/locales/en.manual.jsonand each translationThe MCP tab's old page-wide check,
kasChatOwnsMcpSignIninapi/acpBackend.ts, is removed. The owning specs,connections.md,acp-client.mdandarchitecture/mcp.md, describe the KAS route.Backwards compatibility
Breaking:
POST /api/connections/testanswers 409kas_sign_in_test_unsupportedfor a provider whose Connect signs in on the KAS engine, where main ran Test on kiro-cli's grant. That includes a provider connected through kiro-cli before this change. Writer sweep on origin/main @ b341cc6 (git grep -nE "connections/test|connectionsTest"oversrc,website/src,apps,scripts): the only caller is the Connections card, which offers no Test on acrewHeldrow, and the status feed setscrewHeldfor every such provider. No CLI command, MCP tool or app calls the endpoint.Reader: website/src/pages/connections/ConnectionsPage.tsx:testConnection -- crew page -- the card hides Test on a crewHeld row (test_a_provider_that_signs_in_on_kas_is_offered_no_test, test_test_is_refused_for_a_provider_that_signs_in_on_kas)
Reader: website/src/pages/connections/ConnectionsPageCard.tsx:ConnectionCard -- crew page -- signInInChat is left off only when the KAS vault holds the grant, the one case a KAS chat reads it (test_the_card_reads_a_vault_sign_in_as_connected_with_no_kas_caveat)
Reader: website/src/pages/overview/McpTab.tsx:McpTab -- crew page -- the only caller of the removed kasChatOwnsMcpSignIn; it reads each row's kasChatSignIn instead (website/src/test/McpTab.kasChatNote.test.tsx)
Tests
New
test/test_connections_mint_kas.pydrivesstart_oauth_mintwith a fake KAS engine that stores through Kiro Crew's real secret store. It locks in::443), keeps every one on a census gap or a refused purge, and names a holder only while the vault may still hold what it keeps;chatoragaincaveat, or none.The suites that drive the kiro-cli sign-in (
test/connections_mint_helpers.py,test/test_connections_handoff.py,test/test_connections_premint.py) pin it off the KAS route by a string-target patch, so the reverted tree fails them at setup rather than aborting collection.test/test_agent_spec_hardened_reads.pyregisters the new spec read.test/test_pid_reader_ratchet.pycounts the new module's four engine liveness reads as owner reads:mint_kas.pystarts and ends that engine itself and no other session uses it, so each read carries# pid-owner-ok,_BASELINE_OWNER_MARKEDis 13 and_BASELINE_SITESstays 143.test/test_connections_backend_oauth.py's config stub carries the persistence key. Frontend:website/src/test/McpRowSignIn.test.tsxandwebsite/src/test/McpTab.kasChatNote.test.tsxpin the per-row note, andwebsite/src/api/acpBackend.test.tsdrops the removed helper's cases.All runs were on a Linux DevSpace with
PYTHONPATH=srcand the repo venv, at 4acfe1af6c58 (base ae57c81) unless a line names another head. This head 418d051 (base 27cb69f) is that commit rebased, patch unchanged (git range-diff=).=): the review fix was made on base b4b8a013fe2c, then carried to ae57c81 and to 27cb69f. Main's commits between change Google connection setup, registry entries,connections.md's Google paragraph, app approvals and chat rows, none of the code these suites cover. On this head 418d051 the two repros below (exit 0), the 33, 368 and 317 passed again, as didscripts/check_black_formatting.py,isort --check-only,flake8,scripts/check_file_line_cap.pyandmypy src/kiro_crew/(exit 0 each), andprove.py --base 27cb69f8f696prints the line below.test/test_connections_mint_kas.py::test_disconnect_keeps_a_kas_sign_in_another_configured_entry_still_holds: exit 1 on 128ede8 rebased (the vault lost notion'stokensandclientwhile notion-team at/MCPstayed configured); exit 0 here; exit 1 again with onlyconnections/ownership.pyanddashboard/handlers/connections.pyreverted. With those two reverted, the query-variant,:443spelling and holder-url tests fail too (4 of the 8 Disconnect and card tests).test/test_connections_mint_kas.py::test_a_vault_sign_in_an_entry_with_headers_cannot_use_does_not_read_connected: exit 1 on 128ede8 rebased (the card readconnected,grantPresent: true); exit 0 here; exit 1 again with onlyconnections/status.pyandconnections/mint_kas.pyreverted.pytest -n0 test/test_connections_mint_kas.py: exit 0, 33 passed.pytest -n 4 --dist loadgroup --max-worker-restart=2over the changed backend test files and the 4 helper suites: exit 0, 368 passed. Over the relatedtest_connections_status*,test_connections_disconnect*,test_mcp_probe_*,test_mcp_grant_kas,test_crew_oauth_dcrandtest_agent_home_isolation_derived_specsfiles: exit 0, 317 passed.pytest -n0 test/test_flake_pattern_ratchet.py: exit 0, 68 passed.scripts/check_black_formatting.py,black --checkon the five changed Python files,scripts/check_subprocess_encoding.py,isort --check-only,flake8,mypy src/kiro_crew/,scripts/check_comment_history.py,scripts/check_brand_name.py,scripts/check_harness_parity.py,scripts/check_sync_io_in_async.py,scripts/check_file_line_cap.py,scripts/check_feature_map.pyandscripts/docs-lint.sh: exit 0 each.semgrep scan --config semgrep/ --baseline-commit ae57c81fa498 --error: exit 0, 0 findings.prove.py --base ae57c81fa498prints the line below.website/src/api/acpBackend.test.ts,website/src/test/McpRowSignIn.test.tsxandwebsite/src/test/McpTab.kasChatNote.test.tsx, 3 files, 49 tests), andtest/test_pid_reader_ratchet.py::test_pid_reader_sites_match_the_recorded_count_exactly, the red in Fast Gate run 42570846459, failed with the four# pid-owner-okmarkers inmint_kas.pyreverted. The frontend is unchanged since. Determinism (testing-conventions D12) on cd6c8cf0707a:test/test_connections_mint_kas.pypassed 20 of 20 runs at-n0; withtest_connections_premint.pyandtest_connections_handoff.py, 10 of 10 runs at-n 4 --dist loadgroup --max-worker-restart=2; one shuffled run, seed 27653, 87 passed.url(a trailing slash is a distinct key), and Disconnect deletes the saved sign-in insideremove_provider_entry's locked transaction, not after the lock is released. Two new tests intest/test_connections_mint_kas.py(test_a_sign_in_saved_under_the_mounted_urls_trailing_slash_reads_granted,test_disconnect_deletes_the_kas_sign_in_before_the_mcp_lock_is_released) failed with the product hunks reverted (stateexpired; sign-in entries still in the vault at lock release) and pass here. On a Linux DevSpace:pytest -n0 test/test_connections_mint_kas.py35 passed; the related connections, mcp_probe, mcp_grant_kas, crew_oauth_dcr, pid_reader_ratchet, agent_spec_hardened_reads and flake_pattern_ratchet files 561 passed (exit 0). The end-to-end repro (md5 c023a930, kiro-cli 2.37.1): base ed80c1d exit 1 (bug present), this head exit 0 (vault holdstokens, KAS chat has the serverready).check_black_formatting.py,black --check,isort --check-only,flake8,mypy --platform linux src/kiro_crew,check_comment_history.py,check_brand_name.py,check_file_line_cap.py,check_harness_parity.py,check_sync_io_in_async.pyanddocs-lint.sh: exit 0 each.Proof: PROVEN test/test_agent_spec_hardened_reads.py::TestCallSiteLabelRatchet::test_every_call_site_carries_the_expected_label[_read_agent_spec], test/test_connections_mint_kas.py::test_a_kas_sign_in_saves_its_tokens_where_a_kas_chat_reads_them, test/test_connections_mint_kas.py::test_a_server_the_vault_already_signs_in_is_granted_with_no_url, test/test_connections_mint_kas.py::test_a_consent_url_carrying_a_credential_is_never_published, test/test_connections_mint_kas.py::test_connect_on_kas_never_adopts_a_kiro_cli_warm_url (head 418d051)
Manual verification
A scripted end-to-end repro on the DevSpace: a real isolated gateway with the real kiro-cli 2.37.1 install (its KAS relay for the chat), a loopback OAuth MCP fixture that logs which token each request carries, driven only through the dashboard API. It adds the server, signs in from Settings > MCP, consents, probes the row, then opens a KAS chat.
tokensandcliententries; the KAS chat's engine logged "saved sign-in found", itsserver/discover,initialize,notifications/initializedandtools/listcalls all carried the issued token, and the chat's MCP report had the serverready.granted) and its grant went to kiro-cli's cache, but the KAS grant vault held notokensentry for the server. The KAS chat's engine was told "no saved sign-in", reached the server once with no token, and the chat's MCP report had itawaiting_auth.tokensandcliententries. The KAS chat's engine logged "saved sign-in found", itsserver/discover,initialize,notifications/initializedandtools/listcalls all carried the issued token, and the chat's MCP report had the serverready.awaiting_auth. Fix: exit 0, bug absent. The vault held the server'stokensandcliententries and kiro-cli's cache held no grant. The KAS chat's engine logged "saved sign-in found", all four of its calls carried the token, and the server wasready.awaiting_auth. Fix: exit 0, bug absent: the vault held the server'stokensandcliententries and kiro-cli's cache held no grant, the KAS chat's engine logged "saved sign-in found", all four of its calls carried the token, and the server wasready.Screenshots / video
Captured from the built SPA with stubbed API answers, on the DevSpace, in dark and light.
MCP Servers while chats run on KAS.
docs-internalsigns in on the KAS engine and shows no line.legacy-oauthkeeps the kiro-cli sign-in, so it says to sign in from the chat.wiki-internalis signed in only in kiro-cli's cache, so it says to sign in again.Connections cards. Linear signed in on the KAS engine: Connected, no Test, no caveat. Notion holds only a kiro-cli grant: no Test, and the card's existing "Chats sign in separately" line.
Light theme
Related Issues
Fixes #24693
Draft #27974 targets the same issue.
Sibling sweep
Swept: git grep -nE "start_oauth_mint(|adopt_shared_mint(|warm_mint_all(|start_mint_row(" -- src
Sibling: src/kiro_crew/dashboard/handlers/connections.py:574 -- changed here
Sibling: src/kiro_crew/connections/warm_runtime/rearms.py:70 -- not affected -- a URL it re-warms for a KAS-route provider is never adopted by Connect, so no sign-in reaches kiro-cli's cache through it
Sibling: src/kiro_crew/connections/crew_oauth.py:854 -- not affected -- a Crew-held sign-in keeps its grant in Kiro Crew's own store, not kiro-cli's cache
Pattern harvest
Rule candidate: review-prompt
Pattern: a credential is written by one harness's process into its own store while chats on another harness read a different store, and no test reads the grant back through the reader
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)