diff --git a/strix/config/settings.py b/strix/config/settings.py index ecea8e50..91fbdef1 100644 --- a/strix/config/settings.py +++ b/strix/config/settings.py @@ -50,6 +50,7 @@ class RuntimeSettings(BaseSettings): # Hard cap on a local target's size before we refuse to stream it into the # sandbox file-by-file (the SDK copies every file individually, which stalls # on large repos). Above this, the user must bind-mount via ``--mount``. + # Set to 0 (or less) to disable the pre-flight check entirely. max_local_copy_mb: int = Field(default=1024, alias="STRIX_MAX_LOCAL_COPY_MB") diff --git a/strix/interface/utils.py b/strix/interface/utils.py index fbde4c2c..95a70f04 100644 --- a/strix/interface/utils.py +++ b/strix/interface/utils.py @@ -1239,8 +1239,11 @@ def find_oversized_local_targets( """Return ``(path, size_bytes)`` for non-mounted local targets over ``max_bytes``. Mounted targets are bind-mounted rather than copied, so their size is - irrelevant and they are excluded. + irrelevant and they are excluded. A ``max_bytes`` of zero or less disables + the check entirely (returns no targets). """ + if max_bytes <= 0: + return [] oversized: list[tuple[str, int]] = [] for target in targets_info: if target.get("type") != "local_code": diff --git a/tests/test_local_sources.py b/tests/test_local_sources.py index 2b0cd2a6..1cda1767 100644 --- a/tests/test_local_sources.py +++ b/tests/test_local_sources.py @@ -70,7 +70,14 @@ def test_find_oversized_ignores_mounted_targets(tmp_path: Path) -> None: def test_find_oversized_ignores_non_local_targets() -> None: targets = [{"type": "web_application", "details": {"target_url": "https://x"}}] - assert find_oversized_local_targets(targets, max_bytes=0) == [] + assert find_oversized_local_targets(targets, max_bytes=1) == [] + + +@pytest.mark.parametrize("disabled", [0, -1]) +def test_find_oversized_disabled_for_non_positive_limit(tmp_path: Path, disabled: int) -> None: + _write_file(tmp_path / "big.bin", 500) + targets = [_local_target(str(tmp_path))] + assert find_oversized_local_targets(targets, max_bytes=disabled) == [] def test_collect_local_sources_propagates_mount_flag() -> None: