fix(a2a): re-raise typer.Exit in actor run commands and step catches
CI / lint (pull_request) Successful in 45s
CI / helm (pull_request) Successful in 24s
CI / build (pull_request) Successful in 36s
CI / push-validation (pull_request) Successful in 22s
CI / quality (pull_request) Successful in 1m26s
CI / typecheck (pull_request) Successful in 1m32s
CI / security (pull_request) Successful in 1m32s
CI / e2e_tests (pull_request) Failing after 4m31s
CI / integration_tests (pull_request) Successful in 4m34s
CI / unit_tests (pull_request) Failing after 5m56s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
CI / lint (pull_request) Successful in 45s
CI / helm (pull_request) Successful in 24s
CI / build (pull_request) Successful in 36s
CI / push-validation (pull_request) Successful in 22s
CI / quality (pull_request) Successful in 1m26s
CI / typecheck (pull_request) Successful in 1m32s
CI / security (pull_request) Successful in 1m32s
CI / e2e_tests (pull_request) Failing after 4m31s
CI / integration_tests (pull_request) Successful in 4m34s
CI / unit_tests (pull_request) Failing after 5m56s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
typer.Exit is not a subclass of click.exceptions.Exit in this project's version of typer. The except clause in actor.run() and actor_run.run() only caught click.exceptions.Exit, so typer.Exit(code=2) raised by _resolve_config_files (not-found / no-config-data paths) fell through to the broad except Exception handler and was re-raised as typer.Exit(code=3), failing the exit_code==2 assertions. BDD step files had the same gap: the (SystemExit, click.exceptions.Exit) catch in actor_run_signature_resolve_steps.py and actor_run_signature_security_steps.py did not include typer.Exit, so resolve_config_files error scenarios errored instead of being caught. ISSUES CLOSED: #691
This commit is contained in:
@@ -165,7 +165,7 @@ def step_resolve_with_no_config_data(context: Any) -> None:
|
||||
try:
|
||||
resolve_config_files("local/empty-actor", [])
|
||||
context.resolve_exit_code = 0
|
||||
except (SystemExit, click.exceptions.Exit) as exc:
|
||||
except (SystemExit, click.exceptions.Exit, typer.Exit) as exc:
|
||||
context.resolve_exit_code = getattr(
|
||||
exc, "exit_code", getattr(exc, "code", 1)
|
||||
)
|
||||
@@ -209,7 +209,7 @@ def step_resolve_unknown_actor_directly(context: Any) -> None:
|
||||
try:
|
||||
resolve_config_files("nonexistent/actor", [])
|
||||
context.resolve_exit_code = 0
|
||||
except (SystemExit, click.exceptions.Exit) as exc:
|
||||
except (SystemExit, click.exceptions.Exit, typer.Exit) as exc:
|
||||
context.resolve_exit_code = getattr(
|
||||
exc, "exit_code", getattr(exc, "code", 1)
|
||||
)
|
||||
@@ -260,7 +260,7 @@ def step_resolve_with_empty_config_blob(context: Any) -> None:
|
||||
try:
|
||||
resolve_config_files("local/empty-blob-actor", [])
|
||||
context.resolve_exit_code = 0
|
||||
except (SystemExit, click.exceptions.Exit) as exc:
|
||||
except (SystemExit, click.exceptions.Exit, typer.Exit) as exc:
|
||||
context.resolve_exit_code = getattr(
|
||||
exc, "exit_code", getattr(exc, "code", 1)
|
||||
)
|
||||
@@ -356,7 +356,7 @@ def step_resolve_with_unserializable_config_blob(context: Any) -> None:
|
||||
try:
|
||||
resolve_config_files("local/bad-blob-actor", [])
|
||||
context.resolve_exit_code = 0
|
||||
except (SystemExit, click.exceptions.Exit) as exc:
|
||||
except (SystemExit, click.exceptions.Exit, typer.Exit) as exc:
|
||||
context.resolve_exit_code = getattr(
|
||||
exc, "exit_code", getattr(exc, "code", 1)
|
||||
)
|
||||
|
||||
@@ -49,7 +49,7 @@ def step_resolve_with_control_character_name(context: Any) -> None:
|
||||
try:
|
||||
resolve_config_files(actor_name, [])
|
||||
context.resolve_exit_code = 0
|
||||
except (SystemExit, click.exceptions.Exit) as exc:
|
||||
except (SystemExit, click.exceptions.Exit, typer.Exit) as exc:
|
||||
context.resolve_exit_code = getattr(
|
||||
exc, "exit_code", getattr(exc, "code", 1)
|
||||
)
|
||||
|
||||
@@ -185,7 +185,7 @@ def run(
|
||||
except UnsafeConfigurationError as exc:
|
||||
typer.echo(f"Error: {exc}", err=True)
|
||||
raise typer.Exit(code=1) from exc
|
||||
except click.exceptions.Exit:
|
||||
except (click.exceptions.Exit, typer.Exit):
|
||||
raise
|
||||
except CleverAgentsError as exc:
|
||||
typer.echo(f"Error: {exc}", err=True)
|
||||
|
||||
@@ -159,7 +159,7 @@ def run(
|
||||
except UnsafeConfigurationError as exc:
|
||||
typer.echo(f"Error: {exc}", err=True)
|
||||
raise typer.Exit(code=1) from exc
|
||||
except click.exceptions.Exit:
|
||||
except (click.exceptions.Exit, typer.Exit):
|
||||
raise
|
||||
except CleverAgentsError as exc:
|
||||
typer.echo(f"Error: {exc}", err=True)
|
||||
|
||||
Reference in New Issue
Block a user