Skip to content

feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697

Closed

Description

@dan-petty

Context & Rationale

The rule is written down and nothing reads it. AGENTS.md:98-100 requires defect fixes to add AGENTS.md guardrails when the cause cannot be fixed at source; docs/SELF_IMPROVEMENT.md:58 says every unexpected failure 'is immediately codified into AGENTS.md'. No workflow references AGENTS.md (grep -rln AGENTS.md .github/workflows exits 1) and devops pr check-readiness (src/devops_cli/commands/pr.py:1405-1406) reads neither labels nor files. The taxonomy leaks: PR #485 carries type/security plus scope/infra, undefined in .github/labels.yml; .github/ISSUE_TEMPLATE/bug_report.yml:3-4 mandates a fix(<scope>): title. vibes' .github/workflows/recursive-hardening.yml first real run saw 0 files instead of 12 and accused an author who had hardened (tests/test_workflow_contracts.py:1-14, 249-263; recursive-hardening.yml:51).

Scope & Deliverables

  • Context & Rationale*: The rule is written down and nothing reads it. AGENTS.md:98-100 requires defect fixes to add AGENTS.md guardrails when the cause cannot be fixed at source; docs/SELF_IMPROVEMENT.md:58 says every unexpected failure 'is immediately codified into AGENTS.md'. No workflow references AGENTS.md (grep -rln AGENTS.md .github/workflows exits 1) and devops pr check-readiness (src/devops_cli/commands/pr.py:1405-1406) reads neither labels nor files. The taxonomy leaks: PR fix(security): close the keyring's remaining plaintext and host-credential gaps #485 carries type/security plus scope/infra, undefined in .github/labels.yml; .github/ISSUE_TEMPLATE/bug_report.yml:3-4 mandates a fix(<scope>): title. vibes' .github/workflows/recursive-hardening.yml first real run saw 0 files instead of 12 and accused an author who had hardened (tests/test_workflow_contracts.py:1-14, 249-263; recursive-hardening.yml:51).
  • Deliverable*: Slice 1 measures: devops pr hardening-report [--pr N] lists merged defect PRs (type/bug, type/security, or a fix(/fix: title) and reports per PR which declared surfaces gained lines (AGENTS.md, src/devops_cli/ai/tasks/*.md, src/devops_cli/ai/knowledge_base/, common_hallucinations.json) from gh pr view --json files, ignoring labels absent from labels.yml, plus fix-titled PRs lacking type/bug; it also rewords docs/SELF_IMPROVEMENT.md:58 to name the surfaces actually used. Slice 2, behind --require-hardening: _check_hardening_blocker in _evaluate_pr_blockers (pr.py:1304) requires additions to a declared surface, reporting 'touched but added nothing' separately from 'not touched'; default-on with --allow-unhardened only after slice 1 covers the full merged-defect population. Slice 3: a pull_request: types: [closed] job gated on merged == true plus the two labels, running hardening-report --pr $PR_NUMBER --fail-on-missing and opening an issue on failure via create_repository_issue (src/devops_cli/github/issues.py:245) with labels.yml-defined labels. Prerequisite: a new tests/test_workflow_contracts.py extending tests/test_ci.py:537-628 to resolve each uv run devops ... in run: against the Typer app, assert triggers, and fail on a GitHub Actions expression inside run: (update-prs.yml:74-86 violates this). Port only vibes' decisions: label gating (recursive-hardening.yml:34), two-way verdict (tools/project_tooling.py:200-221), empty file list is an error (recursive-hardening.yml:74-76), skip-not-fail for fork tokens (pr-sentinel.yml:69-74); not its range walk or count_guardrail_lines (project_tooling.py:186), since the files endpoint is merge-strategy independent.
  • Constraint*: An AGENTS.md-only check accuses all 32 merged type/bug PRs though 25 wrote their lesson into docs/ROADMAP.md, so the surface set must be declared and the verdict must name it; docs/ROADMAP.md is no longer one, because it becomes a generated view (feat(github): github-sourced roadmap, migration and generated roadmap view (devops roadmap migrate, render) #739) and lessons enter as items through intake (feat(github): single-entry item intake with duplicate detection and placement (devops roadmap intake) #742); tests/ and docs/agent/tasks/ (32 and 31 of 32) are vacuous. A type/bug-only gate misses the 29 of the last 100 merged PRs that are fix-titled without it. A job that never fires is indistinguishable from one that passes; ci.yml:65-66 actionlint checks syntax only. Commit to slice 1 and the contract test first; slices 2-3 depend on its result.
  • Measured*: gh pr list --repo dan-petty/devops-cli --state merged --label type/bug --limit 100 --json number --jq length = 32. Iterating gh pr view <n> --json files over those 32 and counting paths with additions > 0: AGENTS.md 0, docs/ROADMAP.md 25 (the tests/ and docs/agent/tasks/ counts in Constraint come from the same iteration). gh pr list --state merged --limit 100 --json number,title,labels filtered with jq for fix-prefixed titles lacking type/bug = 29.
  • Source*: vibes .github/workflows/recursive-hardening.yml, .github/workflows/autonomous-triage.yml, .github/workflows/pr-sentinel.yml, tools/project_tooling.py, tests/test_workflow_contracts.py, tests/test_project_tooling.py, patterns/root-cause-hardening.md, AGENTS.md

Strategic Alignment

  • Milestone: Backlog (no release) (Reactive Workstation Command Center, Interactive TUI & Unified Operations Hub)
  • Roadmap Reference: docs/ROADMAP.md

Amendment (2026-10-01 assessment)

  • Corrections to this body: The milestone line says v0.2.24, but the issue has no milestone; it is in the backlog.
  • Coordination:
    • Resolver: The prerequisite tests/test_workflow_contracts.py resolves uv run devops ... in workflow run: blocks. It should reuse the resolver from fix(mcp): mcp tools and resources call commands and options that exist #836. That item builds the resolver behind devops docs check, following the design in ROADMAP.md:908.
    • Classifier: The defect-PR classifier (type/bug, type/security, or a fix(/fix: title) is also needed by feat(ci): fail-to-pass check. Whichever lands first owns it, in src/devops_cli/github/.

Update 2026-10-08: refinement

Nothing is built (rule at AGENTS.md:107-109). Slice 3 hands findings to intake (AGENTS.md:106), not create_repository_issue, and the PR says how the job reaches it. The SELF_IMPROVEMENT.md rewording is gone. #861's contract test is the same test; whichever lands first builds it in tests/test_workflow_contracts.py, and (proposed) the expression-in-run: rule moves to #861. Slice 2 becomes a predicate of #998's verdict.

Proposed design

Problem statement

The rule requiring defect PRs to add guardrails to declared surfaces (AGENTS.md, task files, knowledge base) is documented in AGENTS.md and SELF_IMPROVEMENT.md but unenforced: no workflow reads AGENTS.md, devops pr check-readiness ignores labels and files, and the label taxonomy leaks with undefined labels on PRs. This issue delivers a measurement command (devops pr hardening-report), a post-merge audit workflow that hands findings to intake, and a shared defect-PR classifier, so the hardening rule is actually checked and violations are surfaced. Per the 2026-10-08 refinement, Slice 2 (the readiness blocker) is deferred to #998's verdict module, the SELF_IMPROVEMENT.md rewording is dropped, and Slice 3 hands findings to intake rather than opening an issue via create_repository_issue.

Acceptance criteria

  • Criterion 1: devops pr hardening-report [--pr N] lists merged defect PRs (type/bug, type/security, or a fix(/fix: title) and reports per PR which declared surfaces gained lines (additions > 0), reading file data from gh pr view --json files
    Verification: Run uv run devops pr hardening-report against the repository and confirm it lists the 32 merged type/bug PRs plus the 29 fix-titled PRs lacking type/bug, showing per-PR surface additions; run with --pr N for a single PR and confirm the same per-PR detail
  • Criterion 2: The declared surface set is AGENTS.md, src/devops_cli/ai/tasks/*.md, src/devops_cli/ai/knowledge_base/, and common_hallucinations.json; docs/ROADMAP.md is excluded because it is a generated view
    Verification: Inspect the surface list in the hardening-report source and confirm docs/ROADMAP.md is absent and the four listed surfaces are present; run the report and confirm no PR is credited for ROADMAP.md additions
  • Criterion 3: A post-merge audit workflow triggers on pull_request types [closed] gated on merged == true plus the two defect labels, runs hardening-report --pr $PR_NUMBER --fail-on-missing, and hands findings to intake on failure
    Verification: Inspect the workflow YAML for the correct trigger, gate conditions, and run command; confirm the failure path calls the intake mechanism (not create_repository_issue) and uses labels.yml-defined labels
  • Criterion 4: The defect-PR classifier (type/bug, type/security, or fix(/fix: title) lives in src/devops_cli/github/ and is importable by other commands such as the fail-to-pass check
    Verification: Import the classifier from src/devops_cli/github/ in a test and confirm it correctly classifies a PR with type/bug, a PR with type/security, a PR with a fix(ci): title, and a PR with none of these
  • Criterion 5: The workflow contract test in tests/test_workflow_contracts.py validates the new audit workflow's structure (triggers, permissions, run commands) and is shared with fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861
    Verification: Run pytest tests/test_workflow_contracts.py and confirm the new workflow passes its structural assertions; confirm the test file is importable and reusable by fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861's tests

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.
[end-marker]

Activity

  1. added this to the v0.2.24 milestone on Sep 28, 2026
  2. added
    type/feature
    scope/github
    priority/p1-high
    on Sep 28, 2026
  3. modified the milestones: v0.2.24, v0.2.25 on Sep 30, 2026
  4. dan-petty commented on Sep 30, 2026

    @dan-petty
    OwnerAuthor

    Revised for the roadmap design (#739-#746): docs/ROADMAP.md is dropped from the declared hardening surfaces, because ADR 0001 makes it a generated view. A defect PR's lesson now enters as an item through intake (#742).

  5. modified the milestones: v0.2.25, v0.2.26 on Sep 30, 2026
  6. dan-petty commented on Sep 30, 2026

    @dan-petty
    OwnerAuthor

    Moved from v0.2.25 to v0.2.26. v0.2.25 is capped at 12 items (#740): it keeps #739-#742, their dependency #704, and the oldest P1 items. This P1 item is next in line.

  7. removed this from the v0.2.26 milestone on Oct 1, 2026
  8. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Moved from v0.2.26 to the backlog. After the v0.2.23 P1 leftovers were retargeted (they were committed earlier), v0.2.25 and v0.2.26 are full at 12 items each, and the roadmap-service items placed in v0.2.26 stay. It is next in line for a planned release.

  9. added a commit that references this issue on Oct 1, 2026
  10. added this to the v0.2.34 milestone on Oct 9, 2026
  11. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    Status set to Ready at b5ea6ff (see proposed design in issue body).

  12. dan-petty commented on Oct 11, 2026

    @dan-petty
    OwnerAuthor

    Merged

  13. added a commit that references this issue on Oct 11, 2026
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

    priority/p1-highscope/githubtype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions