fix: ignore adk-bot administrative actions in stale agent

Merge https://github.com/google/adk-python/pull/4041

## Description
This PR fixes false positive stale labels in the `adk_stale_agent`.

Previously, the agent was incorrectly identifying the issue as "stale" because it treated `adk-bot` (acting via PAT) as a human maintainer. Since the username lacks the `[bot]` suffix, administrative alerts (e.g., "Notification: The author has updated...") were counted as maintainer activity, inadvertently triggering the stale logic immediately after an author's edit.

## Changes Made
- **Hardcoded Bot Exclusion:** Added `BOT_NAME = "adk-bot"` and updated history parsing loops (comments, edits, timeline) to explicitly ignore this actor.
- **Bot Alert Skip:** Added logic to `continue` (skip) processing the bot's specific "Notification" comment so it is not recorded as the last activity on the timeline.

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4041 from ryanaiagent:fix/stale-bot-logic f1500a94cb8c9d5090e9b1ef29690506120f7749
PiperOrigin-RevId: 852365962
This commit is contained in:
Rohit Yanamadala
2026-01-05 10:45:18 -08:00
committed by Copybara-Service
parent 6b7386b762
commit 3ec7ae3b8d
@@ -49,6 +49,7 @@ logger = logging.getLogger("google_adk." + __name__)
BOT_ALERT_SIGNATURE = (
"**Notification:** The author has updated the issue description"
)
BOT_NAME = "adk-bot"
# --- Global Cache ---
_MAINTAINERS_CACHE: Optional[List[str]] = None
@@ -246,8 +247,9 @@ def _build_history_timeline(
if BOT_ALERT_SIGNATURE in c_body:
if last_bot_alert_time is None or c_time > last_bot_alert_time:
last_bot_alert_time = c_time
continue
if actor and not actor.endswith("[bot]"):
if actor and not actor.endswith("[bot]") and actor != BOT_NAME:
# Use edit time if available, otherwise creation time
e_time = c.get("lastEditedAt")
actual_time = dateutil.parser.isoparse(e_time) if e_time else c_time
@@ -263,7 +265,7 @@ def _build_history_timeline(
if not e:
continue
actor = e.get("editor", {}).get("login")
if actor and not actor.endswith("[bot]"):
if actor and not actor.endswith("[bot]") and actor != BOT_NAME:
history.append({
"type": "edited_description",
"actor": actor,
@@ -285,7 +287,7 @@ def _build_history_timeline(
label_events.append(time_val)
continue
if actor and not actor.endswith("[bot]"):
if actor and not actor.endswith("[bot]") and actor != BOT_NAME:
pretty_type = (
"renamed_title" if etype == "RenamedTitleEvent" else "reopened"
)