Skip to content

Commit 7a5c400

Browse files
dougborgclaude
andcommitted
revert(mcp): drop SendMessage from iframe apply on_error
Reconsidered: the existing UpdateContext on the on_error chain already pushes the failure into the agent's model context — the agent reacts on its next turn, mirroring the on_success path's UpdateContext(content= RESULT). Adding a SendMessage doubles up: it puts a chat-visible "Apply failed: ..." line that the agent then has to deduplicate against the same content arriving via UpdateContext, AND adds chat noise on the common-rare error path. Keep the existing rail unchanged: - SetState/ShowToast → iframe feedback (toast for user, state for UI) - UpdateContext → agent receives the error reason The Bug #1 datetime fix (this PR) eliminates the load-bearing trigger for the SRAM-session Bug #4 — naive datetimes will no longer 422 silently. If iframe-error visibility remains an issue on a different class of failure, address it separately by investigating WHY the existing toast / UpdateContext aren't reaching their audience rather than layering SendMessage on top. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9574f24 commit 7a5c400

2 files changed

Lines changed: 0 additions & 24 deletions

File tree

katana_mcp_server/src/katana_mcp/tools/prefab_ui.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,6 @@ def _build_apply_action_direct(
332332
SetState("pending", False),
333333
SetState("error", "{{ $error }}"),
334334
ShowToast("{{ $error }}", variant="error"),
335-
# Mirror the cancel-button rail (line ~355): send a chat-
336-
# visible message so the user sees the failure in chat
337-
# instead of relying on the iframe toast (which is
338-
# easy to miss / may not render in some hosts). The
339-
# ``UpdateContext`` below is the agent-visible channel —
340-
# this ``SendMessage`` is the user-visible one.
341-
SendMessage("Apply failed: {{ $error }}"),
342335
UpdateContext(content="Apply failed: {{ $error }}"),
343336
],
344337
),

katana_mcp_server/tests/test_prefab_ui.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,23 +1047,6 @@ def test_po_preview_direct_apply_handles_error(self):
10471047
toasts = [a for a in on_error if a.get("action") == "showToast"]
10481048
assert len(toasts) == 1, f"Expected one error toast; got {toasts!r}"
10491049

1050-
# Bug #4 (2026-05-12 SRAM session): the iframe toast alone was
1051-
# invisible to the user during a live session where 9 confirm
1052-
# clicks silently failed against a Katana 422. The cancel-button
1053-
# rail uses SendMessage to surface back to chat; mirror that on
1054-
# error so users see a chat-visible message, not just an
1055-
# in-iframe toast.
1056-
send_messages = [a for a in on_error if a.get("action") == "sendMessage"]
1057-
assert len(send_messages) == 1, (
1058-
f"Expected one SendMessage on error so the failure surfaces in "
1059-
f"chat (not just the iframe toast); got {send_messages!r}"
1060-
)
1061-
send_content = send_messages[0].get("content", "")
1062-
assert "$error" in send_content, (
1063-
f"SendMessage on error must inline the $error reason so the user "
1064-
f"sees what went wrong; got {send_messages[0]!r}"
1065-
)
1066-
10671050
def test_po_preview_direct_apply_double_click_is_guarded(self):
10681051
"""Confirm button binds ``pending`` so a double-click cannot fire
10691052
two applies. Ensures (1) on_click sets pending=True before

0 commit comments

Comments
 (0)