Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
feat: add --traceback flag for full CLI stack traces (#937)
掠蓝ba448fcf4411
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 53e2196a2..a43bc8894 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,8 @@- **Failed runs now carry a structured error on the delivery webhook.** When a pipeline run fails, the webhook payload includes an `error` object — the full `ErrorReport` as a dict — so receivers can rehydrate it with `ErrorReport.from_dict(...)`, render an RFC 7807 response, or route on `error_domain` / `retryable`. Applies to both Temporal and direct execution modes. A `WebhookTarget.payload` that declares a Pipelex-owned key (`pipeline_run_id` / `status` / `result_url` / `error`) is now rejected at construction time, so a caller's static payload key can no longer silently shift meaning with delivery status.+- **`--traceback` CLI flag for full stack traces.** By default CLI commands print a friendly one-line error; passing `--traceback` also prints the Rich-rendered stack trace before that message, for debugging. The flag is intercepted in `PipelexCLI.make_context` (mirroring `--no-logo`), so it is position-agnostic — it works both before and after the subcommand (`pipelex run --traceback pipe ...` and `pipelex run pipe ... --traceback`) without changing any command signature.+### Changed- **Filesystem path helpers in `pipelex.tools.misc.file_utils` and `pipelex.tools.misc.json_utils` now take and return `pathlib.Path` instead of `str`.** Helpers such as `save_text_to_path`, `load_text_from_path`, `load_binary` / `load_binary_async`, `load_json_from_path` / `load_json_dict_from_path` / `load_json_list_from_path`, `save_as_json_to_path`, `copy_file`, `remove_file` / `remove_folder`, `ensure_directory_exists` / `ensure_directory_for_file_path`, and `get_incremental_directory_path` / `get_incremental_file_path` now operate on `Path`. Path handling is `Path`-based throughout `pipelex/`, converting to/from `str` only at boundaries (CLI arguments, environment variables, JSON/TOML serialization). Callers passing bare strings must now wrap them with `Path(...)`.diff --git a/pipelex/cli/_cli.py b/pipelex/cli/_cli.pyindex e990a00ac..1bb3e67e2 100644--- a/pipelex/cli/_cli.py+++ b/pipelex/cli/_cli.py@@ -63,18 +63,24 @@ class PipelexCLI(TyperGroup):parent: Context | None = None,**extra: object,) -> Context:- """Intercept --no-logo from args before Click/Typer processes them.+ """Intercept global flags from args before Click/Typer processes them.- This allows --no-logo to be placed anywhere in the command line- (before or after subcommands) while keeping the CLI architecture clean.+ This allows --no-logo and --traceback to be placed anywhere in the+ command line (before or after subcommands) while keeping the CLI+ architecture clean."""no_logo = "--no-logo" in argsif no_logo:args = [arg for arg in args if arg != "--no-logo"]+ traceback = "--traceback" in args+ if traceback:+ args = [arg for arg in args if arg != "--traceback"]+ctx = super().make_context(info_name, args, parent, **extra)ctx.ensure_object(dict)ctx.obj["no_logo"] = no_logo+ ctx.obj["traceback"] = tracebackreturn ctxdiff --git a/pipelex/cli/commands/run/_run_core.py b/pipelex/cli/commands/run/_run_core.pyindex 655d38d65..daa17076d 100644--- a/pipelex/cli/commands/run/_run_core.py+++ b/pipelex/cli/commands/run/_run_core.py@@ -15,6 +15,7 @@ from pipelex.cli.error_handlers import (ErrorContext,handle_model_availability_error,handle_model_choice_error,+ print_traceback_if_requested,)from pipelex.config import get_configfrom pipelex.core.interpreter.exceptions import PipelexInterpreterError@@ -77,9 +78,11 @@ async def _execute_run(raise typer.Exit(1)pipe_code = main_pipe_codeexcept FileNotFoundError as exc:+ print_traceback_if_requested(get_console())typer.secho(f"Failed to load bundle '{bundle_path}': {exc}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from excexcept PipelexInterpreterError as exc:+ print_traceback_if_requested(get_console())typer.secho(f"Failed to parse bundle '{bundle_path}': {exc}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from excelif not pipe_code:@@ -93,6 +96,7 @@ async def _execute_run(try:pipeline_inputs = json.loads(inputs)except json.JSONDecodeError as json_decode_exc:+ print_traceback_if_requested(get_console())typer.secho(f"Failed to parse inline JSON inputs: {json_decode_exc}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from json_decode_excelse:@@ -103,9 +107,11 @@ async def _execute_run(pipeline_inputs = resolve_inputs_paths(pipeline_inputs, base_dir)typer.echo(f"Loaded inputs from: {inputs}")except FileNotFoundError as file_not_found_exc:+ print_traceback_if_requested(get_console())typer.secho(f"Failed to load input file '{inputs}': file not found", fg=typer.colors.RED, err=True)raise typer.Exit(1) from file_not_found_excexcept JsonTypeError as json_type_error_exc:+ print_traceback_if_requested(get_console())typer.secho(f"Failed to parse input file '{inputs}': must be a valid JSON dictionary", fg=typer.colors.RED, err=True)raise typer.Exit(1) from json_type_error_exc@@ -134,9 +140,11 @@ async def _execute_run()pipe_output = response.pipe_outputexcept PipelineExecutionError as exc:+ print_traceback_if_requested(get_console())typer.secho(f"Failed to execute pipeline '{exc.pipe_code}': {exc}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from excexcept PipelexError as exc:+ print_traceback_if_requested(get_console())typer.secho(f"Failed to execute pipeline '{pipe_code or bundle_path}': {exc}", fg=typer.colors.RED, err=True)raise typer.Exit(1) from exc@@ -308,6 +316,7 @@ def execute_run(except PipelexError as exc:console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]Failed to execute pipeline[/bold red]\n")console.print(f" {exc.message}\n")raise typer.Exit(1) from excdiff --git a/pipelex/cli/error_handlers.py b/pipelex/cli/error_handlers.pyindex 09e8beabd..ceee1895f 100644--- a/pipelex/cli/error_handlers.py+++ b/pipelex/cli/error_handlers.py@@ -1,9 +1,11 @@from pathlib import Pathfrom typing import NoReturn+import clickimport typerfrom rich.console import Consolefrom rich.markup import escape+from rich.traceback import Tracebackfrom pipelex.cogt.exceptions import GatewayUnknownModelError, ModelDeckPresetValidatonErrorfrom pipelex.core.pipes.exceptions import PipeOperatorModelChoiceError@@ -43,6 +45,26 @@ class ErrorContext(StrEnum):KIT = "Kit operation"+def is_traceback_requested() -> bool:+ """Check whether the --traceback global flag was passed on the CLI invocation."""+ try:+ ctx = click.get_current_context(silent=True)+ except RuntimeError:+ return False+ if ctx is None:+ return False+ obj = ctx.find_root().obj+ if obj is None:+ return False+ return bool(obj.get("traceback", False))+++def print_traceback_if_requested(console: Console) -> None:+ """Print a Rich traceback of the current exception when --traceback is active."""+ if is_traceback_requested():+ console.print(Traceback())++def display_error_panel(console: Console,*,@@ -89,12 +111,14 @@ def handle_model_choice_error(exc: PipeOperatorModelChoiceError, context: ErrorCexc: The model choice error exceptioncontext: Context for the error message"""+ console = get_console()+ print_traceback_if_requested(console)report = exc.to_error_report()tip = report.user_action_detail() or (f"Check your model configuration in .pipelex/inference/ or specify a different model in the '{exc.pipe_code}' pipe.")display_error_panel(- get_console(),+ console,title=f"{context} failed because of a model choice could not be interpreted correctly",fields=[("Pipe", f"[yellow]'{escape(exc.pipe_code)}'[/yellow] [dim]({escape(exc.pipe_type)})[/dim]"),@@ -118,6 +142,8 @@ def handle_model_availability_error(exc: PipeOperatorModelAvailabilityError, conexc: The model availability error exceptioncontext: Context for the error message"""+ console = get_console()+ print_traceback_if_requested(console)report = exc.to_error_report()fields: list[tuple[str, str]] = [("Pipe", f"[yellow]'{escape(exc.pipe_code)}'[/yellow] [dim]({escape(exc.pipe_type)})[/dim]"),@@ -133,7 +159,7 @@ def handle_model_availability_error(exc: PipeOperatorModelAvailabilityError, conf"Check your model configuration in .pipelex/inference/ or specify a different model in the '{exc.pipe_code}' pipe.")display_error_panel(- get_console(),+ console,title=f"{context} failed because a model wasn't available",fields=fields,error_message=escape(str(exc)),@@ -153,6 +179,8 @@ def handle_model_deck_preset_error(exc: ModelDeckPresetValidatonError, context:exc: The model deck preset validation error exceptioncontext: Context for the error message"""+ console = get_console()+ print_traceback_if_requested(console)report = exc.to_error_report()model_handle = exc.model_handle or ""fields: list[tuple[str, str]] = [@@ -186,7 +214,7 @@ def handle_model_deck_preset_error(exc: ModelDeckPresetValidatonError, context:tip = "\n".join(tip_lines)display_error_panel(- get_console(),+ console,title=f"{context} failed due to model deck preset validation error",fields=fields,error_message=escape(exc.message),@@ -280,6 +308,7 @@ def handle_validate_bundle_error(exc: ValidateBundleError, bundle_path: Path | N"""report = exc.to_error_report()console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Bundle validation failed[/bold red]\n")if bundle_path:@@ -306,6 +335,7 @@ def handle_inference_setup_required_error(exc: InferenceSetupRequiredError) -> Nexc: The inference setup required error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold yellow]⚠ First-time inference setup required[/bold yellow]\n")console.print(@@ -332,6 +362,7 @@ def handle_telemetry_config_validation_error(exc: TelemetryConfigValidationErrorexc: The telemetry config validation error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Telemetry configuration format has changed[/bold red]\n")console.print(@@ -361,6 +392,7 @@ def handle_gateway_terms_not_accepted_error(exc: GatewayTermsNotAcceptedError) -exc: The gateway terms not accepted error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Pipelex Gateway terms not accepted[/bold red]\n")console.print("[bold yellow]⚠ Action Required:[/bold yellow] Pipelex Gateway is enabled but you haven't accepted\nthe terms of service yet.\n")@@ -387,6 +419,7 @@ def handle_gateway_api_key_missing_error(exc: GatewayApiKeyMissingError) -> NoReexc: The gateway API key missing error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Pipelex Gateway API key not set[/bold red]\n")console.print("[bold yellow]⚠ Action Required:[/bold yellow] Pipelex Gateway is enabled but the API key\nenvironment variable is not set.\n")@@ -416,6 +449,7 @@ def handle_gateway_do_not_track_conflict_error(exc: GatewayDoNotTrackConflictErrexc: The gateway do not track conflict error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Pipelex Gateway requires telemetry[/bold red]\n")console.print(@@ -444,6 +478,7 @@ def handle_remote_config_validation_error(exc: RemoteConfigValidationError) -> Nexc: The remote config validation error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Pipelex Gateway configuration is invalid[/bold red]\n")console.print(@@ -480,6 +515,7 @@ def handle_remote_config_unavailable_error(exc: RemoteConfigUnavailableError) ->exc: The remote config unavailable error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Pipelex Gateway is unreachable and no cached config is available[/bold red]\n")console.print(@@ -513,6 +549,7 @@ def handle_gateway_unknown_model_error(exc: GatewayUnknownModelError) -> NoReturexc: The gateway unknown model error exception"""console = get_console()+ print_traceback_if_requested(console)console.print("\n[bold red]❌ Unknown gateway model handle[/bold red]\n")console.print(f"[bold cyan]Model handle:[/bold cyan] [yellow]'{escape(exc.model_name)}'[/yellow]")diff --git a/tests/unit/pipelex/cli/test_is_traceback_requested.py b/tests/unit/pipelex/cli/test_is_traceback_requested.pynew file mode 100644index 000000000..ae5d2a7f0--- /dev/null+++ b/tests/unit/pipelex/cli/test_is_traceback_requested.py@@ -0,0 +1,36 @@+"""Tests for is_traceback_requested().++Verifies that the function correctly reads the --traceback flag from the Click context.+"""++from __future__ import annotations++import click++from pipelex.cli.error_handlers import is_traceback_requested+++class TestIsTracebackRequested:+ """Unit tests for is_traceback_requested()."""++ def test_returns_false_when_no_click_context(self) -> None:+ """Outside a Click context, should return False."""+ assert is_traceback_requested() is False++ def test_returns_false_when_flag_not_set(self) -> None:+ """When ctx.obj has no 'traceback' key, should return False."""+ ctx = click.Context(click.Command("test"), obj={})+ with ctx:+ assert is_traceback_requested() is False++ def test_returns_true_when_flag_set(self) -> None:+ """When ctx.obj['traceback'] is True, should return True."""+ ctx = click.Context(click.Command("test"), obj={"traceback": True})+ with ctx:+ assert is_traceback_requested() is True++ def test_returns_false_when_flag_explicitly_false(self) -> None:+ """When ctx.obj['traceback'] is False, should return False."""+ ctx = click.Context(click.Command("test"), obj={"traceback": False})+ with ctx:+ assert is_traceback_requested() is Falsediff --git a/tests/unit/pipelex/cli/test_make_context.py b/tests/unit/pipelex/cli/test_make_context.pynew file mode 100644index 000000000..7491cf83c--- /dev/null+++ b/tests/unit/pipelex/cli/test_make_context.py@@ -0,0 +1,31 @@+"""Tests for PipelexCLI.make_context intercepting --traceback.++Verifies that the custom CLI group correctly strips --traceback from args+and stores it in ctx.obj.+"""++from __future__ import annotations++import click++from pipelex.cli._cli import PipelexCLI # noqa: PLC2701+++class TestPipelexCLIMakeContext:+ """Test that PipelexCLI.make_context intercepts --traceback."""++ def test_traceback_flag_intercepted(self) -> None:+ """--traceback should be removed from args and stored in ctx.obj."""+ group = PipelexCLI(name="pipelex")+ group.add_command(click.Command("dummy"))++ ctx = group.make_context("pipelex", ["--traceback", "dummy"])+ assert ctx.obj["traceback"] is True++ def test_no_traceback_flag(self) -> None:+ """Without --traceback, ctx.obj['traceback'] should be False."""+ group = PipelexCLI(name="pipelex")+ group.add_command(click.Command("dummy"))++ ctx = group.make_context("pipelex", ["dummy"])+ assert ctx.obj["traceback"] is Falsediff --git a/tests/unit/pipelex/cli/test_print_traceback_if_requested.py b/tests/unit/pipelex/cli/test_print_traceback_if_requested.pynew file mode 100644index 000000000..4a1ead564--- /dev/null+++ b/tests/unit/pipelex/cli/test_print_traceback_if_requested.py@@ -0,0 +1,42 @@+"""Tests for print_traceback_if_requested().++Verifies that the function prints a Rich traceback only when --traceback is active.+"""++from __future__ import annotations++from typing import TYPE_CHECKING++import click+from rich.traceback import Traceback++from pipelex.cli.error_handlers import print_traceback_if_requested++if TYPE_CHECKING:+ from pytest_mock import MockerFixture+++class TestPrintTracebackIfRequested:+ """Unit tests for print_traceback_if_requested()."""++ def test_does_not_print_when_flag_not_set(self, mocker: MockerFixture) -> None:+ """When --traceback is not active, console.print should not be called."""+ console = mocker.MagicMock()+ ctx = click.Context(click.Command("test"), obj={"traceback": False})+ with ctx:+ print_traceback_if_requested(console)+ console.print.assert_not_called()++ def test_prints_traceback_when_flag_set(self, mocker: MockerFixture) -> None:+ """When --traceback is active, console.print should be called with a Traceback."""+ console = mocker.MagicMock()+ ctx = click.Context(click.Command("test"), obj={"traceback": True})+ with ctx:+ try:+ msg = "test error"+ raise ValueError(msg)+ except ValueError:+ print_traceback_if_requested(console)+ console.print.assert_called_once()+ arg = console.print.call_args[0][0]+ assert isinstance(arg, Traceback)diff --git a/tests/unit/pipelex/cli/test_traceback_flag_error_handlers.py b/tests/unit/pipelex/cli/test_traceback_flag_error_handlers.pynew file mode 100644index 000000000..e38a563f3--- /dev/null+++ b/tests/unit/pipelex/cli/test_traceback_flag_error_handlers.py@@ -0,0 +1,62 @@+"""Integration tests for error handlers respecting the --traceback flag.++Verifies that handle_inference_setup_required_error prints or omits a Rich+traceback depending on the --traceback flag state.+"""++from __future__ import annotations++from typing import TYPE_CHECKING++import click+import pytest+import typer+from rich.traceback import Traceback++from pipelex.cli.error_handlers import handle_inference_setup_required_error+from pipelex.system.pipelex_service.exceptions import InferenceSetupRequiredError++if TYPE_CHECKING:+ from pytest_mock import MockerFixture+++class TestTracebackFlagInErrorHandlers:+ """Integration: error handlers respect the --traceback flag."""++ def test_handler_prints_traceback_when_flag_active(self, mocker: MockerFixture) -> None:+ """handle_inference_setup_required_error prints traceback when --traceback is set."""+ mock_console = mocker.MagicMock()+ mocker.patch("pipelex.cli.error_handlers.get_console", return_value=mock_console)++ exc = InferenceSetupRequiredError()+ ctx = click.Context(click.Command("test"), obj={"traceback": True})+ with ctx:+ try:+ raise exc+ except InferenceSetupRequiredError:+ with pytest.raises(typer.Exit):+ handle_inference_setup_required_error(exc)++ # The first call to console.print should be the Traceback+ first_call_arg = mock_console.print.call_args_list[0][0][0]+ assert isinstance(first_call_arg, Traceback)++ def test_handler_does_not_print_traceback_when_flag_absent(self, mocker: MockerFixture) -> None:+ """handle_inference_setup_required_error does NOT print traceback without --traceback."""+ mock_console = mocker.MagicMock()+ mocker.patch("pipelex.cli.error_handlers.get_console", return_value=mock_console)++ exc = InferenceSetupRequiredError()+ ctx = click.Context(click.Command("test"), obj={"traceback": False})+ with ctx:+ try:+ raise exc+ except InferenceSetupRequiredError:+ with pytest.raises(typer.Exit):+ handle_inference_setup_required_error(exc)++ # No call should have a Traceback argument+ for call in mock_console.print.call_args_list:+ args = call[0]+ for arg in args:+ assert not isinstance(arg, Traceback)diff --git a/tests/unit/pipelex/cli/test_traceback_flag_run_core.py b/tests/unit/pipelex/cli/test_traceback_flag_run_core.pynew file mode 100644index 000000000..b9c8931ce--- /dev/null+++ b/tests/unit/pipelex/cli/test_traceback_flag_run_core.py@@ -0,0 +1,184 @@+"""Tests for --traceback flag in _execute_run inner exception handlers.++Verifies that print_traceback_if_requested fires inside _execute_run's+inner except blocks before typer.Exit propagates, which is the actual+scenario described in issue #437.+"""++from __future__ import annotations++import asyncio+from typing import TYPE_CHECKING, Any++import click+import pytest+import typer+from rich.traceback import Traceback++if TYPE_CHECKING:+ from collections.abc import Coroutine++ from pytest_mock import MockerFixture++from pipelex.cli.commands.run._run_core import _execute_run # noqa: PLC2701 # pyright: ignore[reportPrivateUsage]+from pipelex.pipe_run.pipe_run_mode import PipeRunMode+from pipelex.pipeline.exceptions import PipelineExecutionError++OUTPUT_DIR = "temp/test_outputs"+++def _run_async(coro: Coroutine[Any, Any, Any]) -> Any:+ """Run a coroutine synchronously for testing."""+ loop = asyncio.new_event_loop()+ try:+ return loop.run_until_complete(coro)+ finally:+ loop.close()+++class TestTracebackFlagInExecuteRunInnerExcepts:+ """Verify that _execute_run inner except blocks call print_traceback_if_requested."""++ def test_pipeline_execution_error_prints_traceback(self, mocker: MockerFixture) -> None:+ """PipelineExecutionError in _execute_run prints traceback when --traceback is active."""+ mock_console = mocker.MagicMock()++ exc = PipelineExecutionError(+ message="boom",+ run_mode=PipeRunMode.LIVE,+ pipe_code="test-pipe",+ output_name=None,+ pipe_stack=["test-pipe"],+ )++ mocker.patch("pipelex.cli.commands.run._run_core.get_console", return_value=mock_console)+ mock_runner_cls = mocker.patch("pipelex.cli.commands.run._run_core.PipelexRunner")++ mock_runner = mocker.MagicMock()+ mock_runner.execute_pipeline = mocker.MagicMock(side_effect=exc)+ mock_runner_cls.return_value = mock_runner++ # Patch get_config to provide a minimal execution config+ mock_config = mocker.MagicMock()+ mock_config.pipelex.pipeline_execution_config.with_graph_config_overrides.return_value = mocker.MagicMock()+ mocker.patch("pipelex.cli.commands.run._run_core.get_config", return_value=mock_config)++ ctx = click.Context(click.Command("run"), obj={"traceback": True})+ with ctx:+ try:+ raise exc+ except PipelineExecutionError:+ # Now call _execute_run which will re-raise via the runner mock+ with pytest.raises(typer.Exit):+ _run_async(+ _execute_run(+ pipe_code="test-pipe",+ bundle_path=None,+ inputs=None,+ save_working_memory=False,+ working_memory_path=None,+ save_main_stuff=False,+ no_pretty_print=True,+ graph=None,+ graph_full_data=None,+ output_dir=OUTPUT_DIR,+ dry_run=False,+ mock_inputs=False,+ library_dir=None,+ cost_report=None,+ )+ )++ # print_traceback_if_requested should have called console.print with a Traceback+ traceback_calls = [call for call in mock_console.print.call_args_list if call[0] and isinstance(call[0][0], Traceback)]+ assert len(traceback_calls) >= 1, "Expected at least one Traceback print call"++ def test_bundle_file_not_found_prints_traceback(self, mocker: MockerFixture) -> None:+ """FileNotFoundError for bundle in _execute_run prints traceback when --traceback is active."""+ mock_console = mocker.MagicMock()+ mocker.patch("pipelex.cli.commands.run._run_core.get_console", return_value=mock_console)++ ctx = click.Context(click.Command("run"), obj={"traceback": True})+ with ctx, pytest.raises(typer.Exit):+ _run_async(+ _execute_run(+ pipe_code=None,+ bundle_path="/nonexistent/path/to/bundle.mthds",+ inputs=None,+ save_working_memory=False,+ working_memory_path=None,+ save_main_stuff=False,+ no_pretty_print=True,+ graph=None,+ graph_full_data=None,+ output_dir=OUTPUT_DIR,+ dry_run=False,+ mock_inputs=False,+ library_dir=None,+ cost_report=None,+ )+ )++ traceback_calls = [call for call in mock_console.print.call_args_list if call[0] and isinstance(call[0][0], Traceback)]+ assert len(traceback_calls) >= 1, "Expected at least one Traceback print call for bundle FileNotFoundError"++ def test_json_decode_error_prints_traceback(self, mocker: MockerFixture) -> None:+ """json.JSONDecodeError for inline inputs prints traceback when --traceback is active."""+ mock_console = mocker.MagicMock()+ mocker.patch("pipelex.cli.commands.run._run_core.get_console", return_value=mock_console)++ ctx = click.Context(click.Command("run"), obj={"traceback": True})+ with ctx, pytest.raises(typer.Exit):+ _run_async(+ _execute_run(+ pipe_code="test-pipe",+ bundle_path=None,+ inputs="{invalid json!!!",+ save_working_memory=False,+ working_memory_path=None,+ save_main_stuff=False,+ no_pretty_print=True,+ graph=None,+ graph_full_data=None,+ output_dir=OUTPUT_DIR,+ dry_run=False,+ mock_inputs=False,+ library_dir=None,+ cost_report=None,+ )+ )++ traceback_calls = [call for call in mock_console.print.call_args_list if call[0] and isinstance(call[0][0], Traceback)]+ assert len(traceback_calls) >= 1, "Expected at least one Traceback print call for JSONDecodeError"++ def test_no_traceback_when_flag_absent(self, mocker: MockerFixture) -> None:+ """FileNotFoundError for bundle does NOT print traceback when --traceback is False."""+ mock_console = mocker.MagicMock()+ mocker.patch("pipelex.cli.commands.run._run_core.get_console", return_value=mock_console)++ ctx = click.Context(click.Command("run"), obj={"traceback": False})+ with ctx, pytest.raises(typer.Exit):+ _run_async(+ _execute_run(+ pipe_code=None,+ bundle_path="/nonexistent/path/to/bundle.mthds",+ inputs=None,+ save_working_memory=False,+ working_memory_path=None,+ save_main_stuff=False,+ no_pretty_print=True,+ graph=None,+ graph_full_data=None,+ output_dir=OUTPUT_DIR,+ dry_run=False,+ mock_inputs=False,+ library_dir=None,+ cost_report=None,+ )+ )++ # No Traceback should have been printed+ for call in mock_console.print.call_args_list:+ args = call[0]+ for arg in args:+ assert not isinstance(arg, Traceback), "Traceback should NOT be printed when flag is absent"