Skip to content

fix(workflows): permit verified CAO farm snapshot review roles - #2219

Closed
bradygaster wants to merge 1 commit into
devfrom
bradygaster-farm-snapshot-review-role
Closed

bradygaster wants to merge 1 commit into
devfrom
bradygaster-farm-snapshot-review-role

Conversation

@bradygaster

Copy link
Copy Markdown
Collaborator

What

Add one narrow, base-controlled native Squad review exception for CAO farm snapshot PRs, using reserved workflow identities rather than fabricated cast authorship. Working as agentic-workflows-dev (Agentic Workflows Engineer).

Why

The deterministic farm snapshot refresh has no .squad-review.json, so native review currently rejects it and blocks the daily advisory campaign. No tracking issue was supplied. Coordinated CAO producer change: bradygaster/gh-aw-cao#9.

How

Only a genuine attribution-file HTTP 404 permits this path. Require bot author github-actions[bot], exact title [squad-advisory:farm-snapshot] Farm snapshot for the control repository Squad, both labels squad-advisory and squad-advisory:farm-snapshot, and a complete nonempty diff confined to farm/**/*.md (including root Markdown and rename sources).

Require exactly one standalone <!-- squad:farm-snapshot run=<RUN_ID> --> line after CRLF normalization, with no other squad:farm-snapshot occurrence. Verify the same-repository run's canonical path .github/workflows/squad-advisory-farm-snapshot.lock.yml, workflow_dispatch, default branch, and producer SHA equal to or an API-verified ancestor of the current PR base. gh-aw chooses the PR branch, so no branch-name binding is fabricated.

Use @squad/base-controlled-farm-snapshot / @squad/base-controlled-review. Preserve base-loaded guards, exact current PR SHA/review-run checks, ordinary cast attribution and bootstrap behavior. Reuse bootstrap's completion gate: output may precede producer completion; clearing requires completed/success. CAO opens a draft and a maintainer marks it ready. A fresh rerun after producer completion can clear if the initial run raced it.

Validation evidence:

  • New positive snapshot test against original guard: failed as expected before implementation.
  • TMPDIR="$PWD/.squad-review-validation" node node_modules/vitest/vitest.mjs run test/gh-aw-review-guard.test.ts — passed, 234 tests.
  • node workflows/shared/squad-install-verifier.mjs --write-source — passed with checksum-verified isolated gh-aw v0.91.5.
  • node workflows/shared/squad-install-verifier.mjs --check-source — passed.
  • Strict compilation through compileWithPinnedActions plus emitted-artifact assertions — passed; verified both PR-base guard imports, output/final handlers, base-SHA checkout, reserved role.
  • SKIP_BUILD_BUMP=1 npm run build — passed; avoids unrelated version rewrites.
  • git diff --check — passed.

⚠️ Quick Check

  • If SDK/CLI source files changed: completed the applicable Changeset step below (npx changeset add / .changeset/*.md, direct CHANGELOG.md entry for maintainers, or skip-changelog label for no user-facing changes)

N/A: no SDK/CLI source or template changes; workflow package digests regenerated.

PR Readiness Checklist

The PR readiness bot will validate these automatically after push.
Check each item before requesting review. See CONTRIBUTING.md for full details.

Branch & Commit

  • Branch created from dev (not main)
  • Branch is up to date with dev (git fetch upstream && git rebase upstream/dev)
  • Verified diff contains only intended changes (git diff --cached --stat)
  • PR is not in draft mode (mark ready when checks pass)
  • Commit history is clean (squash fixups before review)

Build & Test

  • npm run build passes
  • npm test passes (all tests green)
  • npm run lint passes (type check clean)
  • npm run lint:eslint passes
  • For migration PRs (>20 files): include test output summary in PR description

Focused guard suite and mandatory build passed as above. Full test suite and standalone lint commands were not run, per the explicit focused-validation scope. Not a migration.

Changeset

  • Changeset added via npx changeset add (if packages/squad-sdk/src/ or packages/squad-cli/src/ changed)
  • Or direct CHANGELOG.md entry (maintainers only — write-protected for external contributors)
  • Or skip-changelog label applied (if no user-facing changes)

N/A: no files covered by the changeset gate changed.

Docs

  • README section updated (if new feature/module)
  • Docs feature page (if new user-facing capability)

Updated the gh-aw guide and review workflow instructions; no new module.

Exports

  • package.json subpath exports updated (if new module)

N/A: no SDK changes.


Breaking Changes

None. All non-snapshot review paths remain unchanged.

Waivers

Requested: accept focused guard tests plus strict compiler/package verification and build instead of additional local full-suite/lint runs, per user-directed minimal validation scope. Lead/Quality approval is still required before merge; no waiver is claimed approved. Normal CI, independent review, and branch protections remain in force.

Use reserved workflow roles only for the verified Actions-bot farm Markdown PR and producer run. Preserve ordinary attribution and bootstrap clearing gates.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 33ebda51-5808-40cf-b34d-df44be618896
Copilot AI balanced review requested due to automatic review settings October 14, 2026 04:08
@github-actions

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #2219

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 6
Files added 0
Files modified 6
Files deleted 0
Modules touched 3

🎯 Risk Factors

  • 6 files changed (6-20 → MEDIUM)
  • 3 modules touched (2-4 → MEDIUM)

📦 Modules Affected

docs (1 file)
  • docs/src/content/docs/guide/gh-aw.md
root (4 files)
  • workflows/package/squad-review.md
  • workflows/shared/squad-review-guard.mjs
  • workflows/squad-review.md
  • workflows/squad-workflows.manifest.json
tests (1 file)
  • test/gh-aw-review-guard.test.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 169ce4c

PR Scope: 🔧 Infrastructure

⚠️ 3 item(s) to address before review

Status Check Details
✅ Single commit 1 commit — clean history
✅ Not in draft Ready for review
✅ Branch up to date Up to date with dev
❌ Copilot review No Copilot review yet — it may still be processing
✅ Changeset present No source files changed — changeset not required
✅ Scope clean No .squad/ or docs/proposals/ files
✅ No merge conflicts No merge conflicts
❌ Copilot threads resolved 1 unresolved Copilot thread(s) — fix and resolve before merging
❌ CI passing 1 check(s) still running

Files Changed (6 files, +362 −15)

File +/−
docs/src/content/docs/guide/gh-aw.md +33 −0
test/gh-aw-review-guard.test.ts +163 −0
workflows/package/squad-review.md +47 −3
workflows/shared/squad-review-guard.mjs +66 −3
workflows/squad-review.md +47 −3
workflows/squad-workflows.manifest.json +6 −6

Total: +362 −15


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

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.

🟡 Changes recommended

Producer workflow runs are not immutably bound to the snapshot PR or its exact head.

1 open finding
What changed in this PR

Adds a narrowly scoped native review path for CAO farm snapshot pull requests lacking cast attribution.

Changes:

  • Validates farm-only diffs, producer workflow provenance, and reserved identities.
  • Adds focused positive and mutation tests.
  • Updates workflow documentation and generated integrity metadata.
File Description
workflows/​squad-workflows.manifest.json Refreshes review workflow and guard digests.
workflows/​squad-review.md Documents the farm snapshot exception.
workflows/​shared/​squad-review-guard.mjs Implements snapshot provenance validation.
workflows/​package/​squad-review.md Regenerates the packaged workflow source.
test/​gh-aw-review-guard.test.ts Tests acceptance and fail-closed mutations.
docs/​src/​content/​docs/​guide/​gh-aw.md Documents operator-facing behavior.

Review effort: Balanced

Comment on lines +423 to +425
requireThat(run?.id === runId && run.path === FARM_SNAPSHOT_WORKFLOW &&
run.repository?.full_name === repository && run.event === 'workflow_dispatch' &&
run.head_branch === pr.base.ref,

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.

🔵 Needs a closer look

The producer run is not causally bound to the PR, allowing a qualifying run ID to be replayed by another bot-authored farm PR.

1 open finding

Review effort: Balanced

@bradygaster
bradygaster marked this pull request as draft October 14, 2026 04:28
@bradygaster

Copy link
Copy Markdown
Collaborator Author

Parking as draft. The paired CAO producer (bradygaster/gh-aw-cao#9) is parked: its output conflicts with the CAO farm receipt-ownership contract. Copilot finding 4266690635 is also valid: the run ID is not bound to this PR's head or creation time. If this resumes, bind the run to the PR head and creation window together with the redesigned producer.

@bradygaster

Copy link
Copy Markdown
Collaborator Author

Closing this snapshot-refresh approach. Ongoing research waves now use the run-local CAO evidence hook in #2226.

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