Repository navigation
fix(kas): keep a remote mcp sign-in open long enough to consent - #35649
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The longer default can be reverted and is recorded in a decision entry, and the watcher's new end condition is bounded by the existing 10-minute limit. Notes
[DESIGN-REVIEWED] 32b9b1a Description read[DESCRIPTION-READ] a3f161c320f9fbc885a6be8918f66d0befb7f8c5d9d19464bd94c1692870629f 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. This is a fix for a linked defect (#26525), aimed at the mechanism that causes it: a per-server Not checked: the engine answers Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: let a KAS user finish OAuth consent for a remote MCP server before the callback listener closes. FIX.
[FIRST-PRINCIPLES-REVIEWED] 32b9b1a Description read[DESCRIPTION-READ] 50a910ef26d4b4510b7788355ea7f2605ec0578cc2090962e90238976915f6a0 That sha256 names the PR description this verdict read. 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: |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own. Raises the KAS default An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
buluoray
left a comment
There was a problem hiding this comment.
Approve on a6e18c8. On KAS, a remote MCP server with no timeout of its own now gets 300 seconds, the engine's own sign-in wait, so the sign-in callback stays open long enough for the user to consent. A server Crew reaches through a local launcher keeps the 120 second default, and an explicit timeout still wins. The Settings and Connections sign-in now ends only when the server reports a failed attempt or the engine dies, not at the engine's early answer, so a consent after 60 seconds is still saved. The owner recorded this trade-off in a decision file: a remote server that hangs takes up to 300 seconds to report failed. Each fix has a test that fails when the fix is reverted. No consent or auth step is skipped, and no credential is logged. One known limit stays, and the spec records it as a shortcut. The engine answers the sign-in reset within about 60 seconds, but the sign-in itself can stay open for up to 300 seconds. If the user mentions the same server in chat during that time, a second reset can start. The user then sees that the server's saved sign-in is gone and has to sign in again. Signing in again restores it, so this does not block the PR. Please open a tracking issue for it. A test idea: a second reset that arrives while a sign-in is still open must not clear the stored credentials. Lead note: this is an approval with that finding named. The backend test shards have since run on this head; the only failing tests are the two that are already red on main. Decisive lines: src/kiro_crew/acp/kas_settings_mcp.py:156-157, src/kiro_crew/connections/mint_kas.py:442-448, test/test_kas_settings_mcp.py:271-284, test/test_connections_mint_kas.py:321-343
KAS closes an MCP sign-in's callback listener when the server's timeout runs out (60 s by default, 120 s from Crew), and the listener starts when the sign-in is offered, so a consent that took longer, or a callback pasted back from another machine, found nothing listening. A remote block server with no timeout of its own is now sent 300 s, the engine's own sign-in wait. The Settings and Connections sign-in on KAS no longer reads the engine's reset answer, which comes at most 60 s in, as the end of the attempt: it waits for the server to report failed, the process to exit, or its TTL. Closes #26525
a6e18c8 to
32b9b1a
Compare
|
Rebased: main moved in docs/decisions/README.md and docs/system-specs/modules/acp-client.md since this head's CI ran (f0642e3 -> 2f7e9f2); CI re-running. The two red Backend Tests on the old head ( [operator: bolichen97] |
Problem / Motivation
Goal: A remote MCP sign-in on KAS, from the chat card or from Settings and Connections, stays open long enough for the user to finish consenting.
On KAS, Atlassian, Figma, Slack and Stripe sign-ins fail the same way: the user approves in the browser, the browser is sent back to
http://localhost:<port>/oauth/callback, and nothing is listening there any more (ERR_CONNECTION_REFUSED, or "the approval this return address belongs to is no longer live" for a pasted address). The server never gets its tools, and on 0.12.x there is no harness to switch to.Why it matters
Remote OAuth MCP servers are a daily tool for many people on KAS, the default harness, and the sign-in is the only way to use them. Every reporter on the issue lost the server outright, and a remote gateway, where the callback has to be pasted back from another machine, almost never makes it in time.
Not a goal
oauth.redirectUri,clientIdor scopes to KAS (Connections: configure OAuth (pre-registered clientId, redirectUri, sign-in host allow) for user-added MCP servers from the dashboard #26763).mcp.jsonfor an agent that opts into it; they keep their owntimeout.What changed (motivation → approach → change)
Symptom → cause. KAS closes a sign-in's callback listener when the server's
timeoutruns out: 60 s by default, 120 s on main. The listener opens when Crew offers the sign-in, not when the user clicks Authorize, so slow consent, single sign-on with a second factor, or a callback pasted back from another machine missed it. The Settings and Connections sign-in on KAS also stopped its engine when the engine first answered the sign-in request. That answer comes at most 60 s in, even while the attempt is still listening.timeoutis sent 300 s (kas_settings_mcp), the engine's own sign-in wait. A longermcp.initTimeoutstill wins. An entry's owntimeoutis kept. Local servers keep 120 s.failed, the engine exits, or its 10-minute limit passes (mint_kas). The consent link itself holds the server inawaiting_auth, so that state does not end the wait.The longer
timeoutwas already the documented workaround. The cost: a remote server whose connect hangs takes five minutes, not two, to reportfailed. A server markedwaitForReadyholds that session's prompts for as long. Starting the sign-in at the Authorize click, or sending the chat card to Settings, was not chosen, because the same per-server timer bounds both of those paths. Adocs/decisions/entry records this choice, citing the maintainer's ruling on the issue. Theacp-clientandconnectionsspecs and the comments that said the engine answers only when the attempt ends are updated.Backwards compatibility
Compatible: only the default for a remote entry with no
timeoutgrows; every entry that sets one, every local server, and every other harness is unchanged.Removes nothing: no field, path, key or capability goes away; one default gets longer and one wait ends later.
Tests
test_kas_settings_mcp.py: a remote entry with notimeoutgets 300 000 ms where it got 120 000. A remote entry Crew relays through a local launcher keeps 120 000. A longermcp.initTimeoutstill raises the remote floor.test_connections_mint_kas.py:test_a_reset_answered_before_consent_keeps_the_sign_in_openanswers the sign-in request while the server is stillawaiting_auth. The row stayswaitingwith the engine alive over five watcher polls, and a later consent landsgranted. The fake'sgive_up()reportsfailed, as the engine does for a timed-out connect, so the expiry test still covers the real end.Proof: PROVEN test/test_connections_mint_kas.py::test_a_reset_answered_before_consent_keeps_the_sign_in_open, test/test_kas_settings_mcp.py::TestTimeout::test_unset_timeout_gets_kiro_cli_default (head 32b9b1a)
Determinism: the four new or changed tests ran 20 times at
-n0and 10 times at-n 4 --dist loadgroup --max-worker-restart=2besidetest_connections_mint.pyandtest_kas_agents.py, all green; both touched files in a shuffled order (seed 17870, 98 tests) passed. The new mint test waits on the watcher's own poll counter, not a sleep.Manual verification
N/A — unit coverage sufficient: the engine behaviour these changes depend on (the per-server
timeoutthat bounds the sign-in listener, and the request answered at most 60 s in) was read from the KAS engine bundle that kiro-cli 3.2.0 installs, and a live consent needs a third-party OAuth account.Related Issues
Closes #26525
Sibling sweep
Swept: git grep -nE "sign_in_in_flight|mcp_sign_in_holds|_MCP_SIGN_IN_TIMEOUT|KIRO_CLI_MCP_TIMEOUT_MS|_with_timeout" -- src/
Sibling: src/kiro_crew/connections/mint_kas.py -- changed here
Sibling: src/kiro_crew/acp/kas_settings_mcp.py -- changed here
Sibling: src/kiro_crew/acp/runtime_host_requests.py -- changed here
Sibling: src/kiro_crew/acp/session_handle_mcp.py -- not affected -- the chat card reads the slot only to avoid a second offer, and the engine's 60 s answer is stated as a residual
Pattern harvest
Not generalizable: the defect is one engine's fixed 60 s answer read as the end of a longer attempt, which only the KAS sign-in paths do.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.