Skip to content

feat(plugins): add missing @override decorators to LoggingPlugin callback methods #4496

@cchinchilla-dev

Description

@cchinchilla-dev

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

🔴 Required Information

Is your feature request related to a specific problem?

LoggingPlugin overrides ~12 callback methods from BasePlugin but none of them use the @override decorator from typing_extensions. This is inconsistent with every other plugin in the same package that follows this practice: DebugLoggingPlugin, ReplayPlugin, RecordingsPlugin, EnsureRetryOptionsPlugin, and _RequestIntercepterPlugin all decorate their overridden callbacks with @override.

The project runs mypy with strict = true (configured in pyproject.toml). Without @override, if a base class method in BasePlugin is ever renamed or removed, mypy would catch the breakage in DebugLoggingPlugin but silently miss it in LoggingPlugin — the methods would simply become dead code with no warning.

Describe the Solution You'd Like

Add from typing_extensions import override and the @override decorator to all overridden callback methods in src/google/adk/plugins/logging_plugin.py:

on_user_message_callback, before_run_callback, after_run_callback, on_event_callback, before_agent_callback, after_agent_callback, before_model_callback, after_model_callback, before_tool_callback, after_tool_callback, on_model_error_callback, on_tool_error_callback.

Impact on your work

Low urgency. This is a consistency and type-safety improvement, not a blocker. No timeline needed.

Willingness to contribute

Are you interested in implementing this feature yourself or submitting a PR? Yes — happy to open a PR for this.


🟡 Recommended Information

Describe Alternatives You've Considered

Leaving it as-is and relying on manual review to catch signature drift. This works until it doesn't — @override exists precisely to automate this check.

Proposed API / Implementation

The change is minimal. Current state:

# logging_plugin.py (current — no @override, no import)

class LoggingPlugin(BasePlugin):

  async def on_user_message_callback(
      self, *, invocation_context, user_message,
  ) -> Optional[types.Content]:
      ...

  async def before_run_callback(
      self, *, invocation_context,
  ) -> Optional[types.Content]:
      ...

Proposed:

# logging_plugin.py (proposed — matches DebugLoggingPlugin pattern)
from typing_extensions import override

class LoggingPlugin(BasePlugin):

  @override
  async def on_user_message_callback(
      self, *, invocation_context, user_message,
  ) -> Optional[types.Content]:
      ...

  @override
  async def before_run_callback(
      self, *, invocation_context,
  ) -> Optional[types.Content]:
      ...

Same pattern applied to all 12 overridden methods.

Additional Context

For reference, DebugLoggingPlugin in the same directory (src/google/adk/plugins/debug_logging_plugin.py) already decorates every callback override — this PR would bring LoggingPlugin in line with that established pattern. Purely additive: one import line and 12 decorators. No behavioral, API, or runtime change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tracing[Component] This issue is related to OpenTelemetry tracing

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions