Repository navigation
fix(dashboard): say when a saved MCP change did not reach the agent spec - #19213
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that tests stubbing [DESIGN-REVIEWED] 8baea42 Description read[DESCRIPTION-READ] 7e77e5f9efeaa7bc3039022f145055b7b46d07edc28a6e9112d2eaeae12568a1 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 Check one changed answer: an onboarding MCP import whose rebuild raises used to return 500 and now returns 200 with What this change shipsInventory (10 items) — 10 justifiedIntent: when a dashboard MCP, computer-use or OAuth-client change is saved but the agent spec is not rewritten, the dashboard says so instead of reporting plain success. This is a FIX (#18679; the decline tests fail on base).
[FIRST-PRINCIPLES-REVIEWED] 8baea42 Description read[DESCRIPTION-READ] 42123f7aa648907060dd35170014fe1c4e9de73d9fc934768b4a2aca218e4dfc That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The new notice sends users to a "Logs page" it never links to, and "this copy of Kiro Crew… agent config" is jargon the blind reader couldn't follow. Watch
Suggestions
[UX-REVIEWED] 8baea42 Description read[DESCRIPTION-READ] b62b1b04716001a34ada4997cb87cb23b94e33a27fc3174566adc3cd8133b711 That sha256 names everything this verdict read: the PR description, plus the 17 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: |
6a89d9a to
c3da398
Compare
c3da398 to
dafba0c
Compare
|
|
|
|
|
|
|
|
|
|
|
dafba0c to
28afa4e
Compare
|
|
|
|
|
|
|
|
1c0bc77 to
8baea42
Compare
|
The earlier Backend Tests shard 1 failures here (Windows and Linux) in |
|
|
|
|
|
|
iamwhatever
left a comment
There was a problem hiding this comment.
Dashboard MCP, Discover, onboarding import, computer-use and OAuth-client saves used to ignore whether rebuild_agent_config() wrote the spec. A shared-home decline therefore showed as plain success. This PR fixes that at the root by switching every caller to rebuild_agent_config_reporting(), through one helper (rebuild_agent_spec in handlers/_shared.py) and the direct calls in connections/ownership.py, connections.py and mcp.py. I read every backend hunk. A decline or a raised rebuild returns False, and the config write that already landed is kept. The OAuth client route tells a decline (None: 200, audited, agent_spec_rewritten: false) from a failure (False: the existing 500). Computer use still rebuilds under the config lock and reports only when a rebuild ran. The one changed answer, an onboarding import whose rebuild raises now returns 200 instead of 500, is declared and correct because the import landed. Responses only gain a field. The UX CONCERNS on 8baea42 each have a posted disposition, and checks are green. — crew-pr-reviewer (deep re-check)
Problem / Motivation
Goal: When a dashboard MCP or computer-use change is saved but the agent spec is not rewritten, the dashboard says so instead of reporting plain success.
Adding or editing a custom MCP server, installing one from Discover, importing MCP servers in onboarding, applying the MCP tab, toggling computer use, or changing a connection's OAuth client all end with a call to the plain
rebuild_agent_config(). That rebuild can finish without writing the agent spec: the shared-home guard declines when this instance may not own~/.kiro/agents. The handlers ignored that and answered success, so the user saw "saved" while new sessions still loaded the old servers.Why it matters
Anyone on a non-default data home (a pod, a worktree instance) who edits MCP servers from the dashboard is told the change landed when it did not. They then debug a "missing" server that was saved but never reached the spec.
Not a goal
_sync_mcp_to_agent, not this rebuild.What changed (motivation → approach → change)
POST/PUT /api/mcp/customagent_spec_rewritten: false; modal stays open with the notice and only ClosePOST /api/mcp/discover/installagent_spec_rewritten: false; notice in the detail panePOST /api/onboarding/import/applyagent_spec_rewritten: false; notice on the result page, without the "ready" linePOST /api/mcp/applyrebuild: {ok: false, error}; the notice replaces the green Applied line, and it and the tab's Add Custom / Discover modals drop the hand-off while changes are stagedPUT /api/computer-use/configagent_spec_rewritten: false; notice in the panel without the agent hand-off, kept until an enable change rebuilds again; the restart line drops "so this takes effect"PUT/DELETE /api/connections/oauth-clients/{slug}agent_spec_rewritten: false; notice on the card (a raised rebuild keeps the existingprojection_refresh_failed500)POST /api/connections/disconnectagentSpecRewritten: false; the feedback becomes an alertThe rebuild already reports whether it wrote, through
rebuild_agent_config_reporting(). The handlers now use it through one helper,rebuild_agent_spec()indashboard/handlers/_shared.py. The helper returns True only when the write is confirmed. A declined write and a raised rebuild both return False, and the config write that already landed stays saved. The MCP tab apply, the OAuth client refresh and the Disconnect transaction inconnections/ownership.pycallrebuild_agent_config_reporting()directly; apply fills its existingrebuildfield, and the OAuth client refresh tells a decline (answered and audited) from a failure (500).On the dashboard, one
AgentSpecNotRewrittenNoticecomponent renders throughErrorNoticewith the agent hand-off. It says the change was saved, that this copy of Kiro Crew could not update the agent config so new chats keep the old setup, and to open the Logs page to see why. The hand-off is off on the Computer Use panel, where it would navigate away from unsaved drafts. The response types inwebsite/src/apiandwebsite/src/types/index.tscarry the optional field. The string is translated in everywebsite/src/i18n/localescatalog, anden-XAis regenerated.The capability install and uninstall handlers in
dashboard/agent_admin/capabilities.py(skill and agent packages, not MCP edits) keep their current answer; they are a known deferral, tracked in #19306.Backwards compatibility
Compatible: every response gains a field (or reuses
rebuild.ok), and no input main accepts is rejected.DisconnectScopegains a requiredagent_spec_rewrittenfield; its only constructor isremove_provider_entry. One answer changes: an onboarding MCP import whose rebuild raises returns 200 withagent_spec_rewritten: falseinstead of a 500, because the import itself landed._refresh_client_projectionsreturnsNonefor a decline; both callers treat onlyFalseas the 500.Removes nothing: no key, endpoint or capability is removed; the responses only add a field.
Tests
test/test_mcp_custom_api.py::TestSpecNotRewritten,test/test_mcp_discover_api.py::...test_install_reports_a_declined_rebuild,test/test_api_onboarding_import.py::test_apply_reports_whether_the_agent_spec_was_rewritten,test/test_computer_use_api.py::...test_the_save_reports_whether_the_spec_was_rewritten,test/test_connections_disconnect.py::test_disconnect_reports_a_spec_rebuild_that_did_not_write,test/test_connections_oauth_client_routes.py::test_the_projection_refresh_tells_a_decline_from_a_failureand...test_a_declined_rebuild_answers_success_and_says_the_spec_did_not_follow,test/test_mcp_apply.py::...test_a_declined_rebuild_reports_rebuild_not_ok: a stub that behaves like the guard's refusal (returns the path, reports no write) givesfalse, and a writing stub givestrue. The decline cases fail onorigin/main(11 failed there) and pass here.falseand keeps the save (custom add, onboarding import, computer use).test_mcp_apply.py,test_handlers_mcp_coverage.pyand the fixtures report a write.test_computer_use_registration.pypins the rebuild call ahead of the session reset.McpCustomServerModal.test.tsx(new) checks that the modal closes on a confirmed write and stays open with Add disabled on a decline, and red on main's component. It also checks that only Close remains after the save.AgentImportFlow.test.tsxandComputerUsePanel.test.tsxcheck that the notice renders only onfalse,ConnectionsPage.coverage.test.tsxchecks the Disconnect alert,McpTab.integration.test.tsxchecks that the notice replaces the green Applied line, andConnectionsPanel.test.tsxchecks the OAuth app card.Manual verification
Each of the seven surfaces was rendered in Chromium against stubbed endpoints answering
agent_spec_rewritten: false(orrebuild.ok: false,agentSpecRewritten: false), driven through its real flow, in dark and light themes. The notice appeared on each one.Screenshots / video
Each surface after a save whose agent-spec rebuild did not confirm a write.
All surfaces, dark and light
Related Issues
Closes #18679
Pattern harvest
Rule candidate: review-prompt
Pattern: a handler calls a step that can decline without raising, then reports success without reading that step's verdict.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)