From 3c0fab94b6683bdef8c00482f902df5f57ecd628 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 21 Apr 2026 19:54:18 +0800 Subject: [PATCH] fix: remove unreachable absolute path check in CLI run command The check `if not Path(working_dir).is_absolute()` on line 346 is dead code because both branches above guarantee an absolute path: - Line 336: `working_dir = os.path.abspath(working_dir)` always returns an absolute path - Line 342: `working_dir = os.getcwd()` always returns an absolute path The error message on line 348 could never be displayed. Remove the unreachable block. Co-Authored-By: Claude Opus 4.7 --- trae_agent/cli.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/trae_agent/cli.py b/trae_agent/cli.py index 3c20b820..b133c90d 100644 --- a/trae_agent/cli.py +++ b/trae_agent/cli.py @@ -342,13 +342,6 @@ def run( working_dir = os.getcwd() console.print(f"[blue]Using current directory as working directory: {working_dir}[/blue]") - # Ensure working directory is an absolute path - if not Path(working_dir).is_absolute(): - console.print( - f"[red]Working directory must be an absolute path: {working_dir}, it should start with `/`[/red]" - ) - sys.exit(1) - agent = Agent( agent_type, config,