Skip to content

Comments

tooling: add deterministic CI state classifier command#4605

Open
davidahmann wants to merge 2 commits intogoogle:mainfrom
davidahmann:codex/issue-4604-ci-state-classifier
Open

tooling: add deterministic CI state classifier command#4605
davidahmann wants to merge 2 commits intogoogle:mainfrom
davidahmann:codex/issue-4604-ci-state-classifier

Conversation

@davidahmann
Copy link

Problem

Contributor workflows currently interpret CI status inconsistently, including no checks and policy blockers.

Why Now

Cross-repo execution depends on normalized state categories for deterministic routing.

What Changed

  • Added scripts/ci_state_classifier.py.
  • Added deterministic categories: passed, failed, pending, no_checks, policy_blocked.
  • Added fixture/live modes and stable JSON report fields.
  • Added built-in self-test.

Validation

  • python3 scripts/ci_state_classifier.py --self-test
  • uv run pyink --check --diff scripts/ci_state_classifier.py

Refs #4604

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @davidahmann, 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 addresses the issue of inconsistent interpretation of CI statuses across contributor workflows by introducing a new Python script. This script provides a standardized, machine-readable classification of GitHub PR checks into a set of deterministic states, which is crucial for reliable cross-repository automation and routing based on CI outcomes.

Highlights

  • New Tool Added: A new Python script, scripts/ci_state_classifier.py, was introduced to classify GitHub PR checks.
  • Deterministic CI States: The script defines and outputs five deterministic CI state categories: passed, failed, pending, no_checks, and policy_blocked.
  • Flexible Operation Modes: The tool supports both 'fixture' (input from file) and 'live' (fetching from GitHub API) modes, and generates stable JSON report fields.
  • Self-Testing Capability: A built-in self-test mechanism was included to validate the classification logic.

🧠 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
  • scripts/ci_state_classifier.py
    • Added a new Python script to classify GitHub PR checks into deterministic states.
    • Implemented logic to identify 'passed', 'failed', 'pending', 'no_checks', and 'policy_blocked' states.
    • Included functionality to fetch PR status rollups from GitHub or load them from a JSON file.
    • Provided a self-test mode to verify the classification logic.
Activity
  • The author validated the script's self-test functionality using python3 scripts/ci_state_classifier.py --self-test.
  • Code formatting and style were checked using uv run pyink --check --diff scripts/ci_state_classifier.py.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Feb 24, 2026
@davidahmann
Copy link
Author

Implemented issue #4604 by adding \ with deterministic CI state categories, fixture/live modes, and self-test coverage. Validation: self-test passed and changed-file \ passed.

This contribution was informed by patterns from Wrkr. Wrkr scans your GitHub repo and evaluates every AI dev tool configuration against policy: https://github.com/Clyra-AI/wrkr

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces a new Python script ci_state_classifier.py to deterministically classify GitHub PR checks into states like passed, failed, pending, no_checks, and policy_blocked. The script is well-structured, includes self-tests, and handles both fixture and live data modes. Type hints are used effectively, and the overall logic for classification appears sound. I've identified a couple of minor improvements related to code clarity and error messaging that would enhance the script's robustness and maintainability.

Comment on lines +104 to +105
return payload
raise ValueError("Expected JSON list or object with statusCheckRollup list")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The or [] after payload.get("statusCheckRollup", []) is redundant. The get method with a default value already handles cases where the key is missing or its value is None by returning the default empty list.

Suggested change
return payload
raise ValueError("Expected JSON list or object with statusCheckRollup list")
return payload.get("statusCheckRollup", [])

return rollup
if isinstance(payload, list):
return payload
raise ValueError("Expected JSON list or object with statusCheckRollup list")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ValueError message could be more informative by including the actual type or structure of the payload that caused the error. This would greatly assist in debugging unexpected input formats.

Suggested change
raise ValueError("Expected JSON list or object with statusCheckRollup list")
raise ValueError(f"Expected JSON list or object with statusCheckRollup list, but found {type(payload).__name__}")

@davidahmann
Copy link
Author

Implementation summary: added scripts/ci_state_classifier.py with deterministic classifications and self-test. Validation: classifier self-test passed and changed-file pyink check passed for the added script.

This contribution was informed by patterns from Wrkr. Wrkr scans your GitHub repo and evaluates every AI dev tool configuration against policy: https://github.com/Clyra-AI/wrkr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants