Skip to content

fix(gh-aw): gate merge continuation dispatch - #2040

Merged
bradygaster merged 2 commits into
devfrom
bradygaster-fix-gh-aw-bootstrap
Sep 14, 2026
Merged

bradygaster merged 2 commits into
devfrom
bradygaster-fix-gh-aw-bootstrap

Conversation

@bradygaster

Copy link
Copy Markdown
Collaborator

Summary

  • validate merge-continuation PR markers and branches deterministically before the agent runs
  • load the pre-agent guard from a credential-free default-branch checkout and repeat validation before safe-output processing
  • bind the marker run ID to a completed successful implement-worker run, the same repository/default branch, and the PR creation window
  • reject duplicate, fenced, embedded, malformed, unreadable, fork-head, mismatched, and unrelated-run evidence

Validation

  • npm exec -- vitest run test/gh-aw-implement-workflow.test.ts test/gh-aw-quality.test.ts --reporter=dot (260 passed)
  • gh aw compile --strict --approve --no-check-update and gh aw compile --strict --no-check-update (6/6 compiled)
  • emitted lock inspected for both provenance boundaries and all trusted event fields
  • npm run build

Security review

The compile dry run reported the existing SQUAD_GITHUB_APP_PRIVATE_KEY, SQUAD_GITHUB_TOKEN, and bradygaster/squad/.github/actions/squad-init approval surface. This change adds no secret, action, redirect, dependency, or permission. The existing action is repository-owned and SHA-pinned by the generated workflow contract.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 14, 2026 18:26
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #2040

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 4
Files added 0
Files modified 4
Files deleted 0
Modules touched 2

🎯 Risk Factors

  • 4 files changed (≤5 → LOW)
  • 2 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (2 files)
  • workflows/shared/squad-retro-provenance.mjs
  • workflows/squad-implement-worker.md
tests (2 files)
  • test/gh-aw-implement-workflow.test.ts
  • test/gh-aw-review-workflow.test.ts

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

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

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

PR Scope: 🔧 Infrastructure

⚠️ 3 item(s) to address before review

Status Check Details
❌ Single commit 2 commits — consider squashing before review
✅ 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 3 unresolved Copilot thread(s) — fix and resolve before merging
✅ CI passing All checks passing

Files Changed (4 files, +318 −21)

File +/−
test/gh-aw-implement-workflow.test.ts +180 −6
test/gh-aw-review-workflow.test.ts +4 −3
workflows/shared/squad-retro-provenance.mjs +93 −2
workflows/squad-implement-worker.md +41 −10

Total: +318 −21


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.

Copilot review overview

🟡 Changes recommended

Unresolved critical issues remain in workflow-run validation, merge-specific output validation, and guard capability checks.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 3 High severity

Open findings (3)
What changed in this PR

This pull request hardens merge-continuation dispatches with trusted provenance validation at pre-agent and safe-output boundaries.

Changes:

  • Validates markers, branches, repositories, workflow runs, and timing.
  • Adds trusted validation gates.
  • Expands parser, runtime, compilation, and mutation tests.
File Summary
workflows/​squad-implement-worker.md Adds trusted checkout and validation boundaries.
workflows/​shared/​squad-retro-provenance.mjs Implements merge provenance parsing and run validation.
test/​gh-aw-implement-workflow.test.ts Tests provenance and compiled workflow contracts.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +624 to +628
run.path !== IMPLEMENT_WORKFLOW_PATH ||
run.event !== 'workflow_dispatch' ||
run.status !== 'completed' ||
run.conclusion !== 'success' ||
run.head_branch !== env.SQUAD_IMPLEMENT_DEFAULT_BRANCH ||
if (items === null) return { ok: false, enforced: true, violations: [{ kind: 'unreadable-agent-output' }] };
const origin = await validateImplementOrigin(env, fetchJson);
if (!origin.ok) return origin;
if (origin.origin === 'merge-continuation') return origin;
run: |
set -euo pipefail
node "${GITHUB_WORKSPACE:?}/.github/workflows/shared/squad-retro-provenance.mjs" --implement-inputs
node "${GITHUB_WORKSPACE:?}/.squad-pre-agent-trusted-base/.github/workflows/shared/squad-retro-provenance.mjs" --implement-inputs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
bradygaster added a commit that referenced this pull request Sep 14, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@bradygaster

Copy link
Copy Markdown
Collaborator Author

CI follow-up for the previously failing test job:

  • Root cause: the updated dev documentation from docs(gh-aw): pin verified bootstrap snapshot #2039 renamed the immutable workflow-install variable to SQUAD_WORKFLOW_SHA, while the pre-existing installOrders() test helper still accepted only dev or SQUAD_SHA. The two failed assertions were therefore deterministic base-branch contract drift, not a failure in this PR's merge-continuation security gate.
  • Fix: test-only commit f8235299 accepts the documented pinned variable and supported gh-aw 0.87–0.99 versions. No changeset is required for this test-only correction.
  • Evidence: targeted test passed 12/12 locally. The replacement full CI run is green: test passed 9,076 tests (1 skipped, 47 todo), and strict compile, policy, lint, security, architecture, readiness, SDK exports, samples, and changeset checks all passed.

This PR is now clean and ready for human merge. It has not been merged automatically.

@bradygaster
bradygaster merged commit 5521c46 into dev Sep 14, 2026
18 checks passed
@bradygaster
bradygaster deleted the bradygaster-fix-gh-aw-bootstrap branch September 14, 2026 19:33
@bradygaster
bradygaster restored the bradygaster-fix-gh-aw-bootstrap branch September 14, 2026 19:36
@bradygaster
bradygaster deleted the bradygaster-fix-gh-aw-bootstrap branch September 14, 2026 19:42
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