Skip to content

Commit 7b6eff6

Browse files
committed
Incorporate review feedback
1 parent c256e8b commit 7b6eff6

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

redis_sre_agent/api/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
LOG_DATE_FORMAT = "%H:%M:%S"
3737

3838
logging.basicConfig(
39-
level=logging.__dict__[settings.log_level.upper()],
39+
level=getattr(logging, settings.log_level.upper(), logging.INFO),
4040
format=LOG_FORMAT,
4141
datefmt=LOG_DATE_FORMAT,
4242
)

redis_sre_agent/cli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_command(self, ctx, name):
3636
return None
3737
module_path, attr = target.split(":", 1)
3838
mod = importlib.import_module(module_path)
39-
return mod.__dict__[attr]
39+
return getattr(mod, attr)
4040

4141

4242
@click.command(cls=LazyGroup)

redis_sre_agent/tools/manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ def _get_provider_class(cls, provider_path: str) -> type:
224224
if provider_path not in cls._provider_class_cache:
225225
module_path, class_name = provider_path.rsplit(".", 1)
226226
module = __import__(module_path, fromlist=[class_name])
227-
cls._provider_class_cache[provider_path] = module.__dict__[class_name]
227+
provider_class = getattr(module, class_name, None)
228+
if not provider_class:
229+
logger.warning(f"Failed to load tool provider class: {provider_path}")
230+
cls._provider_class_cache[provider_path] = provider_class
228231
return cls._provider_class_cache[provider_path]
229232

230233
async def __aexit__(self, *args) -> None:

redis_sre_agent/tools/models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
from pydantic import BaseModel, ConfigDict, Field
55

6-
if TYPE_CHECKING:
7-
from redis_sre_agent.tools.models import ToolDefinition
8-
96

107
class ToolCapability(Enum):
118
"""Capabilities that tools can provide."""

redis_sre_agent/tools/protocols.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
data classes, and optional Protocols that describe the minimal contracts
55
HostTelemetry and other orchestrators can program against.
66
"""
7-
7+
import logging
88
from abc import ABC, abstractmethod
99
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Protocol, runtime_checkable
1010

@@ -18,6 +18,9 @@
1818
from .manager import ToolManager
1919

2020

21+
logger = logging.getLogger(__name__)
22+
23+
2124
# --------------------------- Optional provider Protocols ---------------------------
2225
# These describe the minimal contracts higher-level orchestrators can rely on
2326
# without referencing concrete implementations (e.g., Prometheus/Loki).
@@ -395,11 +398,12 @@ def get_status_update(self, tool_name: str, args: Dict[str, Any]) -> Optional[st
395398
try:
396399
op = self.resolve_operation(tool_name, args)
397400
if not op:
401+
logger.warning(f"get_status_update failed to resolve operation for {tool_name}")
398402
return None
399403
method = self.__dict__.get(op) or type(self).__dict__.get(op)
400404
if not method:
401405
return None
402-
template = method._status_update_template if method else None
406+
template = getattr(method, "_status_update_template", None)
403407
if not template:
404408
return None
405409
try:

0 commit comments

Comments
 (0)