Skip to content

fix: fall back when get_check_runs lacks Checks API access#2623

Open
advancedresearcharray wants to merge 1 commit into
github:mainfrom
advancedresearcharray:fix/get-check-runs-fallback-2381
Open

fix: fall back when get_check_runs lacks Checks API access#2623
advancedresearcharray wants to merge 1 commit into
github:mainfrom
advancedresearcharray:fix/get-check-runs-fallback-2381

Conversation

@advancedresearcharray
Copy link
Copy Markdown

@advancedresearcharray advancedresearcharray commented Jun 6, 2026

Summary

  • Add tiered fallbacks for pull_request_read get_check_runs when the Checks API returns 403
  • Retry via Actions workflow runs (filtered by head SHA), then commit statuses
  • Return a source field indicating which API supplied the data
  • Provide clearer permission guidance when all sources are denied

Why

Fixes #2381. Hosted MCP tokens often lack checks:read even though other PR read methods work and the equivalent REST call succeeds with the caller's PAT. This makes get_check_runs unusable in that environment.

What changed

  • Extracted check-runs logic into pkg/github/check_runs.go
  • On Checks API 403, fall back to workflow runs and commit statuses
  • Added converters for workflow runs and commit statuses to MinimalCheckRun
  • Added source to MinimalCheckRunsResult (checks_api, workflow_runs, commit_statuses)
  • Added unit tests for fallback paths and converters

Test plan

  • go test -run Test_GetPullRequestCheckRuns ./pkg/github/...
  • go test -run Test_convertWorkflowRun ./pkg/github/...
  • go test -run Test_convertCommitStatus ./pkg/github/...
  • go test ./pkg/github/... (no regressions)

@advancedresearcharray advancedresearcharray requested a review from a team as a code owner June 6, 2026 08:51
@advancedresearcharray advancedresearcharray force-pushed the fix/get-check-runs-fallback-2381 branch from 1d662b4 to 7330c03 Compare June 6, 2026 10:02
Hosted MCP tokens often lack checks:read even when other PR read
methods succeed. Retry via workflow runs and commit statuses on 403,
and return clearer permission guidance when all sources are denied.

Closes github#2381
@advancedresearcharray advancedresearcharray force-pushed the fix/get-check-runs-fallback-2381 branch from 7330c03 to 49c3197 Compare June 6, 2026 10:02
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.

Hosted MCP get_check_runs fails with 403 where the equivalent REST call succeeds

1 participant