Skip to content

Self-improving AI Employees for everyone

refactor(chat): remove chat and canvas code nothing calls

trohitg719a458d2bc5
diff --git a/client/src/types/INodeProperties.ts b/client/src/types/INodeProperties.ts
index e2d013bd..a9fbe77a 100644
--- a/client/src/types/INodeProperties.ts
+++ b/client/src/types/INodeProperties.ts
@@ -250,8 +250,6 @@ export interface INodeUIHints {
workspace?: { kind: string };
/** Special-case panel for gmaps_create with map preview. */
showLocationPanel?: boolean;
- /** ConsolePanel: this node is a chat-message target. */
- isChatTrigger?: boolean;
/** ConsolePanel: this node consumes console output (filter source). */
isConsoleSink?: boolean;
/** Agent panels show the connected-skills section. */
diff --git a/docs-internal/canvas_node.md b/docs-internal/canvas_node.md
index a474b0ed..cb4cc79e 100644
--- a/docs-internal/canvas_node.md
+++ b/docs-internal/canvas_node.md
@@ -198,8 +198,8 @@ Every mutation is one transaction that bumps `revision`. Caps:
### Panel WS handlers — [`_handlers.py`](../server/nodes/tool/canvas/_handlers.py)
-`canvas_list` / `canvas_remove` / `canvas_clear` / `canvas_versions` /
-`canvas_version` (the last two read an item's versions), all `@ws_response` (never
+`canvas_list` / `canvas_remove` / `canvas_clear` / `canvas_version` (the last
+reads one saved version of an item), all `@ws_response` (never
`@ws_handler` — a user-correctable failure must be one WARN line, not an
ERROR with a traceback), self-registered via `register_ws_handlers` from the
package `__init__`. Security preamble copied verbatim from simple_memory:
@@ -260,7 +260,6 @@ interface CanvasItem {
| `canvas_list {workflow_id, node_id}` | `{success, items: CanvasItem[], revision}` |
| `canvas_remove {workflow_id, node_id, item_id}` | `{success, removed, revision}` + broadcast |
| `canvas_clear {workflow_id, node_id}` | `{success, cleared, revision}` + broadcast |
-| `canvas_versions {workflow_id, node_id, item_id}` | `{success, item_id, versions: [{version, title, created_at, source, size_bytes}], latest}` (newest first) |
| `canvas_version {workflow_id, node_id, item_id, version}` | `{success, item: CanvasItem-at-that-version & {latest}}` |
| broadcast `canvas_updated` | `{type: 'canvas_updated', data: <WorkflowEvent>}`, data.data = `{workflow_id, node_id, revision}` |
| tool `canvas(title?, paths?, url?, content?, language?, mode, update_id?)` | flat schema, no `$defs`; `mode: 'append' \| 'replace'`; `update_id` revises an item |
diff --git a/docs-internal/frontend_architecture.md b/docs-internal/frontend_architecture.md
index ce48f427..aafa5908 100644
--- a/docs-internal/frontend_architecture.md
+++ b/docs-internal/frontend_architecture.md
@@ -593,7 +593,6 @@ Defined on `INodeTypeDescription.uiHints` ([client/src/types/INodeProperties.ts]
| `isCanvasPanel` | `MiddleSection`, `CanvasDock` | Render the pushed-content Canvas board instead of the plain params list. Declared by `canvas`. Double duty: the docked canvas sidebar also uses this flag to FIND Canvas nodes in the graph (`resolveNodeDescription(type)?.uiHints?.isCanvasPanel`) — never the type string. Pairs with an explicit `isConfigNode: False` because the `tool` group would auto-derive `True` while the node's `input-main` is real dataflow. See [canvas_node.md](./canvas_node.md). |
| `isBrowserPanel` | `MiddleSection`, `CanvasDock` (also the server's `graph_index`) | Show the node's live browser (`BrowserWorkspace`) above its parameters. Declared by `browser`. The Dev dock and Home's employee summary also use it to FIND Browser nodes in a graph, never the type string. See [browser_workspace.md](./browser_workspace.md). |
| `showLocationPanel` | `LocationParameterPanel` | Special-case panel for nodes with map preview |
-| `isChatTrigger` | (none) | This node is a chat-message target. No client reader since the console's trigger selector went: the Chat pane sends to every chat trigger of the open workflow. |
| `isConsoleSink` | `ConsolePanel` | This node consumes console output (filter source) |
| `hasSkills` | Agent panels | Connect the connected-skills section |
| `isConfigNode` | `InputSection`, `OutputPanel` | This node is auxiliary configuration — its panel inherits the parent's main inputs instead of showing direct upstream connections. **Auto-derived on the backend** by `_derive_auto_ui_hints` in [`server/services/plugin/base.py`](../server/services/plugin/base.py): plugins whose `group` tuple contains `memory` or `tool` get this for free. Explicit `cls.ui_hints` always wins. |
diff --git a/server/core/database.py b/server/core/database.py
index 6281a400..09796534 100644
--- a/server/core/database.py
+++ b/server/core/database.py
@@ -1629,26 +1629,14 @@ class Database:
"execution_id": message.execution_id,
}
- async def get_chat_messages(
+ async def read_chat_messages(
self, session_id: str, limit: Optional[int] = None,
execution_id: Optional[str] = None,
) -> List[Dict[str, Any]]:
"""Chat messages for a session, oldest first: the newest ``limit``
when given, of one generation when ``execution_id`` is. Rows are
- shaped by :meth:`chat_row`. A read that fails returns ``[]``; use
- :meth:`read_chat_messages` where a failure must be told apart from an
- empty thread."""
- try:
- return await self.read_chat_messages(session_id, limit, execution_id=execution_id)
- except Exception as e:
- logger.error("Failed to get chat messages", session_id=session_id, error=str(e))
- return []
-
- async def read_chat_messages(
- self, session_id: str, limit: Optional[int] = None,
- execution_id: Optional[str] = None,
- ) -> List[Dict[str, Any]]:
- """:meth:`get_chat_messages`, raising when the read fails."""
+ shaped by :meth:`chat_row`. Raises when the read fails, so a failure
+ is never mistaken for an empty thread."""
async with self.get_session() as session:
stmt = select(ChatMessage).where(ChatMessage.session_id == session_id)
if execution_id is not None:
@@ -1692,38 +1680,6 @@ class Database:
logger.error("Failed to clear chat messages", session_id=session_id, error=str(e))
return 0
- async def get_chat_sessions(self) -> List[Dict[str, Any]]:
- """Get list of all chat sessions with message counts."""
- try:
- async with self.get_session() as session:
- from sqlalchemy import func as sa_func
-
- stmt = (
- select(
- ChatMessage.session_id,
- sa_func.count(ChatMessage.id).label("message_count"),
- sa_func.max(ChatMessage.created_at).label("last_message_at"),
- )
- .group_by(ChatMessage.session_id)
- .order_by(sa_func.max(ChatMessage.created_at).desc())
- )
-
- result = await session.execute(stmt)
- rows = result.all()
-
- return [
- {
- "session_id": row.session_id,
- "message_count": row.message_count,
- "last_message_at": row.last_message_at.isoformat() if row.last_message_at else None,
- }
- for row in rows
- ]
-
- except Exception as e:
- logger.error("Failed to get chat sessions", error=str(e))
- return []
-
# ============================================================================
# Console Logs (Console Panel persistence)
# ============================================================================
diff --git a/server/models/node_metadata.py b/server/models/node_metadata.py
index 8a6a4e4f..df957dd3 100644
--- a/server/models/node_metadata.py
+++ b/server/models/node_metadata.py
@@ -37,7 +37,7 @@ class NodeMetadata(TypedDict, total=False):
description: str
version: int
# Per-node UI panel hints lifted from the legacy frontend INodeUIHints.
- # Flags like isChatTrigger / isConsoleSink / hasCodeEditor / isMemoryPanel.
+ # Flags like isConsoleSink / hasCodeEditor / isMemoryPanel.
uiHints: dict[str, object]
# Wave 10.A — full visual contract:
diff --git a/server/nodes/tool/canvas/_handlers.py b/server/nodes/tool/canvas/_handlers.py
index 5bc9cd6f..bc23084a 100644
--- a/server/nodes/tool/canvas/_handlers.py
+++ b/server/nodes/tool/canvas/_handlers.py
@@ -136,20 +136,6 @@ async def handle_canvas_clear(
return {"success": True, **result}
-@ws_response
-async def handle_canvas_versions(data: Dict[str, Any], websocket: WebSocket) -> Dict[str, Any]:
- """An item's versions, newest first."""
- store, scope = await _resolve_store_and_scope(data, websocket)
- item_id = str(data.get("item_id") or "").strip()
- if not item_id:
- raise NodeUserError("item_id required")
- try:
- result = await store.versions(scope, item_id)
- except CanvasStoreError as exc:
- raise NodeUserError(str(exc)) from exc
- return {"success": True, **result}
-
-
@ws_response
async def handle_canvas_version(data: Dict[str, Any], websocket: WebSocket) -> Dict[str, Any]:
"""One version of an item, whole."""
@@ -170,7 +156,6 @@ WS_HANDLERS: Dict[str, WSHandler] = {
"canvas_list": handle_canvas_list,
"canvas_remove": handle_canvas_remove,
"canvas_clear": handle_canvas_clear,
- "canvas_versions": handle_canvas_versions,
"canvas_version": handle_canvas_version,
}
@@ -181,5 +166,4 @@ __all__ = [
"handle_canvas_list",
"handle_canvas_remove",
"handle_canvas_version",
- "handle_canvas_versions",
]
diff --git a/server/nodes/trigger/chat_trigger/__init__.py b/server/nodes/trigger/chat_trigger/__init__.py
index 5e78417c..12d07ea2 100644
--- a/server/nodes/trigger/chat_trigger/__init__.py
+++ b/server/nodes/trigger/chat_trigger/__init__.py
@@ -57,7 +57,6 @@ class ChatTriggerNode(TriggerNode):
description = "Trigger workflow when user sends a chat message from the console input"
component_kind = "trigger"
handles = ({"name": "output-main", "kind": "output", "position": "right", "label": "Output", "role": "main"},)
- ui_hints = {"isChatTrigger": True}
task_queue = TaskQueue.TRIGGERS_EVENT
mode = "event"
event_type = "chat_message_received"
diff --git a/server/tests/nodes/_harness.py b/server/tests/nodes/_harness.py
index 39f9b26b..3918ae47 100644
--- a/server/tests/nodes/_harness.py
+++ b/server/tests/nodes/_harness.py
@@ -204,7 +204,7 @@ def _build_mock_database() -> MagicMock:
db.save_node_parameters = AsyncMock(return_value=None)
db.save_api_usage_metric = AsyncMock(return_value=None)
db.add_token_usage_metric = AsyncMock(return_value=None)
- db.get_chat_messages = AsyncMock(return_value=[])
+ db.read_chat_messages = AsyncMock(return_value=[])
db.add_chat_message = AsyncMock(return_value=None)
db.add_console_log = AsyncMock(return_value=None)
return db
diff --git a/server/tests/nodes/test_canvas_node.py b/server/tests/nodes/test_canvas_node.py
index 57425582..9abb2643 100644
--- a/server/tests/nodes/test_canvas_node.py
+++ b/server/tests/nodes/test_canvas_node.py
@@ -29,7 +29,6 @@ from nodes.tool.canvas._handlers import (
handle_canvas_list,
handle_canvas_remove,
handle_canvas_version,
- handle_canvas_versions,
)
from nodes.tool.canvas._store import (
CANVAS_NOTE_MAX_BYTES,
@@ -711,7 +710,7 @@ async def test_handler_round_trip_list_remove_clear(
assert final["items"] == []
-async def test_handler_reads_versions(canvas_database, handler_env, handler_events):
+async def test_handler_reads_a_version(canvas_database, handler_env, handler_events):
handler_env(_graph())
store = CanvasStore(canvas_database)
scope = CanvasScope(owner_id="owner", workflow_id="wf-h", node_id="canvas-h")
@@ -719,16 +718,14 @@ async def test_handler_reads_versions(canvas_database, handler_env, handler_even
await store.update(scope, note["id"], {"kind": "note", "content": "two"})
where = {"workflow_id": "wf-h", "node_id": "canvas-h", "item_id": note["id"]}
- listed = await handle_canvas_versions(where, _FakeSocket())
- assert (listed["success"], listed["latest"], [entry["version"] for entry in listed["versions"]]) == (True, 2, [2, 1])
first = await handle_canvas_version({**where, "version": 1}, _FakeSocket())
assert (first["success"], first["item"]["content"], first["item"]["latest"]) == (True, "one", 2)
assert (await handle_canvas_version({**where, "version": 9}, _FakeSocket()))["success"] is False
assert (await handle_canvas_version({**where, "version": "1"}, _FakeSocket()))["success"] is False
- assert (await handle_canvas_versions({**where, "item_id": ""}, _FakeSocket()))["success"] is False
+ assert (await handle_canvas_version({**where, "item_id": "", "version": 1}, _FakeSocket()))["success"] is False
# The same preamble as the other handlers.
- assert (await handle_canvas_versions(where, _FakeSocket(path="/ws/internal")))["success"] is False
+ assert (await handle_canvas_version({**where, "version": 1}, _FakeSocket(path="/ws/internal")))["success"] is False
# ---------------------------------------------------------------------------
diff --git a/server/tests/services/chat/test_attachments.py b/server/tests/services/chat/test_attachments.py
index 27452942..08c1e4de 100644
--- a/server/tests/services/chat/test_attachments.py
+++ b/server/tests/services/chat/test_attachments.py
@@ -87,7 +87,7 @@ async def test_a_message_carries_its_files_to_the_employee(chat, workspace):
{"message": "Is this stock right?", "session_id": "wf", "attachments": [{"path": photo}], "options": {"web": False}}, None
)
assert sent["success"] is True
- [row] = await chat.database.get_chat_messages("wf")
+ [row] = await chat.database.read_chat_messages("wf")
assert [ref["path"] for ref in row["attachments"]] == [photo]
assert chat.dispatched[-1]["data"]["attachments"][0]["path"] == photo
run = await ledger.get_run(chat.database, sent["run_id"])
diff --git a/server/tests/services/chat/test_handlers.py b/server/tests/services/chat/test_handlers.py
index 9767a0f6..b5ac5f72 100644
--- a/server/tests/services/chat/test_handlers.py
+++ b/server/tests/services/chat/test_handlers.py
@@ -67,7 +67,7 @@ async def test_a_second_message_while_a_run_is_live_is_refused(chat):
second = await send(chat, "And Sunday?")
assert second == {"success": False, "error": "run_in_progress", "run_id": first["run_id"]}
assert len(chat.dispatched) == 1
- assert [row["message"] for row in await chat.database.get_chat_messages("wf")] == ["Book Saturday"]
+ assert [row["message"] for row in await chat.database.read_chat_messages("wf")] == ["Book Saturday"]
async def test_a_resent_message_returns_the_first_send_and_dispatches_once(chat):
@@ -90,7 +90,7 @@ async def test_no_run_when_no_deployed_chat_trigger_answers_the_session(chat):
assert (await send(chat, session_id="wf2"))["run_id"] is None
await add_control(chat.database, "wf3", "running", nodes=[chat_trigger("wf3", disabled=True)])
assert (await send(chat, session_id="wf3"))["run_id"] is None
- assert len(await chat.database.get_chat_messages("wf")) == 1
+ assert len(await chat.database.read_chat_messages("wf")) == 1
async def test_the_owner_writes_only_their_own_messages(chat):
diff --git a/server/tests/services/chat/test_ledger.py b/server/tests/services/chat/test_ledger.py
index 05280dd5..c5b214e8 100644
--- a/server/tests/services/chat/test_ledger.py
+++ b/server/tests/services/chat/test_ledger.py
@@ -48,7 +48,7 @@ async def test_a_message_and_its_run_are_admitted_together(database, hub):
assert run.user_message_uid == admission.message["uid"]
assert run.reply_message_uid == f"a_{run.run_id}"
assert (run.workflow_id, run.run_key) == ("wf", "gen-1")
- [row] = await database.get_chat_messages("wf")
+ [row] = await database.read_chat_messages("wf")
assert (row["role"], row["message"], row["run_id"], row["execution_id"]) == ("user", "Book Saturday", run.run_id, "gen-1")
@@ -58,7 +58,7 @@ async def test_one_live_run_per_session(database, hub):
await admit(database, text_="And Sunday?")
assert refused.value.run.run_id == first.run.run_id
# Nothing of the refused send was written.
- assert [row["message"] for row in await database.get_chat_messages("wf")] == ["Book Saturday"]
+ assert [row["message"] for row in await database.read_chat_messages("wf")] == ["Book Saturday"]
# Another session has its own lane.
assert (await admit(database, "other")).run is not None
@@ -85,7 +85,7 @@ async def test_a_resent_message_returns_the_first_send(database, hub):
assert again.created is False
assert again.message["uid"] == first.message["uid"]
assert again.run.run_id == first.run.run_id
- assert len(await database.get_chat_messages("wf")) == 1
+ assert len(await database.read_chat_messages("wf")) == 1
# The same client id in another chat names another message.
elsewhere = await admit(database, "other", client_message_id="c-1")
assert elsewhere.message["uid"] != first.message["uid"]
@@ -95,7 +95,7 @@ async def test_a_resent_message_returns_the_first_send(database, hub):
async def test_a_malformed_client_message_id_is_refused(database, bad):
with pytest.raises(ValueError):
await admit(database, client_message_id=bad)
- assert await database.get_chat_messages("wf") == []
+ assert await database.read_chat_messages("wf") == []
async def test_an_untracked_message_starts_no_run(database):
@@ -110,7 +110,7 @@ async def test_an_untracked_message_starts_no_run(database):
async def test_every_message_follows_the_last_one(database):
for n in range(3):
await database.add_chat_message("wf", "user", f"m{n}")
- rows = await database.get_chat_messages("wf")
+ rows = await database.read_chat_messages("wf")
assert rows[0]["parent_uid"] is None
assert [row["parent_uid"] for row in rows[1:]] == [row["uid"] for row in rows[:-1]]
async with database.get_session() as session:
@@ -122,7 +122,7 @@ async def test_every_message_follows_the_last_one(database):
async def test_concurrent_writes_never_fork_the_chain(database):
await asyncio.gather(*(database.add_chat_message("wf", "assistant", f"m{n}") for n in range(10)))
- rows = await database.get_chat_messages("wf")
+ rows = await database.read_chat_messages("wf")
parents = [row["parent_uid"] for row in rows]
assert len(set(parents)) == 10, "two messages followed the same one"
assert sum(parent is None for parent in parents) == 1
@@ -131,7 +131,7 @@ async def test_concurrent_writes_never_fork_the_chain(database):
async def test_a_message_id_from_another_chat_is_refused(database):
await database.add_chat_message("wf", "user", "mine", uid="m_shared")
assert await database.add_chat_message("other", "user", "theirs", uid="m_shared") is None
- assert await database.get_chat_messages("other") == []
+ assert await database.read_chat_messages("other") == []
async def test_older_rows_are_migrated_into_one_chain(database):
@@ -152,7 +152,7 @@ async def test_older_rows_are_migrated_into_one_chain(database):
)
await database._migrate_chat_messages()
await database._migrate_chat_messages() # runs again at every startup; changes nothing
- rows = await database.get_chat_messages("wf")
+ rows = await database.read_chat_messages("wf")
assert [(row["uid"], row["parent_uid"]) for row in rows] == [("m1", None), ("m3", "m1")]
assert [(row["kind"], row["status"], row["parts"]) for row in rows] == [("text", "complete", {})] * 2
# A new message continues the migrated chain.
@@ -236,7 +236,7 @@ async def test_a_second_reply_node_gets_its_own_id_and_a_retry_saves_once(databa
retry = await ledger.post_reply(database, run=run, node_id="n1", text="One (retried).", execution_id="gen-1")
assert (first["uid"], second["uid"], retry["uid"]) == (run.reply_message_uid, f"{run.reply_message_uid}.2", run.reply_message_uid)
assert retry["message"] == "One."
- assert [row["message"] for row in await database.get_chat_messages("wf")] == ["Book Saturday", "One.", "Two."]
+ assert [row["message"] for row in await database.read_chat_messages("wf")] == ["Book Saturday", "One.", "Two."]
async def test_two_reply_nodes_at_once_never_share_an_id(database, hub):
diff --git a/server/tests/services/chat/test_parts.py b/server/tests/services/chat/test_parts.py
index 616c35d6..c69943b0 100644
--- a/server/tests/services/chat/test_parts.py
+++ b/server/tests/services/chat/test_parts.py
@@ -82,7 +82,7 @@ async def test_the_reply_carries_the_ui_from_the_moment_it_is_saved(database, hu
assert [item["part_id"] for item in reply["parts"]["ui"]] == [part_id]
finished = await ledger.finish_run(database, run_id=run.run_id, success=True, **CLAIM)
assert finished.result == {"reply_message_id": run.reply_message_uid}
- [_, saved] = await database.get_chat_messages("wf")
+ [_, saved] = await database.read_chat_messages("wf")
assert saved["parts"]["ui"][0]["part_id"] == part_id
@@ -91,7 +91,7 @@ async def test_a_run_that_only_showed_a_ui_gets_a_reply_holding_it(database, hub
part_id = await parts.show_ui(database, stream_of(run), tool_call_id="call_1", spec=booking())
finished = await ledger.finish_run(database, run_id=run.run_id, success=True, **CLAIM)
assert finished.result == {"reply_message_id": run.reply_message_uid}
- [_, reply] = await database.get_chat_messages("wf")
+ [_, reply] = await database.read_chat_messages("wf")
assert (reply["role"], reply["message"], reply["uid"]) == ("assistant", "", run.reply_message_uid)
assert reply["parts"]["ui"][0]["part_id"] == part_id
# Open threads were told to read it.
@@ -106,7 +106,7 @@ async def test_the_end_keeps_what_the_owner_set_after_the_reply_was_saved(databa
# A second interface after the reply was saved is added at the end.
second = await parts.show_ui(database, stream_of(run), tool_call_id="call_2", spec=booking())
await ledger.finish_run(database, run_id=run.run_id, success=True, **CLAIM)
- [_, reply] = await database.get_chat_messages("wf")
+ [_, reply] = await database.read_chat_messages("wf")
assert [item["part_id"] for item in reply["parts"]["ui"]] == [first, second]
assert reply["parts"]["ui"][0]["state"]["slot"] == "s4"
@@ -151,7 +151,7 @@ async def test_what_the_owner_sets_is_kept_on_the_ui(database, hub):
# After, on the reply.
second = await parts.update_ui_state(database, "wf", part_id, [{"path": "/note", "value": "Patch test done"}, {"path": "/a/b", "value": 1}])
assert second["state_revision"] == 2 and second["state"]["note"] == "Patch test done" and second["state"]["a"] == {"b": 1}
- [_, reply] = await database.get_chat_messages("wf")
+ [_, reply] = await database.read_chat_messages("wf")
assert reply["parts"]["ui"][0]["state"]["slot"] == "s4"
with pytest.raises(parts.UiRefused):
@@ -192,7 +192,7 @@ async def test_a_press_goes_to_the_employee_as_a_ui_event(chat):
assert sent["success"] is True
pressed_run = await ledger.get_run(chat.database, sent["run_id"])
assert pressed_run.kind == "action"
- rows = await chat.database.get_chat_messages("wf")
+ rows = await chat.database.read_chat_messages("wf")
owner = rows[-1]
# The owner's message reads the button's label, whatever the client sent.
assert (owner["message"], owner["kind"], owner["meta"]["ui_event"]) == ("Hold this slot for 15 min", "action", press)
@@ -242,7 +242,7 @@ async def test_a_document_the_run_wrote_shows_once_at_its_latest_version(databas
# A run that wrote nothing but the document gets a reply holding its card.
finished = await ledger.finish_run(database, run_id=run.run_id, success=True, **CLAIM)
assert finished.result == {"reply_message_id": run.reply_message_uid}
- [_, reply] = await database.get_chat_messages("wf")
+ [_, reply] = await database.read_chat_messages("wf")
assert (reply["message"], reply["parts"]["artifacts"]) == ("", [document(2)])
@@ -254,7 +254,7 @@ async def test_a_newer_version_replaces_the_card_on_a_saved_reply(database, hub)
await parts.show_artifact(database, stream_of(run), artifact=document(2))
await parts.show_artifact(database, stream_of(run), artifact=document(1, item_id="item_2"))
await ledger.finish_run(database, run_id=run.run_id, success=True, **CLAIM)
- [_, saved] = await database.get_chat_messages("wf")
+ [_, saved] = await database.read_chat_messages("wf")
# In place, then the new one.
assert saved["parts"]["artifacts"] == [document(2), document(1, item_id="item_2")]
diff --git a/server/tests/services/chat/test_relay.py b/server/tests/services/chat/test_relay.py
index 8a1211cb..90393b3d 100644
--- a/server/tests/services/chat/test_relay.py
+++ b/server/tests/services/chat/test_relay.py
@@ -14,7 +14,6 @@ from __future__ import annotations
import asyncio
import inspect
import json
-from types import SimpleNamespace
from typing import Any, Dict, List, Optional
import pytest
diff --git a/server/tests/services/test_chat_thread.py b/server/tests/services/test_chat_thread.py
index 9df698f3..75741c9f 100644
--- a/server/tests/services/test_chat_thread.py
+++ b/server/tests/services/test_chat_thread.py
@@ -128,7 +128,7 @@ async def test_a_recorded_message_is_stamped_and_announced(database, frames):
await control(database, "7", "running", generation=2)
saved = await chat_thread.record_chat_message(database, "7", "assistant", "Done.")
assert saved["message"] == "Done." and saved["uid"].startswith("m_")
- [row] = await database.get_chat_messages("7")
+ [row] = await database.read_chat_messages("7")
assert (row["role"], row["message"], row["execution_id"]) == ("assistant", "Done.", "gen-2")
[frame] = frames
assert frame["type"] == "chat.updated"
@@ -140,7 +140,7 @@ async def test_a_recorded_message_is_stamped_and_announced(database, frames):
async def test_the_editors_default_chat_is_no_workflows_thread(database, frames):
await chat_thread.record_chat_message(database, "default", "user", "hi")
- [row] = await database.get_chat_messages("default")
+ [row] = await database.read_chat_messages("default")
assert row["execution_id"] is None
assert updates(frames) == [{"workflow_id": None, "session_id": "default", "role": "user"}]
@@ -149,7 +149,7 @@ async def test_clearing_removes_every_generation_and_is_announced(database, fram
await database.add_chat_message("7", "user", "old", execution_id="gen-1")
await database.add_chat_message("7", "user", "new", execution_id="gen-2")
assert await chat_thread.clear_chat_thread(database, "7") == 2
- assert await database.get_chat_messages("7") == []
+ assert await database.read_chat_messages("7") == []
assert updates(frames) == [{"workflow_id": "7", "session_id": "7", "role": None}]
@@ -170,8 +170,8 @@ async def test_a_reset_ends_the_workflows_chat_session(database, frames, node):
args = {"node_id": f"7:{node}:1", "workflow_id": "7", "execution_id": "gen-1", "generation": 1, "graph": {}, "database": database}
assert await reset(**args) == {"reset": True, "cleared_chat_messages": 2}
- assert await database.get_chat_messages("7") == []
- assert [row["message"] for row in await database.get_chat_messages("8")] == ["another workflow's thread"]
+ assert await database.read_chat_messages("7") == []
+ assert [row["message"] for row in await database.read_chat_messages("8")] == ["another workflow's thread"]
# The next chat node in the same Reset finds nothing, and says nothing.
assert await reset(**args) == {"reset": False, "cleared_chat_messages": 0}
assert updates(frames) == [{"workflow_id": "7", "session_id": "7", "role": None}]
@@ -186,13 +186,13 @@ async def test_deleting_the_workflow_deletes_its_thread(database, frames, monkey
monkeypatch.setattr(hooks, "_HOOKS", [chat_thread.clear_chat_thread])
await database.add_chat_message("7", "user", "hello", execution_id="gen-1")
await hooks.run_workflow_deleted_hooks(database, "7")
- assert await database.get_chat_messages("7") == []
+ assert await database.read_chat_messages("7") == []
async def test_history_is_the_newest_rows_oldest_first_in_utc(database):
for text in ("one", "two", "three"):
await database.add_chat_message("7", "user", text, execution_id="gen-1")
- rows = await database.get_chat_messages("7", limit=2)
+ rows = await database.read_chat_messages("7", limit=2)
assert [row["message"] for row in rows] == ["two", "three"]
assert rows[0]["id"] < rows[1]["id"]
assert datetime.fromisoformat(rows[0]["timestamp"]).utcoffset().total_seconds() == 0
@@ -212,7 +212,7 @@ async def test_a_workflow_that_is_not_running_takes_no_message(router):
assert await send("hello?", "7") == {"success": False, "error": "not_running"}
await control(router.database, "7", "failed")
assert (await send("hello?", "7"))["error"] == "not_running"
- assert await router.database.get_chat_messages("7") == []
+ assert await router.database.read_chat_messages("7") == []
assert router.dispatched == [] and router.frames == []
@@ -221,7 +221,7 @@ async def test_a_message_goes_now_or_waits_for_resume(router, status, delivery):
await control(router.database, "7", status, generation=3)
result = await send("Book Tuesday", "7")
assert result["success"] is True and result["delivery"] == delivery and result["timestamp"] == "t"
- [row] = await router.database.get_chat_messages("7")
+ [row] = await router.database.read_chat_messages("7")
assert (row["role"], row["message"], row["execution_id"]) == ("user", "Book Tuesday", "gen-3")
assert result["message_id"] == row["uid"]
# No chat trigger answers this graph, so the message starts no run.
@@ -235,7 +235,7 @@ async def test_the_default_session_keeps_its_old_behaviour(router):
result = await chat_handlers.handle_send_chat_message({"message": "hi"}, None)
assert result["success"] is True and "delivery" not in result
assert datetime.fromisoformat(result["timestamp"]).utcoffset() is not None
- assert [row["message"] for row in await router.database.get_chat_messages("default")] == ["hi"]
+ assert [row["message"] for row in await router.database.read_chat_messages("default")] == ["hi"]
assert router.dispatched[0][1] is None
@@ -288,7 +288,7 @@ async def test_the_owners_clear_lets_the_agent_forget_too(router):
cleared = await chat_handlers.handle_clear_chat_messages({"session_id": "7"}, None)
assert cleared["cleared_count"] == 1
- assert await router.database.get_chat_messages("7") == []
+ assert await router.database.read_chat_messages("7") == []
# A failing listener never fails the clear, nor stops the next one.
assert heard == [(router.database, "7")]
@@ -301,7 +301,7 @@ async def test_save_and_clear_go_through_the_thread(router):
await control(router.database, "7", "running", generation=4)
saved = await chat_handlers.handle_save_chat_message({"message": "An answer", "role": "assistant", "session_id": "7"}, None)
assert saved["success"] is True
- [row] = await router.database.get_chat_messages("7")
+ [row] = await router.database.read_chat_messages("7")
assert row["execution_id"] == "gen-4"
cleared = await chat_handlers.handle_clear_chat_messages({"session_id": "7"}, None)
assert cleared["cleared_count"] == 1
diff --git a/server/tests/services/test_workflow_control.py b/server/tests/services/test_workflow_control.py
index 30cb647a..86e01986 100644
--- a/server/tests/services/test_workflow_control.py
+++ b/server/tests/services/test_workflow_control.py
@@ -88,7 +88,7 @@ async def test_generation_atomically_creates_and_archives_isolated_data_scope(co
await control_database.add_chat_message("wf-scope", "user", "archived", execution_id=scope.id)
await control_database.add_chat_message("wf-scope", "user", "new", execution_id="new-scope")
- current_chat = await control_database.get_chat_messages(
+ current_chat = await control_database.read_chat_messages(
"wf-scope", execution_id="new-scope",
)
assert [item["message"] for item in current_chat] == ["new"]
diff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.py
index 7f885973..07d757d3 100644
--- a/server/tests/test_node_spec.py
+++ b/server/tests/test_node_spec.py
@@ -756,14 +756,10 @@ class TestDisplayOptionsEnrichment:
class TestUIHintsInNodeSpec:
"""Wave 6 Phase 5.b: NODE_METADATA carries panel-level uiHints
- (isChatTrigger/isConsoleSink/hasCodeEditor/etc) so frontend
+ (isConsoleSink/hasCodeEditor/etc) so frontend
dispatch can read them off the cached NodeSpec instead of
importing legacy *_NODE_TYPES arrays or per-node definition flags."""
- def test_chat_trigger_carries_is_chat_trigger(self):
- spec = get_node_spec("chatTrigger")
- assert spec.get("uiHints", {}).get("isChatTrigger") is True
-
def test_console_carries_is_console_sink(self):
spec = get_node_spec("console")
assert spec.get("uiHints", {}).get("isConsoleSink") is True
@@ -957,7 +953,6 @@ class TestNodeSpecContractInvariants:
# request budget instead of keeping its own list of slow types.
"executionTimeoutMs",
"showLocationPanel",
- "isChatTrigger",
"isConsoleSink",
"hasSkills",
# Wave 10.A: size hints carried by plugin registrations