Skip to content

chore: sync workflow templates - #344

Merged
agents-workflows-bot[bot] merged 1 commit into
mainfrom
sync/workflows-c6b722d74cfd
Jun 19, 2026
Merged

chore: sync workflow templates#344
agents-workflows-bot[bot] merged 1 commit into
mainfrom
sync/workflows-c6b722d74cfd

Conversation

@stranske

@stranske stranske commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Sync Summary

Files Updated

  • agents-guard.yml: Agents guard - enforces agents workflow protections (Health 45)
  • agents-guard.js: Health 45 agents guard logic used by the workflow protections
  • WORKFLOW_USER_GUIDE.md: Workflow user guide - explains the CI/agent system for repo consumers

Files Skipped

  • pr-00-gate.yml: File exists and sync_mode is create_only
  • ci.yml: File exists and sync_mode is create_only
  • renovate.json: File exists and sync_mode is create_only
  • cross-repo-smoke.yml: File exists and sync_mode is create_only
  • llm_slots.json: None

Review Checklist

  • CI passes with updated workflows
  • No repo-specific customizations were overwritten

Source: stranske/Workflows
Source SHA: 5d306dbf622f81baba35684f8f03fdad013da942
Template hash: c6b722d74cfd
Sync branch: sync/workflows-c6b722d74cfd
Consumer repo: stranske/Ready
Manifest: .github/sync-manifest.yml

Summary by CodeRabbit

  • Documentation

    • Updated the workflow user guide to clarify when the agents:allow-change label now bypasses code owner approval requirements specifically for dependency-only updates sourced from recognized automation tools and services.
  • Chores

    • Enhanced the workflow authorization guard to better support dependency automation scenarios with improved recognition of dependency-update bot identities and author association validations.

Automated sync from stranske/Workflows
Template hash: c6b722d74cfd

Changes synced from sync-manifest.yml
@stranske stranske added sync Automated sync from Workflows automated Automated sync from Workflows labels Jun 19, 2026
@stranske
stranske temporarily deployed to agent-standard June 19, 2026 06:43 — with GitHub Actions Inactive
@stranske
stranske temporarily deployed to agent-standard June 19, 2026 06:43 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a dependency-only authorization bypass to agents-guard.js: new bot-identity constants, helper functions to detect action-ref-only patches, a new authorAssociation parameter in evaluateGuard, revised bypass-gating logic with four new return fields, workflow wiring, and documentation updates.

Changes

Dependency-only bypass in agents-guard

Layer / File(s) Summary
Bot identity constants and patch-parsing helpers
.github/scripts/agents-guard.js
Adds DEPENDENCY_UPDATE_BOT_LOGINS and TRUSTED_DEPENDENCY_AUTHOR_ASSOCIATIONS constants, and two helper functions to parse uses: action references from diff lines and to determine whether a patch changes only action refs without altering the action sequence.
evaluateGuard: new parameter, bypass logic, and return fields
.github/scripts/agents-guard.js
Extends evaluateGuard with an authorAssociation input; computes isDependencyUpdateBot, authorCanUseDependencyBypass, and protectedChangesAreDependencyOnly; gates the agents:allow-change bypass on those conditions; extends the return payload with four new fields; and exports patchChangesOnlyActionReferences.
Workflow wiring and documentation
.github/workflows/agents-guard.yml, WORKFLOW_USER_GUIDE.md
Reads context.payload.pull_request.author_association and passes it as authorAssociation to evaluateGuard; updates label and maintenance-workflow documentation to reflect the narrowed dependency-only bypass scope.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • stranske/Ready#329: Touches WORKFLOW_USER_GUIDE.md to update agents:allow-change label documentation aligned with agents-guard CODEOWNER bypass behavior, overlapping with the same doc lines modified in this PR.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'chore: sync workflow templates' is vague and generic. While it accurately describes that workflow templates are being synced, it does not convey the substantial security and functionality changes involved, such as the new dependency-update authorization logic, the extended guard evaluation parameters, or the documentation updates that clarify bypass conditions. Consider a more specific title that captures the main change, such as 'chore: sync workflow templates with dependency-update authorization logic' or similar, to better reflect the security-relevant functionality being introduced.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/workflows-c6b722d74cfd

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Workflow state fingerprint for Keepalive Loop Reporter. Do not edit.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Workflow state fingerprint for Agents Gate Followups. Do not edit.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/agents-guard.js:
- Around line 616-620: The guard enforcement for protected files only checks for
modifications via the modifiedProtectedPaths check and the filter condition on
line 617-620 that uses file.status === 'modified'. This misses protected files
that are newly added to the PR, allowing them to bypass the approval gate. To
fix this, update the filter condition to include both modified and added files
by checking file.status === 'modified' || file.status === 'added' when
evaluating protectedChangesAreDependencyOnly. Additionally, ensure that
hasProtectedChanges accounts for both added and modified protected paths. Apply
the same fix to the similar logic mentioned at lines 633-637.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 649005c5-a5e9-4642-b7e3-3699299de700

