Skip to content

fix(ci): repair agentic triage lock and gate it against drift - #1489

Merged
thiras merged 2 commits into
mainfrom
fix/agentic-triage-lock-drift
Jul 28, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/agentic-triage-lock-drift

Conversation

@thiras

@thiras thiras commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Agentic Triage has been broken since 2026-06-26 — every run that reached activation failed with:

ERR_CONFIG: E009 CONFIG_HASH_MISMATCH: Lock file '.github/workflows/issue-triage.lock.yml' is outdated!

Root cause: f2a4cc9 (#1002) changed the frontmatter of issue-triage.md and hand-patched the lock instead of running gh aw compile. The frontmatter_hash in the lock's # gh-aw-metadata: header was left at the value from the original commit (4f59c43) — unchanged across every lock commit since. The github/gh-aw-actions/setup action rehashes the .md at run time and aborts on mismatch, so the agent job never ran. (The Artifact not found for name: agent error in those runs is a downstream symptom, not the cause.)

It went unnoticed for a month because the same commit set report-failure-as-issue: false, so nothing was filed.

Changes

  1. Recompiled the lock. The local gh aw was v0.72.1 vs a latest of v0.83.4; recompiling with the old one would have reverted Dependabot's action bumps, so the extension was upgraded first. Schema v3 → v4 (adds body_hash), setup action v0.83.4 now matches the compiler.
  2. New agentic-lock CI job — reinstalls the compiler recorded in the lock metadata, recompiles, fails on any diff. Wired into the CI success gate.
  3. Dependabot ignore for github/gh-aw-actions — its pin and the stamped compiler_version come from one gh aw compile, and Dependabot cannot recompile.
  4. .github/workflows/aw.json ({"maintenance": false}) — see reviewer notes.
  5. .github/aw/actions-lock.json — gh-aw documents this as belonging in version control.

Verification

Reproduced the failure and confirmed the fix using gh-aw's own runtime hash implementation (actions/setup/js/frontmatter_hash_pure.cjs):

Lock stored computed from .md result
before 96062276… 6dfe291f… MISMATCH → E009
after 6dfe291f… 6dfe291f… MATCH (body_hash too)

The website repo runs the same workflow successfully on the same v0.72.1-stamped lock, which ruled out compiler/action version skew as the cause.

The new job's script was regression-tested against 11 scenarios in throwaway clones — all green:

Case Expect Result
Correct tree pass ✅
#1002 replay (stale hash) fail ✅
Dependabot pin bump in lock fail ✅
Lock deleted, .md kept fail ✅
Orphaned lock (2-workflow repo) fail ✅
Malformed metadata JSON fail ✅
compiler_version key missing fail ✅
Metadata header stripped fail ✅
.gitattributes deleted fail ✅
No agentic workflows at all pass ✅
Installed ≠ pinned fail ✅

actionlint clean, shellcheck clean, pre-commit run clean, gh aw compile idempotent.

Reviewer notes

aw.json is a decision worth checking. The v0.83.4 compiler emits an extra agentics-maintenance.yml — a daily cron that closes issues, creates labels and cleans caches. It appeared silently during compile. Since it was never requested, it is disabled here; issue-triage.md uses no expires, so this is a genuine no-op. Delete aw.json and recompile to opt in.

.github/dependabot.yml is deliberately outside the job's diff scope. gh-aw's ignore-block reconciler is gated behind --dependabot; plain gh aw compile leaves the file untouched, verified against v0.83.4.

Known limitation: the compiler pin is read from the lock the compiler produced, so the job proves internal consistency, not currency. With Dependabot now ignoring gh-aw-actions, nothing will flag a stale compiler. A scheduled staleness check is a reasonable follow-up.

Not included, worth a follow-up: no pre-commit hook or CONTRIBUTING entry mirrors this gate locally, unlike every other gate in the repo — the same discoverability gap that let #1002 merge.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • CI & Maintenance
    • Added automated validation to detect and prevent drift in agentic workflow lock files.
    • Pinned workflow action versions for more consistent automation.
    • Updated dependency management to exclude selected agentic workflow actions from automatic upgrades.
    • Refreshed issue triage automation with updated tooling, error handling, reporting, and safe-output processing.
  • Configuration
    • Added workflow maintenance configuration to support agentic workflow management.

Every Agentic Triage run that reached `activation` has failed since
2026-06-26 with `ERR_CONFIG: E009 CONFIG_HASH_MISMATCH`.

Root cause: f2a4cc9 (#1002) added `report-failure-as-issue: false` to
the frontmatter of issue-triage.md and hand-patched the corresponding
`GH_AW_FAILURE_REPORT_AS_ISSUE` line into the lock, but never ran
`gh aw compile`. The `frontmatter_hash` in the lock's `# gh-aw-metadata:`
header stayed at the value from the original commit (4f59c43). The
`github/gh-aw-actions/setup` action recomputes that hash from the .md at
run time and aborts when it disagrees, so the `agent` job never ran.

It went unnoticed for a month because that same commit disabled failure
reporting; the only signal was red runs in the Actions tab.

Verified with gh-aw's own `frontmatter_hash_pure.cjs`: the committed lock
computed 6dfe291f... against a stored 96062276..., and now matches on both
`frontmatter_hash` and `body_hash`.

Fixes, in three parts:

* Recompile the lock. The `gh aw` extension was v0.72.1 against a latest
  of v0.83.4; recompiling with the old one would have reverted Dependabot's
  action bumps, so upgrade first. Schema v3 -> v4 (adds `body_hash`), setup
  action now v0.83.4 matching the compiler. v0.83.4 also stops emitting
  trailing whitespace, so the pre-commit conflict behind 65172c3 is gone.

* Add an `agentic-lock` CI job that reinstalls the exact compiler recorded
  in each lock's metadata, recompiles, and fails on any diff. Pinning by
  reading `compiler_version` from the lock avoids a version in ci.yml that
  would drift; `latest` would fail every PR until someone recompiled. Also
  asserts .md <-> .lock.yml parity in both directions, since `gh aw compile`
  regenerates locks from sources and never audits an orphan.

* Ignore `github/gh-aw-actions` in Dependabot. Its pin and the stamped
  `compiler_version` are emitted by one `gh aw compile`, and Dependabot
  cannot recompile. Three of the four Dependabot commits that touched the
  lock were this action. Other actions are deliberately not ignored: their
  ci.yml bumps are wanted, and `agentic-lock` catches the lock half.

Adds .github/workflows/aw.json with `{"maintenance": false}`. The v0.83.4
compiler otherwise emits an agentics-maintenance.yml daily cron that was
never requested; issue-triage.md uses no `expires`, so disabling is a
no-op. Delete the file and recompile to opt in.

Also commits .github/aw/actions-lock.json, which gh-aw documents as
belonging in version control so contributors resolve identical pins.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 28, 2026 15:36
@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@thiras, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 2e49319a-307f-4f2a-979c-27108ce95e2e

📥 Commits

Reviewing files that changed from the base of the PR and between 9626ca2 and 6f1f681.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Walkthrough

The change adds agentic workflow lock validation, pins GitHub Actions, excludes generated gh-aw updates from Dependabot, and refreshes the generated issue-triage workflow for gh-aw v0.83.4 across activation, agent execution, detection, conclusion, and safe-output processing.

Changes

Agentic workflow refresh

Layer / File(s) Summary
Compiler lock and CI validation
.github/aw/actions-lock.json, .github/dependabot.yml, .github/workflows/aw.json, .github/workflows/ci.yml
Pins action metadata, configures Dependabot exclusions, adds agentic workflow state, and introduces CI compilation and generated-output drift validation.
Activation and prompt refresh
.github/workflows/issue-triage.lock.yml
Updates generated metadata, activation guardrails, repository configuration restoration, prompt construction, runtime substitutions, and agent handoff artifacts.
Agent runtime and MCP execution
.github/workflows/issue-triage.lock.yml
Refreshes agent setup, safe-output schemas, MCP Gateway wiring, Copilot execution, firewall handling, and agent error reporting.
Detection workflow
.github/workflows/issue-triage.lock.yml
Reworks detection execution, threat-detection preparation, token usage parsing, failure classification, and tracing outputs.
Conclusion and safe-output processing
.github/workflows/issue-triage.lock.yml
Expands conclusion guardrails and usage accounting, updates failure and no-op reporting, and changes safe-output processing and artifact collection.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Activation
  participant Agent
  participant MCPGateway
  participant CopilotCLI
  participant Detection
  participant Conclusion
  Activation->>Agent: provide refreshed prompt and runtime context
  Agent->>MCPGateway: start safe-output services
  Agent->>CopilotCLI: execute agent workflow
  CopilotCLI->>MCPGateway: submit safe-output calls
  MCPGateway-->>Agent: return tool results
  Agent->>Detection: expose execution status and usage data
  Detection->>Conclusion: provide detection result and failure outputs
  Conclusion->>Conclusion: process safe outputs and publish usage artifacts
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.57% (2422/2704 lines)
▲ +0.00pp vs base (89.57% → 89.57%)
Run: 30374827648

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

Copilot AI 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.

Pull request overview

Repairs the broken Agentic Triage workflow by regenerating the gh-aw lock file with a modern compiler/schema and adds a CI gate to prevent future drift between agentic sources, lock files, and pinned action/compiler inputs.

Changes:

  • Regenerated .github/workflows/issue-triage.lock.yml with gh-aw v0.83.4 (schema v4, updated action/container pins, new metadata hashes).
  • Added a new agentic-lock job to CI that reinstalls the compiler version recorded in lock metadata, recompiles, and fails on any diff.
  • Added supporting repo config: aw.json to disable unrequested maintenance workflow generation, Dependabot ignores for github/gh-aw-actions*, and a checked-in .github/aw/actions-lock.json.

Reviewed changes

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

Show a summary per file
File Description
.github/workflows/issue-triage.lock.yml Recompiled gh-aw-generated workflow lock to fix the runtime hash mismatch and align with newer schema/tooling.
.github/workflows/ci.yml Adds path filtering output + agentic-lock drift-check job and wires it into ci-success gating.
.github/workflows/aw.json Disables gh-aw “maintenance” workflow generation to avoid introducing an unrequested daily cron.
.github/dependabot.yml Ignores github/gh-aw-actions updates that Dependabot can’t safely apply without recompiling locks.
.github/aw/actions-lock.json Adds a version-controlled action lock file used by gh-aw compilation/pinning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Outdated
# indistinguishable from a hand-edited lock, and the run log has no
# record of which compiler produced the diff below.
# `gh aw version` writes to stderr, hence the redirect.
installed=$(gh aw version 2>&1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6f1f681, though the mechanism is different from the one described.

SIGPIPE doesn't reproduce here: gh aw version emits a single line, so grep finishes writing and exits 0 before head closes the pipe. 0 failures in 1000 trials.

The real fragility is a no-match. If gh aw version's format ever changes, grep exits 1, pipefail propagates it, and set -e kills the job on that line — so the ::error::pinned X but installed Y annotation directly below, which exists specifically to diagnose this, never prints. Confirmed: the script aborts at exit 1 having printed nothing.

grep -m 1 on its own doesn't address that, since it still exits 1 when there's no match. Applied both halves:

installed=$(gh aw version 2>&1 | grep -m1 -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || true)

-m1 removes the second process (and with it the SIGPIPE surface you identified), || true lets an unparseable version fall through to the explicit check and report installed unknown.

Verified across all three paths — correct version passes, wrong version and unparseable output each exit 1 with the annotation.

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.22% (was 81.22%, ● 0.00%) — 52851/65073 lines

No Rust files changed in this PR.

History
Commit Total Δ vs base
9626ca2 81.22% ● 0.00%
6f1f681 (HEAD) 81.22% ● 0.00%

Copilot review flagged `grep ... | head -1` under `set -euo pipefail` as a
SIGPIPE risk. The pipeline is fragile, but not for that reason: with a
single line of input grep completes before head exits, and SIGPIPE did not
reproduce in 1000 trials.

The actual failure is a no-match. If `gh aw version` ever changes format,
grep exits 1, pipefail propagates it, and `set -e` kills the job on that
line — so the `::error::pinned X but installed Y` annotation immediately
below, which exists precisely to explain this, never prints. Verified: the
script aborts at exit 1 having printed nothing.

`grep -m1` alone does not fix that, since it still exits 1 on no match.
Use `-m1` to drop the second process (removing the SIGPIPE surface the
review identified) and `|| true` so an unparseable version falls through
to the explicit check and reports "installed unknown".

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@thiras
thiras merged commit 1edcf0d into main Jul 28, 2026
24 checks passed
@thiras
thiras deleted the fix/agentic-triage-lock-drift branch July 28, 2026 15:46
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