Repository navigation
fix(connections): say a hand-written mcp.json row is the user's to change on Connect - #37864
cruisercohen wants to merge 2 commits into
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item comes from #35817, or is needed so the message's own "remove it, then press Connect" step actually works. What this change shipsInventory (4 items) — 4 justifiedIntent: a user who wrote a provider row by hand in their own
[FIRST-PRINCIPLES-REVIEWED] 23f0c1c Description read[DESCRIPTION-READ] 98d5708e1d5ecbb714a54eeffab7ecbc1e96f8fdc21dba2072b87f364b91f8fb 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: a 404 that was a dead end now either names a fix the user can apply or goes on to add the provider, and nothing is newly written or taken away. Notes
[DESIGN-REVIEWED] 23f0c1c Description read[DESCRIPTION-READ] 650bcba0b05132f06d3438886da949627199256b1079798bba50f7d15792c144 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 |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The PR adds no controls, only two error strings. Both appear in the screenshots, and the blind reader understood what each one asks. Notes
[UX-REVIEWED] 23f0c1c Description read[DESCRIPTION-READ] d0a595e85cd07c83eabe18a45ac90a55ce893bcf39bd296ad50b592d81716198 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 |
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: |
2a5e6ce to
579aa13
Compare
|
Integration (in-process gateway) is red on |
579aa13 to
72cacd7
Compare
72cacd7 to
c911a07
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for this. The 404 message is a clear improvement, and the first test checks the right things: no update, no re-enable and no sign-in start on a row Kiro Crew does not own. One problem in the second commit needs a fix before this can merge.
website/src/pages/connections/ConnectionsPage.tsx:563: the re-read runs too early. It fires when the 404 arrives, while the hand-written row is still in the user's mcp.json, so the refetch caches the same row again. The['mcp-servers']query inheritsstaleTime: Infinityfromwebsite/src/api/queryClient.ts. It polls only while a card is waiting after a mint, and I found no WebSocket target that refreshes it when mcp.json changes. So if the user removes the row as the new message tells them and presses Connect, the card still passes the cached row,mcpCustomGetreturns 404 again, and they see the same message. Only the third press adds the provider. The comment at :561-562 says this case works, but it does not.
Smallest fix: move the fresh read to the point of decision. In the 404 branch (or at the start ofconnectwhenexistingis set),await queryClient.fetchQuery({ queryKey: ['mcp-servers'], queryFn: () => api.mcpServers(), staleTime: 0 }). IfserverForConnection(provider, fresh)no longer finds a row, take themcpCustomAddpath. Otherwise throwconnect_hand_written_row.
Then fix the test atwebsite/src/test/ConnectionsPage.coverage.test.tsx:1758. TodaymcpServers.mockResolvedValueOnce([row])falls back to the[]default on the re-read fired at the 404, so the removal happens before the alert shows. Keep the row in the list through the first alert, return[]only after it, and assert that the next Connect reachesmcpCustomAdd.
Optional:
- The message says every 404 is a row in "your own mcp.json", but the endpoint returns 404 for any row outside Kiro Crew's own scope.
existing.presencecould pick the right file or wording. - Add one test where
mcpCustomGetrejects withnew ApiError(500, 'boom'). It would pin the body's promise that other errors pass through unchanged. - The body's "What changed" and "Tests" sections do not mention the re-read or the second test. A short line in each would help.
9481730 to
f285520
Compare
|
Thanks, you were right: the re-read ran at the 404 while the row was still there, so it re-cached it. Fixed on f285520 (the second commit now carries the fix; the first is unchanged).
Vitest does not run on my host, so CI is the check for these tests. |
f285520 to
314d6b8
Compare
|
Follow-up on 314d6b8 for the GPT 6.1 finding on f285520: when the user removes the global row, the gateway's rendered agent config still lists it until a restart.
So the copy-only case now asks for a restart. Skipping the restart would mean changing the backend collision rule: |
314d6b8 to
3487fb1
Compare
|
Correction to my previous comment (issuecomment-6990145225): a restart does not clear the copy. The gateway's rebuild at boot starts from the existing rendered agent config, so the row survives a restart and Connect would show the same message again. Uninstall in MCP Servers does clear it: its purge strips the rendered copy as well as every scope ( Fixed on 3487fb1:
Letting Connect handle this case without the Uninstall step would still need the backend collision-rule change. I can do that as a separate follow-up. |
3487fb1 to
4e62174
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. This head fixes the issue from my earlier review. One evidence gap still blocks merge.
Earlier review, item by item:
- Re-read at the point of decision: fixed. The fresh
fetchQuerywithstaleTime: 0now runs inside the 404 handler, and a missing row takes themcpCustomAddpath in the same press. - Test shape: fixed. The second test keeps the row in the list through the first alert, then empties it and checks that the next Connect reaches
mcpCustomAdd. - Optional items: the 500 pass-through test was added, and the body now covers the re-read. You explained why you kept the out-of-scope wording.
Blocking:
website/src/pages/connections/ConnectionsPage.tsx:578: no screenshot shows the newconnect_rendered_copy_onlyerror. Trigger: the row's presence flags are false for every scope exceptkirocrew, so Connect throws the "In MCP Servers, press Uninstall on ... and then Apply, then press Connect" message into the card'sErrorNotice. Outcome: this is the longest new user-facing string in the change, and no reviewer has seen it rendered. The two attached images show only the hand-written-row message. The UX lane names this as its evidence gap on this head. Its BLOCK was published as PASS only because the comment had no Trigger and Outcome lines, so the gap is still open. Smallest fix: attach a light and a dark screenshot from this head of the card showing this message, rendered the same way as the existing pair, then re-run the UX lane. No code change is needed.
PR Readiness is also red on Backend Tests (Windows) (8), in test/test_bare_session_handle_guard.py. This PR changes no backend or Python test file, so that red does not come from this diff. A rebase onto current main should clear it.
Optional:
- In each translated catalog,
connect_rendered_copy_onlykeeps the English tab name "MCP Servers". The tab itself is translated there (es "Servidores MCP", de "MCP-Server"). Using each catalog'snav.mcp_serversvalue would match what the user sees. - No test pins the
kind: stored ? 'reconnect' : 'new'change. Pressing Cancel after the same-press add in the second test, and assertingmcpApplywithuninstall: true, would catch a revert.
…4 so Connect adds the provider once the row is removed, or points to Uninstall when only the rendered copy holds it
4e62174 to
23f0c1c
Compare
|
Thanks. Answered on head 23f0c1c (still 2 commits, rebased onto green main 910f01f). Blocking:
Windows backend 8 ( Optional, both done:
|
|
Follow-up: I replaced the two new stills so they carry the card's "Action failed:" wrapping, as the live card and the existing pair do (the UX lane noted the first versions dropped it). Same head 23f0c1c, same render path, message text unchanged. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the follow-up. This head closes everything from my earlier reviews.
Earlier items:
- Fresh read at the point of decision, and a test that keeps the row through the first alert: fixed on the previous head, and still in place here.
- Screenshots of
connect_rendered_copy_only: fixed. The light and dark stills in the body show the card's "Action failed:" wrapping, and the UX lane passed on this head. - Optional items: done. Each catalog now names the tab with its own
nav.mcp_serverslabel, and the second test presses Cancel to pinkind: stored ? 'reconnect' : 'new'.
What I checked on this head: the 404 from GET /api/mcp/custom/{name} only means there is no row Kiro Crew stores itself. A message branch never writes or starts a sign-in. Errors other than a 404 pass through unchanged. The add path still hits the backend's 409 name-collision guard. The copy-only check matches how presence is defined. The four new tests each pin one branch and run deterministically. What I liked most: the decision runs on a fresh read, so a single Connect press does the right thing whether the row is still there, already gone, or left only in the rendered agent config.
Optional:
website/src/test/ConnectionsPage.coverage.test.tsx:1758and:1784use a test client whose defaultstaleTimeis already 0, so they would stay green ifstaleTime: 0were deleted from the freshfetchQuery. The shipped client usesInfinity. Mounting these two tests withqueryDefaults: { staleTime: Infinity }, asConnectionsPage.coverage.connect.test.tsx:407does, would pin that option.- If a user edits the URL of the hand-written row instead of removing it, the fresh read finds no matching row and the add returns a generic "name already in use". Nothing is written. Before returning null, you could check whether
freshstill holds a row namedexisting.nameand showconnect_hand_written_rowin that case.
Problem / Motivation
Goal: When a Connections card's Connect meets a row the user wrote by hand in their own
mcp.json, the card says where that row is and what to change, instead of failing with "server 'notion' not found".A card claims an MCP row named for its slug at the registry URL. For a
needs_authrow, Connect first reads the stored spec withGET /api/mcp/custom/{name}to rewrite its URL. That read finds only rows Kiro Crew stores itself, so for a hand-written globalmcp.jsonrow (for examplenotionathttps://mcp.notion.com/mcp/) it answered 404 and the card showedAction failed: server 'notion' not found(#35817).Why it matters
A user who added a provider by hand and then presses Connect on its card gets an error that reads like a bug and gives no way forward.
Not a goal
mcp.jsonfrom the card (Kiro Crew does not own that file).What changed (motivation → approach → change)
In
ConnectionsPage.tsxconnect(), a 404 from the stored-spec read now becomes a plain error: the provider is set up by hand in the user's ownmcp.jsonunder that name, Kiro Crew does not change that file, and removing that entry lets Connect add the provider here. Nothing is written and no sign-in starts on that path. Any other error from the read is passed on unchanged. At that 404 the card reads the server list fresh (fetchQuerywithstaleTime: 0, since['mcp-servers']never goes stale on its own): if the user has already removed the row, Connect adds the provider in the same press instead of repeating the message. If the fresh row is held by no raw scope (every non-kirocrewpresenceflag false), only the gateway's rendered agent config still lists it (a restart keeps it, since the rebuild starts from that file), and an add would collide with that name, so the card asks the user to press Uninstall on that entry in MCP Servers, then Apply, then Connect. Uninstall's purge also strips the rendered copy (new stringconnect_rendered_copy_only, in every catalog; each translation names the tab by that catalog's ownnav.mcp_serverslabel).The new string
pages.connectionsPage.connect_hand_written_rowis translated in every catalog underwebsite/src/i18n/locales/, uses{{productName}}for the product name, anden-XAis regenerated.Backwards compatibility
Compatible: rows Kiro Crew stores itself still read, rewrite and sign in exactly as before; only the 404 branch changes its message.
Removes nothing: the 404 already ended Connect; it now ends it with a message that names the file.
Tests
website/src/test/ConnectionsPage.coverage.test.tsx›says a hand-written mcp.json row is the user's to change instead of "not found": the stored-spec read rejects with a 404, and the card's alert names the user's ownmcp.jsonand does not say "not found". No spec update, re-enable or mint call is made. It fails on main'sConnectionsPage.tsxand passes on this head.adds the provider on Connect once the user removes the hand-written rowkeeps the row in the list through the first alert, empties it, and asserts the next single Connect reachesmcpCustomAdd; Cancel on that wait then uninstalls the new entry, which pins the waiting card'skind: stored ? 'reconnect' : 'new'(it fails with main'sexisting ? ...).passes any other stored-spec read error through unchangedpins that a 500 shows its own error and writes nothing.points to Uninstall in MCP Servers when only the rendered copy still holds the removed rowpins the copy-only case: Uninstall message, no add, update or mint.ConnectionsPage.coverage.test.tsx(99 tests) and the i18n suites (82 files, 1270 tests) pass on this head, andtscandeslintare clean.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
Not run against a live gateway with a hand-written row; the test drives the real page with a 404 from the same API client the gateway answers.
Screenshots / video
The card's feedback line before and after, rendered with the real catalog and the card's inline
ErrorNotice:The card's feedback line for the copy-only case (
connect_rendered_copy_only), under the first-press message, from the same render path, with the card's "Action failed:" wrapping:Related Issues
Closes #35817
Sibling sweep
Swept: git grep -n "mcpCustomGet" -- website/src ':!website/src/test'
Sibling: website/src/pages/connections/ConnectionsPage.tsx -- changed here
Sibling: website/src/components/McpCustomServerModal.tsx -- not affected -- edits only rows the MCP tab lists as Kiro Crew's own
Pattern harvest
Not generalizable: this is the one card path that reads a Kiro Crew-only endpoint for a row it may not own.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)