From 2fc941c1df66ad3930c92c6bd95f71c9391c8030 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Wed, 16 Apr 2025 21:25:21 +0200 Subject: [PATCH 1/4] fix(cli): only render progress when in TTY Prevents logging terminal clear commands in non-TTY environments (LangSmith / CI) --- libs/cli/langgraph_cli/progress.py | 37 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/libs/cli/langgraph_cli/progress.py b/libs/cli/langgraph_cli/progress.py index 38154f1b9..252abd009 100644 --- a/libs/cli/langgraph_cli/progress.py +++ b/libs/cli/langgraph_cli/progress.py @@ -44,21 +44,30 @@ class Progress: sys.stdout.flush() def __enter__(self) -> Callable[[str], None]: - self.thread = threading.Thread(target=self.spinner_task) - self.thread.start() + if not sys.stdout.isatty(): + self.thread = threading.Thread(target=self.spinner_task) + self.thread.start() - def set_message(message): - self.message = message - if not message: - self.thread.join() + def set_message(message): + self.message = message + if not message: + self.thread.join() - return set_message + return set_message + else: + + def set_message(message): + sys.stderr.write(message + "\n") + sys.stderr.flush() + + return set_message def __exit__(self, exception, value, tb): - self.message = "" - try: - self.thread.join() - finally: - del self.thread - if exception is not None: - return False + if sys.stdout.isatty(): + self.message = "" + try: + self.thread.join() + finally: + del self.thread + if exception is not None: + return False From 43af618bb5b1c34b9e6c2a487a12046ad9278030 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Wed, 16 Apr 2025 23:28:07 +0200 Subject: [PATCH 3/4] Remove negation --- libs/cli/langgraph_cli/progress.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/cli/langgraph_cli/progress.py b/libs/cli/langgraph_cli/progress.py index 252abd009..f07b48db1 100644 --- a/libs/cli/langgraph_cli/progress.py +++ b/libs/cli/langgraph_cli/progress.py @@ -44,7 +44,7 @@ class Progress: sys.stdout.flush() def __enter__(self) -> Callable[[str], None]: - if not sys.stdout.isatty(): + if sys.stdout.isatty(): self.thread = threading.Thread(target=self.spinner_task) self.thread.start() From 960f612dd730cdbef69e97678e30444b2639c5a8 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Wed, 16 Apr 2025 23:34:54 +0200 Subject: [PATCH 4/4] Bump to 0.2.4 --- libs/cli/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/cli/pyproject.toml b/libs/cli/pyproject.toml index a17a8dbc3..a69df77ed 100644 --- a/libs/cli/pyproject.toml +++ b/libs/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langgraph-cli" -version = "0.2.3" +version = "0.2.4" description = "CLI for interacting with LangGraph API" authors = [] license = "MIT"