📥 Commits

Reviewing files that changed from the base of the PR and between 817f61f and aab6aeb.

📒 Files selected for processing (3)
  • .github/scripts/agents-guard.js
  • .github/workflows/agents-guard.yml
  • WORKFLOW_USER_GUIDE.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • stranske/Workflows (auto-detected)
📜 Review details
🧰 Additional context used
📓 Path-based instructions (6)
{pyproject.toml,.github/workflows/*.{yml,yaml}}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

{pyproject.toml,.github/workflows/*.{yml,yaml}}: For Python projects with coverage thresholds, ensure both pyproject.toml ([tool.coverage.report] fail_under) and workflow files have matching coverage-min settings, or the lower one will determine the actual threshold
The Manager-Database repository has a coverage threshold of 75%

Files:

  • .github/workflows/agents-guard.yml
.github/workflows/*.{yml,yaml}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

For GitHub Actions workflow startup_failure errors, check for invalid YAML syntax, invalid permissions: block in workflow_call reusable workflows, invalid permission scopes, or circular workflow references

Files:

  • .github/workflows/agents-guard.yml
.github/workflows/**/*.yml

📄 CodeRabbit inference engine (CLAUDE.md)

Reference reusable workflows with @main unless intentionally pinning to an exact commit SHA for a controlled reason.

Files:

  • .github/workflows/agents-guard.yml
.github/workflows/agents-*.yml

📄 CodeRabbit inference engine (CLAUDE.md)

Agent workflow files (agents-*.yml) should be fixed in stranske/Workflows, not locally

Files:

  • .github/workflows/agents-guard.yml
**/.github/workflows/*.yml

📄 CodeRabbit inference engine (AGENTS.md)

Reference reusable workflows in first-party consumers with @main unless intentionally pinning to an exact commit SHA for a controlled reason

Files:

  • .github/workflows/agents-guard.yml
**/.github/workflows/agents-*.yml

📄 CodeRabbit inference engine (AGENTS.md)

agents-*.yml workflow files should be fixed in stranske/Workflows, not in the consumer repo

Files:

  • .github/workflows/agents-guard.yml
🔀 Multi-repo context stranske/Workflows

Based on my exploration of the stranske/Workflows repository, I've identified the cross-repository context relevant to this PR sync.

Linked repositories findings

stranske/Workflows [::stranske/Workflows::]

API Changes in agents-guard.js:

  1. Function signature update [::stranske/Workflows::]

    • evaluateGuard() now accepts a new optional parameter authorAssociation (default: '')
    • Location: .github/scripts/agents-guard.js:478-489
    • The parameter is normalized and used to check against TRUSTED_DEPENDENCY_AUTHOR_ASSOCIATIONS
  2. New module exports [::stranske/Workflows::]

    • patchChangesOnlyActionReferences is now exported from module.exports
    • Location: .github/scripts/agents-guard.js (end of file)
    • This helper function parses uses: action references from diff lines
  3. New return value fields [::stranske/Workflows::]

    • evaluateGuard() return object now includes:
      • hasDependencyUpgradeBypass (boolean)
      • protectedChangesAreDependencyOnly (boolean)
      • isDependencyUpdateBot (boolean)
      • authorCanUseDependencyBypass (boolean)
    • Location: .github/scripts/agents-guard.js:709-733
  4. New authorization constants [::stranske/Workflows::]

    • DEPENDENCY_UPDATE_BOT_LOGINS = new Set(['dependabot[bot]', 'renovate[bot]'])
    • TRUSTED_DEPENDENCY_AUTHOR_ASSOCIATIONS = new Set(['OWNER', 'MEMBER', 'COLLABORATOR'])
    • Location: .github/scripts/agents-guard.js (early in file)

Workflow Integration:

The agents-guard.yml workflow now [::stranske/Workflows::]

  • Extracts author_association from context.payload.pull_request.author_association
  • Passes it as authorAssociation to evaluateGuard()
  • Location: .github/workflows/agents-guard.yml:203-204, 417

Test Coverage: [::stranske/Workflows::]
The repository includes comprehensive tests in tests/workflows/test_agents_guard.py:

  • test_dependency_bot_action_version_update_with_label_passes() (line 378)
  • test_owner_action_version_update_with_label_passes_without_personal_codeowner() (line 400)
  • Tests verify that dependency-bot PRs and OWNER-associated PRs can bypass CODEOWNER approval when agents:allow-change label is present and changes are dependency-only

Documentation Updates: [::stranske/Workflows::]

  • templates/consumer-repo/WORKFLOW_USER_GUIDE.md:168 clarifies that agents:allow-change bypasses CODEOWNER approval only for dependency-only uses: reference updates from Dependabot/Renovate or owner/member/collaborator PRs
  • templates/consumer-repo/docs/LABELS.md:605-622 documents the label behavior
  • Reference to maint-auto-label-dep-prs.yml which auto-applies the label to dependency-bot PRs

Impact Assessment:

The changes are backward-compatible because:

  • The new authorAssociation parameter has a default empty string value
  • Existing callers of evaluateGuard() will continue to work without modification
  • The new return fields are additive and don't break existing consumers

Consumers of this template need to verify:

  • Workflow evaluation logic correctly passes author_association from the GitHub context
  • Any custom bypass logic is compatible with the new dependency-only bypass mechanism
  • CODEOWNER configuration matches the protected paths expectations
🔇 Additional comments (2)
.github/workflows/agents-guard.yml (1)

211-212: LGTM!

Also applies to: 425-425

WORKFLOW_USER_GUIDE.md (1)

168-168: LGTM!

Also applies to: 853-853

Comment on lines 616 to +620
const hasProtectedChanges = modifiedProtectedPaths.size > 0;
// Security note: Allow `agents:allow-change` label to bypass CODEOWNER approval
// ONLY for automated dependency PRs from known bots (dependabot, renovate).
// Human PRs or other bot PRs still require CODEOWNER approval even with label.
const isAutomatedPR = normalizedAuthor && (normalizedAuthor === 'dependabot[bot]' || normalizedAuthor === 'renovate[bot]');
const needsApproval = hasProtectedChanges && !hasCodeownerApproval && !(hasAllowLabel && isAutomatedPR);
const protectedChangesAreDependencyOnly = hasProtectedChanges && relevantFiles
.filter((file) => file.status === 'modified' && matchProtectedPath(file.filename || ''))
.every((file) => patchChangesOnlyActionReferences(file.patch || ''));
const isDependencyUpdateBot = Boolean(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Protected workflow file additions are not guarded by the new bypass gate

Line 616 keys guard enforcement off modifiedProtectedPaths, and Line 617-620 only inspects modified protected files for dependency-only diffs. A protected file added in the PR is excluded from both checks, so it can pass without CODEOWNER approval (and can be bundled with dependency-only edits without breaking the bypass lane).

Suggested fix
-  if (status === 'modified') {
+  if (status === 'modified' || status === 'added') {
     modifiedProtectedPaths.add(protectedPath);
   }

-  const hasProtectedChanges = modifiedProtectedPaths.size > 0;
-  const protectedChangesAreDependencyOnly = hasProtectedChanges && relevantFiles
-    .filter((file) => file.status === 'modified' && matchProtectedPath(file.filename || ''))
-    .every((file) => patchChangesOnlyActionReferences(file.patch || ''));
+  const protectedChangedFiles = relevantFiles.filter((file) =>
+    (file.status === 'modified' || file.status === 'added') &&
+    matchProtectedPath(file.filename || '')
+  );
+  const hasProtectedChanges = protectedChangedFiles.length > 0;
+  const protectedChangesAreDependencyOnly = hasProtectedChanges &&
+    protectedChangedFiles.every((file) =>
+      file.status === 'modified' && patchChangesOnlyActionReferences(file.patch || '')
+    );

Also applies to: 633-637

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/agents-guard.js around lines 616 - 620, The guard
enforcement for protected files only checks for modifications via the
modifiedProtectedPaths check and the filter condition on line 617-620 that uses
file.status === 'modified'. This misses protected files that are newly added to
the PR, allowing them to bypass the approval gate. To fix this, update the
filter condition to include both modified and added files by checking
file.status === 'modified' || file.status === 'added' when evaluating
protectedChangesAreDependencyOnly. Additionally, ensure that hasProtectedChanges
accounts for both added and modified protected paths. Apply the same fix to the
similar logic mentioned at lines 633-637.

@agents-workflows-bot
agents-workflows-bot Bot merged commit ff79848 into main Jun 19, 2026
87 of 93 checks passed
@agents-workflows-bot
agents-workflows-bot Bot deleted the sync/workflows-c6b722d74cfd branch June 19, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Automated sync from Workflows sync Automated sync from Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant