Skip to content

The agent that grows with you

review-fix(suppress-audit): agent_init/browser_supervisor/skills_sync_client/write_approval — restore BASE exception semantics

Tekniumc4b8485877b9
diff --git a/agent/agent_init.py b/agent/agent_init.py
index d9a739004f5..a0158d43059 100644
--- a/agent/agent_init.py
+++ b/agent/agent_init.py
@@ -1784,7 +1784,8 @@ def _select_context_engine(_agent_cfg):
general plugin system → None (built-in ContextCompressor)."""
_engine_name = "compressor"
with suppress(Exception):
- _engine_name = _agent_cfg.get("context", {}).get("engine", "compressor") or "compressor"
+ _ctx_cfg = _agent_cfg.get("context", {}) if isinstance(_agent_cfg, dict) else {}
+ _engine_name = _ctx_cfg.get("engine", "compressor") or "compressor"
if _engine_name == "compressor":
return None # built-in; don't auto-activate plugins
_selected_engine = None
diff --git a/tools/browser_supervisor.py b/tools/browser_supervisor.py
index 1b79ce7a3d7..900e70f47db 100644
--- a/tools/browser_supervisor.py
+++ b/tools/browser_supervisor.py
@@ -282,6 +282,7 @@ class CDPSupervisor(DialogSupervisionMixin, FrameTrackingMixin):
t.cancel()
if pending:
loop.run_until_complete(asyncio.gather(*pending, return_exceptions=True))
+ with contextlib.suppress(Exception):
loop.close()
self._set_active(False)
diff --git a/tools/skills_sync_client.py b/tools/skills_sync_client.py
index ca26c45716a..60e52d2baad 100644
--- a/tools/skills_sync_client.py
+++ b/tools/skills_sync_client.py
@@ -483,7 +483,8 @@ def sync_status() -> Dict[str, Any]:
except Exception as e:
logger.debug("skills_sync_client: sync_status identity failed: %s", e)
with suppress(Exception):
- status.update(opted_in_skills=list_synced_skill_names(), local_head=read_sync_state().get("head"))
+ status["opted_in_skills"] = list_synced_skill_names()
+ status["local_head"] = read_sync_state().get("head")
try:
org_identity = resolve_org_identity()
status.update(org_available=True, org_id=org_identity.get("org_id"), org_role=org_identity.get("org_role"),
diff --git a/tools/write_approval.py b/tools/write_approval.py
index 1c13433421a..5f84aeb72ca 100644
--- a/tools/write_approval.py
+++ b/tools/write_approval.py
@@ -106,9 +106,11 @@ def list_pending(subsystem: str) -> List[Dict[str, Any]]:
def get_pending(subsystem: str, pending_id: str) -> Optional[Dict[str, Any]]:
"""Return a single pending record by id, or None."""
+ path = _pending_path(subsystem, pending_id)
+ if not path.exists():
+ return None
with suppress(Exception):
- path = _pending_path(subsystem, pending_id)
- return json.loads(path.read_text(encoding="utf-8")) if path.exists() else None
+ return json.loads(path.read_text(encoding="utf-8"))
return None
@@ -126,8 +128,11 @@ def discard_pending(subsystem: str, pending_id: str) -> bool:
def pending_count(subsystem: str) -> int:
"""Cheap count of pending records (for notification badges)."""
+ d = _pending_path(subsystem, "").parent
+ if not d.exists():
+ return 0
with suppress(Exception):
- return len(_pending_files(subsystem))
+ return sum(1 for _ in d.glob("*.json"))
return 0
@@ -235,11 +240,13 @@ def _frontmatter_description(content: str) -> str:
def _find_skill_path(name: str) -> Optional[Path]:
"""Directory of an installed skill, or None if unknown / lookup unavailable."""
- with suppress(Exception):
+ try:
from tools.skill_manager_tool import _find_skill
- found = _find_skill(name)
- return found["path"] if found else None
- return None
+ except Exception:
+ return None
+ # Only the import is guarded (as on main); a lookup failure propagates.
+ found = _find_skill(name)
+ return found["path"] if found else None
def skill_pending_diff(record: Dict[str, Any]) -> str: