Skip to content

source-control + guardrails: close the required-PR-section loop before CI (recurring pr-issue-linkage 'Related' failures) #1164

Closed as not planned

Description

@kyle-sexton

Problem

The pr-issue-linkage CI gate (.github/workflows/pr-issue-linkage.yml) fails a PR whose body is missing any section in this repo's configured pr_body_required_sections (.claude/source-control.md: Summary, Test plan, Related). This fails on close to every PR opened by an agent that reaches for gh pr create directly instead of /source-control:pull-request create — the finding is discovered ~4s into CI, then patched by a read-modify-write body edit, repeatedly.

Root cause is a broken loop, not agent forgetfulness:

  • /source-control:pull-request create reads the config and scaffolds all required sections at create time — the intended path never trips the gate.
  • The guardrails advisory hook flag-commit-pr-skill-bypass.sh flags a direct gh pr create but is advisory-only, never blocks (deliberate — create.md documents a legitimate inline fallback when skill discovery is broken).
  • So any run on the inline fallback opens a PR with no scaffold, and the Related requirement in particular surfaces only at CI-fail time. Related is the usual offender: a PR that cleanly Closes #N and references nothing else still fails, because the section is required unconditionally.

What to build

Close the loop so the required-section contract is satisfied (or its absence surfaced) BEFORE the PR reaches CI. Reproduce the failure first, then choose among (cheapest → most ambitious; a maintainer decision, do not assume one):

  1. Upgrade the advisory to inject/repair. When flag-commit-pr-skill-bypass.sh sees a direct gh pr create, have the guidance (or a companion PreToolUse step) surface the repo's resolved pr_body_required_sections so the agent scaffolds them in the same call. Keep it non-blocking per the hook's documented posture, but make the requirement visible at author time, not CI time. Cheapest; highest leverage; kills the class.
  2. Local pre-push / pre-PR gate mirroring pr-issue-linkage so the missing-section failure fires locally before the PR exists. Shifts the loop left; needs a client-side hook surface.
  3. Reconsider the Related requirement. Make it conditional — required only when the body carries no Closes/Fixes/Resolves #N — or demote it to advisory. A PR that closes an issue and references nothing else is the common case the gate currently red-lines. This is a policy call on pr-body-convention + the repo's .claude/source-control.md.

Options are not mutually exclusive (1 + 3 together is plausible). Whatever lands, record the decision on docs/conventions/pr-body-convention/README.md.

Acceptance criteria

  • Failure reproduced: a direct gh pr create with a Closes #N-only body fails pr-issue-linkage on Related, documented in the issue.
  • The required-section contract is satisfiable (or its gap surfaced to the author) before CI runs, for BOTH the /pull-request path and a direct gh pr create.
  • Any change to the guardrails hook keeps its non-blocking posture and passes its contract test (flag-commit-pr-skill-bypass.test.sh).
  • If Related is made conditional/advisory, pr-issue-linkage.yml + docs/conventions/pr-body-convention/README.md + .claude/source-control.md agree, and a Closes #N-only PR passes.
  • Decision recorded; touched plugins version-bumped per semver weight; gates pass.

Blocked by

None — can start immediately.

Provenance

Recurring friction observed across many PRs in this repo; surfaced concretely on PR #1159 (this session) and raised by the maintainer as "this keeps occurring almost on every PR." Orthogonal to the melodic-session-plugins-audit chain (#1151–#1154) — filed standalone.

Activity

  1. added theissue type on Jul 23, 2026
  2. added
    status: ready
    needs-human
    on Jul 23, 2026
  3. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI (triage lane — gate-audit claim). Claiming this item for one gate-audit cycle: an independent panel re-classifies whether the needs-human / status: needs-decision gate is still warranted, or whether the item is C2/C3 and liftable to agent-ready. Outcome comment follows in this cycle.

  4. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI (triage lane — gate audit). Independent panel: two fresh-context agents (one fable, one opus), each given only the issue content and the repo's own plugins/autonomy/reference/guardrails/work-classes.md, plus the triage lane's own read. This lane never executes work items, authors fixes, or merges.

    Gate audit: GATE UPHELD — the issue itself reserves the decision

    Panel: 2-of-2 STAYS-GATED (classed C3 and C4). Lane read concurs.

    The build work is bounded, but the issue deliberately presents three non-exclusive options and states outright that the remedy choice is "a maintainer decision, do not assume one." Option 3 additionally changes the pr_body_required_sections contract across pr-issue-linkage.yml, docs/conventions/pr-body-convention/README.md, and .claude/source-control.md simultaneously, and option 1 edits a guardrails hook whose non-blocking posture is a recorded design choice.

    A cold agent cannot execute this without inventing policy, which is exactly the floor.

    Decision required

    Which remedy closes the required-PR-section loop before CI?

    RECOMMENDED — option 1 + option 3 together. Surface the resolved pr_body_required_sections at author time via the existing advisory hook (kills the discovery-lag class), and make Related conditional — required only when the body carries no Closes/Fixes/Resolves #N (kills the common false positive, where a PR that already links its issue is failed for lacking a separate section). Both panel legs converged on this pairing independently: it attacks the recurring failure at both ends rather than treating a contract defect as purely an author-visibility problem.

    Alternative — option 1 alone, keeping Related unconditional. Choose this if a mandatory cross-reference section on every PR is considered valuable in its own right, and the false positives are acceptable.

    Whichever is chosen, the issue requires the decision recorded on docs/conventions/pr-body-convention/README.md. Once recorded, the implementation becomes a clean C3 lift.

  5. kyle-sexton commented on Jul 27, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI (triage lane — claim release). Gate-audit cycle complete for this item; the triage claim posted earlier this cycle is released. No lease is held — another instance or lane may pick this up immediately. The outcome comment above this one carries the classification and either the lift rationale or the decision summary.

  6. kyle-sexton commented on Aug 13, 2026

    @kyle-sexton
    MemberAuthor

    Frontier disposition (drain session)

    Ruling: Close as not planned for this drain wave (frontier consensus).

    Dual-panel drain ruling: advisory, superseded, folded into a program umbrella, or blocked on a host/design carrier without an actionable in-repo slice this session. Re-open with a concrete acceptance brief if a consumer needs the work.

    KEEP set for this wave: standing telemetry; host-physical Class C (#631 family); program umbrellas #530/#531/#532/#535; live design carriers #1500/#1553/#1668/#1695/#1716/#1681/#1718; #1360.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanstatus: ready

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions