Skip to content

fix(guard): allow Wave 0 deprecated-workflow removals through Health 45 guard - #2007

Merged
stranske merged 3 commits into
mainfrom
fix/agents-guard-allow-wave0-removals
May 5, 2026
Merged

fix(guard): allow Wave 0 deprecated-workflow removals through Health 45 guard#2007
stranske merged 3 commits into
mainfrom
fix/agents-guard-allow-wave0-removals

Conversation

@stranske

@stranske stranske commented May 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • allow Health 45 Agents Guard to accept Wave 0 cleanup deletions for four deprecated consumer-template workflows
  • apply the same allowlist to the consumer-template guard script so the next sync can propagate it to consumer repos
  • cover the Wave 0 removal paths in the existing agents guard unit test

Evidence

Validation

  • node --check .github/scripts/agents-guard.js
  • node --check templates/consumer-repo/.github/scripts/agents-guard.js
  • node --test .github/scripts/__tests__/agents-guard.test.js
  • scripts/validate_template_completeness.py

This PR only expands the explicit deletion allowlist for deprecated template workflows removed by Wave 0 cleanup. It does not relax label or CODEOWNER checks for modified protected workflows.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@stranske
stranske marked this pull request as ready for review May 4, 2026 20:43
Copilot AI review requested due to automatic review settings May 4, 2026 20:43
@agents-workflows-bot

agents-workflows-bot Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: fc36190
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / guard
Required: core tests (3.12): ⏳ pending, core tests (3.13): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 0

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

@stranske
stranske temporarily deployed to agent-standard May 4, 2026 20:44 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8381fb4f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +37 to +40
'.github/workflows/agents-autofix-loop.yml',
'.github/workflows/agents-bot-comment-handler.yml',
'.github/workflows/agents-keepalive-loop.yml',
'.github/workflows/agents-verify-to-issue-v2.yml',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep active workflows out of removal allowlist

Adding these four paths to ALLOW_REMOVED_PATHS disables Health 45 protection for deleting or renaming them in the Workflows repo, because evaluateGuard treats allowlisted removals/renames as an immediate continue (no fatal violation, label, or CODEOWNER gate). Since these workflow files still exist under .github/workflows/, a PR can now remove critical automation like agents-autofix-loop.yml or agents-keepalive-loop.yml without the guard blocking it.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the agents guard allowlist so Wave 0 consumer-template cleanup PRs can delete several deprecated workflow files without being blocked by Health 45, and mirrors that change into the consumer template copy. The PR fits into the repo’s sync/guardrail layer by adjusting how protected agents-* workflow deletions are validated during template cleanup.

Changes:

  • Extend ALLOW_REMOVED_PATHS in the root guard script for four deprecated consumer-template workflow paths.
  • Apply the same allowlist expansion to the consumer-template guard script for downstream syncs.
  • Expand the existing guard unit test to cover the newly allowlisted removal paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
templates/consumer-repo/.github/scripts/agents-guard.js Mirrors the new deletion allowlist into the consumer-template guard.
.github/scripts/agents-guard.js Expands the root guard’s allowlisted removed workflow paths.
.github/scripts/__tests__/agents-guard.test.js Adds removal-path test coverage for the new allowlist entries.

Comment on lines +35 to +40
// Wave 0 cleanup removes deprecated consumer-template workflows past the
// 2026-02-15 deprecation deadline so sync PRs can delete stale copies.
'.github/workflows/agents-autofix-loop.yml',
'.github/workflows/agents-bot-comment-handler.yml',
'.github/workflows/agents-keepalive-loop.yml',
'.github/workflows/agents-verify-to-issue-v2.yml',
stranske added a commit that referenced this pull request May 5, 2026
…TECTION_TOKEN in health-44

Wave 1's state-fingerprint helper (#1998 + #2002 wireup) broke
Health 44 enforce because the workflow's GITHUB_TOKEN can't access
the actions/variables endpoint even with `actions: write` set —
that endpoint requires a token with Variables permission (PAT,
GitHub App, or fine-grained PAT).

Resulting failure observed on every PR running Health 44 enforce
since #2002 merged (incl. PR #2006, PR #2007 today):

  GET /repos/stranske/Workflows/actions/variables/STATE_FINGERPRINT_HEALTH_44_GATE_BRANCH_PROTECTION_*
  failed: 403 "Resource not accessible by integration"

Two-part fix:

1) `scripts/state_fingerprint.py` — `RepoVariableStorage` now treats
   401/403 from the variables API as "storage unavailable" rather
   than fatal. Read returns None (no prior fingerprint), write skips
   silently, and a warning goes to stderr so the operator sees the
   misconfiguration in workflow logs. The existing 404 (no prior)
   path is unchanged.

   Effect: any workflow that adopts `--storage repo-variable` but
   doesn't have the right token degrades gracefully (skips the
   optimization, runs anyway) instead of failing outright. Future
   Wave 1+ workflows using repo-variable storage benefit from this.

