diff --git a/src/kiro_crew/connections/ownership.py b/src/kiro_crew/connections/ownership.py index 534ba26ca7c0..6a96a4b8f097 100644 --- a/src/kiro_crew/connections/ownership.py +++ b/src/kiro_crew/connections/ownership.py @@ -91,6 +91,10 @@ class DisconnectScope: # a surviving artifact. Restricting the re-stat to attempts is what makes a # survivor unambiguously a FAILED unlink. attempted_urls: tuple[str, ...] + # Whether the agent-spec rebuild after the purge confirmed a write. False when it + # declined (this instance may not write the shared agent home) or raised: new + # sessions may still load the entry this Disconnect removed from the config. + agent_spec_rewritten: bool def _json_spec_names(spec_dir: Path) -> list[str] | None: @@ -719,11 +723,19 @@ def _collect_owned(url: object, holder: str) -> None: # ``~/.kiro/agents/kirocrew.lock`` (apps/bridges._mcp_lock), so they are # different flocks and reentrancy never arises. try: - from kiro_crew.agent import rebuild_agent_config + from kiro_crew.agent import rebuild_agent_config_reporting - await _offload_config_write(rebuild_agent_config) + _spec_path, spec_rewritten = await _offload_config_write(rebuild_agent_config_reporting) except Exception: # noqa: BLE001 — the config write already landed logger.warning("agent config rebuild failed after disconnect", exc_info=True) + spec_rewritten = False + else: + if not spec_rewritten: + logger.warning( + "agent spec was not rewritten after disconnect of %s: this instance may " + "not write the shared agent home", + slug, + ) # OUTSIDE the lock and awaited by nobody. This provider is warmable again precisely # because its stored grant is gone, and the pool only premints ahead of need -- so @@ -748,4 +760,5 @@ def _collect_owned(url: object, holder: str) -> None: census_incomplete=census_gap, census_unreadable=tuple(_census_source_name(label) for label in unreadable), attempted_urls=tuple(attempted), + agent_spec_rewritten=spec_rewritten, ) diff --git a/src/kiro_crew/dashboard/handlers/_shared.py b/src/kiro_crew/dashboard/handlers/_shared.py index 458ef2df543e..6f1628195a66 100644 --- a/src/kiro_crew/dashboard/handlers/_shared.py +++ b/src/kiro_crew/dashboard/handlers/_shared.py @@ -3948,3 +3948,41 @@ async def vector_memory_for_store(state: DashboardState, store: str): from kiro_crew.context import ContextBuilder return await ContextBuilder.ensure_store(store) + + +# The response text for a saved change whose agent-spec rebuild did not confirm a write. +AGENT_SPEC_NOT_REWRITTEN = ( + "saved, but the agent spec may not have been rewritten, so new sessions may keep " + "the previous servers; see the gateway log" +) + + +def rebuild_agent_spec(context: str) -> bool: + """Rebuild the agent spec after a dashboard config write; True only on a confirmed rewrite. + + Blocking: call it through ``asyncio.to_thread``. A handler puts the answer in + its response as ``agent_spec_rewritten`` so the dashboard can say the change + was saved but may not have reached the agent spec. ``False`` covers both + unconfirmed outcomes: the rebuild declined to write (this instance may not own + the shared agent home), or it raised, possibly after part of the spec set was + already written. The config write itself already landed, so neither is an + error response. + + The import stays function-local: ``kiro_crew.agent`` imports the dashboard + handlers, and resolving the name at call time is what lets a test that + substitutes ``kiro_crew.agent.rebuild_agent_config`` reach this call. + """ + try: + from kiro_crew.agent import rebuild_agent_config_reporting + + _spec_path, wrote = rebuild_agent_config_reporting() + except Exception: + logger.warning("agent spec rebuild failed after %s", context, exc_info=True) + return False + if not wrote: + logger.warning( + "agent spec was not rewritten after %s: this instance may not write the shared " + "agent home, so new sessions may keep the previous spec", + context, + ) + return wrote diff --git a/src/kiro_crew/dashboard/handlers/computer_use.py b/src/kiro_crew/dashboard/handlers/computer_use.py index 94678d65db9e..6e2110a94f7f 100644 --- a/src/kiro_crew/dashboard/handlers/computer_use.py +++ b/src/kiro_crew/dashboard/handlers/computer_use.py @@ -768,6 +768,8 @@ async def api_computer_use_config_save(request: web.Request) -> web.Response: # are read per call and need no restart, and re-saving the same value must not # tear down the user's session. sessions_reset = 0 + # None when the enable did not change, so no rebuild ran to report on. + spec_rewritten: bool | None = None if STATE_KEY_ENABLED in state_patch and state_patch[STATE_KEY_ENABLED] != enabled_before: # REBUILD THE AGENT SPEC FIRST. The enable is also a spec-emission gate # (``agent._computer_use_spec_gate``): while it is off the server is not in @@ -787,24 +789,21 @@ async def api_computer_use_config_save(request: web.Request) -> web.Response: # its own acquisition, and ``rebuild_agent_config`` never takes this lock, # so this cannot self-deadlock. # - # A rebuild failure must not fail the SAVE: the write already landed and - # was audited. The fallback is the un-rebuilt spec — the tool surface - # appears on the next gateway start. + # A rebuild that fails or declines to write must not fail the SAVE: the + # write already landed and was audited. The response says the spec was + # not rewritten; the tool surface then appears on the next gateway start. # - # The import is function-local and must STAY function-local, which is not - # a style choice: it makes the name resolve at CALL time, so - # ``kiro_crew.agent`` is the single place a test can substitute the - # rebuild. Hoisting it to module scope binds the name here at import time, - # and the test guard that keeps the suite from rewriting the operator's - # real ``~/.kiro/agents`` would silently stop reaching this call site. + # ``rebuild_agent_spec`` resolves ``kiro_crew.agent`` at CALL time, so that + # module is the single place a test can substitute the rebuild, and the + # test guard that keeps the suite from rewriting the operator's real + # ``~/.kiro/agents`` reaches this call site. # Pinned by ``test_patching_the_agent_module_REACHES_the_handler``. - try: - from kiro_crew.agent import rebuild_agent_config + from kiro_crew.dashboard.handlers._shared import rebuild_agent_spec - async with _get_config_lock(): - await asyncio.to_thread(rebuild_agent_config) - except Exception: - logger.exception("computer-use enable saved, but agent config rebuild failed") + async with _get_config_lock(): + spec_rewritten = await asyncio.to_thread( + rebuild_agent_spec, "computer-use enable change" + ) from kiro_crew.dashboard.handlers.sessions import _reset_all_sessions @@ -818,6 +817,8 @@ async def api_computer_use_config_save(request: web.Request) -> web.Response: payload = await _full_payload() payload["sessions_reset"] = sessions_reset + if spec_rewritten is not None: + payload["agent_spec_rewritten"] = spec_rewritten return web.json_response(payload) diff --git a/src/kiro_crew/dashboard/handlers/connections.py b/src/kiro_crew/dashboard/handlers/connections.py index 0a7a770992bc..cbf77a9f7613 100644 --- a/src/kiro_crew/dashboard/handlers/connections.py +++ b/src/kiro_crew/dashboard/handlers/connections.py @@ -848,6 +848,7 @@ async def api_connections_disconnect(request: web.Request) -> web.Response: "grantSharedWith": list(scope.grant_shared_with), "grantCensusIncomplete": scope.census_incomplete, "grantCensusUnreadable": list(scope.census_unreadable), + "agentSpecRewritten": scope.agent_spec_rewritten, } ) @@ -1005,7 +1006,7 @@ def _oauth_client_configured(provider: Provider) -> bool: return bool(oauth_client_view(provider, config=config, vault_names=names).get("configured")) -async def _refresh_client_projections(slug: str) -> bool: +async def _refresh_client_projections(slug: str) -> bool | None: """Bring every runtime projection of ``slug``'s client in line with the record. The vault and config.json are the source of truth; the emitted agent spec and @@ -1017,7 +1018,12 @@ async def _refresh_client_projections(slug: str) -> bool: would otherwise merge straight back; (2) rebuild the agent spec so the next session reads the new client (or none). - Returns False when the scope scrub or the spec rebuild failed. The caller reports that as an + Returns True when every projection is refreshed, and None when the record and + scopes are clean but the rebuild declined to write the spec (this instance may + not write the shared agent home): the caller answers success, audits it, and + says ``agent_spec_rewritten: false``, because that decline repeats on every + call and a 500 would never clear. Returns False when the scope scrub or the + spec rebuild failed. The caller reports that as an error rather than success: the RECORD is committed (and stays committed -- reverting the source to match a stale projection would keep the retired credential authoritative, the opposite of what the operator asked), but a @@ -1052,12 +1058,19 @@ async def _refresh_client_projections(slug: str) -> bool: ) return False try: - from kiro_crew.agent import rebuild_agent_config # circular at module scope + from kiro_crew.agent import rebuild_agent_config_reporting # circular at module scope - await asyncio.to_thread(rebuild_agent_config) + _spec_path, wrote = await asyncio.to_thread(rebuild_agent_config_reporting) except Exception: # noqa: BLE001 -- reported to the caller, see docstring logger.warning("rebuild_agent_config failed after an OAuth client change", exc_info=True) return False + if not wrote: + logger.warning( + "agent spec was not rewritten after an OAuth client change for %s: this instance " + "may not write the shared agent home", + slug, + ) + return None return True @@ -1250,6 +1263,8 @@ async def api_connections_oauth_client_put(request: web.Request) -> web.Response slug = str(provider["slug"]) + spec_rewritten = [True] + async def _mutate() -> web.Response | None: async with _OAUTH_CLIENT_MUTATION: failure = await _write_oauth_client( @@ -1257,7 +1272,9 @@ async def _mutate() -> web.Response | None: ) if failure is not None: return failure - if not await _refresh_client_projections(slug): + refreshed = await _refresh_client_projections(slug) + spec_rewritten[0] = refreshed is True + if refreshed is False: views_now = await asyncio.to_thread(_oauth_client_views) return _projection_stale_response( slug, next((v for v in views_now if v.get("slug") == slug), None) @@ -1290,7 +1307,9 @@ async def _mutate() -> web.Response | None: ) views = await asyncio.to_thread(_oauth_client_views) current = next((v for v in views if v.get("slug") == slug), None) - return web.json_response({"ok": True, "client": current}) + return web.json_response( + {"ok": True, "client": current, "agent_spec_rewritten": spec_rewritten[0]} + ) async def api_connections_oauth_client_delete(request: web.Request) -> web.Response: @@ -1328,6 +1347,8 @@ def _drop_client(cfg: dict) -> dict | None: del clients[slug] return cfg + spec_rewritten = [True] + async def _mutate() -> web.Response | None: async with _OAUTH_CLIENT_MUTATION: # Same order and the same rollback as the PUT: the vault half goes @@ -1350,7 +1371,9 @@ async def _mutate() -> web.Response | None: {"error": "could not write config.json", "code": "config_write_failed"}, status=500, ) - if not await _refresh_client_projections(slug): + refreshed = await _refresh_client_projections(slug) + spec_rewritten[0] = refreshed is True + if refreshed is False: views_now = await asyncio.to_thread(_oauth_client_views) return _projection_stale_response( slug, next((v for v in views_now if v.get("slug") == slug), None) @@ -1370,4 +1393,6 @@ async def _mutate() -> web.Response | None: ) views = await asyncio.to_thread(_oauth_client_views) current = next((v for v in views if v.get("slug") == slug), None) - return web.json_response({"ok": True, "client": current}) + return web.json_response( + {"ok": True, "client": current, "agent_spec_rewritten": spec_rewritten[0]} + ) diff --git a/src/kiro_crew/dashboard/handlers/mcp.py b/src/kiro_crew/dashboard/handlers/mcp.py index ae984f5a1339..87a28dc1dfe4 100644 --- a/src/kiro_crew/dashboard/handlers/mcp.py +++ b/src/kiro_crew/dashboard/handlers/mcp.py @@ -22,7 +22,7 @@ _atomic_json_write, _declined_foreign_spec_write, kiro_agents_dir_path, - rebuild_agent_config, + rebuild_agent_config_reporting, ) from kiro_crew.agent_discovery import _read_agent_spec from kiro_crew.agent_spec_format import iter_agent_spec_files @@ -36,7 +36,7 @@ ) from kiro_crew.config.paths import data_home, kiro_agents_dir from kiro_crew.dashboard.chat_utils import run_to_completion -from kiro_crew.dashboard.handlers._shared import read_bounded_json +from kiro_crew.dashboard.handlers._shared import AGENT_SPEC_NOT_REWRITTEN, read_bounded_json from kiro_crew.dashboard.state import DashboardState from kiro_crew.env import emit_env from kiro_crew.loop_lock import LoopBoundLock @@ -3656,8 +3656,12 @@ async def _run_one_uninstall(uname: str) -> None: rebuild_ok = False rebuild_error: str | None = None try: - await asyncio.to_thread(rebuild_agent_config) - rebuild_ok = True + _spec_path, rebuild_ok = await asyncio.to_thread(rebuild_agent_config_reporting) + if not rebuild_ok: + # Declined, not failed: this instance may not write the shared agent + # home, so the saved change does not reach new sessions. + rebuild_error = AGENT_SPEC_NOT_REWRITTEN + logger.warning("agent spec was not rewritten after apply: %s", rebuild_error) except Exception as exc: # Rebuild failures can surface file paths, env var contents, or # credential fragments (e.g. JSON decode errors that echo file diff --git a/src/kiro_crew/dashboard/handlers/mcp_custom.py b/src/kiro_crew/dashboard/handlers/mcp_custom.py index 813691b0126e..9cb7cfa40814 100644 --- a/src/kiro_crew/dashboard/handlers/mcp_custom.py +++ b/src/kiro_crew/dashboard/handlers/mcp_custom.py @@ -24,6 +24,7 @@ from aiohttp import web from kiro_crew.dashboard.handlers import mcp as _mcp +from kiro_crew.dashboard.handlers._shared import rebuild_agent_spec from kiro_crew.dashboard.handlers.mcp import ( _find_server_spec_anywhere, _get_kirocrew_entry, @@ -358,15 +359,13 @@ async def _record_owner_servers(entries: dict[str, dict]) -> None: logger.warning("could not record owner MCP servers %s", sorted(entries), exc_info=True) -async def _rebuild_agent_config() -> None: - """Best-effort agent-config rebuild so changes load on the next session.""" - try: - # circular import: kiro_crew.agent imports dashboard handlers. - from kiro_crew.agent import rebuild_agent_config +async def _rebuild_agent_config() -> bool: + """Rebuild the agent spec so the change loads on the next session. - await asyncio.to_thread(rebuild_agent_config) - except Exception: - logger.warning("rebuild_agent_config failed after MCP custom write", exc_info=True) + True only when the spec was rewritten; the caller reports a False to the + dashboard instead of claiming the change is live. + """ + return await asyncio.to_thread(rebuild_agent_spec, "MCP custom write") async def api_mcp_custom_add(request: web.Request) -> web.Response: @@ -459,7 +458,7 @@ async def api_mcp_custom_add(request: web.Request) -> web.Response: await _mcp._offload_config_write(_mcp._atomic_write, _mcp._kirocrew_mcp_json(), data) await _record_owner_servers(cleaned) - await _rebuild_agent_config() + spec_rewritten = await _rebuild_agent_config() added = sorted(cleaned) sel().log_api_access( @@ -469,7 +468,9 @@ async def api_mcp_custom_add(request: web.Request) -> web.Response: source="dashboard", resources=f"custom:{','.join(added)} enabled={enable}", ) - return web.json_response({"ok": True, "added": added, "enabled": enable}) + return web.json_response( + {"ok": True, "added": added, "enabled": enable, "agent_spec_rewritten": spec_rewritten} + ) async def api_mcp_custom_get(request: web.Request) -> web.Response: @@ -628,7 +629,7 @@ async def api_mcp_custom_update(request: web.Request) -> web.Response: return web.json_response({"error": f"server '{name}' not found"}, status=404) await _record_owner_servers({name: spec}) - await _rebuild_agent_config() + spec_rewritten = await _rebuild_agent_config() sel().log_api_access( caller="dashboard", @@ -637,4 +638,4 @@ async def api_mcp_custom_update(request: web.Request) -> web.Response: source="dashboard", resources=f"custom:{name}", ) - return web.json_response({"ok": True, "name": name}) + return web.json_response({"ok": True, "name": name, "agent_spec_rewritten": spec_rewritten}) diff --git a/src/kiro_crew/dashboard/handlers/mcp_discover.py b/src/kiro_crew/dashboard/handlers/mcp_discover.py index 37146a00b706..6ff03798c30b 100644 --- a/src/kiro_crew/dashboard/handlers/mcp_discover.py +++ b/src/kiro_crew/dashboard/handlers/mcp_discover.py @@ -18,6 +18,7 @@ from aiohttp import web from kiro_crew.agent import SharedAgentHomeRefused +from kiro_crew.dashboard.handlers._shared import rebuild_agent_spec from kiro_crew.dashboard.handlers.mcp import ( _find_server_spec_anywhere, _get_mcp_lock, @@ -379,15 +380,9 @@ async def _install_from_official(request: web.Request, server_id: str) -> web.Re enable_now = not mcp_entry_is_muted(existing) # Rebuild the rendered agent configs so the new server loads on the next - # session, mirroring api_mcp_apply. Best-effort: the config write above - # already succeeded and survives a failed rebuild. - try: - # circular import: kiro_crew.agent imports dashboard handlers. - from kiro_crew.agent import rebuild_agent_config - - await asyncio.to_thread(rebuild_agent_config) - except Exception: - logger.warning("rebuild_agent_config failed after MCP install", exc_info=True) + # session, mirroring api_mcp_apply. The config write above already landed + # and survives a skipped rebuild; the response says whether the spec moved. + spec_rewritten = await asyncio.to_thread(rebuild_agent_spec, "MCP install") sel().log_api_access( caller="dashboard", @@ -403,6 +398,7 @@ async def _install_from_official(request: web.Request, server_id: str) -> web.Re "required_env": required_env, "method": method, "enabled": enable_now, + "agent_spec_rewritten": spec_rewritten, } ) diff --git a/src/kiro_crew/dashboard/handlers/onboarding_import.py b/src/kiro_crew/dashboard/handlers/onboarding_import.py index 866b75c52482..784bab3acb27 100644 --- a/src/kiro_crew/dashboard/handlers/onboarding_import.py +++ b/src/kiro_crew/dashboard/handlers/onboarding_import.py @@ -13,7 +13,7 @@ from kiro_crew.config.loader import ConfigReadError, coerce_dict_section, update_config_locked from kiro_crew.dashboard.chat_utils import run_config_write -from kiro_crew.dashboard.handlers._shared import require_owner_dashboard_request +from kiro_crew.dashboard.handlers._shared import rebuild_agent_spec, require_owner_dashboard_request from kiro_crew.loop_lock import LoopBoundLock logger = logging.getLogger(__name__) @@ -566,11 +566,9 @@ def _log_backfill_result(task: asyncio.Future[int]) -> None: logger.info("Embedded %d imported memories in the background", embedded) -def _rebuild_agent_config() -> None: - # Circular import: agent imports dashboard handlers during gateway startup. - from kiro_crew.agent import rebuild_agent_config - - rebuild_agent_config() +def _rebuild_agent_config() -> bool: + """Rebuild the agent spec after an MCP import; True only when it was rewritten.""" + return rebuild_agent_spec("MCP import") def _persist_state(completed: bool) -> None: @@ -642,6 +640,8 @@ async def api_onboarding_import_apply(request: web.Request) -> web.Response: config_selected = {pair for pair in selected if pair[1] != "mcp_servers"} mcp_selected = {pair for pair in selected if pair[1] == "mcp_servers"} results: list[object] = [] + # None when nothing touched MCP, so no rebuild ran to report on. + spec_rewritten: bool | None = None if config_selected: # run_config_write, not a manual lock + bare to_thread: the # config-category importer read-modify-writes config.json, and @@ -673,9 +673,12 @@ async def api_onboarding_import_apply(request: web.Request) -> web.Response: conflict_strategy, ) ) - await asyncio.to_thread(_rebuild_agent_config) + spec_rewritten = await asyncio.to_thread(_rebuild_agent_config) result = _merge_import_results(results, conflict_strategy) - response = web.json_response(_apply_response(result)) + payload = _apply_response(result) + if spec_rewritten is not None: + payload["agent_spec_rewritten"] = spec_rewritten + response = web.json_response(payload) # Import wrote episodic rows without vectors so this request could # return in ~1s instead of minutes. Embed them on a worker thread now # — inside the import lock's scope but not awaited, so the response diff --git a/test/test_api_onboarding_import.py b/test/test_api_onboarding_import.py index 7dedef9db279..32ae8816f9d8 100644 --- a/test/test_api_onboarding_import.py +++ b/test/test_api_onboarding_import.py @@ -7,6 +7,7 @@ import json import threading import time +from pathlib import Path from types import SimpleNamespace from typing import Any @@ -1316,3 +1317,79 @@ async def test_every_refusal_carries_a_code(monkeypatch) -> None: assert response.status >= 400, body assert isinstance(body.get("code"), str) and body["code"], body assert isinstance(body.get("error"), str) and body["error"], body + + +def _mcp_only_backend(): + def preview_import(source_ids=None): + return { + "sources": [ + { + "id": "codex", + "categories": [{"id": "mcp_servers", "selected": True}], + } + ], + "selection": [{"source_id": "codex", "category_id": "mcp_servers"}], + } + + def apply_import(plan, **kwargs): + return {"imported": {"mcp_servers": 1}, "imported_count": 1, "already_imported": 0} + + return SimpleNamespace(preview_import=preview_import, apply_import=apply_import) + + +async def _apply_mcp_import(module) -> dict: + async with TestClient(TestServer(_make_app(module))) as client: + response = await client.post( + "/api/onboarding/import/apply", + json={"sources": [{"id": "codex", "categories": ["mcp_servers"]}]}, + headers={"X-Test-User": "owner"}, + ) + assert response.status == 200 + return await response.json() + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + ("rebuild", "expected"), + [ + pytest.param( + lambda **kw: (kw["_wrote_out"].append(True), Path("/dev/null"))[1], + True, + id="wrote", + ), + # The shared-home guard refused: the path comes back and nothing is written. + pytest.param(lambda **_: Path("/dev/null"), False, id="declined"), + ], +) +async def test_apply_reports_whether_the_agent_spec_was_rewritten( + monkeypatch, rebuild, expected +) -> None: + import kiro_crew.agent as agent_mod + + module = _handler_module() + monkeypatch.setattr(module, "_backend", _mcp_only_backend) + monkeypatch.setattr(module, "_sel", lambda: _AuditLog()) + monkeypatch.setattr(agent_mod, "rebuild_agent_config", rebuild) + + body = await _apply_mcp_import(module) + + assert body["summary"]["imported"] == 1 + assert body["agent_spec_rewritten"] is expected + + +@pytest.mark.asyncio +async def test_a_failed_rebuild_keeps_the_import_and_reports_it(monkeypatch) -> None: + """The MCP entries already landed, so a rebuild error is a report, not a 500.""" + import kiro_crew.agent as agent_mod + + def boom(**_): + raise RuntimeError("boom") + + module = _handler_module() + monkeypatch.setattr(module, "_backend", _mcp_only_backend) + monkeypatch.setattr(module, "_sel", lambda: _AuditLog()) + monkeypatch.setattr(agent_mod, "rebuild_agent_config", boom) + + body = await _apply_mcp_import(module) + + assert body["agent_spec_rewritten"] is False diff --git a/test/test_computer_use_api.py b/test/test_computer_use_api.py index 071c670cdc6f..f3988ad2b26f 100644 --- a/test/test_computer_use_api.py +++ b/test/test_computer_use_api.py @@ -1791,6 +1791,46 @@ def _boom(**_): assert body["enabled"] is True assert len(calls) == 1 assert json.loads(state_file.read_text())[STATE_KEY_ENABLED] is True + assert body["agent_spec_rewritten"] is False + + @pytest.mark.asyncio + @pytest.mark.parametrize( + ("rebuild", "expected"), + [ + pytest.param( + lambda **kw: (kw["_wrote_out"].append(True), Path("/dev/null"))[1], + True, + id="wrote", + ), + # The shared-home guard refused: the path comes back and nothing is written. + pytest.param(lambda **_: Path("/dev/null"), False, id="declined"), + ], + ) + async def test_the_save_reports_whether_the_spec_was_rewritten( + self, state_file, monkeypatch, rebuild, expected + ): + import kiro_crew.agent as agent_mod + + self._spy(monkeypatch) + monkeypatch.setattr(agent_mod, "rebuild_agent_config", rebuild) + async with _client() as client: + resp = await client.put("/api/computer-use/config", json={"enabled": True}) + body = await resp.json() + assert resp.status == 200 + assert body["enabled"] is True + assert body["agent_spec_rewritten"] is expected + + @pytest.mark.asyncio + async def test_a_save_without_an_enable_change_reports_no_rebuild( + self, state_file, monkeypatch + ): + state_file.write_text(json.dumps({STATE_KEY_ENABLED: True}), encoding="utf-8") + self._spy(monkeypatch) + async with _client() as client: + resp = await client.put("/api/computer-use/config", json={"enabled": True}) + body = await resp.json() + assert resp.status == 200 + assert "agent_spec_rewritten" not in body class TestAMalformedKeystoneStillRendersSettings: diff --git a/test/test_computer_use_registration.py b/test/test_computer_use_registration.py index 06885738b2e6..ba708f142bb1 100644 --- a/test/test_computer_use_registration.py +++ b/test/test_computer_use_registration.py @@ -30,6 +30,7 @@ from __future__ import annotations import json +import re from contextlib import ExitStack from pathlib import Path from unittest.mock import patch @@ -1191,7 +1192,8 @@ def test_enabling_rebuilds_the_spec_before_resetting_sessions(self): from kiro_crew.dashboard.handlers import computer_use as handler src = inspect.getsource(handler.api_computer_use_config_save) - rebuild_at = src.find("rebuild_agent_config") + rebuild_call = re.search(r"to_thread\(\s*rebuild_agent_spec\b", src) + rebuild_at = rebuild_call.start() if rebuild_call else -1 reset_at = src.find("_reset_all_sessions") assert rebuild_at != -1, "the enable flip must rebuild the agent spec" assert reset_at != -1 diff --git a/test/test_connections_disconnect.py b/test/test_connections_disconnect.py index 6ad7735599a0..d9598c7b815d 100644 --- a/test/test_connections_disconnect.py +++ b/test/test_connections_disconnect.py @@ -166,6 +166,14 @@ def _entry(name: str, url: str) -> types.SimpleNamespace: return types.SimpleNamespace(name=name, url=url) +def _rebuild_that_writes(**kwargs) -> pathlib.Path: + """A rebuild that wrote the spec: it reports the write the way the real one does.""" + wrote_out = kwargs.get("_wrote_out") + if wrote_out is not None: + wrote_out.append(True) + return pathlib.Path("/dev/null") + + def _wire( monkeypatch: pytest.MonkeyPatch, *, @@ -232,7 +240,7 @@ def _purge(name: str, *, scopes: tuple[str, ...] | None = None) -> dict: _purge.seen = scopes if scopes is not None else [] # type: ignore[attr-defined] monkeypatch.setattr(mcp_handlers, "_purge_server_config", _purge) - monkeypatch.setattr(agent_mod, "rebuild_agent_config", lambda: None) + monkeypatch.setattr(agent_mod, "rebuild_agent_config", _rebuild_that_writes) monkeypatch.setattr(connections, "sel", lambda: types.SimpleNamespace(log_api_access=_audit)) if not real_rearm: seen_rearms = rearms if rearms is not None else [] @@ -307,10 +315,44 @@ async def test_disconnect_revokes_the_grant_and_removes_the_entry( "grantSharedWith": [], "grantCensusIncomplete": False, "grantCensusUnreadable": [], + "agentSpecRewritten": True, } assert purged == [_SLUG] +@pytest.mark.asyncio +@pytest.mark.parametrize( + "rebuild", + [ + # The shared-home guard refused: the path comes back and nothing is written. + pytest.param(lambda **_: pathlib.Path("/dev/null"), id="declined"), + pytest.param( + lambda **_: (_ for _ in ()).throw(RuntimeError("boom")), + id="raised", + ), + ], +) +async def test_disconnect_reports_a_spec_rebuild_that_did_not_write( + monkeypatch: pytest.MonkeyPatch, rebuild +) -> None: + """The entry is gone from the config, but new sessions may still load it.""" + purged: list[str] = [] + _wire( + monkeypatch, + removed=["token", "registration"], + surviving=[], + inventory=[_entry(_SLUG, _provider_url())], + purged=purged, + ) + monkeypatch.setattr(agent_mod, "rebuild_agent_config", rebuild) + + body = await _disconnect() + + assert body["entryRemoved"] is True + assert body["agentSpecRewritten"] is False + assert purged == [_SLUG] + + @pytest.mark.asyncio async def test_disconnect_response_carries_no_slug_echo( monkeypatch: pytest.MonkeyPatch, diff --git a/test/test_connections_oauth_client_routes.py b/test/test_connections_oauth_client_routes.py index 5535053a5448..c05fa6a40fc8 100644 --- a/test/test_connections_oauth_client_routes.py +++ b/test/test_connections_oauth_client_routes.py @@ -11,6 +11,7 @@ import json from pathlib import Path +from types import SimpleNamespace import pytest from aiohttp import web @@ -29,6 +30,10 @@ SECRET = "s3cr3t-value-that-must-never-be-echoed" +# The real refresh, held before the autouse ``refreshed`` fixture replaces it. +_REAL_REFRESH = connections._refresh_client_projections + + @pytest.fixture() def home(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> Path: """A scratch config dir + vault; no operator env values leak in.""" @@ -712,3 +717,80 @@ async def _boom_after_side_write(*_args, **_kwargs): held = vault.get(GITHUB_VAULT_NAME) assert held is not None and held.reveal() == "newer-from-elsewhere" + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + ("rebuild", "expected"), + [ + pytest.param( + lambda **kw: (kw["_wrote_out"].append(True), Path("/dev/null"))[1], + True, + id="wrote", + ), + # The shared-home guard refused: the path comes back and nothing is written. + pytest.param(lambda **_: Path("/dev/null"), None, id="declined"), + pytest.param( + lambda **_: (_ for _ in ()).throw(RuntimeError("boom")), + False, + id="raised", + ), + ], +) +async def test_the_projection_refresh_tells_a_decline_from_a_failure( + monkeypatch, rebuild, expected +): + import kiro_crew.agent as agent_mod + import kiro_crew.connections.mint as mint_mod + + async def _no_mint(slug: str) -> None: + return None + + class _NoLock: + async def __aenter__(self): + return None + + async def __aexit__(self, *exc): + return None + + monkeypatch.setattr(mint_mod, "cancel_mint", _no_mint) + monkeypatch.setattr(connections, "_scrub_preregistered_oauth_copies", lambda slug: None) + monkeypatch.setattr(connections, "_get_mcp_lock", _NoLock) + monkeypatch.setattr(agent_mod, "rebuild_agent_config", rebuild) + + assert await _REAL_REFRESH("github") is expected + + +@pytest.mark.asyncio +async def test_a_declined_rebuild_answers_success_and_says_the_spec_did_not_follow( + home, monkeypatch +): + """A decline repeats on every call, so a 500 would never clear: the save is + answered and audited, and the response says the agent spec did not follow.""" + + async def _declined(slug: str) -> None: + return None + + audits: list[dict] = [] + monkeypatch.setattr(connections, "_refresh_client_projections", _declined) + monkeypatch.setattr( + connections, "sel", lambda: SimpleNamespace(log_api_access=lambda **kw: audits.append(kw)) + ) + + client = await _client() + try: + resp = await client.put(f"{BASE}/github", json={"client_secret": SECRET}) + assert resp.status == 200 + body = await resp.json() + assert body["agent_spec_rewritten"] is False + assert SECRET not in json.dumps(body) + resp = await client.delete(f"{BASE}/github") + assert resp.status == 200 + assert (await resp.json())["agent_spec_rewritten"] is False + finally: + await client.close() + + assert [a["operation"] for a in audits] == [ + "connections_oauth_client_put", + "connections_oauth_client_delete", + ] diff --git a/test/test_handlers_mcp_coverage.py b/test/test_handlers_mcp_coverage.py index 41b38d195dc6..ec56855716b5 100644 --- a/test/test_handlers_mcp_coverage.py +++ b/test/test_handlers_mcp_coverage.py @@ -1604,7 +1604,7 @@ def __exit__(self, *a): return None monkeypatch.setattr(mcp_mod, "_get_mcp_lock", lambda: _FlagLock()) - monkeypatch.setattr(mcp_mod, "rebuild_agent_config", lambda: None) + monkeypatch.setattr(mcp_mod, "rebuild_agent_config_reporting", lambda: (Path(), True)) monkeypatch.setattr(mcp_mod, "_get_mcp_lock_sync", lambda: _NoSync()) async def run() -> None: diff --git a/test/test_mcp_apply.py b/test/test_mcp_apply.py index dbf2d65a4ff7..bbee34f235b4 100644 --- a/test/test_mcp_apply.py +++ b/test/test_mcp_apply.py @@ -1,6 +1,7 @@ from __future__ import annotations import json +from pathlib import Path from types import SimpleNamespace from unittest.mock import AsyncMock, MagicMock @@ -175,8 +176,11 @@ async def test_preservation_kiro_to_kirocrew(self, tmp_path, monkeypatch): "_find_server_spec_anywhere", lambda name: ({"command": "slack", "args": []} if name == "slack-mcp" else None), ) - # Stub rebuild_agent_config — we only care about file writes here. - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + # Stub the spec rebuild — we only care about file writes here. + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) # No-op the lock to simplify testing. class _NoLock: @@ -236,7 +240,10 @@ async def test_uninstall_removes_from_all_three(self, tmp_path, monkeypatch): lambda: MagicMock(**{"available.return_value": False}), ) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -292,8 +299,10 @@ async def test_ambiguous_uninstall_is_refused_before_any_side_effect( monkeypatch.setattr( "kiro_crew.dashboard.handlers._shared._capability_manager", lambda: manager ) - rebuild = MagicMock() - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", rebuild) + rebuild = MagicMock(return_value=(Path(), True)) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", rebuild + ) sel = MagicMock() monkeypatch.setattr(mcp_mod, "sel", lambda: sel) @@ -361,8 +370,10 @@ async def test_an_ambiguous_scope_toggle_is_refused_before_any_write( "kiro_crew.dashboard.handlers._shared._capability_manager", lambda: MagicMock(**{"available.return_value": False}), ) - rebuild = MagicMock() - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", rebuild) + rebuild = MagicMock(return_value=(Path(), True)) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", rebuild + ) sel = MagicMock() monkeypatch.setattr(mcp_mod, "sel", lambda: sel) @@ -404,8 +415,10 @@ async def test_a_commented_scope_file_is_refused_before_any_write(self, tmp_path monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", kiro_path) monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", list) monkeypatch.setattr(mcp_mod, "kiro_agents_dir", lambda: tmp_path / "agents") - rebuild = MagicMock() - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", rebuild) + rebuild = MagicMock(return_value=(Path(), True)) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", rebuild + ) monkeypatch.setattr(mcp_mod, "sel", lambda: MagicMock()) request = _make_request( @@ -467,7 +480,10 @@ def pin_then_edit(names): monkeypatch.setattr( "kiro_crew.dashboard.handlers._shared._capability_manager", lambda: manager ) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) sel = MagicMock() monkeypatch.setattr(mcp_mod, "sel", lambda: sel) @@ -512,8 +528,10 @@ async def test_calls_rebuild_agent_config_once(self, tmp_path, monkeypatch): lambda: MagicMock(**{"available.return_value": False}), ) - rebuild = MagicMock() - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", rebuild) + rebuild = MagicMock(return_value=(Path(), True)) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", rebuild + ) class _NoLock: async def __aenter__(self): @@ -541,6 +559,35 @@ async def __aexit__(self, *a): assert rebuild.call_count == 1 # rebuild called ONCE after all edits assert body["rebuild"]["ok"] is True + @pytest.mark.asyncio + async def test_a_declined_rebuild_reports_rebuild_not_ok(self, tmp_path, monkeypatch): + """The guard refused the write: the change is saved but not live, so say so.""" + from kiro_crew.dashboard.handlers import mcp as mcp_mod + from kiro_crew.dashboard.handlers._shared import AGENT_SPEC_NOT_REWRITTEN + + monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "mc.json") + monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", tmp_path / "kiro.json") + monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), False), + ) + + class _NoLock: + async def __aenter__(self): + pass + + async def __aexit__(self, *a): + pass + + monkeypatch.setattr(mcp_mod, "_get_mcp_lock", lambda: _NoLock()) + monkeypatch.setattr(mcp_mod, "_find_server_spec_anywhere", lambda n: {"command": "x"}) + + request = _make_request({"changes": [{"name": "a", "kirocrew": True}]}) + body = json.loads((await mcp_mod.api_mcp_apply(request)).body) + assert body["applied"] == 1 + assert body["rebuild"] == {"ok": False, "error": AGENT_SPEC_NOT_REWRITTEN} + # --------------------------------------------------------------------------- # Name validation: malicious / malformed server names are rejected before any @@ -591,8 +638,10 @@ async def test_rejects_hostile_names(self, tmp_path, monkeypatch, bad_name): lambda: pytest.fail("_capability_manager must not be reached for invalid name"), ) - rebuild = MagicMock() - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", rebuild) + rebuild = MagicMock(return_value=(Path(), True)) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", rebuild + ) class _NoLock: async def __aenter__(self): @@ -639,7 +688,10 @@ async def test_hostile_tool_name_filtered_server_kept(self, tmp_path, monkeypatc lambda: MagicMock(**{"available.return_value": False}), ) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -734,7 +786,10 @@ async def test_colon_name_passes_the_gate_and_applies(self, tmp_path, monkeypatc "kiro_crew.dashboard.handlers._shared._capability_manager", lambda: MagicMock(**{"available.return_value": False}), ) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -920,7 +975,10 @@ async def test_accepts_batch_at_cap(self, monkeypatch, tmp_path) -> None: monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", tmp_path / "kiro.json") monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -1008,7 +1066,10 @@ async def test_apply_uninstall_calls_manager_off_lock(self, monkeypatch, tmp_pat monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", tmp_path / "kiro.json") monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -1048,7 +1109,10 @@ async def test_apply_uninstall_phase_timeout_marks_timed_out( monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", tmp_path / "kiro.json") monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) # Tiny budget so the hanging op blows the phase deadline immediately. from kiro_crew.platform import capability_bound @@ -1104,7 +1168,10 @@ async def test_config_purged_even_when_loop_aborts(self, monkeypatch, tmp_path) monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", kiro_path) monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -1169,7 +1236,10 @@ async def test_sweep_purges_by_request_regardless_of_outcome( monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", kiro_path) monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) monkeypatch.setattr(capability_bound, "CAPABILITY_UNINSTALL_TIMEOUT", 0.01) class _NoLock: @@ -1233,7 +1303,10 @@ async def test_config_purged_on_phase1_cancellation(self, monkeypatch, tmp_path) monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", kiro_path) monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -1314,7 +1387,10 @@ async def test_sweep_runs_off_event_loop_thread(self, monkeypatch, tmp_path) -> monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", kiro_path) monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) class _NoLock: async def __aenter__(self): @@ -1374,7 +1450,10 @@ async def test_concurrent_applies_are_serialized(self, monkeypatch, tmp_path) -> monkeypatch.setattr(mcp_mod, "_KIROCREW_MCP_JSON", tmp_path / "kc.json") monkeypatch.setattr(mcp_mod, "_GLOBAL_MCP_JSON", tmp_path / "kiro.json") monkeypatch.setattr(mcp_mod, "_extra_mcp_scopes", lambda: []) - monkeypatch.setattr("kiro_crew.dashboard.handlers.mcp.rebuild_agent_config", lambda: None) + monkeypatch.setattr( + "kiro_crew.dashboard.handlers.mcp.rebuild_agent_config_reporting", + lambda: (Path(), True), + ) # Reset the module-global apply lock so a permit a crashed earlier test # left held can't leak in (LoopBoundLock rebinds per loop on its own). monkeypatch.setattr(mcp_mod, "_apply_lock", mcp_mod.LoopBoundLock()) diff --git a/test/test_mcp_custom_api.py b/test/test_mcp_custom_api.py index 91ff61de97e9..eb8a19814751 100644 --- a/test/test_mcp_custom_api.py +++ b/test/test_mcp_custom_api.py @@ -25,6 +25,19 @@ _REMOTE = {"url": "https://mcp.example.com/sse"} +def _rebuild_that_writes(**kwargs) -> Path: + """A rebuild that wrote the spec: it reports the write the way the real one does.""" + wrote_out = kwargs.get("_wrote_out") + if wrote_out is not None: + wrote_out.append(True) + return Path("/dev/null") + + +def _rebuild_that_declines(**_kwargs) -> Path: + """A rebuild the shared-home guard refused: it returns the path and writes nothing.""" + return Path("/dev/null") + + @pytest.fixture def fake_home(tmp_path, monkeypatch): """Pin $HOME to tmp_path so all config paths resolve into a sandbox.""" @@ -45,7 +58,7 @@ def sandbox(fake_home, monkeypatch): import kiro_crew.agent as agent_mod - rebuild = MagicMock() + rebuild = MagicMock(side_effect=_rebuild_that_writes) monkeypatch.setattr(agent_mod, "rebuild_agent_config", rebuild) return SimpleNamespace( @@ -110,7 +123,12 @@ async def test_stdio_add_lands_disabled_by_default(self, sandbox, fake_sel): resp = await client.post("/api/mcp/custom", json={"servers": {"weather": _STDIO}}) assert resp.status == 200 body = await resp.json() - assert body == {"ok": True, "added": ["weather"], "enabled": False} + assert body == { + "ok": True, + "added": ["weather"], + "enabled": False, + "agent_spec_rewritten": True, + } entry = _written(sandbox)["weather"] assert entry["command"] == "npx" assert entry["args"] == ["-y", "@acme/weather-mcp"] @@ -373,7 +391,11 @@ async def test_replaces_spec_and_preserves_disabled_state(self, sandbox, fake_se try: resp = await client.put("/api/mcp/custom/weather", json={"spec": _REMOTE}) assert resp.status == 200 - assert await resp.json() == {"ok": True, "name": "weather"} + assert await resp.json() == { + "ok": True, + "name": "weather", + "agent_spec_rewritten": True, + } written = _written(sandbox)["weather"] assert written["url"] == _REMOTE["url"] assert "command" not in written # old stdio keys fully replaced @@ -1276,3 +1298,45 @@ async def test_a_server_written_straight_to_the_store_is_never_recorded( encoding="utf-8", ) assert _owner_record() == {} + + +# --------------------------------------------------------------------------- +# A rebuild that does not write the spec is reported, not hidden +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +class TestSpecNotRewritten: + async def test_add_reports_a_declined_rebuild(self, sandbox, fake_sel): + sandbox.rebuild.side_effect = _rebuild_that_declines + client = await _client() + try: + resp = await client.post("/api/mcp/custom", json={"servers": {"weather": _STDIO}}) + assert resp.status == 200 + body = await resp.json() + assert body["added"] == ["weather"] + assert body["agent_spec_rewritten"] is False + assert "weather" in _written(sandbox), "the saved server must stay saved" + finally: + await client.close() + + async def test_update_reports_a_declined_rebuild(self, sandbox, fake_sel): + client = await _client() + try: + await client.post("/api/mcp/custom", json={"servers": {"weather": _STDIO}}) + sandbox.rebuild.side_effect = _rebuild_that_declines + resp = await client.put("/api/mcp/custom/weather", json={"spec": _STDIO}) + assert resp.status == 200 + assert (await resp.json())["agent_spec_rewritten"] is False + finally: + await client.close() + + async def test_add_reports_a_failed_rebuild(self, sandbox, fake_sel): + sandbox.rebuild.side_effect = RuntimeError("boom") + client = await _client() + try: + resp = await client.post("/api/mcp/custom", json={"servers": {"weather": _STDIO}}) + assert resp.status == 200 + assert (await resp.json())["agent_spec_rewritten"] is False + finally: + await client.close() diff --git a/test/test_mcp_discover_api.py b/test/test_mcp_discover_api.py index 3cedb0dd81bf..c5742b619744 100644 --- a/test/test_mcp_discover_api.py +++ b/test/test_mcp_discover_api.py @@ -112,6 +112,14 @@ def fake_home(tmp_path, monkeypatch): return tmp_path +def _rebuild_that_writes(**kwargs) -> Path: + """A rebuild that wrote the spec: it reports the write the way the real one does.""" + wrote_out = kwargs.get("_wrote_out") + if wrote_out is not None: + wrote_out.append(True) + return Path("/dev/null") + + @pytest.fixture def sandbox(fake_home, monkeypatch): """Sandbox the mcp.py module-level config paths + collaborator seams. @@ -132,7 +140,7 @@ def sandbox(fake_home, monkeypatch): import kiro_crew.agent as agent_mod - rebuild = MagicMock() + rebuild = MagicMock(side_effect=_rebuild_that_writes) monkeypatch.setattr(agent_mod, "rebuild_agent_config", rebuild) return SimpleNamespace( @@ -440,6 +448,7 @@ async def test_official_install_happy_path(self, sandbox, fake_sel, reset_regist "required_env": ["WEATHER_API_KEY"], "method": "npx", "enabled": False, + "agent_spec_rewritten": True, } # The translated spec landed in the KiroCrew scope — DISABLED, # because required env is unset: enabling after configuration is @@ -459,6 +468,24 @@ async def test_official_install_happy_path(self, sandbox, fake_sel, reset_regist finally: await client.close() + async def test_install_reports_a_declined_rebuild(self, sandbox, fake_sel, reset_registry): + """The shared-home guard refused the write: saved, but not live yet.""" + sandbox.rebuild.side_effect = lambda **_: Path("/dev/null") + client = await _client(FakeOfficialProvider()) + try: + resp = await client.post( + "/api/mcp/discover/install", + json={"provider": "official", "id": _WEATHER_ID}, + ) + assert resp.status == 200 + data = await resp.json() + assert data["name"] == "weather" + assert data["agent_spec_rewritten"] is False + written = json.loads(sandbox.kirocrew_json.read_text(encoding="utf-8")) + assert "weather" in written["mcpServers"], "the install must stay saved" + finally: + await client.close() + async def test_install_without_required_env_also_lands_disabled( self, sandbox, fake_sel, reset_registry ): diff --git a/website/integration/McpTab.integration.test.tsx b/website/integration/McpTab.integration.test.tsx index de8b1e92f453..77f07b9cf8bc 100644 --- a/website/integration/McpTab.integration.test.tsx +++ b/website/integration/McpTab.integration.test.tsx @@ -141,6 +141,41 @@ describe('McpTab Integration Tests', () => { }) }) + it('says the apply did not reach the agent spec instead of a green Applied', async () => { + const user = userEvent.setup() + server.use( + http.get('/api/mcp', () => HttpResponse.json([ + { + name: 'toggle-server', + status: 'ok', + enabled: true, + tools: ['ToggleTool'], + disabledTools: [], + command: 'node toggle', + presence: { kirocrew: true, kiroGlobal: false, ccGlobal: false }, + }, + ])), + http.post('/api/mcp/apply', () => HttpResponse.json({ + ok: true, applied: 1, results: [], rebuild: { ok: false, error: 'not rewritten' }, + })), + ) + + renderWithProviders() + await waitFor(() => expect(screen.getByText(/1 tools/)).toBeInTheDocument()) + await user.click(screen.getByText(/1 tools/)) + await user.click(await screen.findByText('ToggleTool')) + await user.click(await screen.findByRole('button', { name: /^apply$/i })) + + const notice = await screen.findByTestId('agent-spec-not-rewritten') + expect(screen.queryByText(/Applied 1 change/i)).not.toBeInTheDocument() + expect(within(notice).getByRole('button')).toBeInTheDocument() + + // Once a new change is staged, the hand-off would unmount the tab and drop it. + await user.click(screen.getByText('ToggleTool')) + await waitFor(() => expect(screen.getByText(/pending change/i)).toBeInTheDocument()) + expect(within(screen.getByTestId('agent-spec-not-rewritten')).queryByRole('button')).not.toBeInTheDocument() + }) + it('stages KiroCrew scope off and commits it via Apply', async () => { const user = userEvent.setup() diff --git a/website/src/api/client/browserAndComputerUse.ts b/website/src/api/client/browserAndComputerUse.ts index dccfca14e213..f23a4c9b0a9b 100644 --- a/website/src/api/client/browserAndComputerUse.ts +++ b/website/src/api/client/browserAndComputerUse.ts @@ -195,6 +195,8 @@ export interface ComputerUseConfigData { * Only ever non-zero on a save that FLIPPED `enabled` (see the handler); * absent on GET. */ sessions_reset?: number + /** Present when the enable changed; false when the agent spec was not rewritten. */ + agent_spec_rewritten?: boolean } /** Writable computer-use fields sent to PUT /api/computer-use/config. */ diff --git a/website/src/api/client/connections.ts b/website/src/api/client/connections.ts index bf2a97848db6..5fff6bc80bb9 100644 --- a/website/src/api/client/connections.ts +++ b/website/src/api/client/connections.ts @@ -139,7 +139,7 @@ export function createConnectionsEndpoints({ post, put, del, j, jfetch: fetch }: // whose URL could not be compared) names no file, and a gateway predating the // field sends none. connectionsDisconnect: (slug: string) => - post('/api/connections/disconnect', { slug }).then(j) as Promise<{ ok: boolean; grantRemoved: boolean; grantSurviving: string[]; entryRemoved: boolean; grantSharedWith: string[]; grantCensusIncomplete: boolean; grantCensusUnreadable?: string[] }>, + post('/api/connections/disconnect', { slug }).then(j) as Promise<{ ok: boolean; grantRemoved: boolean; grantSurviving: string[]; entryRemoved: boolean; grantSharedWith: string[]; grantCensusIncomplete: boolean; grantCensusUnreadable?: string[]; agentSpecRewritten?: boolean }>, // Operator-registered OAuth clients for providers that refuse dynamic client // registration (Settings → OAuth Apps). The list is readable by any dashboard // user (it is what the gallery's "needs configuration" card is built from and @@ -149,9 +149,9 @@ export function createConnectionsEndpoints({ post, put, del, j, jfetch: fetch }: // Omitted fields are left as they are, so the id can be saved without re-entering // a secret the panel never displays; `client_secret_clear` removes the stored one. connectionsOAuthClientSave: (slug: string, body: ConnectionOAuthClientSave) => - put(`/api/connections/oauth-clients/${encodeURIComponent(slug)}`, body).then(j) as Promise<{ ok: boolean; client: ConnectionOAuthClient | null }>, + put(`/api/connections/oauth-clients/${encodeURIComponent(slug)}`, body).then(j) as Promise<{ ok: boolean; client: ConnectionOAuthClient | null; agent_spec_rewritten?: boolean }>, connectionsOAuthClientDelete: (slug: string) => - del(`/api/connections/oauth-clients/${encodeURIComponent(slug)}`).then(j) as Promise<{ ok: boolean; client: ConnectionOAuthClient | null }>, + del(`/api/connections/oauth-clients/${encodeURIComponent(slug)}`).then(j) as Promise<{ ok: boolean; client: ConnectionOAuthClient | null; agent_spec_rewritten?: boolean }>, } return { accounts } diff --git a/website/src/api/client/mcp.ts b/website/src/api/client/mcp.ts index c282327c4f48..7a0fdc46d9ed 100644 --- a/website/src/api/client/mcp.ts +++ b/website/src/api/client/mcp.ts @@ -106,13 +106,13 @@ export function createMcpEndpoints({ get, post, put, j, jfetch: fetch }: ClientT post('/api/mcp/discover/install', { provider, id }).then(j) as Promise, mcpCustomAdd: (servers: Record, enable: boolean) => - post('/api/mcp/custom', { servers, enable }).then(j) as Promise<{ ok: boolean; added: string[]; enabled: boolean }>, + post('/api/mcp/custom', { servers, enable }).then(j) as Promise<{ ok: boolean; added: string[]; enabled: boolean; agent_spec_rewritten?: boolean }>, mcpCustomGet: (name: string) => get(`/api/mcp/custom/${encodeURIComponent(name)}`).then(j) as Promise, mcpCustomUpdate: (name: string, spec: import('../../types').McpCustomSpec) => - put(`/api/mcp/custom/${encodeURIComponent(name)}`, { spec }).then(j) as Promise<{ ok: boolean; name: string }>, + put(`/api/mcp/custom/${encodeURIComponent(name)}`, { spec }).then(j) as Promise<{ ok: boolean; name: string; agent_spec_rewritten?: boolean }>, mcpActive: (agent?: string) => fetch('/api/mcp/active' + (agent ? `?agent=${encodeURIComponent(agent)}` : '')).then(j), mcpProbe: () => post('/api/mcp/probe').then(j), mcpResetProbeFailures: (name: string) => diff --git a/website/src/api/client/onboarding.ts b/website/src/api/client/onboarding.ts index 65674090bf75..df454f895684 100644 --- a/website/src/api/client/onboarding.ts +++ b/website/src/api/client/onboarding.ts @@ -248,6 +248,8 @@ export interface AgentImportApplyResponse { ok: true conflict_strategy: AgentImportConflictStrategy summary: AgentImportSummary + /** Present when MCP servers were imported; false when the agent spec was not rewritten. */ + agent_spec_rewritten?: boolean } export function createOnboardingEndpoints({ get, post, put, j, jNullable }: ClientTransport) { diff --git a/website/src/components/AgentImportFlow.test.tsx b/website/src/components/AgentImportFlow.test.tsx index ff351a94f4dd..19cc538aed21 100644 --- a/website/src/components/AgentImportFlow.test.tsx +++ b/website/src/components/AgentImportFlow.test.tsx @@ -620,6 +620,31 @@ describe('AgentImportFlow', () => { expect(onComplete).not.toHaveBeenCalled() }) + it('says the import is not live when the agent spec was not rewritten', async () => { + mockSuccessfulRequests() + vi.mocked(api.onboardingImportApply).mockResolvedValue({ ...APPLY_RESPONSE, agent_spec_rewritten: false }) + + renderWithProviders() + await startImport() + await screen.findByText('Import complete') + + expect(await screen.findByTestId('agent-spec-not-rewritten')).toHaveTextContent( + 'Saved, but this copy of Kiro Crew could not update the agent config', + ) // "Ready" would contradict the notice. + expect(screen.queryByText(/ready in Kiro Crew/i)).not.toBeInTheDocument() + }) + + it('shows no notice when the agent spec was rewritten', async () => { + mockSuccessfulRequests() + vi.mocked(api.onboardingImportApply).mockResolvedValue({ ...APPLY_RESPONSE, agent_spec_rewritten: true }) + + renderWithProviders() + await startImport() + await screen.findByText('Import complete') + + expect(screen.queryByTestId('agent-spec-not-rewritten')).not.toBeInTheDocument() + }) + it('offers a resolution when items conflict, and does not by default', async () => { mockSuccessfulRequests() vi.mocked(api.onboardingImportApply).mockResolvedValue(CONFLICTED_APPLY_RESPONSE) diff --git a/website/src/components/AgentImportFlow.tsx b/website/src/components/AgentImportFlow.tsx index 35439d28e548..207d21991a0a 100644 --- a/website/src/components/AgentImportFlow.tsx +++ b/website/src/components/AgentImportFlow.tsx @@ -27,6 +27,7 @@ import { fmtList } from '../i18n/format' import { useDocumentImeLatch } from '../hooks/useImeGuard' import { Btn, SendBtn } from './ui' import ErrorNotice from './ErrorNotice' +import AgentSpecNotRewrittenNotice, { agentSpecNotRewritten } from './AgentSpecNotRewrittenNotice' import OnboardingChapterShell, { OnboardingShellContext, type ShellAsideCopy, @@ -547,7 +548,10 @@ export default function AgentImportFlow({ }, 4: { title: i18nT('components.agentImportFlow.import_complete'), - description: i18nT('components.agentImportFlow.your_selected_setup_is_ready_in_kiro_crew'), + // "Ready" would contradict the notice when the agent spec did not follow. + description: agentSpecNotRewritten(applyMutation.data) + ? '' + : i18nT('components.agentImportFlow.your_selected_setup_is_ready_in_kiro_crew'), }, } const { title, description } = headings[stage] @@ -556,7 +560,7 @@ export default function AgentImportFlow({

