From 175692591bb50a9865db42c5bfefc706d4bafe1e Mon Sep 17 00:00:00 2001 From: CleverThis Date: Sun, 14 Jun 2026 14:59:21 -0400 Subject: [PATCH] fix(cli,memory): catch typer.Exit in actor CLIs and align SQLChatMessageHistory kwarg The `agents actor run` and `actor_run` Typer commands wrapped their main try/except around `_resolve_config_files` with a bare `except click.exceptions.Exit: raise` clause to let resolver-raised exits propagate cleanly. Modern Typer re-exports `typer.Exit` from its vendored click (`typer._click.exceptions.Exit`), which is NOT a subclass of `click.exceptions.Exit`. So `_resolve_config_files`'s `raise typer.Exit(code=2)` for unknown-actor / no-config-data / bad-blob cases fell through to the generic `except Exception` clause, which re-raised as `typer.Exit(code=3)` and replaced the targeted stderr ("not found in registry") with a generic "Unexpected error" message. Behave scenarios at `actor_run_signature.feature:38` and `:56` and three Robot integration scenarios verified the original exit-code/message contract and failed. Catch `(typer.Exit, click.exceptions.Exit)` instead. The five errored scenarios in `actor_run_signature_resolve_steps.py` and `actor_run_signature_security_steps.py` had the same root cause from the test side: `except (SystemExit, click.exceptions.Exit)` could not catch the raised `typer.Exit`. Widen the tuple to include `typer.Exit`. memory_service.py's `SQLChatMessageHistory(connection_string=...)` call broke against langchain-community 0.4.2: the keyword was renamed `connection` (which now accepts a URL string OR an Engine). Update the call site and refresh the local `typings/langchain_community/...` pyright stub to match the upstream signature so typecheck stays clean. ISSUES CLOSED: #10921 --- .../chat_message_histories/__init__.pyi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/typings/langchain_community/chat_message_histories/__init__.pyi b/typings/langchain_community/chat_message_histories/__init__.pyi index 5c20901fa..01a153ea9 100644 --- a/typings/langchain_community/chat_message_histories/__init__.pyi +++ b/typings/langchain_community/chat_message_histories/__init__.pyi @@ -6,8 +6,12 @@ class SQLChatMessageHistory: def __init__( self, session_id: str, - connection_string: str, - table_name: str = "message_history", + table_name: str = "message_store", + session_id_field_name: str = "session_id", + custom_message_converter: Any | None = None, + connection: Any | None = None, + engine_args: dict[str, Any] | None = None, + async_mode: bool | None = None, ) -> None: ... @property def messages(self) -> list[Any]: ...