Skip to content

Resolve change_proposal.approval.gate for GitHub pull requests in the entity adapter #9909

Done

Description

@fullsend-ai-triage

Parent

Continues #9583 (parent #8418, ADR 0147). Split out of #9583 so the parent can be driven to completion.

Problem

The GitHub entity adapter (internal/forge/github/entity_adapter.go) returns entity.change_proposal.approval.gate as unknown with reason unsupported for every pull request. A predicate over the approval gate therefore always defers.

The normalized-entity v1 contract defines the gate as not_required, satisfied, unsatisfied, or unknown. It is the current approval requirement for the proposal revision, distinct from overall mergeability. A known gate is scoped to the revision it was read at.

What to build

  • Map GitHub's review decision and the applicable branch protection or ruleset approval requirements to the gate, at the same source revision as the base read. Read these only when the predicate's plan needs change_proposal data, using the existing @include gating.
  • Leave the gate unknown, with a reason that is not empty, whenever the requirement cannot be determined soundly. Examples are insufficient token access to read branch rules, and rules the adapter does not understand. Never guess not_required.
  • Keep current_approvals and reviewers coverage independent of the gate.

Acceptance criteria

  • A pull request with no mandatory approval rule maps to not_required, one with a satisfied rule to satisfied, and one with an unsatisfied rule to unsatisfied.
  • An unreadable or unrecognised rule leaves the gate unknown and the result deferred.
  • A gate read at a different source revision than the rest of the evidence produces no result.
  • A predicate that does not use the gate does not read review decisions or branch rules, which a query-shape test covers.

Activity

  1. self-assigned this
    on Nov 30, 2026
  2. ifireball commented on Nov 30, 2026

    @ifireball
    Member

    /fs-triage

    Design direction: entity.change_proposal.approval.gate is the forge-native approval-policy result for this proposal revision. For GitHub, GitHub evaluates its effective review requirements and decides which reviews count. The field is independent of Fullsend's per-harness human_min_role; it is not a Fullsend trust verdict and it does not mean overall mergeability.

    A reviewer can causally change GitHub's gate, but if GitHub accepts that review under the repository's configured policy, the native gate is satisfied. That is intentional. Fullsend's actor admission still applies to the separate actor-attributed current_approvals and reviewers data used by harness CEL. A harness that needs a Fullsend role condition must express that separately over admitted actors, subject to collection coverage.

    Please reconcile the implementation with the current contract before coding: normalized-entity v1 says satisfied is after harness actor admission, Authorization v2 treats aggregates over actor-originated facts as actor-gated, and internal/entityview currently downgrades satisfied and unsatisfied to unknown. Update those contracts and the entity-view behavior to preserve the provider-native gate, or file and make this issue depend on the required spec change. Do not implement the mapping only to have the entity view erase it. Keep actor admission on current_approvals unchanged.

    Implementation constraints:

    • Bind the gate and its policy evidence to the same current proposal revision as the rest of the entity read.
    • Do not infer not_required from reviewDecision alone; establish that no mandatory approval rule applies. Leave the gate unknown when applicable rules or review evidence are unreadable or unrecognized.
    • Do not add administration:read to built-in roles. If classic branch-protection policy cannot be read with existing permissions, report unknown.
    • Preserve @include gating: a predicate that does not need change-proposal data must not read review decisions or branch rules.
    • Keep current_approvals and reviewers coverage independent of the gate.

    References: Normalized Entity v1, Authorization Contract v2, GitHub review decision, effective branch rules, classic branch protection permissions.

  3. fullsend-ai-triage commented on Nov 30, 2026

    @fullsend-ai-triage
    Author

    🤖 Finished Triage · ✅ Success · Started 9:09 AM UTC · Completed 9:11 AM UTC

    Commit: 0947e43 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.22

  4. added
    feature
    triaged
    on Nov 30, 2026
  5. fullsend-ai-triage commented on Nov 30, 2026

    @fullsend-ai-triage
    Author

    Triage notes (building on the design direction in the maintainer comment):

    Scope. The work has two linked parts that should land together (or in an ordered series): (1) the contract/entity-view reconciliation the maintainer asked for, and (2) the GitHub adapter mapping. Confirmed in the repo that entityChangeProposal in internal/forge/github/entity_adapter.go hardcodes the approval as unknown/unsupported. approval() in internal/entityview/gate.go also converts satisfied and unsatisfied to unknown (reason approval_not_recomputed_for_harness). The normalized-entity v1 README currently describes satisfied as holding after harness actor admission, so the contract text and the entity-view tests need to change as well. Doing that in this issue is allowed by the maintainer's direction, so no separate prerequisite is being raised.

    Constraints to carry into implementation: bind the gate to the same head revision as the base read; never infer not_required from reviewDecision alone; report unknown (non-empty reason) for unreadable or unrecognized rules, including classic branch protection when existing permissions can't read it (no administration:read added to built-in roles); keep @include gating so non-gate predicates read nothing extra; keep current_approvals/reviewers coverage independent.

    Proposed test case

    Adapter: no mandatory rule -> not_required; rule + approved -> satisfied;
      rule + unmet -> unsatisfied; unreadable/unknown rule -> unknown (non-empty reason, deferred);
      head SHA differs between reads -> no result;
      predicate not using the gate -> query-shape test shows no reviewDecision/branch-rule reads.
    Entityview: known satisfied/unsatisfied pass through; current_approvals admission unchanged.
    

    No open PRs or duplicate issues were found for this work.


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  6. ifireball commented on Nov 30, 2026

    @ifireball
    Member

    /fs-code

  7. fullsend-ai-coder commented on Nov 30, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 9:40 AM UTC · Completed 9:58 AM UTC

    Commit: 5bf4a02 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $4.94

  8. added a commit that references this issue on Nov 30, 2026
  9. added a commit that references this issue on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featuretriaged

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions