Skip to content

The agent that grows with you

review-fix(suppress-audit): bedrock_adapter/run_turn_runner/self_repo_guard — restore BASE exception semantics

Teknium81984a7ebd7f
diff --git a/agent/bedrock_adapter.py b/agent/bedrock_adapter.py
index 26f01525165..a24513b026a 100644
--- a/agent/bedrock_adapter.py
+++ b/agent/bedrock_adapter.py
@@ -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)
diff --git a/gateway/run_turn_runner.py b/gateway/run_turn_runner.py
index a7c0696cca2..6735b495579 100644
--- a/gateway/run_turn_runner.py
+++ b/gateway/run_turn_runner.py
@@ -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) ───────────────────────────────────
diff --git a/tools/self_repo_guard.py b/tools/self_repo_guard.py
index a97bb2ffb04..35ab063966f 100644
--- a/tools/self_repo_guard.py
+++ b/tools/self_repo_guard.py
@@ -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(