{title}

-

{description}

+ {description &&

{description}

} ) })() @@ -903,6 +907,7 @@ export default function AgentImportFlow({
{summary?.skipped ?? 0}
+ {agentSpecNotRewritten(applyMutation.data) && } {!!summary?.resolvable_conflicts && (
+ ) +} diff --git a/website/src/components/McpBrowserModal.tsx b/website/src/components/McpBrowserModal.tsx index 699871147cf5..216e2c526ae7 100644 --- a/website/src/components/McpBrowserModal.tsx +++ b/website/src/components/McpBrowserModal.tsx @@ -15,6 +15,7 @@ import { Download, Check, ExternalLink, Loader2, RefreshCw, ArrowLeft, KeyRound, import { api, ApiError } from '../api/client' import Modal from './Modal' import ErrorNotice from './ErrorNotice' +import AgentSpecNotRewrittenNotice, { agentSpecNotRewritten } from './AgentSpecNotRewrittenNotice' import { errMessage } from '../utils/thunkError' import { Btn } from './ui' import MarkdownRenderer from './MarkdownRenderer' @@ -28,12 +29,15 @@ import { useImeGuard } from '../hooks/useImeGuard' interface Props { open: boolean onClose: () => void + /** Whether the not-applied notice may offer the agent hand-off; the host turns it + * off while it holds unsaved state the hand-off's navigation would discard. */ + askAgent?: boolean } /** Per-server install lifecycle for UI feedback. */ type InstallPhase = | { step: 'installing' } - | { step: 'done'; name: string; requiredEnv: string[]; enabled: boolean } + | { step: 'done'; name: string; requiredEnv: string[]; enabled: boolean; specNotRewritten: boolean } | { step: 'conflict' } | { step: 'error'; message: string } @@ -85,7 +89,7 @@ function ProviderFailureNotice({ ) } -export default function McpBrowserModal({ open, onClose }: Props) { +export default function McpBrowserModal({ open, onClose, askAgent = true }: Props) { const ime = useImeGuard() const queryClient = useQueryClient() const [query, setQuery] = useState('') @@ -184,6 +188,7 @@ export default function McpBrowserModal({ open, onClose }: Props) { // Absent (capability installs) means enabled; official installs // with required env land disabled until the user configures them. enabled: result.enabled !== false, + specNotRewritten: agentSpecNotRewritten(result), }) setInstalledOverride(prev => new Set(prev).add(key)) queryClient.invalidateQueries({ queryKey: ['mcp-servers'] }) @@ -397,6 +402,7 @@ export default function McpBrowserModal({ open, onClose }: Props) { installed={isInstalled(selectedServer)} phase={installPhases[serverKey(selectedServer)]} onInstall={handleInstall} + askAgent={askAgent} />
@@ -508,11 +514,13 @@ function ServerDetailPanel({ installed, phase, onInstall, + askAgent, }: { server: DiscoveredMcpServer installed: boolean phase: InstallPhase | undefined onInstall: (server: DiscoveredMcpServer) => void + askAgent: boolean }) { const { data: detail, isLoading: detailLoading, error: detailError } = useQuery({ queryKey: ['mcp-discover-detail', server.provider, server.id], @@ -565,6 +573,7 @@ function ServerDetailPanel({ )} + {phase?.step === 'done' && phase.specNotRewritten && } {phase?.step === 'done' && !phase.enabled && (
{i18nT('components.mcpBrowserModal.installed_disabled_review_the_entry_in_the_serve')} diff --git a/website/src/components/McpCustomServerModal.test.tsx b/website/src/components/McpCustomServerModal.test.tsx new file mode 100644 index 000000000000..e61581afdfb9 --- /dev/null +++ b/website/src/components/McpCustomServerModal.test.tsx @@ -0,0 +1,77 @@ +import { fireEvent, screen, waitFor, within } from '@testing-library/react' +import { beforeEach, describe, expect, it, vi } from 'vitest' +import { api } from '../api/client' +import { renderWithProviders } from '../test/helpers' +import McpCustomServerModal from './McpCustomServerModal' + +vi.mock('../api/client', async (importOriginal) => { + const mod = await importOriginal() + return { + ...mod, + api: { + mcpCustomAdd: vi.fn(), + mcpCustomGet: vi.fn(), + mcpCustomUpdate: vi.fn(), + }, + } +}) + +const SERVERS = JSON.stringify({ mcpServers: { weather: { command: 'npx', args: ['weather'] } } }) + +async function addOne(onClose: () => void, askAgent = true) { + renderWithProviders() + const textarea = document.querySelector('textarea') + expect(textarea).not.toBeNull() + fireEvent.change(textarea!, { target: { value: SERVERS } }) + fireEvent.click(await screen.findByRole('button', { name: /^Add/ })) + await waitFor(() => expect(api.mcpCustomAdd).toHaveBeenCalledTimes(1)) +} + +describe('McpCustomServerModal', () => { + beforeEach(() => vi.clearAllMocks()) + + it('closes after an add that reached the agent spec', async () => { + vi.mocked(api.mcpCustomAdd).mockResolvedValue({ + ok: true, + added: ['weather'], + enabled: false, + agent_spec_rewritten: true, + }) + const onClose = vi.fn() + await addOne(onClose) + await waitFor(() => expect(onClose).toHaveBeenCalled()) + expect(screen.queryByTestId('agent-spec-not-rewritten')).not.toBeInTheDocument() + }) + + it('stays open and says so when the add did not reach the agent spec', async () => { + vi.mocked(api.mcpCustomAdd).mockResolvedValue({ + ok: true, + added: ['weather'], + enabled: false, + agent_spec_rewritten: false, + }) + const onClose = vi.fn() + await addOne(onClose) + expect(await screen.findByTestId('agent-spec-not-rewritten')).toHaveTextContent( + 'Saved, but this copy of Kiro Crew could not update the agent config', + ) + expect(onClose).not.toHaveBeenCalled() + // The server is already saved: a second Add would only collide with it. + expect(screen.queryByRole('button', { name: /^Add/ })).not.toBeInTheDocument() + // The server is saved, so the way out is Close, not Cancel. + expect(screen.getAllByRole('button', { name: 'Close' }).length).toBeGreaterThan(0) + expect(screen.queryByRole('button', { name: 'Cancel' })).not.toBeInTheDocument() + }) + + it('drops the hand-off when the host holds unsaved state', async () => { + vi.mocked(api.mcpCustomAdd).mockResolvedValue({ + ok: true, + added: ['weather'], + enabled: false, + agent_spec_rewritten: false, + }) + await addOne(vi.fn(), false) + const notice = await screen.findByTestId('agent-spec-not-rewritten') + expect(within(notice).queryByRole('button')).not.toBeInTheDocument() + }) +}) diff --git a/website/src/components/McpCustomServerModal.tsx b/website/src/components/McpCustomServerModal.tsx index bb0fb2371391..3fbf6862ddc8 100644 --- a/website/src/components/McpCustomServerModal.tsx +++ b/website/src/components/McpCustomServerModal.tsx @@ -20,6 +20,7 @@ import { AlertTriangle, Check, Loader2 } from 'lucide-react' import { api, ApiError } from '../api/client' import Modal from './Modal' import ErrorNotice from './ErrorNotice' +import AgentSpecNotRewrittenNotice, { agentSpecNotRewritten } from './AgentSpecNotRewrittenNotice' import { Btn } from './ui' import type { McpCustomSpec } from '../types' @@ -30,6 +31,9 @@ interface Props { onClose: () => void /** When set, the modal edits this installed server instead of adding. */ editName?: string | null + /** Whether the not-applied notice may offer the agent hand-off; the host turns it + * off while it holds unsaved state the hand-off's navigation would discard. */ + askAgent?: boolean } /** Result of client-side parsing of the pasted JSON. */ @@ -113,13 +117,15 @@ const PLACEHOLDER = JSON.stringify( 2, ) -export default function McpCustomServerModal({ open, onClose, editName }: Props) { +export default function McpCustomServerModal({ open, onClose, editName, askAgent = true }: Props) { const queryClient = useQueryClient() const editing = !!editName const [text, setText] = useState('') const [bareName, setBareName] = useState('') const [enableNow, setEnableNow] = useState(false) const [submitError, setSubmitError] = useState(null) + // The save landed but the agent spec did not follow: stay open to say so. + const [notApplied, setNotApplied] = useState(false) // Reset per open so a reopened modal never carries stale state. useEffect(() => { @@ -128,6 +134,7 @@ export default function McpCustomServerModal({ open, onClose, editName }: Props) setBareName('') setEnableNow(false) setSubmitError(null) + setNotApplied(false) } }, [open, editName]) @@ -169,9 +176,10 @@ export default function McpCustomServerModal({ open, onClose, editName }: Props) const addMutation = useMutation({ mutationFn: () => api.mcpCustomAdd(parsed!.ok ? parsed!.servers : {}, enableNow), - onSuccess: () => { + onSuccess: (r) => { queryClient.invalidateQueries({ queryKey: ['mcp-servers'] }) - onClose() + if (agentSpecNotRewritten(r)) setNotApplied(true) + else onClose() }, onError: (err) => { if (err instanceof ApiError && err.status === 409) { @@ -184,9 +192,10 @@ export default function McpCustomServerModal({ open, onClose, editName }: Props) const updateMutation = useMutation({ mutationFn: () => api.mcpCustomUpdate(editName!, parsed!.ok ? parsed!.servers[editName!] : {}), - onSuccess: () => { + onSuccess: (r) => { queryClient.invalidateQueries({ queryKey: ['mcp-servers'] }) - onClose() + if (agentSpecNotRewritten(r)) setNotApplied(true) + else onClose() }, onError: (err) => setSubmitError(err instanceof Error ? err.message : String(err)), }) @@ -194,7 +203,7 @@ export default function McpCustomServerModal({ open, onClose, editName }: Props) const busy = addMutation.isPending || updateMutation.isPending const submit = () => { setSubmitError(null) - if (!canSubmit || busy) return + if (!canSubmit || busy || notApplied) return if (editing) updateMutation.mutate() else addMutation.mutate() } @@ -295,6 +304,7 @@ export default function McpCustomServerModal({ open, onClose, editName }: Props) message={submitError} testId="mcp-custom-submit-error" /> + {notApplied && }
{!editing ? ( @@ -317,7 +327,12 @@ export default function McpCustomServerModal({ open, onClose, editName }: Props) {i18nT('components.mcpCustomServerModal.saving_keeps_the_server_s_enabled_disabled_state')} )}
- {i18nT('components.mcpCustomServerModal.cancel')} + {/* After a save that landed, "Cancel" would read as discarding it. */} + + {notApplied ? i18nT('app.close') : i18nT('components.mcpCustomServerModal.cancel')} + + {/* Once the save landed, Close is the only action left. */} + {!notApplied && ( {busy ? ( + )}
diff --git a/website/src/i18n/locales/bn.json b/website/src/i18n/locales/bn.json index 7bd715e92d30..c65a45077007 100644 --- a/website/src/i18n/locales/bn.json +++ b/website/src/i18n/locales/bn.json @@ -5805,6 +5805,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "আপনার বিদ্যমান {{productName}} সেটআপ প্রভাবিত হবে না।", "your_selected_setup_is_ready_in_kiro_crew": "তোমার নির্বাচিত সেটআপ {{productName}}-এ তৈরি।" }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "সংরক্ষিত হয়েছে, কিন্তু এই {{productName}} এজেন্ট কনফিগারেশন আপডেট করতে পারেনি, তাই নতুন চ্যাটগুলো আগের সেটআপ রাখবে। কারণ জানতে 'লগ' পেজ খোলো।" + }, "agentSelector": { "agent_list": "এজেন্ট তালিকা", "default": "ডিফল্ট", @@ -12265,6 +12268,7 @@ "disconnect_census_incomplete": "সংরক্ষিত অনুমতিটি রাখা হয়েছে কারণ একটি কনফিগারেশন উৎস পড়া যায়নি, তাই অন্য কোনো সার্ভার এটি ব্যবহার করছে কিনা তা নিশ্চিত করা যায়নি। সার্ভার কনফিগারেশন পরীক্ষা করে আবার সংযোগ বিচ্ছিন্ন করুন।", "disconnect_census_incomplete_source": "{{source}} পড়া যায়নি, তাই অন্য কোনো সার্ভার এটি ব্যবহার করছে কিনা তা নিশ্চিত করা যায়নি এবং সংরক্ষিত অনুমতিটি রাখা হয়েছে। ওই ফাইলটি ঠিক করুন বা সরান এবং আবার সংযোগ বিচ্ছিন্ন করুন।", "disconnect_entry_left_alone": "তোমার সার্ভার কনফিগারেশন অপরিবর্তিত রাখা হয়েছে। MCP সার্ভার ট্যাব থেকে এই এন্ট্রিটি পরিচালনা করা যাবে।", + "disconnect_spec_not_rewritten": "এই {{productName}} এজেন্ট কনফিগারেশন আপডেট করতে পারেনি, তাই নতুন চ্যাটগুলো এখনও এই সংযোগ লোড করবে। কারণ জানতে 'লগ' পেজ খোলো।", "disconnect_entry_not_ours": "সংরক্ষিত অনুমোদন সরিয়ে দেওয়া হয়েছে। তোমার সার্ভার কনফিগারেশন অপরিবর্তিত রাখা হয়েছে। MCP সার্ভার ট্যাব থেকে এই এন্ট্রিটি পরিচালনা করা যাবে।", "disconnect_grant_shared": "একই এন্ডপয়েন্ট নিচের সার্ভারেও কনফিগার করা আছে, তাই সঞ্চিত অনুমতি রাখা হয়েছে: {{names}}। প্রোভাইডারের কাছে বাতিল করলে এদের অ্যাক্সেসও বন্ধ হয়ে যাবে।", "disconnect_grant_survived": "সঞ্চিত অনুমতির কিছু অংশ সরানো যায়নি। প্রদানকারীর কাছে অ্যাক্সেস বাতিল করুন।", @@ -15854,7 +15858,8 @@ "takes_focus_and_cursor": "ফোকাস + কার্সর", "on_windows_keystrokes_take_your_keyboard_focus": "Windows-এ কীস্ট্রোক আপনার কীবোর্ড ফোকাস নিয়ে নেয় এবং কোঅর্ডিনেট ক্লিক আপনার আসল কার্সার সরায় — এই প্ল্যাটফর্মে অ্যাপ-ভিত্তিক ইনপুট পথ নেই।", "the_app_lists_in_computer_use_json_could_not_be": "computer_use.json-এ থাকা অ্যাপের তালিকা পড়া যায়নি, তাই এখানে খালি দেখানো হচ্ছে। ফাইলটি বৈধ JSON না হওয়া পর্যন্ত এজেন্ট ওই তালিকার উপর নির্ভরশীল প্রতিটি কাজ করতেই অস্বীকার করবে।", - "your_chat_sessions_were_restarted_so_this_takes": "তোমার চ্যাট সেশনগুলো আবার চালু করা হয়েছে যাতে এটা সঙ্গে সঙ্গেই কাজ করে — Kiro প্রতি সেশনে একবারই তার টুলের তালিকা পড়ে, তাই খোলা চ্যাট এটা টের পেত না। তোমার মেসেজ সবই আছে; পরের মেসেজেই এজেন্ট তার কনটেক্সট আবার পড়ে নেবে।" + "your_chat_sessions_were_restarted_so_this_takes": "তোমার চ্যাট সেশনগুলো আবার চালু করা হয়েছে যাতে এটা সঙ্গে সঙ্গেই কাজ করে — Kiro প্রতি সেশনে একবারই তার টুলের তালিকা পড়ে, তাই খোলা চ্যাট এটা টের পেত না। তোমার মেসেজ সবই আছে; পরের মেসেজেই এজেন্ট তার কনটেক্সট আবার পড়ে নেবে।", + "your_chat_sessions_were_restarted": "তোমার চ্যাট সেশনগুলো আবার চালু করা হয়েছে। তোমার বার্তাগুলো এখনও আছে।" }, "crewmatesSection": { "title": "ক্রু সদস্যরা", diff --git a/website/src/i18n/locales/de.json b/website/src/i18n/locales/de.json index 7c2994779b00..bce51152029e 100644 --- a/website/src/i18n/locales/de.json +++ b/website/src/i18n/locales/de.json @@ -5805,6 +5805,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "Ihre bestehende {{productName}}-Einrichtung bleibt unberührt.", "your_selected_setup_is_ready_in_kiro_crew": "Deine ausgewählte Konfiguration ist in {{productName}} bereit." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "Gespeichert, aber diese {{productName}}-Instanz konnte die Agent-Konfiguration nicht aktualisieren, daher behalten neue Chats die alte Einrichtung. Den Grund findest du auf der Seite „Protokolle“." + }, "agentSelector": { "agent_list": "Agenten-Liste", "default": "Standard", @@ -12265,6 +12268,7 @@ "disconnect_census_incomplete": "Die gespeicherte Berechtigung wurde beibehalten, weil eine Konfigurationsquelle nicht gelesen werden konnte, um auszuschließen, dass ein anderer Server sie verwendet. Überprüfen Sie Ihre Serverkonfiguration und trennen Sie erneut.", "disconnect_census_incomplete_source": "Die gespeicherte Berechtigung wurde beibehalten, weil {{source}} nicht gelesen werden konnte, um auszuschließen, dass ein anderer Server sie verwendet. Beheben oder entfernen Sie diese Datei und trennen Sie erneut.", "disconnect_entry_left_alone": "Ihre Serverkonfiguration wurde nicht verändert. Dieser Eintrag kann im Tab „MCP-Server“ verwaltet werden.", + "disconnect_spec_not_rewritten": "Diese {{productName}}-Instanz konnte die Agent-Konfiguration nicht aktualisieren, daher laden neue Chats diese Verbindung weiterhin. Den Grund findest du auf der Seite „Protokolle“.", "disconnect_entry_not_ours": "Die gespeicherte Berechtigung wurde entfernt. Ihre Serverkonfiguration wurde nicht verändert. Dieser Eintrag kann im Tab „MCP-Server“ verwaltet werden.", "disconnect_grant_shared": "Die gespeicherte Berechtigung wurde beibehalten, da derselbe Endpunkt auch von Folgenden konfiguriert wird: {{names}}. Ein Widerruf beim Anbieter würde auch deren Zugriff beenden.", "disconnect_grant_survived": "Ein Teil der gespeicherten Berechtigung konnte nicht entfernt werden. Widerrufen Sie den Zugriff beim Anbieter.", @@ -15854,7 +15858,8 @@ "takes_focus_and_cursor": "Fokus + Zeiger", "on_windows_keystrokes_take_your_keyboard_focus": "Unter Windows übernehmen Tastenanschläge Ihren Tastaturfokus und Koordinatenklicks bewegen Ihren echten Mauszeiger — auf dieser Plattform gibt es keinen App-spezifischen Eingabeweg.", "the_app_lists_in_computer_use_json_could_not_be": "Die App-Listen in computer_use.json konnten nicht gelesen werden, daher werden sie hier leer angezeigt. Der Agent verweigert weiterhin jede Aktion, die von ihnen abhängt, bis die Datei gültiges JSON ist.", - "your_chat_sessions_were_restarted_so_this_takes": "Deine Chat-Sitzungen wurden neu gestartet, damit dies sofort wirkt — Kiro liest seine Werkzeugliste einmal pro Sitzung, ein offener Chat hätte sie sonst nicht übernommen. Deine Nachrichten sind weiterhin da; der Agent liest seinen Kontext bei deiner nächsten Nachricht erneut." + "your_chat_sessions_were_restarted_so_this_takes": "Deine Chat-Sitzungen wurden neu gestartet, damit dies sofort wirkt — Kiro liest seine Werkzeugliste einmal pro Sitzung, ein offener Chat hätte sie sonst nicht übernommen. Deine Nachrichten sind weiterhin da; der Agent liest seinen Kontext bei deiner nächsten Nachricht erneut.", + "your_chat_sessions_were_restarted": "Deine Chat-Sitzungen wurden neu gestartet. Deine Nachrichten sind noch da." }, "crewmatesSection": { "title": "Crew-Mitglieder", diff --git a/website/src/i18n/locales/en-XA.json b/website/src/i18n/locales/en-XA.json index 63e884708113..7ff7db6ed8fa 100644 --- a/website/src/i18n/locales/en-XA.json +++ b/website/src/i18n/locales/en-XA.json @@ -5343,6 +5343,9 @@ "the_import_did_not_finish_please_try_again": "[Ţĥè ìɱþøŕţ ðìð ñøţ ƒìñìşĥ. Þĺèàşè ţŕý àğàìñ. ······················]", "your_selected_setup_is_ready_in_kiro_crew": "[Ýøùŕ şèĺèçţèð şèţùþ ìş ŕèàðý ìñ {{productName}}. ·················]" }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "[Şàṽèð, ƀùţ ţĥìş çøþý øƒ {{productName}} çøùĺð ñøţ ùþðàţè ţĥè àğèñţ çøñƒìğ, şø ñèẁ çĥàţş ķèèþ ţĥè øĺð şèţùþ. Øþèñ ţĥè Ĺøğş þàğè ţø şèè ẁĥý. ·····································]" + }, "agentSelector": { "agent_list": "[Àğèñţ ĺìşţ ···············]", "default": "[ðèƒàùĺţ ···········]", @@ -15458,7 +15461,8 @@ "takes_focus_and_cursor": "[Ƒøçùş + çùŕşøŕ ·············]", "on_windows_keystrokes_take_your_keyboard_focus": "[Øñ Ẁìñðøẁş, ķèýşţŕøķèş ţàķè ýøùŕ ķèýƀøàŕð ƒøçùş àñð çøøŕðìñàţè çĺìçķş ɱøṽè ýøùŕ ŕèàĺ çùŕşøŕ — ţĥèŕè ìş ñø þèŕ-àþþ ìñþùţ ŕøùţè øñ ţĥìş þĺàţƒøŕɱ. ···········································]", "the_app_lists_in_computer_use_json_could_not_be": "[Ţĥè àþþ ĺìşţş ìñ çøɱþùţèŕ_ùşè.ĵşøñ çøùĺð ñøţ ƀè ŕèàð, şø ţĥèý àŕè şĥøẁñ èɱþţý ĥèŕè. Ţĥè àğèñţ şţìĺĺ ŕèƒùşèş èṽèŕý àçţìøñ ţĥàţ ðèþèñðş øñ ţĥèɱ ùñţìĺ ţĥè ƒìĺè ìş ṽàĺìð ĴŞØÑ. ···················································]", - "your_chat_sessions_were_restarted_so_this_takes": "[Ýøùŕ çĥàţ şèşşìøñş ẁèŕè ŕèşţàŕţèð şø ţĥìş ţàķèş èƒƒèçţ ŕìğĥţ àẁàý — Ķìŕø ŕèàðş ìţş ţøøĺ ĺìşţ øñçè þèŕ şèşşìøñ, şø àñ øþèñ çĥàţ ẁøùĺð ñøţ ĥàṽè þìçķèð ìţ ùþ øţĥèŕẁìşè. Ýøùŕ ɱèşşàğèş àŕè şţìĺĺ ţĥèŕè; ţĥè àğèñţ ŕè-ŕèàðş ìţş çøñţèẋţ øñ ýøùŕ ñèẋţ ɱèşşàğè. ···········································································]" + "your_chat_sessions_were_restarted_so_this_takes": "[Ýøùŕ çĥàţ şèşşìøñş ẁèŕè ŕèşţàŕţèð şø ţĥìş ţàķèş èƒƒèçţ ŕìğĥţ àẁàý — Ķìŕø ŕèàðş ìţş ţøøĺ ĺìşţ øñçè þèŕ şèşşìøñ, şø àñ øþèñ çĥàţ ẁøùĺð ñøţ ĥàṽè þìçķèð ìţ ùþ øţĥèŕẁìşè. Ýøùŕ ɱèşşàğèş àŕè şţìĺĺ ţĥèŕè; ţĥè àğèñţ ŕè-ŕèàðş ìţş çøñţèẋţ øñ ýøùŕ ñèẋţ ɱèşşàğè. ···········································································]", + "your_chat_sessions_were_restarted": "[Ýøùŕ çĥàţ şèşşìøñş ẁèŕè ŕèşţàŕţèð. Ýøùŕ ɱèşşàğèş àŕè şţìĺĺ ţĥèŕè. ·······················]" }, "developerPanel": { "developer_mode": "[Ðèṽèĺøþèŕ Ṁøðè ·············]", @@ -17370,6 +17374,7 @@ "disconnect_census_incomplete": "[Ţĥè şţøŕèð ğŕàñţ ẁàş ķèþţ ƀèçàùşè à çøñƒìğùŕàţìøñ şøùŕçè çøùĺð ñøţ ƀè ŕèàð ţø ŕùĺè øùţ àñøţĥèŕ şèŕṽèŕ ùşìñğ ìţ. Çĥèçķ ýøùŕ şèŕṽèŕ çøñƒìğùŕàţìøñ àñð ðìşçøññèçţ àğàìñ. ··················································]", "disconnect_census_incomplete_source": "[Ţĥè şţøŕèð ğŕàñţ ẁàş ķèþţ ƀèçàùşè {{source}} çøùĺð ñøţ ƀè ŕèàð ţø ŕùĺè øùţ àñøţĥèŕ şèŕṽèŕ ùşìñğ ìţ. Ƒìẋ øŕ ŕèɱøṽè ţĥàţ ƒìĺè àñð ðìşçøññèçţ àğàìñ. ·········································]", "disconnect_entry_left_alone": "[Ýøùŕ şèŕṽèŕ çøñƒìğùŕàţìøñ ẁàş ĺèƒţ ùñçĥàñğèð. Ýøù çàñ ɱàñàğè ţĥìş èñţŕý ƒŕøɱ ţĥè ṀÇÞ Şèŕṽèŕş ţàƀ. ·····························]", + "disconnect_spec_not_rewritten": "[Ţĥìş çøþý øƒ {{productName}} çøùĺð ñøţ ùþðàţè ţĥè àğèñţ çøñƒìğ, şø ñèẁ çĥàţş şţìĺĺ ĺøàð ţĥìş çøññèçţìøñ. Øþèñ ţĥè Ĺøğş þàğè ţø şèè ẁĥý. ····································]", "disconnect_entry_not_ours": "[Ţĥè şţøŕèð ğŕàñţ ẁàş ŕèɱøṽèð. Ýøùŕ şèŕṽèŕ çøñƒìğùŕàţìøñ ẁàş ĺèƒţ ùñçĥàñğèð. Ýøù çàñ ɱàñàğè ţĥìş èñţŕý ƒŕøɱ ţĥè ṀÇÞ Şèŕṽèŕş ţàƀ. ······································]", "disconnect_grant_shared": "[Ţĥè şţøŕèð ğŕàñţ ẁàş ķèþţ ƀèçàùşè ţĥè şàɱè èñðþøìñţ ìş àĺşø çøñƒìğùŕèð ƀý: {{names}}. Ŕèṽøķìñğ àţ ţĥè þŕøṽìðèŕ ẁøùĺð çùţ øƒƒ ţĥèìŕ àççèşş ţøø. ········································]", "disconnect_grant_survived": "[Þàŕţ øƒ ţĥè şţøŕèð ğŕàñţ çøùĺð ñøţ ƀè ŕèɱøṽèð. Ŕèṽøķè àççèşş àţ ţĥè þŕøṽìðèŕ. ·······················]", diff --git a/website/src/i18n/locales/en.json b/website/src/i18n/locales/en.json index e286588cafde..d375394dedb0 100644 --- a/website/src/i18n/locales/en.json +++ b/website/src/i18n/locales/en.json @@ -4099,6 +4099,9 @@ "files_could_not_be_read": "Files could not be read", "your_existing_kirocrew_setup_will_not_be_affecte": "Your existing {{productName}} setup will not be affected." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "Saved, but this copy of {{productName}} could not update the agent config, so new chats keep the old setup. Open the Logs page to see why." + }, "agentSelector": { "agent_list": "Agent list", "default": "default", diff --git a/website/src/i18n/locales/en.manual.json b/website/src/i18n/locales/en.manual.json index 5d92196f2849..f219a0d7d456 100644 --- a/website/src/i18n/locales/en.manual.json +++ b/website/src/i18n/locales/en.manual.json @@ -5662,6 +5662,7 @@ "disconnect_census_incomplete": "The stored grant was kept because a configuration source could not be read to rule out another server using it. Check your server configuration and disconnect again.", "disconnect_census_incomplete_source": "The stored grant was kept because {{source}} could not be read to rule out another server using it. Fix or remove that file and disconnect again.", "disconnect_entry_left_alone": "Your server configuration was left unchanged. You can manage this entry from the MCP Servers tab.", + "disconnect_spec_not_rewritten": "This copy of {{productName}} could not update the agent config, so new chats still load this connection. Open the Logs page to see why.", "disconnect_entry_not_ours": "The stored grant was removed. Your server configuration was left unchanged. You can manage this entry from the MCP Servers tab.", "disconnect_grant_shared": "The stored grant was kept because the same endpoint is also configured by: {{names}}. Revoking at the provider would cut off their access too.", "disconnect_grant_survived": "Part of the stored grant could not be removed. Revoke access at the provider.", @@ -7222,7 +7223,8 @@ "takes_focus_and_cursor": "Focus + cursor", "on_windows_keystrokes_take_your_keyboard_focus": "On Windows, keystrokes take your keyboard focus and coordinate clicks move your real cursor — there is no per-app input route on this platform.", "the_app_lists_in_computer_use_json_could_not_be": "The app lists in computer_use.json could not be read, so they are shown empty here. The agent still refuses every action that depends on them until the file is valid JSON.", - "your_chat_sessions_were_restarted_so_this_takes": "Your chat sessions were restarted so this takes effect right away — Kiro reads its tool list once per session, so an open chat would not have picked it up otherwise. Your messages are still there; the agent re-reads its context on your next message." + "your_chat_sessions_were_restarted_so_this_takes": "Your chat sessions were restarted so this takes effect right away — Kiro reads its tool list once per session, so an open chat would not have picked it up otherwise. Your messages are still there; the agent re-reads its context on your next message.", + "your_chat_sessions_were_restarted": "Your chat sessions were restarted. Your messages are still there." }, "postureDisclosure": { "filter": "Filter {{label}}", diff --git a/website/src/i18n/locales/es.json b/website/src/i18n/locales/es.json index 0a75900af8ac..7df162c940b1 100644 --- a/website/src/i18n/locales/es.json +++ b/website/src/i18n/locales/es.json @@ -5897,6 +5897,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "Tu configuración existente de {{productName}} no se verá afectada.", "your_selected_setup_is_ready_in_kiro_crew": "La configuración que seleccionaste ya está lista en {{productName}}." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "Guardado, pero esta copia de {{productName}} no pudo actualizar la configuración del agente, así que los chats nuevos mantienen la configuración anterior. Abre la página «Registros» para ver el motivo." + }, "agentSelector": { "agent_list": "Lista de agentes", "default": "predeterminado", @@ -12454,6 +12457,7 @@ "disconnect_census_incomplete": "Se conservó la autorización almacenada porque no se pudo leer una fuente de configuración para descartar que otro servidor la use. Revisa la configuración de tu servidor y vuelve a desconectar.", "disconnect_census_incomplete_source": "Se conservó la autorización almacenada porque no se pudo leer {{source}} para descartar que otro servidor la use. Corrige o elimina ese archivo y vuelve a desconectar.", "disconnect_entry_left_alone": "La configuración de tu servidor no se modificó. Puedes gestionar esta entrada desde la pestaña Servidores MCP.", + "disconnect_spec_not_rewritten": "Esta copia de {{productName}} no pudo actualizar la configuración del agente, así que los chats nuevos siguen cargando esta conexión. Abre la página «Registros» para ver el motivo.", "disconnect_entry_not_ours": "Se eliminó la autorización almacenada. La configuración de tu servidor no se modificó. Puedes gestionar esta entrada desde la pestaña Servidores MCP.", "disconnect_grant_shared": "Se conservó la autorización almacenada porque el mismo endpoint también está configurado por: {{names}}. Revocarla en el proveedor también les cortaría el acceso.", "disconnect_grant_survived": "No se pudo eliminar parte de la autorización almacenada. Revoca el acceso en el proveedor.", @@ -16095,7 +16099,8 @@ "takes_focus_and_cursor": "Foco + cursor", "on_windows_keystrokes_take_your_keyboard_focus": "En Windows, las pulsaciones de teclas toman el foco del teclado y los clics por coordenadas mueven el cursor real: en esta plataforma no existe una vía de entrada por aplicación.", "the_app_lists_in_computer_use_json_could_not_be": "No se pudieron leer las listas de aplicaciones de computer_use.json, así que aquí se muestran vacías. El agente sigue rechazando toda acción que dependa de ellas hasta que el archivo sea JSON válido.", - "your_chat_sessions_were_restarted_so_this_takes": "Tus sesiones de chat se reiniciaron para que esto surta efecto de inmediato — Kiro lee su lista de herramientas una vez por sesión, así que un chat abierto no lo habría detectado de otro modo. Tus mensajes siguen ahí; el agente vuelve a leer su contexto en tu siguiente mensaje." + "your_chat_sessions_were_restarted_so_this_takes": "Tus sesiones de chat se reiniciaron para que esto surta efecto de inmediato — Kiro lee su lista de herramientas una vez por sesión, así que un chat abierto no lo habría detectado de otro modo. Tus mensajes siguen ahí; el agente vuelve a leer su contexto en tu siguiente mensaje.", + "your_chat_sessions_were_restarted": "Tus sesiones de chat se reiniciaron. Tus mensajes siguen ahí." }, "crewmatesSection": { "title": "Miembros del equipo", diff --git a/website/src/i18n/locales/fr.json b/website/src/i18n/locales/fr.json index 1358fb2ee471..91f32578d2e1 100644 --- a/website/src/i18n/locales/fr.json +++ b/website/src/i18n/locales/fr.json @@ -5897,6 +5897,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "Votre configuration {{productName}} existante ne sera pas affectée.", "your_selected_setup_is_ready_in_kiro_crew": "La configuration sélectionnée est prête dans {{productName}}." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "Enregistré, mais cette copie de {{productName}} n’a pas pu mettre à jour la configuration de l’agent : les nouveaux chats gardent l’ancienne configuration. Ouvre la page « Journaux » pour en connaître la raison." + }, "agentSelector": { "agent_list": "Liste des agents", "default": "par défaut", @@ -12454,6 +12457,7 @@ "disconnect_census_incomplete": "L'autorisation stockée a été conservée car une source de configuration n'a pas pu être lue pour exclure qu'un autre serveur l'utilise. Vérifiez votre configuration de serveur, puis déconnectez à nouveau.", "disconnect_census_incomplete_source": "L'autorisation stockée a été conservée car {{source}} n'a pas pu être lu pour exclure qu'un autre serveur l'utilise. Corrigez ou supprimez ce fichier, puis déconnectez à nouveau.", "disconnect_entry_left_alone": "Votre configuration de serveur n'a pas été modifiée. Gérez cette entrée depuis l'onglet Serveurs MCP.", + "disconnect_spec_not_rewritten": "Cette copie de {{productName}} n’a pas pu mettre à jour la configuration de l’agent : les nouveaux chats chargent encore cette connexion. Ouvre la page « Journaux » pour en connaître la raison.", "disconnect_entry_not_ours": "L'autorisation stockée a été supprimée. Votre configuration de serveur n'a pas été modifiée. Gérez cette entrée depuis l'onglet Serveurs MCP.", "disconnect_grant_shared": "L'autorisation stockée a été conservée car le même point de terminaison est aussi configuré par : {{names}}. La révoquer chez le fournisseur leur couperait aussi l'accès.", "disconnect_grant_survived": "Une partie de l'autorisation stockée n'a pas pu être supprimée. Révoquez l'accès chez le fournisseur.", @@ -16095,7 +16099,8 @@ "takes_focus_and_cursor": "Focus + curseur", "on_windows_keystrokes_take_your_keyboard_focus": "Sous Windows, les frappes prennent le focus du clavier et les clics par coordonnées déplacent votre curseur réel — cette plateforme n'a aucune voie d'entrée par application.", "the_app_lists_in_computer_use_json_could_not_be": "Les listes d’applications de computer_use.json n’ont pas pu être lues, elles apparaissent donc vides ici. L’agent continue de refuser toute action qui en dépend jusqu’à ce que le fichier soit du JSON valide.", - "your_chat_sessions_were_restarted_so_this_takes": "Tes sessions de chat ont été redémarrées pour que cela prenne effet immédiatement — Kiro lit sa liste d’outils une seule fois par session, sinon un chat ouvert ne l’aurait pas prise en compte. Tes messages sont toujours là ; l’agent relit son contexte à ton prochain message." + "your_chat_sessions_were_restarted_so_this_takes": "Tes sessions de chat ont été redémarrées pour que cela prenne effet immédiatement — Kiro lit sa liste d’outils une seule fois par session, sinon un chat ouvert ne l’aurait pas prise en compte. Tes messages sont toujours là ; l’agent relit son contexte à ton prochain message.", + "your_chat_sessions_were_restarted": "Tes sessions de chat ont été redémarrées. Tes messages sont toujours là." }, "crewmatesSection": { "title": "Membres de l'équipe", diff --git a/website/src/i18n/locales/hi.json b/website/src/i18n/locales/hi.json index 8210b0b7c5d3..c56b4a8af459 100644 --- a/website/src/i18n/locales/hi.json +++ b/website/src/i18n/locales/hi.json @@ -5805,6 +5805,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "आपके मौजूदा {{productName}} सेटअप पर कोई असर नहीं पड़ेगा।", "your_selected_setup_is_ready_in_kiro_crew": "चुना हुआ सेटअप {{productName}} में तैयार है।" }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "सहेजा गया, लेकिन यह {{productName}} एजेंट कॉन्फ़िगरेशन अपडेट नहीं कर सका, इसलिए नई चैट पुरानी सेटिंग ही रखेंगी। कारण जानने के लिए 'लॉग' पेज खोलें।" + }, "agentSelector": { "agent_list": "एजेंट सूची", "default": "डिफ़ॉल्ट", @@ -12265,6 +12268,7 @@ "disconnect_census_incomplete": "संग्रहीत अनुमति रखी गई क्योंकि एक कॉन्फ़िगरेशन स्रोत पढ़ा नहीं जा सका और यह पुष्टि नहीं हो सकी कि कोई अन्य सर्वर इसका उपयोग नहीं कर रहा है। अपना सर्वर कॉन्फ़िगरेशन जाँचें और फिर से डिस्कनेक्ट करें।", "disconnect_census_incomplete_source": "संग्रहीत अनुमति रखी गई क्योंकि {{source}} पढ़ा नहीं जा सका और यह पुष्टि नहीं हो सकी कि कोई अन्य सर्वर इसका उपयोग नहीं कर रहा है। उस फ़ाइल को ठीक करें या हटाएँ और फिर से डिस्कनेक्ट करें।", "disconnect_entry_left_alone": "तुम्हारा सर्वर कॉन्फ़िगरेशन अपरिवर्तित रहा। इस प्रविष्टि को MCP सर्वर टैब से प्रबंधित किया जा सकता है।", + "disconnect_spec_not_rewritten": "यह {{productName}} एजेंट कॉन्फ़िगरेशन अपडेट नहीं कर सका, इसलिए नई चैट अब भी यह कनेक्शन लोड करेंगी। कारण जानने के लिए 'लॉग' पेज खोलें।", "disconnect_entry_not_ours": "संचित अनुमति हटा दी गई। तुम्हारा सर्वर कॉन्फ़िगरेशन अपरिवर्तित रहा। इस प्रविष्टि को MCP सर्वर टैब से प्रबंधित किया जा सकता है।", "disconnect_grant_shared": "संग्रहीत अनुमति रखी गई क्योंकि वही एंडपॉइंट इनके द्वारा भी कॉन्फ़िगर किया गया है: {{names}}। प्रदाता के यहाँ रद्द करने से इनकी पहुँच भी कट जाएगी।", "disconnect_grant_survived": "संग्रहीत अनुमति का कुछ हिस्सा हटाया नहीं जा सका। प्रदाता पर एक्सेस रद्द करें।", @@ -15854,7 +15858,8 @@ "takes_focus_and_cursor": "फ़ोकस + कर्सर", "on_windows_keystrokes_take_your_keyboard_focus": "Windows पर, कीस्ट्रोक तुम्हारा कीबोर्ड फ़ोकस ले लेते हैं और निर्देशांक क्लिक तुम्हारे असली कर्सर को हिलाते हैं — इस प्लैटफ़ॉर्म पर प्रति-ऐप इनपुट मार्ग नहीं है।", "the_app_lists_in_computer_use_json_could_not_be": "computer_use.json में दी गई ऐप सूचियाँ पढ़ी नहीं जा सकीं, इसलिए यहाँ ख़ाली दिख रही हैं। जब तक फ़ाइल वैध JSON नहीं होती, एजेंट उन पर निर्भर हर कार्रवाई से इनकार करता रहेगा।", - "your_chat_sessions_were_restarted_so_this_takes": "तुम्हारे चैट सत्र दोबारा शुरू किए गए हैं ताकि यह तुरंत लागू हो — Kiro हर सत्र में अपनी टूल सूची एक ही बार पढ़ता है, इसलिए खुली चैट इसे वरना उठा नहीं पाती। तुम्हारे मैसेज अब भी मौजूद हैं; एजेंट अगले मैसेज पर अपना कॉन्टेक्स्ट फिर पढ़ेगा।" + "your_chat_sessions_were_restarted_so_this_takes": "तुम्हारे चैट सत्र दोबारा शुरू किए गए हैं ताकि यह तुरंत लागू हो — Kiro हर सत्र में अपनी टूल सूची एक ही बार पढ़ता है, इसलिए खुली चैट इसे वरना उठा नहीं पाती। तुम्हारे मैसेज अब भी मौजूद हैं; एजेंट अगले मैसेज पर अपना कॉन्टेक्स्ट फिर पढ़ेगा।", + "your_chat_sessions_were_restarted": "तुम्हारे चैट सत्र फिर से शुरू किए गए। तुम्हारे संदेश अब भी मौजूद हैं।" }, "crewmatesSection": { "title": "क्रू सदस्य", diff --git a/website/src/i18n/locales/it.json b/website/src/i18n/locales/it.json index 5dcad8d8495c..c2e9dcbae12d 100644 --- a/website/src/i18n/locales/it.json +++ b/website/src/i18n/locales/it.json @@ -5897,6 +5897,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "La tua configurazione esistente di {{productName}} non verrà modificata.", "your_selected_setup_is_ready_in_kiro_crew": "La configurazione selezionata è pronta in {{productName}}." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "Salvato, ma questa copia di {{productName}} non è riuscita ad aggiornare la configurazione dell’agente, quindi le nuove chat mantengono la configurazione precedente. Apri la pagina «Log» per vedere il motivo." + }, "agentSelector": { "agent_list": "Elenco degli agenti", "default": "predefinito", @@ -12454,6 +12457,7 @@ "disconnect_census_incomplete": "L'autorizzazione memorizzata è stata conservata perché non è stato possibile leggere una fonte di configurazione per escludere che un altro server la utilizzi. Controlla la configurazione del server e disconnetti di nuovo.", "disconnect_census_incomplete_source": "L'autorizzazione memorizzata è stata conservata perché non è stato possibile leggere {{source}} per escludere che un altro server la utilizzi. Correggi o rimuovi quel file e disconnetti di nuovo.", "disconnect_entry_left_alone": "La configurazione del server non è stata modificata. Puoi gestire questa voce dalla scheda Server MCP.", + "disconnect_spec_not_rewritten": "Questa copia di {{productName}} non è riuscita ad aggiornare la configurazione dell’agente, quindi le nuove chat caricano ancora questa connessione. Apri la pagina «Log» per vedere il motivo.", "disconnect_entry_not_ours": "L'autorizzazione memorizzata è stata rimossa. La configurazione del server non è stata modificata. Puoi gestire questa voce dalla scheda Server MCP.", "disconnect_grant_shared": "L'autorizzazione memorizzata è stata mantenuta perché lo stesso endpoint è configurato anche da: {{names}}. Revocarla presso il provider taglierebbe anche il loro accesso.", "disconnect_grant_survived": "Parte dell'autorizzazione memorizzata non è stata rimossa. Revoca l'accesso presso il provider.", @@ -16095,7 +16099,8 @@ "takes_focus_and_cursor": "Focus + cursore", "on_windows_keystrokes_take_your_keyboard_focus": "Su Windows, i tasti premuti assumono il focus della tastiera e i clic per coordinate spostano il cursore reale: questa piattaforma non ha un percorso di input per singola app.", "the_app_lists_in_computer_use_json_could_not_be": "Non è stato possibile leggere gli elenchi di app in computer_use.json, quindi qui appaiono vuoti. L’agente continua a rifiutare ogni azione che dipende da essi fino a quando il file non è JSON valido.", - "your_chat_sessions_were_restarted_so_this_takes": "Le tue sessioni di chat sono state riavviate perché questa modifica abbia effetto subito — Kiro legge l’elenco dei suoi strumenti una volta per sessione, quindi una chat aperta non l’avrebbe recepita. I tuoi messaggi sono ancora lì; l’agente rilegge il proprio contesto al tuo prossimo messaggio." + "your_chat_sessions_were_restarted_so_this_takes": "Le tue sessioni di chat sono state riavviate perché questa modifica abbia effetto subito — Kiro legge l’elenco dei suoi strumenti una volta per sessione, quindi una chat aperta non l’avrebbe recepita. I tuoi messaggi sono ancora lì; l’agente rilegge il proprio contesto al tuo prossimo messaggio.", + "your_chat_sessions_were_restarted": "Le tue sessioni di chat sono state riavviate. I tuoi messaggi sono ancora lì." }, "crewmatesSection": { "title": "Membri della crew", diff --git a/website/src/i18n/locales/ja.json b/website/src/i18n/locales/ja.json index 101ed6e04584..99ebe3424552 100644 --- a/website/src/i18n/locales/ja.json +++ b/website/src/i18n/locales/ja.json @@ -5683,6 +5683,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "既存の {{productName}} セットアップは影響を受けません。", "your_selected_setup_is_ready_in_kiro_crew": "選択されたセットアップは {{productName}} で準備ができています。" }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "保存しましたが、この {{productName}} ではエージェント設定を更新できなかったため、新しいチャットでは以前の設定が使われます。理由は「ログ」ページで確認してください。" + }, "agentSelector": { "agent_list": "エージェントリスト", "default": "デフォルト", @@ -12076,6 +12079,7 @@ "disconnect_census_incomplete": "設定ソースを読み取れず、他のサーバーが使用していないことを確認できなかったため、保存された認可は保持されました。サーバー設定を確認してから、再度切断してください。", "disconnect_census_incomplete_source": "{{source}} を読み取れず、他のサーバーが使用していないことを確認できなかったため、保存された認可は保持されました。そのファイルを修正または削除してから、再度切断してください。", "disconnect_entry_left_alone": "サーバー設定は変更されていません。このエントリは「MCP サーバー」タブで管理できます。", + "disconnect_spec_not_rewritten": "この {{productName}} ではエージェント設定を更新できなかったため、新しいチャットでもこの接続が読み込まれます。理由は「ログ」ページで確認してください。", "disconnect_entry_not_ours": "保存されていた認可を削除しました。サーバー設定は変更されていません。このエントリは「MCP サーバー」タブで管理できます。", "disconnect_grant_shared": "同じエンドポイントが次のサーバーでも設定されているため、保存された認可は保持されました:{{names}}。プロバイダー側で取り消すと、これらのサーバーのアクセスも失われます。", "disconnect_grant_survived": "保存された認可の一部を削除できませんでした。プロバイダー側でアクセスを取り消してください。", @@ -15613,7 +15617,8 @@ "takes_focus_and_cursor": "フォーカス + カーソル", "on_windows_keystrokes_take_your_keyboard_focus": "Windows では、キー入力はキーボードフォーカスを奪い、座標クリックは実際のカーソルを動かします。このプラットフォームにはアプリ単位の入力経路がありません。", "the_app_lists_in_computer_use_json_could_not_be": "computer_use.json のアプリリストが読み取れなかったため、ここに空で表示されています。ファイルが有効な JSON になるまで、エージェントはそれらに依存するすべてのアクションを拒否します。", - "your_chat_sessions_were_restarted_so_this_takes": "チャットセッションが再起動されたため、すぐに反映されます。Kiro はセッションごとにツールリストを一度だけ読み取るため、オープンなチャットではそれを取得できなかったはずです。メッセージはまだそこにあります。エージェントは次のメッセージでコンテキストを再度読み取ります。" + "your_chat_sessions_were_restarted_so_this_takes": "チャットセッションが再起動されたため、すぐに反映されます。Kiro はセッションごとにツールリストを一度だけ読み取るため、オープンなチャットではそれを取得できなかったはずです。メッセージはまだそこにあります。エージェントは次のメッセージでコンテキストを再度読み取ります。", + "your_chat_sessions_were_restarted": "チャットセッションを再起動しました。メッセージはそのまま残っています。" }, "crewmatesSection": { "title": "クルーメンバー", diff --git a/website/src/i18n/locales/ko.json b/website/src/i18n/locales/ko.json index 4d61d2a4e391..bd74588ed60d 100644 --- a/website/src/i18n/locales/ko.json +++ b/website/src/i18n/locales/ko.json @@ -5683,6 +5683,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "기존 {{productName}} 설정은 영향을 받지 않습니다.", "your_selected_setup_is_ready_in_kiro_crew": "선택한 설정이 {{productName}}에 준비되었습니다." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "저장했지만 이 {{productName}}에서 에이전트 구성을 업데이트하지 못해 새 채팅은 이전 설정을 사용합니다. 이유는 '로그' 페이지에서 확인하세요." + }, "agentSelector": { "agent_list": "에이전트 목록", "default": "기본값", @@ -12076,6 +12079,7 @@ "disconnect_census_incomplete": "구성 소스를 읽을 수 없어 다른 서버의 사용 여부를 확인할 수 없었기 때문에 저장된 권한이 유지되었습니다. 서버 구성을 확인한 후 다시 연결 해제하세요.", "disconnect_census_incomplete_source": "{{source}}을(를) 읽을 수 없어 다른 서버의 사용 여부를 확인할 수 없었기 때문에 저장된 권한이 유지되었습니다. 해당 파일을 수정하거나 제거한 후 다시 연결 해제하세요.", "disconnect_entry_left_alone": "서버 구성은 변경되지 않았습니다. 이 항목은 MCP 서버 탭에서 관리할 수 있습니다.", + "disconnect_spec_not_rewritten": "이 {{productName}}에서 에이전트 구성을 업데이트하지 못해 새 채팅에서도 이 연결이 로드됩니다. 이유는 '로그' 페이지에서 확인하세요.", "disconnect_entry_not_ours": "저장된 권한을 삭제했습니다. 서버 구성은 변경되지 않았습니다. 이 항목은 MCP 서버 탭에서 관리할 수 있습니다.", "disconnect_grant_shared": "같은 엔드포인트를 다음에서도 구성하고 있으므로 저장된 권한은 유지되었습니다: {{names}}. 제공업체에서 취소하면 이들의 접근도 차단됩니다.", "disconnect_grant_survived": "저장된 권한의 일부를 제거할 수 없었습니다. 공급자에서 액세스를 취소하세요.", @@ -15613,7 +15617,8 @@ "takes_focus_and_cursor": "포커스 + 커서", "on_windows_keystrokes_take_your_keyboard_focus": "Windows에서는 키 입력이 키보드 포커스를 가져가고 좌표 클릭이 실제 커서를 움직입니다. 이 플랫폼에는 앱별 입력 경로가 없습니다.", "the_app_lists_in_computer_use_json_could_not_be": "computer_use.json의 앱 목록을 읽을 수 없어 여기에는 비어 있는 상태로 표시됩니다. 파일이 유효한 JSON이 될 때까지 에이전트는 이 목록에 의존하는 모든 작업을 거부합니다.", - "your_chat_sessions_were_restarted_so_this_takes": "채팅 세션이 다시 시작되어 이 변경이 즉시 적용됩니다 — Kiro는 세션마다 도구 목록을 한 번만 읽으므로 열려 있던 채팅은 그렇지 않으면 변경을 반영하지 못합니다. 메시지는 그대로 남아 있으며, 에이전트는 다음 메시지에서 컨텍스트를 다시 읽습니다." + "your_chat_sessions_were_restarted_so_this_takes": "채팅 세션이 다시 시작되어 이 변경이 즉시 적용됩니다 — Kiro는 세션마다 도구 목록을 한 번만 읽으므로 열려 있던 채팅은 그렇지 않으면 변경을 반영하지 못합니다. 메시지는 그대로 남아 있으며, 에이전트는 다음 메시지에서 컨텍스트를 다시 읽습니다.", + "your_chat_sessions_were_restarted": "채팅 세션을 다시 시작했습니다. 메시지는 그대로 남아 있습니다." }, "crewmatesSection": { "title": "크루 멤버", diff --git a/website/src/i18n/locales/pt.json b/website/src/i18n/locales/pt.json index 03458e303baa..842f3dbe930a 100644 --- a/website/src/i18n/locales/pt.json +++ b/website/src/i18n/locales/pt.json @@ -5897,6 +5897,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "A sua configuração existente do {{productName}} não será afetada.", "your_selected_setup_is_ready_in_kiro_crew": "A configuração selecionada está pronta no {{productName}}." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "Salvo, mas esta cópia do {{productName}} não conseguiu atualizar a configuração do agente, então os novos chats mantêm a configuração anterior. Abra a página “Logs” para ver o motivo." + }, "agentSelector": { "agent_list": "Lista de agentes", "default": "padrão", @@ -12454,6 +12457,7 @@ "disconnect_census_incomplete": "A autorização armazenada foi mantida porque não foi possível ler uma fonte de configuração para descartar que outro servidor a use. Verifique a configuração do seu servidor e desconecte novamente.", "disconnect_census_incomplete_source": "A autorização armazenada foi mantida porque não foi possível ler {{source}} para descartar que outro servidor a use. Corrija ou remova esse arquivo e desconecte novamente.", "disconnect_entry_left_alone": "A configuração do seu servidor não foi alterada. Você pode gerenciar esta entrada na aba Servidores MCP.", + "disconnect_spec_not_rewritten": "Esta cópia do {{productName}} não conseguiu atualizar a configuração do agente, então os novos chats ainda carregam esta conexão. Abra a página “Logs” para ver o motivo.", "disconnect_entry_not_ours": "A autorização armazenada foi removida. A configuração do seu servidor não foi alterada. Você pode gerenciar esta entrada na aba Servidores MCP.", "disconnect_grant_shared": "A autorização armazenada foi mantida porque o mesmo endpoint também está configurado por: {{names}}. Revogá-la no provedor também cortaria o acesso deles.", "disconnect_grant_survived": "Parte da autorização armazenada não pôde ser removida. Revogue o acesso no provedor.", @@ -16095,7 +16099,8 @@ "takes_focus_and_cursor": "Foco + cursor", "on_windows_keystrokes_take_your_keyboard_focus": "No Windows, as teclas assumem o foco do teclado e os cliques por coordenadas movem o cursor real — esta plataforma não tem uma rota de entrada por aplicativo.", "the_app_lists_in_computer_use_json_could_not_be": "As listas de apps em computer_use.json não puderam ser lidas, então aparecem vazias aqui. O agente continua recusando toda ação que depende delas até o arquivo ser um JSON válido.", - "your_chat_sessions_were_restarted_so_this_takes": "As suas sessões de conversa foram reiniciadas para que isso tenha efeito imediato — o Kiro lê a lista de ferramentas uma vez por sessão, então uma conversa aberta não teria percebido a mudança. As suas mensagens continuam lá; o agente relê o contexto na sua próxima mensagem." + "your_chat_sessions_were_restarted_so_this_takes": "As suas sessões de conversa foram reiniciadas para que isso tenha efeito imediato — o Kiro lê a lista de ferramentas uma vez por sessão, então uma conversa aberta não teria percebido a mudança. As suas mensagens continuam lá; o agente relê o contexto na sua próxima mensagem.", + "your_chat_sessions_were_restarted": "Suas sessões de chat foram reiniciadas. Suas mensagens continuam lá." }, "crewmatesSection": { "title": "Membros da equipe", diff --git a/website/src/i18n/locales/ru.json b/website/src/i18n/locales/ru.json index c5b04a3b6e0b..ae201f85f1ba 100644 --- a/website/src/i18n/locales/ru.json +++ b/website/src/i18n/locales/ru.json @@ -5989,6 +5989,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "Ваша существующая конфигурация {{productName}} не будет затронута.", "your_selected_setup_is_ready_in_kiro_crew": "Выбранная конфигурация готова в {{productName}}." }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "Сохранено, но эта копия {{productName}} не смогла обновить конфигурацию агента, поэтому новые чаты используют прежние настройки. Причину смотри на странице «Логи»." + }, "agentSelector": { "agent_list": "Список агентов", "default": "по умолчанию", @@ -12643,6 +12646,7 @@ "disconnect_census_incomplete": "Сохранённое разрешение было оставлено, потому что не удалось прочитать источник конфигурации и исключить его использование другим сервером. Проверьте конфигурацию сервера и отключитесь снова.", "disconnect_census_incomplete_source": "Сохранённое разрешение было оставлено, потому что не удалось прочитать {{source}} и исключить его использование другим сервером. Исправьте или удалите этот файл и отключитесь снова.", "disconnect_entry_left_alone": "Конфигурация ваших серверов осталась без изменений. Управлять этой записью можно на вкладке «MCP-серверы».", + "disconnect_spec_not_rewritten": "Эта копия {{productName}} не смогла обновить конфигурацию агента, поэтому новые чаты по-прежнему загружают это подключение. Причину смотри на странице «Логи».", "disconnect_entry_not_ours": "Сохранённое разрешение удалено. Конфигурация ваших серверов осталась без изменений. Управлять этой записью можно на вкладке «MCP-серверы».", "disconnect_grant_shared": "Сохранённое разрешение оставлено, так как тот же адрес настроен также в: {{names}}. Отзыв у провайдера лишит доступа и их.", "disconnect_grant_survived": "Часть сохранённого разрешения не удалось удалить. Отзовите доступ у поставщика.", @@ -16336,7 +16340,8 @@ "takes_focus_and_cursor": "Фокус + курсор", "on_windows_keystrokes_take_your_keyboard_focus": "В Windows нажатия клавиш забирают фокус клавиатуры, а клики по координатам перемещают ваш реальный курсор — на этой платформе нет отдельного канала ввода для приложения.", "the_app_lists_in_computer_use_json_could_not_be": "Списки приложений в computer_use.json не удалось прочитать, поэтому здесь они пустые. Агент по-прежнему отклоняет все действия, которые от них зависят, пока файл не станет корректным JSON.", - "your_chat_sessions_were_restarted_so_this_takes": "Сессии чатов перезапущены, чтобы изменение вступило в силу сразу: Kiro читает список инструментов один раз за сессию, иначе открытый чат его бы не подхватил. Сообщения на месте — агент перечитает контекст при следующем сообщении." + "your_chat_sessions_were_restarted_so_this_takes": "Сессии чатов перезапущены, чтобы изменение вступило в силу сразу: Kiro читает список инструментов один раз за сессию, иначе открытый чат его бы не подхватил. Сообщения на месте — агент перечитает контекст при следующем сообщении.", + "your_chat_sessions_were_restarted": "Твои сеансы чата перезапущены. Твои сообщения на месте." }, "crewmatesSection": { "title": "Участники команды", diff --git a/website/src/i18n/locales/zh-CN.json b/website/src/i18n/locales/zh-CN.json index bc30a74824c3..a39e46d153db 100644 --- a/website/src/i18n/locales/zh-CN.json +++ b/website/src/i18n/locales/zh-CN.json @@ -5713,6 +5713,9 @@ "your_existing_kirocrew_setup_will_not_be_affecte": "你已有的 {{productName}} 设置不会受到影响。", "your_selected_setup_is_ready_in_kiro_crew": "你所选的配置已在 {{productName}} 中就绪。" }, + "agentSpecNotRewrittenNotice": { + "saved_but_not_applied": "已保存,但此 {{productName}} 无法更新智能体配置,新聊天会继续使用之前的设置。请打开“日志”页面查看原因。" + }, "agentSelector": { "agent_list": "代理列表", "default": "默认", @@ -12076,6 +12079,7 @@ "disconnect_census_incomplete": "由于无法读取某个配置源以排除其他服务器正在使用该授权,已保留存储的授权。请检查服务器配置后再次断开连接。", "disconnect_census_incomplete_source": "由于无法读取 {{source}} 以排除其他服务器正在使用该授权,已保留存储的授权。请修复或删除该文件后再次断开连接。", "disconnect_entry_left_alone": "服务器配置未作更改。你可以在“MCP 服务器”标签页中管理该条目。", + "disconnect_spec_not_rewritten": "此 {{productName}} 无法更新智能体配置,新聊天仍会加载此连接。请打开“日志”页面查看原因。", "disconnect_entry_not_ours": "已删除存储的授权。服务器配置未作更改。你可以在“MCP 服务器”标签页中管理该条目。", "disconnect_grant_shared": "由于以下服务器也配置了相同的端点,已保留存储的授权:{{names}}。在提供方撤销授权也会切断它们的访问。", "disconnect_grant_survived": "部分已存储的授权无法删除。请在服务商处撤销访问权限。", @@ -15613,7 +15617,8 @@ "takes_focus_and_cursor": "焦点 + 光标", "on_windows_keystrokes_take_your_keyboard_focus": "在 Windows 上,按键会夺取你的键盘焦点,坐标点击会移动真实光标——这个平台没有面向单个应用的输入通道。", "the_app_lists_in_computer_use_json_could_not_be": "无法读取 computer_use.json 中的应用列表,因此这里显示为空。在该文件成为有效 JSON 之前,代理仍会拒绝所有依赖这些列表的操作。", - "your_chat_sessions_were_restarted_so_this_takes": "你的聊天会话已重启,所以改动立即生效 — Kiro 每个会话只读取一次工具列表,否则已经打开的聊天不会拾取到改动。你的消息都还在;代理会在你下一条消息时重新读取上下文。" + "your_chat_sessions_were_restarted_so_this_takes": "你的聊天会话已重启,所以改动立即生效 — Kiro 每个会话只读取一次工具列表,否则已经打开的聊天不会拾取到改动。你的消息都还在;代理会在你下一条消息时重新读取上下文。", + "your_chat_sessions_were_restarted": "你的聊天会话已重启。你的消息仍然保留。" }, "crewmatesSection": { "title": "团队成员", diff --git a/website/src/pages/connections/ConnectionsPage.tsx b/website/src/pages/connections/ConnectionsPage.tsx index 38eeb57bf6a7..6d68432069bb 100644 --- a/website/src/pages/connections/ConnectionsPage.tsx +++ b/website/src/pages/connections/ConnectionsPage.tsx @@ -1680,18 +1680,24 @@ export default function ConnectionsPage({ servicesEnabled = false }: { servicesE entryKept && (survived || shared || !result.grantRemoved) ? t('pages.connectionsPage.disconnect_entry_left_alone') : '' + // The rebuild after the purge did not confirm a write, so new sessions may + // still load the entry. That is a failed step, reported like a survivor. + // Only when the entry actually left the config: a click that removed + // nothing changed nothing the spec should follow. + const specNotRewritten = result.agentSpecRewritten === false && result.entryRemoved + const specClause = specNotRewritten ? t('pages.connectionsPage.disconnect_spec_not_rewritten') : '' setFeedback(current => ({ ...current, [provider.slug]: disconnectFeedback( provider, - [grantClause, entryClause].filter(Boolean).join(' '), + [grantClause, entryClause, specClause].filter(Boolean).join(' '), // A census gap tells the user their access was NOT withdrawn and hands // them a repair to make; a not-ours entry leaves the card showing // Connected with a live Disconnect button, so a green success would // misreport a click that changed nothing. Neither is an `error`, // because nothing failed — a safety rule declined to act, or there was // nothing here to act on. - survived ? 'error' : censusGap || entryNotOurs ? 'warning' : 'success', + survived || specNotRewritten ? 'error' : censusGap || entryNotOurs ? 'warning' : 'success', ), })) } diff --git a/website/src/pages/overview/McpTab.tsx b/website/src/pages/overview/McpTab.tsx index 6f0d6f31b533..224be2a30b9d 100644 --- a/website/src/pages/overview/McpTab.tsx +++ b/website/src/pages/overview/McpTab.tsx @@ -8,6 +8,7 @@ import { api } from '../../api/client' import { Card, Btn, Badge, SearchInput, ContentSkeleton } from '../../components/ui' import InfoTip from '../../components/InfoTip' import ErrorNotice from '../../components/ErrorNotice' +import AgentSpecNotRewrittenNotice from '../../components/AgentSpecNotRewrittenNotice' import { useProvider } from '../../providers' import McpBrowserModal from '../../components/McpBrowserModal' import McpCustomServerModal from '../../components/McpCustomServerModal' @@ -428,6 +429,8 @@ export default function McpTab({ onManagedProviderClick }: McpTabProps = {}) { // button as scope toggles so rapid clicks don't race. const [pendingTools, setPendingTools] = useState>>({}) const [applyMsg, setApplyMsg] = useState('') + // The last apply saved but its agent-spec rebuild did not write. + const [specNotRewritten, setSpecNotRewritten] = useState(false) // Auto-dismiss timers for the success banners. Held in refs and cleared on // unmount so a pending setTimeout never fires a state update after the @@ -566,7 +569,11 @@ export default function McpTab({ onManagedProviderClick }: McpTabProps = {}) { return r }, onSuccess: (r) => { - setApplyMsg(i18nT('pages.overview.mcpTab.applied_change', { count: r.applied ?? 0 })) + const notRewritten = r.rebuild?.ok === false + // The notice already says the change was saved; a green "Applied" above it + // would read as the opposite verdict. + setApplyMsg(notRewritten ? '' : i18nT('pages.overview.mcpTab.applied_change', { count: r.applied ?? 0 })) + setSpecNotRewritten(notRewritten) setPending({}) setPendingTools({}) queryClient.invalidateQueries({ queryKey: ['mcp-servers'] }) @@ -644,6 +651,9 @@ export default function McpTab({ onManagedProviderClick }: McpTabProps = {}) { {apply.error &&
{(apply.error as Error).message}
} {applyMsg &&
{applyMsg}
} + {/* No hand-off while changes are staged: opening the chat unmounts this tab + and drops the pending MCP changes it holds. */} + {specNotRewritten && } {/* Pending-changes banner */} {pendingCount > 0 && ( @@ -1065,8 +1075,14 @@ export default function McpTab({ onManagedProviderClick }: McpTabProps = {}) { )}
- setBrowserOpen(false)} /> - setCustomOpen(false)} /> - setEditTarget(null)} editName={editTarget} /> + {/* The modals' hand-off would unmount this tab and drop its staged changes. */} + setBrowserOpen(false)} askAgent={pendingCount === 0} /> + setCustomOpen(false)} askAgent={pendingCount === 0} /> + setEditTarget(null)} + editName={editTarget} + askAgent={pendingCount === 0} + /> ) } diff --git a/website/src/pages/settings/ComputerUsePanel.test.tsx b/website/src/pages/settings/ComputerUsePanel.test.tsx index fd8b8af8ef60..8ec7a143c4e9 100644 --- a/website/src/pages/settings/ComputerUsePanel.test.tsx +++ b/website/src/pages/settings/ComputerUsePanel.test.tsx @@ -1,5 +1,5 @@ import { describe, it, expect, vi, beforeEach } from 'vitest' -import { screen, fireEvent, waitFor } from '@testing-library/react' +import { screen, fireEvent, waitFor, within } from '@testing-library/react' import { renderWithProviders } from '../../test/helpers' import type { ComputerUseConfigData } from '../../api/client' @@ -69,6 +69,43 @@ describe('ComputerUsePanel', () => { expect(await screen.findByText(/chat sessions were restarted/i)).toBeInTheDocument() }) + it('says the enable is not live when the agent spec was not rewritten', async () => { + await renderPanel() + ;(api.saveComputerUseConfig as ReturnType).mockResolvedValue( + snapshot({ enabled: true, sessions_reset: 0, agent_spec_rewritten: false }), + ) + fireEvent.click(await screen.findByRole('switch', { name: ENABLE_LABEL })) + const notice = await screen.findByTestId('agent-spec-not-rewritten') + // No hand-off here: it would navigate away from the panel's unsaved drafts. + expect(within(notice).queryByRole('button')).not.toBeInTheDocument() + }) + + it('still says the sessions were restarted beside the not-rewritten notice', async () => { + await renderPanel() + ;(api.saveComputerUseConfig as ReturnType).mockResolvedValue( + snapshot({ enabled: true, sessions_reset: 2, agent_spec_rewritten: false }), + ) + fireEvent.click(await screen.findByRole('switch', { name: ENABLE_LABEL })) + await screen.findByTestId('agent-spec-not-rewritten') + // The restart happened, so the user must be told why their chats were torn down, + // without the claim that it made the change take effect. + expect(screen.getByText(/chat sessions were restarted/i)).toBeInTheDocument() + expect(screen.queryByText(/takes effect/i)).not.toBeInTheDocument() + }) + + it('keeps the notice through a later save that did not touch the enable', async () => { + await renderPanel() + const save = api.saveComputerUseConfig as ReturnType + save.mockResolvedValueOnce(snapshot({ enabled: true, sessions_reset: 0, agent_spec_rewritten: false })) + fireEvent.click(await screen.findByRole('switch', { name: ENABLE_LABEL })) + await screen.findByTestId('agent-spec-not-rewritten') + // A save of another field carries no verdict, so the spec is still stale. + save.mockResolvedValueOnce(snapshot({ enabled: true, attach_screenshot: false })) + fireEvent.click(await screen.findByRole('switch', { name: /screenshot/i })) + await waitFor(() => expect(save).toHaveBeenCalledTimes(2)) + expect(screen.getByTestId('agent-spec-not-rewritten')).toBeInTheDocument() + }) + it('stays silent when the save restarted nothing', async () => { await renderPanel() ;(api.saveComputerUseConfig as ReturnType).mockResolvedValue( diff --git a/website/src/pages/settings/ComputerUsePanel.tsx b/website/src/pages/settings/ComputerUsePanel.tsx index f92f4be090d5..1ddb5576f8f1 100644 --- a/website/src/pages/settings/ComputerUsePanel.tsx +++ b/website/src/pages/settings/ComputerUsePanel.tsx @@ -9,6 +9,7 @@ import type { ComputerUseConfigData, ComputerUseConfigSave } from '../../api/cli import { i18nT } from '../../i18n/t' import ErrorNotice from '../../components/ErrorNotice' +import AgentSpecNotRewrittenNotice, { agentSpecNotRewritten } from '../../components/AgentSpecNotRewrittenNotice' const QK = ['computer-use-config'] @@ -173,6 +174,8 @@ export function ComputerUsePanel() { const [draftWidth, setDraftWidth] = useState(null) // Set when the server reports it restarted sessions to apply the enable. const [restarted, setRestarted] = useState(false) + // Set when the enable saved but the agent spec was not rewritten. + const [specNotRewritten, setSpecNotRewritten] = useState(false) // Mount time, for the poll's wall-clock bound. A ref (not state) so reading it // never re-renders and the deadline survives every refetch. @@ -210,6 +213,9 @@ export function ComputerUsePanel() { // reads as a crash, and a user who is not told will still wonder why the // tools did not show up. if ((data?.sessions_reset ?? 0) > 0) setRestarted(true) + // Only a save that changed the enable carries the verdict; any other save + // leaves the last one standing, since the spec is still what it was. + if (data && 'agent_spec_rewritten' in data) setSpecNotRewritten(agentSpecNotRewritten(data)) }, onError: (_err, _vars, ctx) => { if (ctx?.prev) qc.setQueryData(QK, ctx.prev) @@ -350,8 +356,18 @@ export function ComputerUsePanel() { disabled={busy} /> )} + {/* No hand-off: the hand-off navigates away, and this panel's numeric + fields hold drafts that only commit on blur. */} + {specNotRewritten && } + {/* Shown even beside the notice: the sessions really were restarted, and + hiding that would leave a torn-down chat unexplained. Beside the notice + it drops "so this takes effect", which the notice says is not true. */} {restarted && ( -
{i18nT('pages.settings.computerUsePanel.your_chat_sessions_were_restarted_so_this_takes')}
+
+ {specNotRewritten + ? i18nT('pages.settings.computerUsePanel.your_chat_sessions_were_restarted') + : i18nT('pages.settings.computerUsePanel.your_chat_sessions_were_restarted_so_this_takes')} +
)} {cfg.enabled && (
{i18nT('pages.settings.computerUsePanel.computer_use_lets_the_agent_read_any_app_window')}
diff --git a/website/src/pages/settings/ConnectionsPanel.test.tsx b/website/src/pages/settings/ConnectionsPanel.test.tsx index c4c3d8b92a44..b54bba121c0c 100644 --- a/website/src/pages/settings/ConnectionsPanel.test.tsx +++ b/website/src/pages/settings/ConnectionsPanel.test.tsx @@ -218,6 +218,22 @@ describe('ConnectionsPanel — saving a client', () => { expect(within(gh).getByText('invalid_client_id')).toBeInTheDocument() }) + it('says the saved app did not reach the agent spec when the rebuild declined', async () => { + saveMock.mockResolvedValue({ + ok: true, + client: github({ client_id: 'abc', client_id_source: 'config' }), + agent_spec_rewritten: false, + }) + await mount() + const gh = cardFor('github') + fireEvent.change(within(gh).getByLabelText('Client ID'), { target: { value: 'abc' } }) + fireEvent.click(within(gh).getByRole('button', { name: 'Save' })) + + const notice = await within(gh).findByTestId('agent-spec-not-rewritten') + // No hand-off: it would unmount the card's unsaved drafts. + expect(within(notice).queryByRole('button')).not.toBeInTheDocument() + }) + it('names the confidential requirement per provider', async () => { await mount([github(), asana({ confidential: false, client_secret_set: false, client_secret_source: null })]) expect(within(cardFor('github')).getByText(/GitHub requires a client secret at the token endpoint/)).toBeInTheDocument() diff --git a/website/src/pages/settings/ConnectionsPanel.tsx b/website/src/pages/settings/ConnectionsPanel.tsx index ed87aa7c6aeb..42906b4029db 100644 --- a/website/src/pages/settings/ConnectionsPanel.tsx +++ b/website/src/pages/settings/ConnectionsPanel.tsx @@ -19,6 +19,7 @@ import { SettingsCard, SettingsInput, SettingsSection } from '../../components/s import { SecretField } from '../../components/SecretField' import { Btn } from '../../components/ui' import ErrorNotice from '../../components/ErrorNotice' +import AgentSpecNotRewrittenNotice, { agentSpecNotRewritten } from '../../components/AgentSpecNotRewrittenNotice' import { api, type ConnectionOAuthClient, type ConnectionOAuthClientSave } from '../../api/client' import { copyToClipboard } from '../../utils/clipboard' import { i18nT } from '../../i18n/t' @@ -99,6 +100,8 @@ function ClientCard({ client, index, readOnly }: { client: ConnectionOAuthClient const [secretClear, setSecretClear] = useState(false) const [formKey, setFormKey] = useState(0) const [error, setError] = useState(null) + // The change was saved but the agent spec did not follow it. + const [notApplied, setNotApplied] = useState(false) const [removeConfirm, setRemoveConfirm] = useState(false) const removeCancelRef = useRef(null) // Focus lands on Cancel when the delete arms, so a stray second press backs out. @@ -110,7 +113,8 @@ function ClientCard({ client, index, readOnly }: { client: ConnectionOAuthClient const saveMut = useMutation({ mutationFn: (body: ConnectionOAuthClientSave) => api.connectionsOAuthClientSave(client.slug, body), - onSuccess: () => { + onSuccess: (r) => { + setNotApplied(agentSpecNotRewritten(r)) setSecret('') setSecretClear(false) setFormKey(k => k + 1) @@ -123,7 +127,8 @@ function ClientCard({ client, index, readOnly }: { client: ConnectionOAuthClient }) const deleteMut = useMutation({ mutationFn: () => api.connectionsOAuthClientDelete(client.slug), - onSuccess: () => { + onSuccess: (r) => { + setNotApplied(agentSpecNotRewritten(r)) setClientId('') setSecret('') setSecretClear(false) @@ -233,6 +238,8 @@ function ClientCard({ client, index, readOnly }: { client: ConnectionOAuthClient destroying the client id and secret the operator has typed but not yet saved (a save failure is exactly when those drafts still exist). */} {error && } + {/* Same reason, no hand-off: it would unmount the card's unsaved drafts. */} + {notApplied && } {!readOnly && (
diff --git a/website/src/test/ConnectionsPage.coverage.test.tsx b/website/src/test/ConnectionsPage.coverage.test.tsx index aff3237c15e5..da3eab873316 100644 --- a/website/src/test/ConnectionsPage.coverage.test.tsx +++ b/website/src/test/ConnectionsPage.coverage.test.tsx @@ -911,6 +911,47 @@ describe('a connected provider', () => { expect(within(slot as HTMLElement).getByRole('link', { name: /Revoke at Notion/ })).toBeInTheDocument() }) + it('alerts when the Disconnect did not reach the agent spec', async () => { + mcpServers.mockResolvedValue(connected) + connectionsDisconnect.mockResolvedValue({ + ok: true, + grantRemoved: true, + grantSurviving: [], + entryRemoved: true, + grantSharedWith: [], + grantCensusIncomplete: false, + agentSpecRewritten: false, + }) + mount() + + fireEvent.click(await waitFor(() => within(card('notion')).getByRole('button', { name: /Disconnect/ }))) + + // The entry left the config, but new sessions may still load it: a failed + // step, so an alert rather than a green success. + const alert = await screen.findByRole('alert') + expect(alert).toHaveTextContent('Disconnected locally.') + expect(alert).toHaveTextContent('new chats still load this connection') + }) + + it('does not blame the agent spec when the Disconnect removed no entry', async () => { + mcpServers.mockResolvedValue(connected) + connectionsDisconnect.mockResolvedValue({ + ok: true, + grantRemoved: false, + grantSurviving: [], + entryRemoved: false, + grantSharedWith: [], + grantCensusIncomplete: false, + agentSpecRewritten: false, + }) + mount() + + fireEvent.click(await waitFor(() => within(card('notion')).getByRole('button', { name: /Disconnect/ }))) + + await screen.findByText(/server configuration was left unchanged/i) + expect(screen.queryByText(/new chats still load this connection/i)).not.toBeInTheDocument() + }) + it('says the grant was kept when another entry shares the endpoint', async () => { mcpServers.mockResolvedValue(connected) connectionsDisconnect.mockResolvedValue({ diff --git a/website/src/types/index.ts b/website/src/types/index.ts index 01a96c00341a..312f42892755 100644 --- a/website/src/types/index.ts +++ b/website/src/types/index.ts @@ -824,6 +824,8 @@ export interface McpDiscoverInstallResult { method: string /** False when the entry was written disabled (required env unset). Absent for capability installs. */ enabled?: boolean + /** False when the install was saved but the agent spec was not rewritten. */ + agent_spec_rewritten?: boolean } /** A raw mcp.json server spec (stdio command/args/env OR remote url). */