Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.
Python agent-evaluationaiai-alignmentai-evaluationai-governanceai-safetyclidiagnostic-tooleu-ai-acthallucination-detectioniso-42001llm-evaluationllm-securitynist-ai-rmfowasp-llmprompt-injectionpythonresponsible-airisk-assessmentrisk-management
fix: propagate failures from runs launched by setup (#273)
Rudy Mizrahi Celekli7925d8edb7ae
diff --git a/ifixai/cli/setup_cmd.py b/ifixai/cli/setup_cmd.pyindex 7118afb..2d0b922 100644--- a/ifixai/cli/setup_cmd.py+++ b/ifixai/cli/setup_cmd.py@@ -475,7 +475,9 @@ def setup(ctx: click.Context) -> None:))click.echo()- subprocess.run(cmd)+ result = subprocess.run(cmd)+ if result.returncode:+ raise SystemExit(result.returncode)else:click.echo(click.style("When you're ready:", bold=True))click.echo(click.style(" ifixai run", fg="cyan"))diff --git a/ifixai/tests/test_setup_run_exit_status.py b/ifixai/tests/test_setup_run_exit_status.pynew file mode 100644index 0000000..32504bd--- /dev/null+++ b/ifixai/tests/test_setup_run_exit_status.py@@ -0,0 +1,35 @@+import os+import subprocess+import sys+from pathlib import Path++from click.testing import CliRunner++from ifixai.cli import setup_cmd+from ifixai.cli.setup_cmd import setup+++def test_setup_propagates_run_failure(monkeypatch):+ runner = CliRunner()+ main_path = str(Path(setup_cmd.__file__).with_name('main.py'))+ root = str(Path(setup_cmd.__file__).parents[2])+ monkeypatch.setenv('PYTHONPATH', os.pathsep.join([root, os.environ.get('PYTHONPATH', '')]))+ monkeypatch.setattr(sys, 'argv', [main_path, 'setup'])+ monkeypatch.setattr(setup_cmd.ui, 'is_interactive', lambda: True)+ monkeypatch.setattr(setup_cmd.ui, 'select', lambda message, choices, **kwargs: 'mock' if 'mock' in choices else choices[0])+ monkeypatch.setattr(setup_cmd.ui, 'text', lambda *args, **kwargs: '')+ monkeypatch.setattr(setup_cmd.ui, 'confirm', lambda *args, **kwargs: True)+ run = subprocess.run+ children = []++ def launch(command):+ child = run([sys.executable, "-m", "ifixai.cli.main", *command[1:], '--definitely-invalid-option'], capture_output=True, text=True)+ children.append(child)+ return child++ monkeypatch.setattr(setup_cmd.subprocess, 'run', launch)+ with runner.isolated_filesystem():+ result = runner.invoke(setup)+ assert result.exit_code == 2, result.exception+ assert len(children) == 1+ assert children[0].returncode == 2, children[0].stdout + children[0].stderr