`gitea_assess_pr_sync_status` could permanently block a merge-ready PR whose
head commit had no status contexts.
Gitea's combined commit-status endpoint reports `state: pending` both when a
check is executing and when the status-context collection is empty. The
wrapper took that `state` verbatim, and `checks_required` defaulted to True
with no production path ever setting it, so "no CI configured" was
indistinguishable from "CI is running" and waiting could never resolve it.
Root cause spans the whole dataflow, not one call site:
* the wrapper read only the combined `state` and never counted contexts;
its `checks_status="none"` fallback was unreachable for any truthy state
* `pr_sync_status.assess_pr_sync_status` defaulted `checks_required=True`
* the MCP wrapper exposed no derived `checks_required` and never passed one
* the branch-protection reader fetched the payload carrying
`enable_status_check` / `status_check_contexts` and discarded both
Changes:
* `pr_sync_status.py`: add `classify_commit_checks` plus explicit
CHECKS_* classifications (success / failure / pending / none /
not_required / missing_required / unknown). The combined state is
recorded for observability but is never evidence that CI is executing.
Aggregation is fail-closed and newest-wins per context.
* `pr_sync_status.py`: rewrite the merge_now checks gate to consume the
derived `checks_required`, distinguish the new classifications with
precise blocker reasons, and fail closed on unrecognized vocabulary.
The previous gate let any value outside its fixed vocabulary fall
through to merge_now.
* `gitea_mcp_server.py`: add `_branch_protection_policy` deriving both the
current-base rule and the status-check requirement from one live read;
`_branch_protection_requires_current_base` is retained as a thin
accessor with unchanged semantics. Add `_commit_checks_snapshot` which
returns the context collection alongside the combined state.
* `gitea_mcp_server.py`: wire the derived `checks_required` into the
production assessment path and report `checks_evidence`.
`checks_required` is always derived from live evidence and is deliberately
not a caller-supplied input, so no session can declare checks optional
without proof. Live classification also outranks a caller-supplied
`checks_status`, which can no longer mask a real required-check failure.
An unreadable protection policy or status collection stays fail-closed.
Approval, current-head, current-base, mergeability, conflict, role, lease
and merge-authorization gates are unchanged.
Tests: `tests/test_issue_751_checks_assessor.py` (40 tests).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Prevent approved PRs from stalling when master advances. Add
gitea_assess_pr_sync_status and gitea_update_pr_branch_by_merge with
head/base pinning, author-only updates, conflict handoff, and approval
invalidation after head changes. Wire task capability map, sequential
controller routing in review-merge workflow, and hermetic AC tests.