AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).
fix(chat): label a calendar delete through manage_event as a removal (#395)
Rufusf060ee7bb2d0
diff --git a/packages/core/openexecutive/orchestrator/action_chips.py b/packages/core/openexecutive/orchestrator/action_chips.pyindex 7059963e..0b32ffa5 100644--- a/packages/core/openexecutive/orchestrator/action_chips.py+++ b/packages/core/openexecutive/orchestrator/action_chips.py@@ -435,7 +435,7 @@ def summarize_action(# tap-to-see list.mcp_name = tool_input.get("name", "tool")payload["tool"] = mcp_name if isinstance(mcp_name, str) else "call_tool"- payload["summary"] = tool_labels.labels_for(mcp_name)[0]+ payload["summary"] = tool_labels.labels_for(mcp_name, tool_input.get("arguments"))[0]payload["target"] = tool_labels.detail_for(mcp_name, tool_input.get("arguments"), tool_result)diff --git a/packages/core/openexecutive/orchestrator/activity_labels.py b/packages/core/openexecutive/orchestrator/activity_labels.pyindex 27b9e6a8..7ffd10f2 100644--- a/packages/core/openexecutive/orchestrator/activity_labels.py+++ b/packages/core/openexecutive/orchestrator/activity_labels.py@@ -218,7 +218,7 @@ def _mcp_label(tool_input: Any) -> tuple[str, str]:return f"{tool_labels.GENERIC_DOING}…", "call_tool"# Label from the full name: the 48-char cut is for `tool` only, and a# cut name would miss the table the chip reads (and the two would differ).- doing = tool_labels.labels_for(raw)[1]+ doing = tool_labels.labels_for(raw, tool_input.get("arguments"))[1]# One line beside the dots: the fallback for an unlisted tool can run# long, so the whole label (ellipsis included) stays within _LABEL_MAX.if len(doing) >= _LABEL_MAX:diff --git a/packages/core/openexecutive/orchestrator/tool_labels.py b/packages/core/openexecutive/orchestrator/tool_labels.pyindex 4f4235ef..acda2bfc 100644--- a/packages/core/openexecutive/orchestrator/tool_labels.py+++ b/packages/core/openexecutive/orchestrator/tool_labels.py@@ -174,11 +174,22 @@ def _clean(text: str, limit: int) -> str:return text if len(text) <= limit else text[: limit - 1].rstrip() + "…"-def labels_for(raw_name: Any) -> tuple[str, str]:- """(done, doing) phrases for an MCP tool name. Never returns the raw name."""+def labels_for(raw_name: Any, arguments: Any = None) -> tuple[str, str]:+ """(done, doing) phrases for an MCP tool name. Never returns the raw name.++ `arguments` matters only for a tool whose action depends on them, such+ as Google's `manage_event`, which also deletes: a deletion must not read+ as "Updated your calendar".+ """if not isinstance(raw_name, str) or not raw_name.strip():return GENERIC_DONE, GENERIC_DOINGserver, tool = _split(raw_name.strip())+ if (+ tool == "manage_event"+ and isinstance(arguments, dict)+ and str(arguments.get("action", "")).lower() == "delete"+ ):+ return _LABELS["delete_calendar_event"]if tool in _LABELS:return _LABELS[tool]words = [w for w in tool.split("_") if w]diff --git a/packages/core/tests/unit/test_tool_labels.py b/packages/core/tests/unit/test_tool_labels.pyindex 11c516ac..f17835de 100644--- a/packages/core/tests/unit/test_tool_labels.py+++ b/packages/core/tests/unit/test_tool_labels.py@@ -139,3 +139,15 @@ def test_a_long_unlisted_tool_keeps_the_progress_line_short() -> None:assert activity is not Noneassert len(activity["label"]) <= 60assert activity["label"].endswith("…")+++def test_a_calendar_delete_through_manage_event_says_so() -> None:+ tool_input = {"name": "google_workspace__manage_event", "arguments": {"action": "delete", "event_id": "e1"}}+ chip = summarize_action(tool_name="call_tool", tool_input=tool_input, tool_result="ok")+ activity = summarize_activity([{"id": "t", "name": "call_tool", "input": tool_input}])+ assert chip is not None and activity is not None+ assert chip["summary"] == "Removed a calendar event"+ assert activity["label"] == "Removing a calendar event…"+ assert tool_labels.labels_for("google_workspace__manage_event", {"action": "update"})[0] == (+ "Updated your calendar"+ )