2) `.github/workflows/health-44-gate-branch-protection.yml` — uses
   `BRANCH_PROTECTION_TOKEN` (already used downstream by `enforce`)
   when present, falling back to `GITHUB_TOKEN`. Now the
   fingerprint optimization actually works when the secret is
   configured.

Existing 6 tests in tests/scripts/test_state_fingerprint.py still
pass. py_compile clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stranske added a commit that referenced this pull request May 5, 2026
…back (#2010)

* fix(keepalive): handle no-checklist draft PRs with accurate disposition

Phase 6 sync-PR review surfaced two related bugs in
keepalive_orchestrator_gate_runner.js (Copilot review on stranske/*
sync PRs):

- routeDraftToHuman() emitted "0 unchecked checklist item(s)" when
  the PR had no checkboxes at all, suggesting the user just needed
  to check boxes that didn't exist.
- The branching at line 404 fell through to the same "needs human"
  path for both genuine missing-acceptance-items cases and PRs that
  legitimately have no checklist at all.

This change distinguishes the no-checklist case end-to-end:

- Adds a noChecklist flag in the caller (computed once where
  checkboxCounts is built).
- Threads noChecklist through routeDraftToHuman so the comment body
  and summary line accurately describe "no acceptance checklist
  found" vs "N unchecked items".
- Adds a distinct reason key 'pr-draft-no-checklist' so weekly
  metrics can distinguish the two cases.

Lockstep edit: canonical .github/scripts/ + templates/consumer-repo/
both updated identically. node --check passes on both.

Out of scope here: the perceived "missing closing brace" Copilot
flagged was already addressed by PR #1985 / #1986 on 2026-04-30 —
the GraphQL mutation block in markDraftReadyForReview() has the
correct three closing braces. The isConcreteAgentLabel() concern
about agent:rate-limited / agent:retry routing as concrete agent
labels is separate and needs broader review of the keepalive
loop's label-routing semantics; deferred.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(state-fingerprint): graceful fallback on 401/403 + use BRANCH_PROTECTION_TOKEN in health-44

Wave 1's state-fingerprint helper (#1998 + #2002 wireup) broke
Health 44 enforce because the workflow's GITHUB_TOKEN can't access
the actions/variables endpoint even with `actions: write` set —
that endpoint requires a token with Variables permission (PAT,
GitHub App, or fine-grained PAT).

Resulting failure observed on every PR running Health 44 enforce
since #2002 merged (incl. PR #2006, PR #2007 today):

  GET /repos/stranske/Workflows/actions/variables/STATE_FINGERPRINT_HEALTH_44_GATE_BRANCH_PROTECTION_*
  failed: 403 "Resource not accessible by integration"

Two-part fix:

1) `scripts/state_fingerprint.py` — `RepoVariableStorage` now treats
   401/403 from the variables API as "storage unavailable" rather
   than fatal. Read returns None (no prior fingerprint), write skips
   silently, and a warning goes to stderr so the operator sees the
   misconfiguration in workflow logs. The existing 404 (no prior)
   path is unchanged.

   Effect: any workflow that adopts `--storage repo-variable` but
   doesn't have the right token degrades gracefully (skips the
   optimization, runs anyway) instead of failing outright. Future
   Wave 1+ workflows using repo-variable storage benefit from this.

2) `.github/workflows/health-44-gate-branch-protection.yml` — uses
   `BRANCH_PROTECTION_TOKEN` (already used downstream by `enforce`)
   when present, falling back to `GITHUB_TOKEN`. Now the
   fingerprint optimization actually works when the secret is
   configured.

Existing 6 tests in tests/scripts/test_state_fingerprint.py still
pass. py_compile clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: apply Black formatting to state_fingerprint.py 401/403 fallback

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stranske
stranske temporarily deployed to agent-standard May 5, 2026 03:08 — with GitHub Actions Inactive
@agents-workflows-bot

Copy link
Copy Markdown
Contributor

Workflow source needed

PR #2007 needs either a linked GitHub issue or one valid non-issue Workflow Source before PR metadata automation can manage it safely.

Please do one of:

  • Add <!-- meta:issue:123 --> or a normal Closes #123 / Related to #123 line.
  • Check one Workflow Source option in the PR body.
  • Add a hidden marker such as <!-- workflow-source:local_request -->, <!-- workflow-source:manual_remote -->, <!-- workflow-source:review_followup -->, <!-- workflow-source:sync_campaign -->, or <!-- workflow-source:dependabot -->.
  • Add a workflow source label such as workflow:source-direct-pr, workflow:source-local-request, workflow:source-review-followup, workflow:source-sync, or workflow:no-automation.

Once a valid source is present, this warning will not be reposted.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants