Repository navigation
fix(acp): offer a KAS MCP sign-in only when the user names the server - #24701
kyleseaman wants to merge 1 commit into
Conversation
|
Local pre-push review (not a CI lane disposition):
|
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the sign-in failure state. The red "Couldn't start the sign-in. Try again." line this PR adds appears in no screenshot. Evidence gaps
Notes
[UX-REVIEWED] 48d7403 Description read[DESCRIPTION-READ] 81b589302c7a2fb64339336ddc091d331d18591e0efae8bcd52017a55054b55f 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The fix goes after the cause: sign-in offers used to be driven by status and rotated through every server, and now they start only when the user asks. The menu's Sign in button covers tasks that need a server without naming it. Notes
[DESIGN-REVIEWED] 48d7403 Description read[DESCRIPTION-READ] 6e432c23264e72bca4ead345256fbb8e6394ccfb4b1c1880d2ad2e1960d4bb74 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The message trigger fixes the cause, which was offering on "needed". The menu Sign in path goes beyond the Goal's "only when the user's message names", but the description names the gap it closes. Notes
What this change shipsInventory (10 items) — 7 justifiedIntent: KAS users stop seeing Authorize cards they didn't ask for in every chat; a card appears when they ask for that server. FIX.
[FIRST-PRINCIPLES-REVIEWED] 48d7403 Description read[DESCRIPTION-READ] 25bfbbdf11295804d9746469239816bc3075d058c62402ba00b7e4712270d17f That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/dashboard/handlers/mcp_sign_in.py:66 -- Slot replacement bypasses app ownership
BLOCKING -- src/kiro_crew/acp/session_handle_mcp.py:766 -- Overlapping link collectors discard assistant output
BLOCKING -- website/src/pages/chat/McpToolsPanel.tsx:339 -- Sign-in failures bypass the required error surface {i18nT('pages.chatPage.mcp_session_sign_in_failed')} Trigger: Sign in receives [BLOCK-MERGE] 48d7403 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F3 —
F1 (fenced) —
F2 (fenced) —
False positive or not applicable? A repository writer can comment: |
|
Local pre-push review (not a CI lane disposition):
|
f4ed342 to
256d3e3
Compare
|
Local pre-push review (not a CI lane disposition):
|
|
Local pre-push review (not a CI lane disposition):
|
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: |
|
self-added: yes
|
256d3e3 to
02bca70
Compare
02bca70 to
8388395
Compare
|
|
|
Hold at f41b21c. This changes when the KAS MCP OAuth sign-in starts: now only when the user's own typed message names an unsigned server (chat_runner.py#L899, session_handle_turn.py#L713). That is auth-flow code, which is reserved for a human reviewer. I found no defect. Every earlier GPT and Opus finding has a fixed disposition with a test, and checks are green. To clear, besides the human review:
— crew-pr-reviewer (r129) |
iamwhatever
left a comment
There was a problem hiding this comment.
Request changes at f41b21c2b712: the fix for the unprompted card rotation (#24614) is right, but it leaves one ordinary flow with no way out and no signal.
Regression. On KAS (the default backend, sections_agent.py#L214), a sign-in card is now offered only when the user's typed message names the server (chat_runner.py#L885-L899, session_handle_mcp.py#L663-L690). A user who asks for a task that needs an unsigned server without saying its name ("check my design files", "what's on my agenda", "my Google Docs" for google-drive) now gets:
- no card, no chat message and no error;
- no tool call failure either, because the server's tools are never exposed, so the model just says it cannot do it;
- only a passive "Awaiting authorization" row in the chat header MCP submenu (McpToolsPanel.tsx#L61) with no sign-in action. Settings sign-in mints into kiro-cli's cache and does not reach KAS (#24693).
Before this PR the rotation eventually offered the card, so the user could always sign in. Now nothing tells them that naming the server is the only path. A dismissed card is also never offered again until the server is named (the re-offer test was deleted).
Suggested fix (any one):
- Give the "Awaiting authorization" row in the MCP submenu a Sign in action that calls the same
begin_mcp_sign_inpath, or - When a turn starts with unsigned servers, show one quiet, non-repeating notice per session ("N servers need sign-in: name one to sign in"), or
- If you prefer to ship this as is, open and link an issue for this gap. #24693 covers Settings sign-in on KAS, not telling the user a server needs sign-in.
Minor, non-blocking. Whole-word aliases still fire on everyday words for unsigned servers with dictionary names ("draw a linear regression" -> Linear, "I have a notion" -> Notion, "fetch", "box", "docs", "remote server" -> remote-mcp, "gh-pages" -> gh). It is one card per message, far less noise than the rotation, so this does not block.
Evidence: 688 tests pass on this head (test_kas_mcp_sign_in.py, test_chat_runner_mcp_sign_in_ask.py, test_kas_mcp_reattempt.py, test_session_handle_bindings.py, test_acp_bindings.py), plus a probe of text_names_mcp_server over 35 server names and 30 sentences.
— crew-pr-reviewer (r133)
f41b21c to
2d06df5
Compare
|
@iamwhatever thanks for r133. Fixed with your suggestion #1. New head: Regression: an unsigned server the user never names. The chat header's MCP submenu now gives every "Awaiting authorization" row a Sign in button. It posts
Re-offer after dismiss. A click is a fresh ask. It clears the server's banner dedupe, so a dismissed server gets a new card. The deleted test's coverage is back as Tests:
New strings are in en and all 11 locales, with en-XA regenerated. The per-locale style tests pass (fr/ru/bn/hi informal). Light and dark screenshots are in the PR body. Minor (aliases): left as is, as you allowed. The PR body lists it under Not a goal. Not done: a live KAS with real OAuth servers. The flow ran against the KAS-shaped stub process and a built SPA with stubbed APIs. |
Every KAS chat offered a sign-in for every remote MCP server that was not signed in, at each turn start and status snapshot, rotating per timeout, so an Authorize card appeared unprompted in every chat. A status that reports a server unauthorized now only records it. An unsigned KAS server's tools are invisible to the model, so the trigger is the user's own message: the dashboard runner hands the message as typed to AcpSessionProvider.note_user_message, and a tracked server it names by name or obvious alias (case-insensitive, whole word) is offered at the next turn start. One ask starts one sign-in; naming a server whose card is live starts no second one; a lapsed or dismissed card returns only when a later message names the server again. kiro-cli is unchanged. The spec records that Settings > MCP sign-in does not reach KAS yet (#24693). Closes #24614
2d06df5 to
48d7403
Compare
|
[operator: bolichen97] Taking this over in #26481 (you are co-author on the commit) so the unprompted Authorize cards stop on main. It keeps the message trigger and drops the MCP-menu Sign in route, which is where all three open GPT blocks sit; that can come back as its own PR. One more fix on top: a multi-word name's last word alone no longer names a server ( |
On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
…#26481) On KAS every chat offered a sign-in to every unsigned remote MCP server at turn start and on every status snapshot, rotating to the next server after each timeout. An Authorize card for a server the chat never used showed up after any message, even "test". Being unsigned no longer starts a sign-in. The dashboard runner hands the person's own typed message to the provider; a server is offered only when that message names it, once per ask. Automated, slash and expanded turns hand nothing over. Takes over #24701 without its MCP-menu Sign in route, whose open review findings belong to that second trigger. Co-authored-by: w <w@k.local> Co-authored-by: Kyle Seaman <2904635+kyleseaman@users.noreply.github.com>
Pull request was closed
Problem / Motivation
Goal: On the KAS backend, a chat shows an MCP Authorize card only when the user's message names an unsigned server, and never at chat start.
Every new KAS chat starts its own KAS process, and that process offered a sign-in to every remote MCP server that was not signed in (here lennysdata, notion and power-figma-figma), rotating to the next one about once a minute. A " requires authentication / Authorize " card appeared unprompted in chats that never used those servers, in every chat.
Why it matters
Any KAS user who has more than one remote OAuth MCP server and is not signed in to them sees a stream of sign-in cards in every chat, including chats that have nothing to do with those servers. The cards push real content off screen, teach people to ignore Authorize cards, and make the chat look broken.
Not a goal
What changed (motivation → approach → change)
Cause: the session offered a sign-in for any server its status reported unauthorized, at every turn start and on every status update. After each timeout it moved on to the next server.
An unsigned KAS server's tools are invisible to the model, so the agent can never call one, and a tool call can't be the trigger. The trigger is the user's own words. Before each user turn, the dashboard runner hands what the person asked to a new
LLMProvider.note_user_messageseam. Nothing the runner prepends goes with it: no cancelled-turn preamble, sub-agent failure text or app context. The seam is a no-op by default.AcpProviderforwards it to the KAS session, which applies it after any pending MCP re-injection. Synthetic, cron, sub-agent and app turns hand nothing. A server that needs a sign-in is offered at that turn's start only when the message names it, by its name or an obvious alias, as a whole word in any case. A status update alone only records the server.One ask starts one sign-in. Naming a server whose card is live starts no second card. After the user dismisses or ignores a card, it comes back only if a later message names the server again, or the user clicks Sign in on its menu row.
A task that needs an unsigned server without naming it ("check my design files") would otherwise get no card at all. So the chat header's MCP submenu now gives each "Awaiting authorization" row a Sign in button. It posts to a new
POST /api/chat/slots/{slot}/mcp/sign-inroute (app-isolation checked), which reaches the KAS session through a declaredLLMProvider.request_mcp_sign_inseam and starts the sign-in on the samebegin_mcp_sign_inpath the message trigger uses. The result is the same Authorize card in this chat, one live card per server: a click while a card is live starts nothing new, and a click after a dismissal re-offers it. Mid-turn, the dispatch loop yields the link as usual. Between turns, the session reads its queue for at most 8 seconds for that link and the route emits it as the card; a turn that starts meanwhile stops that read first, and its pre-turn drain keeps a late link. Frontend:McpToolsPanel.tsxdraws the button,ChatHeaderMenu.tsxwires it tochatSlotMcpSignIninchatSlotSettings.ts, and the four new strings are inen.manual.jsonand every locale (en-XA.jsonregenerated).Settings > MCP sign-in does not reach KAS processes today. It mints into kiro-cli's own OAuth cache, which a KAS engine never reads. So on KAS the in-chat card is the only sign-in path until #24693 lands. The spec says so.
acp-client.md§ KAS MCP OAuth sign-in describes the trigger.Overlap: #22907 also edits
session_handle_mcp.py,session_provider.py,chat_runner.py,providers/acp.py,providers/base.pyand the same spec section. The edits here are small and leave its card-removal logic alone.Backwards compatibility
Compatible: no request, field, config key or event changes shape. KAS starts fewer sign-ins, and kiro-cli starts none from this code either way.
Removes nothing: a KAS chat still gets an Authorize card for an unsigned server, now when the user names it. Settings > MCP and the kiro-cli engine's own sign-in requests are unchanged.
Tests
test/test_kas_mcp_sign_in.py:test_a_message_naming_the_server_starts_one_sign_in_at_turn_start,test_a_message_naming_the_server_starts_its_sign_in_and_clears_the_old_link).test_a_message_that_names_no_unsigned_server_starts_nothing,test_a_chat_that_never_names_the_server_is_never_offered_it).test_a_dismissed_server_is_offered_again_only_when_named_again, plus the turn-level test above).test_naming_a_server_whose_card_is_live_starts_no_second_one).test_several_named_servers_take_the_slot_one_at_a_time,test_named_servers_take_the_slot_one_at_a_time_and_lapse_once).ghormcpcan still be named, andghdoes not match inside "github". Also the bound and its log line.@prompttemplate that names a server is not handed over; only what the user typed is (test_an_expanded_prompt_server_name_is_not_handed_over).AcpProviderto the session. It reaches the handle a re-injection swapped in, never raises into the turn, and does nothing on kiro-cli (test_the_dashboards_provider_forwards_the_users_message_to_the_session,test_the_provider_hands_the_users_message_to_the_handle).test/test_chat_runner_mcp_sign_in_ask.pydrives the real runner. A user turn hands over exactly the typed message, and a prepended sub-agent failure that names a server is left out. That test fails if the runner hands over the prompt with its prepends. Sub-agent and cron turns hand over nothing.resetServerwithstartOAuthand yields exactly one live consent link (test_the_menu_sign_in_reaches_kas_and_yields_one_live_card).test_the_menu_sign_in_re_offers_a_dismissed_server).test_the_menu_sign_in_starts_nothing_when_it_cannot).startedand answers 409 with no live session (test_the_route_starts_a_menu_sign_in_and_emits_its_card).website/src/test/McpToolsPanel.test.tsx: the awaiting row's Sign in button calls the action once, shows "Starting sign-in…", reports a failure and allows a retry; no other row and no caller without the action shows it.There is no Settings-sign-in-on-KAS test: that path does not reach KAS yet (#24693).
kiro-cli:
test_a_host_without_the_capability_starts_nothingand the kiro-cli OAuth suites pass unchanged.Proof: PROVEN test/test_kas_mcp_sign_in.py::test_an_unauthorized_server_gets_the_live_consent_url, test/test_kas_mcp_sign_in.py::test_the_capture_is_whole_however_long_the_stub_takes_to_write_it, test/test_session_handle_bindings.py::test_the_member_set_is_the_frozen_inventory (head 93074017b07b)
Determinism:
test_kas_mcp_sign_in.py(52 ids, without the two subprocess-stub tests) passed 20/20 at-n0.test_chat_runner*set passed at-n 4 --dist loadgroup: 1674 passed.test_process_tree_refresh.pywasPermissionError: 'ps'from the local sandbox and is unrelated.Round 2 (Sign in action), run on the rebased head: the sign-in, re-attempt, bindings,
test_chat_runner_mcp_sign_in_ask.pyand both composition-contract suites passed (1051) at-n 2;McpToolsPanel.test.tsx(14) and the i18n suites including every per-locale style test (306) passed;tsc, eslint,i18n:check, isort, flake8, mypy and black are clean. Memory was tight, so no full related-set run.Manual verification
The submenu was rendered from the built SPA with stubbed APIs (
website/scripts/capture-mcp-awaiting-sign-in.mjs), clicking Sign in and checking exactly one sign-in request went out. Not tried against a live KAS with real OAuth servers.Screenshots / video
The awaiting row with its Sign in action, light and dark:
After the click: starting state
Related Issues
Closes #24614
Follow-up: #24693 (KAS-hosted Settings sign-in into the per-user grant vault from #24677, which it depends on).
Sibling sweep
Swept: git grep -n "begin_mcp_sign_in" -- src/
Sibling: src/kiro_crew/acp/session_handle_mcp.py -- changed here
Sibling: src/kiro_crew/acp/runtime_host_requests.py -- not affected -- it runs the start it is asked for and decides nothing about when
Pattern harvest
Not generalizable: the one offer helper picked its own candidates from status, and that helper is the only place KAS starts a sign-in.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)