Skip to content

agent-completion/truth-gate is unsatisfiable for PRs with no linked dispatch contract #1384

Description

@groupthinking

Problem

agent-completion/truth-gate scores a pull request against the frozen intent snapshot on its linked issue. That snapshot is written only by the snapshot-agent-task-intent job, which is gated on:

if: >-
  github.event_name == 'issues' &&
  (github.event.action == 'labeled' || 'edited' || 'unlabeled')

It never runs on pull_request_target. So a PR with no linked issue has no snapshot, no declared agent_login, and no declared run_id. scripts/ci/agent_completion_gate.py then hard-requires all three:

for field in ("agent_login", "run_id"):
    value = policy.get(field)
    if not isinstance(value, str) or not value.strip():
        invalid_fields.append("policy." + field)

The verdict is invalid_payload, permanently, and no action available to the author can change it.

agentTaskApplicable() arms that state from pull-side provenance alone — a claude/, codex/, jules/ or agent/ branch prefix, a known bot author, or a lock manifest. A branch naming convention is not a dispatch, so PRs that never had a contract to satisfy get measured against one that was never written.

Impact

The check is red on essentially every PR, including merged ones. #1368 — the current tip of main — merged with:

context: agent-completion/truth-gate/pr-1368
state:   failure
desc:    gate-owner:51596082965 invalid_payload

A check that is red on everything gates nothing and hides real failures behind constant noise. .github/workflows/agent-completion-enforcement.yml already warns about exactly this in its own comments:

Reporting those as failure makes this check permanently red on 100% of pull requests, which destroys its signal value and hides real build/test failures behind constant noise.

Its sibling workflow handles the same situation correctly, reporting neutral when the trust policy is unprovisioned. The truth gate reports failure.

Downstream, this contributed to PRs never leaving draft and being re-created rather than landed — the backlog drained in #1377 (61 open → 28).

Expected behaviour

Pull-side provenance should arm the gate only when a linked issue exists to verify against. With no linked issue there is nothing to measure, so the verdict should be not_applicable, not blocked.

This must not weaken enforcement: a PR that links a dispatched issue stays fully gated, and the requirement that a PR bind to a focused issue at all is separately owned by the Canonical issue and evidence / PR Governance checks, which state requirements an author can actually satisfy.

Acceptance criteria

Scope

  • .github/workflows/pr-checks.ymlagentTaskApplicable() (both copies)
  • tests/unit/test_agent_completion_gate.py

Related

Supersedes the two competing implementations #1154 and #1364, consolidated in #1377.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions