Repository navigation
Description
Problem
An external coordinator cannot ask ProPR "is this pull request ready to integrate, and if not, why". The inputs exist in six separate computations that share no types, and the only code path that evaluates all of them (processPRAutoMerge / reevaluatePRAutoMerge in packages/core/src/webhook/checkRunHandler.ts) also withdraws auto-merge, may update the branch and may merge. Most gates report no reason code, only log text.
What to build
A pure read that returns one verdict per pull request and never writes to GitHub or changes auto-merge state.
- MCP tool
get_pull_request_readiness(scoperead,readOnly: true), argsrepository,number. - REST
GET /api/pull-requests/:number/readiness?repository=owner/repo, registered inpackages/api/routeRegistry.ts, documented inROUTE_DOCS, answering errors withErrorEnvelope, with a zod schema inpackages/api/openapi/schemas.ts. - CLI:
propr pr readiness <number> [--json].
Result shape
{
repository, number, head, base, state: open|merged|closed, draft,
verdict: ready | waiting | blocked | merged | closed | unknown,
gates: [{ gate, status: pass|waiting|fail|unknown|not_applicable, reason, detail? }],
blockingReasons: string[], // reason codes of gates with status fail
waitingReasons: string[], // reason codes of gates with status waiting or unknown
review: { score, goal, goalReached, reviewedHead, matchesCurrentHead } | null,
ultrafix: { active, completionStatus, labelPresent } | null,
checks: { reason, blockingFailed, blockingPending, nonBlockingCount },
autoMerge: { eligible: eligible|ineligible|transient, policy: AutoMergeReason | null },
evaluatedAt
}
Verdict rule: merged/closed from PR state; blocked if any gate fails; else waiting if any gate is waiting; else unknown if any gate is unknown; else ready.
Gates and stable reason codes
| gate | codes |
|---|---|
open |
pull_request_merged, pull_request_closed |
not_draft |
draft |
checks |
reuse CiMergeReadiness.reason: checks_passing, checks_not_passing, no_ci, waiting_for_ci, unavailable |
mergeable |
merge_conflict, branch_behind_base, branch_protection_blocked, merge_state_unknown |
human_review |
changes_requested, review_required |
ai_review |
no_review, review_stale_head, score_below_goal, goal_reached |
ultrafix |
ultrafix_active, ultrafix_failed, ultrafix_state_unavailable, ultrafix_succeeded |
active_work |
propr_work_active, active_work_unavailable |
policy |
the existing AutoMergeReason values; not_applicable when auto-merge is not requested |
ai_review is not_applicable when the PR has no ProPR review at all and no ultrafix label; it never blocks a PR that ProPR is not reviewing. policy and auto-merge eligibility are reported but do not change the verdict unless the PR or its issue carries the auto-merge label.
Constraints
- No side effects.
getCiMergeReadiness(packages/core/src/webhook/checkRunHelpers.ts) writes/deletes the Redisauto-merge:head-observed:*key. Split a pure classifier out of it (same blocking/non-blocking classification viasummarizeCheckSignals, reads the observation key but never writes it) and have the existing function call it, so behaviour of the merge path is unchanged. - Reason codes for eligibility.
evaluateAutoMergeEligibility(packages/core/src/webhook/autoMergeEvaluation.ts) returns onlyeligible|ineligible|transient. Add a variant that also returns a reason code; keep the existing function as a wrapper so callers are untouched. - Active-work check must not fail open in this read.
getActiveTasksForPRreturns empty on error; here an error must surface asactive_work_unavailable(statusunknown). - Export
getUltrafixLoopStateand the new read helpers frompackages/core/src/index.ts; do not read the Redis key directly from the API package. - Project
goal_reachedin the score loader (packages/api/routes/reviewScoreStats.ts). - Use the App identity for the evaluation (same view the merge path has, including legacy commit statuses and non-blocking checks); authorise the caller's repository access the same way
get_pull_requestdoes. - Put the evaluation in one core function (for example
evaluatePullRequestReadiness) returning the shape above; REST, MCP and CLI are thin wrappers. Do not create a third type namedPullRequestSnapshot. - Do not change what
merge_pull_requestor auto-merge decide.
Acceptance criteria
- A PR with green blocking checks, clean merge state, no changes requested, latest AI review at or above goal on the current head, and no active ProPR work returns
readywith emptyblockingReasonsandwaitingReasons. - Each reason code above is produced by at least one test.
- A test proves the read performs no GitHub write and no Redis write (including the head-observation key) and does not call update-branch or merge.
- Existing auto-merge tests (
test/checkRunHandler.test.ts,packages/core/test/autoMerge*.test.ts) pass unchanged in behaviour. npm run gen:openapioutput is committed;openapiRouteCoverage,openapiResponseConformance,mcpObservableSurface,mcpDocsandmcpToolInputBudgettests pass.docs/mcp.md,docs/mcp-coverage.mdanddocs/docs/operations/api-reference.mddescribe the verdict, every gate and every reason code. Any new backticked lowercase token indocs/mcp.mdthat is not a tool name is added to the allow-list inpackages/api/test/mcpObservableSurface.test.ts.
Implementation
- Core: pure CI classifier split out of
getCiMergeReadiness; reason-returning eligibility variant;evaluatePullRequestReadiness(owner, repo, number, deps)in a new file underpackages/core/src/webhook/orpackages/core/src/services/; export from the core index together withgetUltrafixLoopState. - API: REST handler + route registry entry + route doc + zod schema; MCP tool in
packages/api/mcp/toolsPullRequests.ts; addgoal_reachedto the score loader. - CLI command
propr pr readiness. - Tests: core unit tests per gate and per reason code with injected deps; no-write test; MCP test following
packages/api/test/mcpPullRequests.test.ts; REST route test. - Regenerate OpenAPI and client types; update docs and the non-tool token allow-list.
Notes
Patterns: packages/api/mcp/pullRequestPreconditions.ts (ordered preconditions with codes), packages/api/mcp/toolsWorkOverview.ts (enrichPullRequests). The auto-merge files changed recently (PR #3450), so re-read them rather than trusting line numbers.
Activity
propr-dev commentedon Nov 12, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-53482/claude-opus-5-5-read-only-pull-request-re-20261112-1226-anv3482-epic-integration-signals-100issue-3482-20261112-1226-claude-opus-5-5-anv🔍 Track Task Execution
Issue #3482 is implemented: one read-only call returns a PR's readine…