-
Notifications
You must be signed in to change notification settings - Fork 278
Stale Issue Auditor agent implementation #845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @hemasekhar-p, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a sophisticated Stale Issue Auditor agent designed to enhance repository health by intelligently managing inactive GitHub issues. This agent, built using the Google ADK, distinguishes between genuinely abandoned issues and those under active maintainer investigation by leveraging a Large Language Model (LLM). It automates the entire lifecycle of an issue, from initial labeling and warning to eventual closure, while also incorporating mechanisms to detect and flag silent edits to issue descriptions by authors. Additionally, several core ADK components were refined to support this new agent's functionality and improve overall event and session management. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces the Stale Issue Auditor, an exemplary agent demonstrating the capabilities of the Google ADK for repository health automation. The implementation is well-structured, particularly the use of GraphQL for efficient data fetching and the clear decision logic in the prompt. The accompanying core framework changes are also solid, improving robustness and adding useful features like callbackContextData. My review focuses on improving the efficiency, robustness, and consistency of the new sample agent code.
| <maven.compiler.source>17</maven.compiler.source> | ||
| <maven.compiler.target>17</maven.compiler.target> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| <adk.version>0.5.0</adk.version> <!--${project.version}</adk.version> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ADK version is hardcoded to 0.5.0, while the parent POM is using 0.5.1-SNAPSHOT. This can lead to build failures or runtime issues if the sample relies on features or fixes introduced in the newer version, which is likely given the concurrent changes to the core framework in this PR. It's best practice to inherit the version from the parent POM to ensure consistency.
| <adk.version>0.5.0</adk.version> <!--${project.version}</adk.version> --> | |
| <adk.version>${project.version}</adk.version> |
| private static String getEnv(String key) { | ||
| return System.getenv(key); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getEnv method returns null if an environment variable is not set. This can lead to a NullPointerException when the value is used later (e.g., in Integer.parseInt or directly). It's more robust to fail fast with a clear error message if a required environment variable is missing.
| private static String getEnv(String key) { | |
| return System.getenv(key); | |
| } | |
| private static String getEnv(String key) { | |
| String value = System.getenv(key); | |
| if (value == null || value.isEmpty()) { | |
| throw new IllegalStateException("Required environment variable '" + key + "' is not set."); | |
| } | |
| return value; | |
| } |
|
|
||
| public class StaleBotApp { | ||
|
|
||
| private static final Logger logger = Logger.getLogger(StaleBotApp.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class uses java.util.logging.Logger, but the project dependencies include SLF4J, which is used in other classes like StaleAgent. For consistency across the project, it's recommended to use SLF4J here as well. This would involve changing the logger initialization and updating the logging calls (e.g., logger.info(...) instead of logger.log(Level.INFO, ...)).
|
|
||
| logger.info("Processing Issue #" + issueNumber + "..."); | ||
|
|
||
| InMemoryRunner localRunner = new InMemoryRunner(StaleAgent.create()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new InMemoryRunner is created for each issue being processed within the loop. This is inefficient as it re-initializes the StaleAgent on every call. It would be more performant to create a single InMemoryRunner instance in the runBot method and reuse it for all issues. Note that there is already an unused InMemoryRunner instance created on line 68 which could be leveraged.
| } catch (Exception ignored) { | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception in this catch block is ignored. This can hide potential issues during event processing, making debugging difficult. It's better to at least log the exception at a warning or error level.
} catch (Exception e) {
logger.log(Level.WARNING, "Error processing event for issue #" + issueNumber, e);
}| result.put("close_threshold_days", StaleBotSettings.CLOSE_HOURS_AFTER_STALE_THRESHOLD / 24.0); | ||
| result.put("maintainers", maintainers); | ||
| result.put("issue_author", issueAuthor); | ||
| result.put("last_comment_text", state.get("last_comment_text")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - **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) OR (Internal Discussion Check == TRUE):** | ||
| - **Report**: "Analysis for Issue #[number]: ACTIVE. Maintainer gave status update or internal discussion detected. No action." No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a1fc4a0 to
e7b6b83
Compare
This PR introduces the Stale Issue Auditor, a sample agent that leverages the Google ADK to automate repository health. Unlike standard time-based bots, it uses an LLM to contextualize inactivity, distinguishing between true abandonment and active maintainer investigation. The agent manages the full issue lifecycle—labeling, warning, and closing—based on configurable thresholds, while including safeguards to detect silent description edits by authors.