mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Prevent stale bot from flagging internal maintainer discussions
Merge https://github.com/google/adk-python/pull/3938 Co-authored-by: Xuan Yang <xygoogle@google.com> COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3938 from ryanaiagent:fix/stale-bot-logic 605d3499784facffc0e0ca3c1fb0547202660f46 PiperOrigin-RevId: 846450195
This commit is contained in:
committed by
Copybara-Service
parent
e4ee9d7c46
commit
f51b9b70b2
@@ -1,3 +1,17 @@
|
||||
# Copyright 2025 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: ADK Stale Issue Auditor
|
||||
|
||||
on:
|
||||
|
||||
@@ -45,7 +45,7 @@ Your job is to analyze a specific issue and report findings before taking action
|
||||
- **IF True**: The user edited the description silently, and we haven't alerted yet.
|
||||
-> **Action**: Call `alert_maintainer_of_edit`.
|
||||
-> **Report**: "Analysis for Issue #[number]: ACTIVE. Silent update detected (Description Edit). Alerted maintainer."
|
||||
- **IF False**:
|
||||
- **IF False**:
|
||||
-> **Report**: "Analysis for Issue #[number]: ACTIVE. Last action was by user. No action."
|
||||
|
||||
- **Check Role**: If `last_action_role` is 'maintainer':
|
||||
@@ -53,16 +53,21 @@ Your job is to analyze a specific issue and report findings before taking action
|
||||
|
||||
**STEP 3: ANALYZE MAINTAINER INTENT**
|
||||
- **Context**: The last person to act was a Maintainer.
|
||||
- **Action**: Read the text in `last_comment_text`.
|
||||
- **Question Check**: Does the text ask a question, request clarification, ask for logs, or suggest trying a fix?
|
||||
- **Action**: Analyze `last_comment_text` using `maintainers` list and `last_actor_name`.
|
||||
|
||||
- **Internal Discussion Check**: Does the comment mention or address any username found in the `maintainers` list (other than the speaker `last_actor_name`)?
|
||||
- **Verdict**: **ACTIVE** (Internal Team Discussion).
|
||||
- **Report**: "Analysis for Issue #[number]: ACTIVE. Maintainer is discussing with another maintainer. No action."
|
||||
|
||||
- **Question Check**: Does the text ask a question, request clarification, ask for logs, or give suggestions?
|
||||
- **Time Check**: Is `days_since_activity` > {stale_threshold_days}?
|
||||
|
||||
- **DECISION**:
|
||||
- **IF (Question == YES) AND (Time == YES)**:
|
||||
- **IF (Question == YES) AND (Time == YES) AND (Internal Discussion Check == FALSE):**
|
||||
- **Action**: Call `add_stale_label_and_comment`.
|
||||
- **Check**: If '{REQUEST_CLARIFICATION_LABEL}' is not in `current_labels`, call `add_label_to_issue` for it.
|
||||
- **Check**: If '{REQUEST_CLARIFICATION_LABEL}' is not in `current_labels`, call `add_label_to_issue` with '{REQUEST_CLARIFICATION_LABEL}'.
|
||||
- **Report**: "Analysis for Issue #[number]: STALE. Maintainer asked question [days_since_activity] days ago. Marking stale."
|
||||
- **IF (Question == YES) BUT (Time == NO)**:
|
||||
- **Report**: "Analysis for Issue #[number]: PENDING. Maintainer asked question, but threshold not met yet. No action."
|
||||
- **IF (Question == NO)** (e.g., "I am working on this"):
|
||||
- **Report**: "Analysis for Issue #[number]: ACTIVE. Maintainer gave status update (not a question). No action."
|
||||
- **IF (Question == NO) OR (Internal Discussion Check == TRUE):**
|
||||
- **Report**: "Analysis for Issue #[number]: ACTIVE. Maintainer gave status update or internal discussion detected. No action."
|
||||
@@ -318,11 +318,13 @@ def _replay_history_to_find_state(
|
||||
- last_activity_time (datetime): Timestamp of the last human action.
|
||||
- last_action_type (str): The type of the last action (e.g., 'commented').
|
||||
- last_comment_text (Optional[str]): The text of the last comment.
|
||||
- last_actor_name (str): The specific username of the last actor.
|
||||
"""
|
||||
last_action_role = "author"
|
||||
last_activity_time = history[0]["time"]
|
||||
last_action_type = "created"
|
||||
last_comment_text = None
|
||||
last_actor_name = issue_author
|
||||
|
||||
for event in history:
|
||||
actor = event["actor"]
|
||||
@@ -337,6 +339,7 @@ def _replay_history_to_find_state(
|
||||
last_action_role = role
|
||||
last_activity_time = event["time"]
|
||||
last_action_type = etype
|
||||
last_actor_name = actor
|
||||
|
||||
# Only store text if it was a comment (resets on other events like labels/edits)
|
||||
if etype == "commented":
|
||||
@@ -349,6 +352,7 @@ def _replay_history_to_find_state(
|
||||
"last_activity_time": last_activity_time,
|
||||
"last_action_type": last_action_type,
|
||||
"last_comment_text": last_comment_text,
|
||||
"last_actor_name": last_actor_name,
|
||||
}
|
||||
|
||||
|
||||
@@ -428,6 +432,7 @@ def get_issue_state(item_number: int) -> Dict[str, Any]:
|
||||
"status": "success",
|
||||
"last_action_role": state["last_action_role"],
|
||||
"last_action_type": state["last_action_type"],
|
||||
"last_actor_name": state["last_actor_name"],
|
||||
"maintainer_alert_needed": maintainer_alert_needed,
|
||||
"is_stale": is_stale,
|
||||
"days_since_activity": days_since_activity,
|
||||
@@ -436,6 +441,8 @@ def get_issue_state(item_number: int) -> Dict[str, Any]:
|
||||
"current_labels": labels_list,
|
||||
"stale_threshold_days": STALE_HOURS_THRESHOLD / 24,
|
||||
"close_threshold_days": CLOSE_HOURS_AFTER_STALE_THRESHOLD / 24,
|
||||
"maintainers": maintainers,
|
||||
"issue_author": issue_author,
|
||||
}
|
||||
|
||||
except RequestException as e:
|
||||
|
||||
Reference in New Issue
Block a user