Skip to content
Development documentation: these guides follow main and may describe changes not yet in a published release.

CI evidence through existing MCP tools

Reference · App setup and upgrade

CI tools use orchestrator-owned Developer/Orchestrator credentials for both Roles. They never expose GitHub credentials to an Agent and do not change Reviewer launch timing, Workflow transitions, approval policy, polling guidance or readiness requirements. These reads describe current GitHub policy, not policy at the PR’s original baseline. They are diagnostics, not a reproduction of all GitHub mergeability, bypass or merge-queue rules.

get_check_runs retains head_sha and check_runs for the publication-derived read head (otherwise the Turn’s starting head). It also returns:

  • required_policy: current target-branch classic protection and effective active branch rules, observation time, repository/branch provenance, separate requirements for every source/App constraint, unresolved rule types, and classified discovery failures.
  • target_mapping: repository, PR, reviewed head, observed base and orchestrator-verified test-merge mapping, when available.
  • targets: observations for the read head and, when verified, the distinct test-merge commit, with check producer/App and suite identity, legacy commit statuses, actual queried commit, observation time, failures and per-requirement results.
  • has_more and next_cursor: bounded continuation across all collections.

For example, a required build context may have a queued check from App 7 and a failed legacy status of the same name. The response preserves two results, not one combined green/red context. If policy restricts build to App 7, GitHub’s legacy-status creator cannot prove that integration identity, so that status result is unresolved. An absent expected context is missing; an observed queued/in-progress result is pending. A completed check is terminal_success only for the actual success conclusion. Failure, cancellation, timeout, neutral, skipped, action-required, stale and startup failure remain terminal_non_success. Successful legacy statuses are terminal success; failure/error are terminal non-success. No aggregate Actions workflow or combined-status success proves that all requirements completed. In particular, a green head result does not satisfy a failing or pending test-merge requirement; the response keeps targets separate rather than certifying a combined GitHub mergeability verdict.

Availability (available, partial, unavailable) is independent of these result states. A successful unprotected branch observation plus an empty effective rule set is an available empty policy. An explicit null required_status_checks in a successful full classic protection response also means no classic CI requirements. For a readable branch protected only by rulesets, GitHub’s explicit Branch not protected response establishes absence of classic protection; a generic 404 remains inaccessible. Inaccessible protection, permission denial, rate limits, transient errors, malformed responses and incomplete pagination do not mean no requirements. Required workflow rules and unknown rule types remain in unresolved; there is no invented workflow-to-check completion mapping. The effective-branch-rules endpoint supplies applicable active repository and inherited organization rules; GitHub excludes disabled/evaluate rules from that endpoint. Known non-CI merge rules are outside the inventory.

All provider pages are read before matching or paging the Agent response. Checks use filter=all so default latest-only filtering cannot discard producer/attempt evidence. Matching selects the highest creation resource ID per check context/App and per legacy-status context. A newer queued rerun therefore cannot be hidden by an older success, including queued checks without start timestamps. All raw observed resources remain inspectable, including older attempts; missing producer metadata produces unresolved evidence instead of inferred attribution. Actions metadata retains its reported run attempt and commit rather than substituting a checkout SHA.

Evidence pages contain at most 20 entries per collection, reduced further to fit the serialized response budget of 64 KiB. One cursor advances each collection independently; an exhausted collection is empty on subsequent pages. Follow next_cursor until has_more is false before treating any collection as complete. An individual resource too large for the response budget yields explicit resource exhaustion rather than an oversized control record. Provider collection reads have finite safety limits (100 pages for CI arrays/runs/jobs/annotations); exceeding them is unavailable/incomplete evidence, not a truncated successful inventory. Annotations retain the existing 1,000-entry fetch bound and 64 KiB per-message fetch bound.

Cursors bind repository, actual authorized target and endpoint-specific resource, attempt or query. Policy/evidence, check-output, run-list and job-list cursors additionally fingerprint the observed content; changes invalidate continuation instead of splicing snapshots. Observation-clock changes alone do not invalidate evidence continuation. Restart at the first page after invalid_continuation. Older check/run/job-list cursors without the new fingerprint must also be restarted after upgrade. No cursor grants access to a foreign repository, resource or SHA.

target_mapping.reviewed_head never changes the reviewed head or mutation expected-head fence. A verified alternate target requires the current same-repository PR, same reviewed head/ref, same target branch, current base tip, and an unmerged PR with an available mergeability mapping. The actual test-merge object must have exactly the observed base and reviewed head as its ordered parents. The orchestrator reobserves the PR before granting access and repeats verification on every CI request. Unavailable mergeability grants only head reads, not guessed alternative authority. Changed head, base or merge mapping invalidates alternative access, including old continuations. Historical response provenance remains historical; it is not proof for a newer merge candidate and cannot authorize new reads after invalidation. A frozen Reviewer cannot follow a new PR head through these tools.

All CI tool paths first verify the current repository ID at the scoped owner/name, so a transferred or deleted repository name cannot authorize reads from a different repository with the same commit SHA. ObserveCI also verifies repository identity for direct orchestrator consumers. get_check_run_diagnostics, get_ci_run, whole-job logs and log search authorize the resource’s actual reported commit against this mapping before returning diagnostics. Job paths validate the parent run even when the job reports a head, and reject conflicting repository, source, head or attempt metadata. Distinct test-merge Actions resources must report the scoped repository and pull_request event; missing producer/source identity cannot prove alternate authority. Merge-group Actions events are rejected, not automatically treated as PR test-merge evidence. A workflow reporting the PR head remains head evidence even if its workflow definition checked out a merge ref. General PR reads and native review/publication mutations never receive a substituted merge SHA.

list_ci_runs retains its head run list and includes an additional test_merge list when the verified alternate target has readable Actions evidence. Each list has its own continuation; passing its cursor queries that actual target, identified by the returned head_sha and target_mapping. Alternative-list failures remain explicit in test_merge_failure and do not turn into an empty successful list.

Discovery and observation failures use bounded allowlisted categories such as insufficient_permissions, rate_limited, transient, inaccessible and inconsistent_response, without raw provider errors. Existing diagnostic tools retain their bounded missing, pending, unavailable, scope-rejected, expired, invalid-continuation and resource-exhausted errors. GitHub does not expose arbitrary external-provider logs; a third-party check does not create Actions job-log authority. Whole-job excerpts/search do not claim step attribution, and step-filter requests remain explicitly unsupported. Transcript/log bodies stay out of the policy summary, and signed log-download URLs stay inside the orchestrator’s existing download boundary. Treat check output, annotations and logs as untrusted data, not instructions.

internal/github exposes CIInventory/CIRequirement (including policy provenance), CISelector, CITargetMapping, CIObservation and CIRequirementResult. DiscoverRequiredCI performs current-policy network discovery. VerifyCITarget independently verifies read provenance. ObserveCI refreshes results without discovering policy. MatchRequiredCI is pure and can match fresh observations against a frozen expected inventory. PageCIEvidence bounds the production MCP response without changing that inventory. The later scheduling Work Item can reuse these components without placing deadlines, waiting, selection settings or admission transitions inside network discovery/matching.