review-fix(suppress-audit): bedrock_adapter/run_turn_runner/self_repo_guard — restore BASE exception semantics
This commit is contained in:
@@ -205,7 +205,8 @@ def _stale_error_types() -> tuple:
|
||||
("botocore.exceptions", ("ConnectionError", "HTTPClientError")),
|
||||
("urllib3.exceptions", ("ProtocolError", "NewConnectionError", "ConnectionError")),
|
||||
):
|
||||
with suppress(ImportError): # pragma: no cover — both present with boto3
|
||||
# AttributeError too: ``from mod import Name`` raised ImportError for a missing name.
|
||||
with suppress(ImportError, AttributeError): # pragma: no cover — both present with boto3
|
||||
types += [getattr(importlib.import_module(module), name) for name in names]
|
||||
return tuple(types)
|
||||
|
||||
|
||||
@@ -76,8 +76,11 @@ class TurnRunner:
|
||||
ctx._cleanup_msg_ids.append(str(result.message_id))
|
||||
|
||||
def _track_future_cleanup_id(self, fut) -> None:
|
||||
with suppress(Exception):
|
||||
self._track_progress_result(fut.result())
|
||||
try:
|
||||
res = fut.result()
|
||||
except Exception:
|
||||
return
|
||||
self._track_progress_result(res)
|
||||
|
||||
# ── progress_callback (agent thread → progress queue) ───────────────────────────────────
|
||||
|
||||
|
||||
@@ -70,10 +70,11 @@ class _ShellContext: # one `(` / `$(` / backtick nesting level and its live quo
|
||||
|
||||
def get_running_source_root() -> Path | None:
|
||||
"""The source checkout backing this process, if there is one."""
|
||||
with contextlib.suppress(OSError, RuntimeError):
|
||||
try:
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
return root if (root / ".git").exists() else None
|
||||
return None
|
||||
except (OSError, RuntimeError):
|
||||
return None
|
||||
return root if (root / ".git").exists() else None
|
||||
|
||||
|
||||
def _resolve(path_str: str, base: Path) -> Path:
|
||||
@@ -373,10 +374,11 @@ def _inspect_git(
|
||||
return None
|
||||
if alias.startswith("!"): # shell alias: scan it as a command
|
||||
return _find_mutation(alias[1:], target, root, depth + 1)
|
||||
with contextlib.suppress(ValueError):
|
||||
try:
|
||||
alias_args = shlex.split(alias, posix=True)
|
||||
return _inspect_git(executable, [*alias_args, *sub_args], target, {}, root, depth + 1)
|
||||
return None
|
||||
except ValueError:
|
||||
return None
|
||||
return _inspect_git(executable, [*alias_args, *sub_args], target, {}, root, depth + 1)
|
||||
|
||||
|
||||
def _inspect_github_cli(
|
||||
|
||||
Reference in New Issue
Block a user