Commit ec213e2
committed
Fix CI gate: use mergeable_state instead of check-runs API
The GitHub MCP list_workflow_runs tool does not support head_sha
filtering, causing the agent to report 'No CI workflow runs exist'
for PRs with all-green CI. The check-runs approach was also unreliable
(only 2 raw API calls reached api.github.com during agent execution;
the rest were proxied through api.githubcopilot.com).
Replace both CI check instructions with a single reliable gate:
mergeable_state === 'clean'
This field is already on the PR object (pull_requests toolset,
get_pull_request). GitHub computes it from all branch protection
checks. Confirmed: PR#112 and #106 show 'clean', PR#101 shows
'blocked' (failing CI) — exactly the right behavior.
Fix CI gate: use pull_request_read get_check_runs instead of mergeable_state
mergeable_state is lazily computed and goes stale for inactive PRs.
The bulk list_pull_requests call never triggers recomputation, so old
Dependabot PRs always return 'unknown' — causing all PRs to be skipped.
Fix: use pull_request_read with method 'get_check_runs' (pull_requests
toolset) which directly returns check-run conclusions for the PR head
commit. Confirmed 9 check-runs (all success/skipped) for PR#112 and
PR#106 via this API. PR#101 has a failing check-run — correctly skipped.
Fix CI gate: use actions_list list_workflow_runs with branch filter
pull_request_read does not have a get_check_runs method — the agent was
silently falling back to get_status which queries the old commit-statuses
API (returns total_count=0 for GitHub Actions, which uses check-runs).
Fix: use actions_list with method list_workflow_runs, filtered by the
PR's head.ref branch. This is a supported MCP tool method and correctly
returns GitHub Actions workflow runs. Group by name, take latest per
workflow (highest run_number), require all to be completed success/skipped.
Verified: branch filter returns all 3 workflows for PR#106 and PR#112
with success conclusions. Also correctly surfaces old failures (run #213,
#230 on chai branch) while latest runs show success — 'latest per workflow'
logic handles re-runs correctly.1 parent 49d0032 commit ec213e2
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
0 commit comments