Skip to content

feat: PR-checks verdict (skipped != failed) + create_issue & CI rerun tools#1

Merged
fatherlinux merged 1 commit into
mainfrom
feat/checks-verdict-and-write-tools
Jun 14, 2026
Merged

feat: PR-checks verdict (skipped != failed) + create_issue & CI rerun tools#1
fatherlinux merged 1 commit into
mainfrom
feat/checks-verdict-and-write-tools

Conversation

@fatherlinux

Copy link
Copy Markdown
Member

Summary

Closes the loop-hole where the foreman treated skipped CI checks as failures and lacked tools to file follow-ups / rerun CI.

  • get_pull_request_checks rewritten to return a verdict: ready_to_merge, mergeable/mergeable_state, and per-bucket passed/failing/pending/skipped. Skipped/neutral are not failures. (Verified live on mcp-ashigaru PR#3 → ready_to_merge=True, ghcr in skipped.)
  • create_issue — file follow-up issues.
  • list_workflow_runs, rerun_workflow_run, rerun_failed_jobs — inspect/retrigger CI.
  • 11 → 15 tools; v0.1.0 → 0.2.0.

Test plan

  • ruff + mypy(strict) + pytest(60) + gourmand(0) all green.
  • Live smoke: verdict on PR#3, list_workflow_runs on this repo.
  • Post-merge: redeploy on lotor; widen kagetora gateway allowlist to include the new write/CI tools.

🤖 Generated with Claude Code

Improve get_pull_request_checks to return a verdict that distinguishes
skipped from failed checks. Classify every check-run and commit-status
context into passed/failing/pending/skipped buckets and expose a
ready_to_merge signal (no failing/pending and not known-unmergeable).
Skipped (skipped/neutral) checks are no longer misread as failures.

Add write tools for the foreman loop:
- create_issue (issues.py)
- list_workflow_runs, rerun_workflow_run, rerun_failed_jobs (actions.py)

rerun POSTs tolerate GitHub's empty 201 body and synthesize a success
dict. Register all new tools (create_issue_tool, list_workflow_runs_tool,
rerun_workflow_run_tool, rerun_failed_jobs_tool). Bump version 0.1.0 ->
0.2.0 in pyproject.toml and Containerfile. Add tests covering the verdict
classification, create_issue, workflow-run unwrapping, and empty-body
reruns.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fatherlinux fatherlinux merged commit de96df7 into main Jun 14, 2026
13 checks passed
@fatherlinux fatherlinux deleted the feat/checks-verdict-and-write-tools branch June 14, 2026 05:12

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

Copy link
Copy Markdown

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 several new GitHub MCP tools, including capabilities to create issues, list workflow runs, and re-run workflow runs or failed jobs. It also refactors the pull request check-run and commit-status classification to explicitly bucket checks into passed, failing, pending, or skipped, and computes a ready_to_merge flag. Feedback on these changes suggests classifying startup_failure and stale check-run conclusions as failing rather than pending, and ensuring ready_to_merge is only set to true when mergeability is explicitly confirmed as True (rather than just not False) to avoid race conditions while GitHub is still calculating mergeability.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +131 to +133
case (
"failure" | "cancelled" | "timed_out" | "action_required"
) as conclusion:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The check-run conclusions "startup_failure" and "stale" are currently not matched, which means they will fall through to the case _: block and be classified as "pending". However, both of these represent completed runs that did not succeed (a startup failure is a critical configuration/execution failure, and a stale run is one that was superseded or timed out). They should be classified under the "failing" bucket instead of "pending" to accurately reflect their completed and non-successful status.

Suggested change
case (
"failure" | "cancelled" | "timed_out" | "action_required"
) as conclusion:
case (
"failure" | "cancelled" | "timed_out" | "action_required" | "startup_failure" | "stale"
) as conclusion:

Comment on lines +215 to +217
ready_to_merge = (
not failing and not pending and mergeable is not False
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When mergeable is None, it indicates that GitHub is still calculating the mergeability of the pull request (which often happens immediately after a PR is created or updated). Treating ready_to_merge as True in this state can lead to race conditions where automated tools attempt to merge the PR before GitHub has verified there are no conflicts, resulting in failed merge attempts. Changing this to mergeable is True ensures we only signal readiness when mergeability is explicitly confirmed.

Suggested change
ready_to_merge = (
not failing and not pending and mergeable is not False
)
ready_to_merge = (
not failing and not pending and mergeable is True
)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant