Repository navigation
Conversation
d00807d to
a3f257d
Compare
A Connections card's Connect runs kiro-cli, so its grant lands in kiro-cli's MCP OAuth cache. A KAS session keeps its grants in Crew's KAS grant vault and cannot use that one. The chat still tagged a KAS session's sign-in request card_owned whenever the server had a card, and the chat hides card-owned banners while connections_ui is on, so a KAS chat (a Bot chat on member_acp_backend, or every chat on a KAS install) got no tools from the server and no visible way to sign in. Add the backend capability ACP_BACKENDS_KIRO_CLI_MCP_GRANTS (kiro-cli only), asked as SessionCapabilities.reads_kiro_cli_mcp_grants, and tag card_owned on the init drain and the mid-turn request only when the requesting session's backend has it. Other sessions skip the ownership read and keep their banner. Closes kirodotdev#29142
a3f257d to
508cba8
Compare
|
Thanks @rinbn. Since this opened, #33737 (merged 2026-11-10, c84e4d7) made a Connections card's Connect sign in on the KAS engine, into the grant vault KAS chats read, whenever ordinary chats run on KAS ( The gap that is still real is narrower: a KAS session (for example a Bot chat on This needs a rework from the author (or a maintainer's call on the shape), so the stale-PR cleanup is leaving it as is. Issue #29142 stays open for it. |
Problem / Motivation
Goal: A chat on KAS that needs to sign in to a remote MCP server shows its own Authorize banner, even when that server has a Connections card.
Example: ordinary chats run on Kiro CLI, Bot chats run on KAS (
agent.member_acp_backend = kas), and the Connections page is on. The user connects a remote MCP server, call it Acme, on its Connections card. Acme registers its own OAuth client. The card shows Connected. The user then types "sign in to Acme" in a Bot's chat. The KAS session starts its own sign-in and sends back a consent link. The chat hides that link's banner because Acme has a card, and the card already says Connected, so it offers no Authorize either. That chat gets no Acme tools and has nowhere to sign in. The only way out was turningconnections_uioff.The same thing happens on an install where every chat runs on KAS. In that case the card even tells the user "Chats sign in separately: type acme in a chat once", and then the chat hides the sign-in that message started.
Why it matters
Everyone who has a Connections card for a remote MCP server and chats on KAS hits this: Bot chats on the default
member_acp_backend, and every chat on a KAS install. Their chats cannot use the server, and nothing on screen says why or how to fix it.Not a goal
connections/status.py_provider_grant_presence,connections/mint.py,connections/warm.py,connections/l1_smoke.py,dashboard/change_cards_readers.py, Disconnect). KAS backend: Connections status, consent watcher, warm scan and Disconnect read only kiro-cli's MCP grant cache #30806 owns them.backendLacksOauth,signInInChat), which still readagent.acp_backendonly and do not considermember_acp_backend.What changed (motivation → approach → change)
Symptom → cause. The chat tags a sign-in request
card_ownedwhen a rendered Connections card owns the server, and whileconnections_uiis on it hides tagged banners, because the card shows the same Authorize action. That reasoning holds only when the card's grant can sign the chat in. A card's Connect runs kiro-cli, so its grant lands in kiro-cli's MCP OAuth cache. A KAS session keeps its grants in Crew's KAS grant vault (<data_home>/kas/mcp-grants/) and never reads that cache. The tag was decided from the server alone, never from the session that asked, so a KAS request was hidden too.Approach. As in #28782, one backend capability rather than a backend-name check.
ACP_BACKENDS_KIRO_CLI_MCP_GRANTScontains kiro-cli only and is exposed asSessionCapabilities.reads_kiro_cli_mcp_grants. The tag is decided from the requesting session's own provider, so it is right for a Bot chat whose backend differs fromagent.acp_backend, and for a fully KAS install.Change.
dashboard/chat_turn/mcp_session.pygains_card_owned_mcp_names(provider). It returns nothing for a session without the capability, and otherwise returns the existing_connections_managed_mcp_names()read off the loop. Both tagging paths call it: the session-init drain and the mid-turn_on_mcp_oauth_request.connections_uiis on (unchanged)The new set is defined in
agent_sdk/backends_mcp.pyand registered the same way asACP_BACKENDS_REMOTE_MCP_OAUTH: re-exported fromagent_sdk/backends.pyandacp_backends.py, listed in the off-card table inagent_sdk/backend_cards.py, and added to the exempt list inscripts/check_harness_parity.pyas an off-the-wire fact. The card-owned paragraph indocs/system-specs/modules/acp-client.mdand thesignInInChatparagraph indocs/system-specs/modules/connections.mddescribe the per-session rule.Backwards compatibility
Compatible: kiro-cli sessions are tagged exactly as before. Only a session that cannot use the card's grant stops being tagged, and the result is that one more banner shows.
The
card_ownedmeta key is no longer set on banners from non-kiro-cli sessions:Reader: website/src/pages/chat/McpOAuthBanner.tsx:renderMcpOAuthMessage -- chat -- hides only rows that carry the key, so a KAS row now renders its Authorize banner, which is the fix; existing McpOAuthBanner tests unchanged
Reader: website/src/pages/connections/connectionsPageCardState.ts:latestOAuthByServer -- crew page -- never reads the key, so the card's approval-URL feed is unchanged
Tests
test/test_mcp_oauth_banner_midturn.py: a KAS session's mid-turn request for a carded provider is emitted untagged with its URL; it stays untagged through a successful or failed sign-in; across every known backend, a carded request is tagged, and the ownership read runs, only when the backend reads kiro-cli's grants; a provider with no capability record is left untagged; kiro-cli is the only backend with the capability. The existing tagging tests now run on a kiro-cli session.test/test_mcp_oauth_banner.py: the init drain leaves a KAS session's carded request untagged; the existing drain tests run on a kiro-cli session.test/test_chat_runner_coverage_output.py: its drain test runs on a kiro-cli session.test/test_agent_sdk_capabilities.py: the new field joinsCAPABILITY_FIELDS, so the consumer and dataclass-drift gates cover it.test/test_chat_runner_composition_contract.py:dashboard/chat_turn/mcp_session.pyjoins the guarded homes ofcapabilities_of(.Proof: PROVEN test/test_agent_sdk_capabilities.py::test_every_capability_field_has_a_consumer, test/test_agent_sdk_capabilities.py::test_the_field_list_matches_the_dataclass, test/test_chat_runner_composition_contract.py::test_a_construct_guards_count_lives_only_in_its_homes[capabilities_of\(-homes19], test/test_mcp_oauth_banner.py::TestEveryPendingRequestIsEmitted::test_kas_session_request_for_a_carded_provider_is_not_annotated, test/test_mcp_oauth_banner_midturn.py::test_kas_chat_keeps_its_banner_for_a_carded_provider (head d00807d)
Local pre-push review at head d00807d: the opus lane (claude-opus-5.5, as pinned) reported no findings. The gpt lane did not run locally: this host's codex endpoint answers 404 for every GPT model, so that lane's verdict comes from CI only.
Manual verification
N/A — unit coverage sufficient: the tests drive the real init drain and mid-turn arm, the real Connections store and registry reads, and the real per-backend capability records. A live check would mean signing in to a real OAuth provider, which this change did not do.
Related Issues
Closes #29142
#30806 owns the card's grant-status readers that read only kiro-cli's cache.
Sibling sweep
Swept: git grep -n "card_owned=|_connections_managed_mcp_names|card_owned" -- src/ website/src
Sibling: src/kiro_crew/dashboard/chat_turn/mcp_session.py -- changed here
Sibling: src/kiro_crew/connections/status.py:167 -- not affected -- chooses card caveat copy and never hides a chat banner; its acp_backend-only read is listed under Not a goal
Pattern harvest
Not generalizable: the general lesson, decide from the requesting session's own backend capability rather than a gateway-wide fact, is already harness-parity H6; this was one tag pair written before KAS sessions sent their own sign-in links.
Checklist