Skip to content

feat(ci): four gh-aw agentic workflows, on the judgement CI cannot do - #359

Merged
athvin merged 5 commits into
mainfrom
bm/gh-aw-agents
Nov 3, 2026
Merged

athvin merged 5 commits into
mainfrom
bm/gh-aw-agents

Conversation

@athvin

@athvin athvin commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

What and why

Four gh aw agentic workflows, aimed at the
judgement step CI cannot do. The Dependabot history is the case for them: of the
last twenty bot PRs, eight were closed rather than landed — ulid 3.0.0,
sha2 0.11.0, hmac 0.13.0, duckdb 1.20000.0, rand 0.10.3, motion 14.3.0
and two whole frontend groups. Several were closed not because the bump was wrong
but because it needed a second, known edit that nobody made. Those coupling
rules are already written down in this repo; what was missing was someone to read
them.

Each workflow is a Markdown prompt with YAML frontmatter; gh aw compile emits
the .lock.yml beside it. Edit the .md.

Workflow Trigger Mode What it does
dependency-upgrade-pilot workflow_run on dependabot/** staged reads release notes for the whole version range, checks the five coupled pins, verdicts safe-to-merge / needs-companion-change (applies + pushes it) / schedule-as-migration
ci-triage workflow_run on failure live classifies red as your-diff / the-world-moved / runner-infra / flake
generated-artifact-healer workflow_run on failure staged re-runs the regen command behind a byte-compared artifact
skill-freshness-auditor weekly live finds sentences in .claude/skills that the code contradicts

Security posture, verified rather than asserted

gh-aw splits each workflow into five or six jobs. The agent job that runs the
model holds no GitHub write scope
— contents: write lives only in the separate
safe_outputs and conclusion jobs that run after it exits. Checked by
extracting the per-job permissions: from every lock file.

One honest exception: the two agents that compile Rust carry id-token: write on
the agent job, because shared/rust-gate.md exchanges it for the sccache role.
That mints an AWS credential, not a GitHub one, against er-ci-sccache-read —
s3:GetObject/ListBucket on one bucket, no DeleteObject in the policy at all.
Read access to compiler output is the whole blast radius. The skill says this
rather than the tidier claim that the agent never writes.

Supply-chain review (required by gh aw compile's safe-update mode): the four
actions introduced — Swatinem/rust-cache, aws-actions/configure-aws-credentials,
mozilla-actions/sccache-action, taiki-e/install-action — are pinned to SHAs
verified byte-identical to the ones rust.yml already uses, so there is no new
supply-chain surface. .github/aw/actions-lock.json records the one genuinely new
action, gh-aw's own setup, resolved to a SHA. No repository secret is added:
engine: copilot draws on the job token, so the zero-secrets invariant holds.

Both push-capable agents start staged

A workflow_run workflow only fires once it is on the default branch, so merging
this is their first real execution — there is no way to watch them first.
Both agents that push therefore set safe-outputs.staged: true: every output is
previewed in the run summary, nothing posted or pushed. Remove one line per agent
after reading a real run. ci-triage stays live because a comment is reversible.

Three prerequisites, in the first commit

Each is a red run otherwise, and they are separated so the plumbing was verified
against a tree with no agentic workflows in it.

  1. skills-check.sh globbed .github/workflows/*.yml to build the generated
    required-checks table. gh aw compile emits *.lock.yml and
    agentics-maintenance.yml, which that glob caught — every compile would have
    churned the reference and failed two jobs. Now skipped by the generated-file
    marker in the header rather than by filename, so whatever gh-aw generates next
    is covered too.
  2. rust.yml's detect counted any path outside .claude/ as code, so
    editing a prompt would spend ~15 minutes on test + ducklake-e2e.
    Deliberately per-file and not ^\.github/workflows/ — the four
    hand-written workflows must keep triggering the gate they define, and
    excluding the directory wholesale is the paths:-filter trap in CLAUDE.md
    wearing a different hat. Sixteen paths table-tested in both directions.
  3. The CI skill gains the section the above implies: agentic workflows may
    never be required checks (a model run is non-deterministic, so requiring one
    gates every merge on a retry), which is also why they are the only workflows
    here allowed a paths: filter.

Three things changed once measured

  • workflow_run, not pull_request. A pull_request event raised by
    Dependabot carries a read-only GITHUB_TOKEN whatever the permissions block
    says, so the companion push would have failed. workflow_run also means CI has
    already answered, so the agent reads the result instead of guessing.
  • No disk-reclaim step, which the plan called for. rust.yml carries it on
    test alone, because that job links a debug binary per crate; lint — whose
    commands these agents replicate — has none. It would also have been harmful:
    the reclaim deletes /opt/hostedtoolcache, which a gh-aw run needs for its own
    actions/setup-node.
  • shared/rust-gate.md's env must match rust.yml exactly. sccache keys on
    the compiler command line, so dropping -fuse-ld=mold would silently yield a
    0% hit rate against a warm cache and the agent would wait out a cold duckdb
    C++ build. Matching it is the only reason these runs are affordable (~6 min for
    fmt + clippy + deny + entity verify).

Verification

  • gh aw compile --strict — 4 succeeded. Two warnings accepted and documented in
    place, both push-to-pull-request-branch: target: "*": the privilege is near
    nil, since the push goes to the PR's own branch which its author can already
    write to, and the suggested fix (a required label) means opting each PR in by
    hand, which is most of the cost these agents exist to remove.
  • gh aw lint — actionlint over all 9 workflow files, no issues.
  • make skills-check — green, and observed red at exit 1 on an uncommitted
    agentic workflow. The first attempt to check that read exit 0 because | tail
    had eaten the status, which is the masking trap this very skill documents.
  • make check is not run here: nothing in this PR touches Rust source, and a
    cold rust/target is 30–80 GB. rust.yml on this PR is that gate.

Not done, deliberately

gh aw init was not run. It would also write .github/mcp.json,
.github/skills/, .github/agents/ and .vscode/settings.json — Copilot
coding-agent scaffolding, which under CLAUDE.md's rules on agent tooling is a
decision to make explicitly, not a side effect of installing four workflows. The
one piece that mattered, .gitattributes marking lock files generated,
gh aw compile writes by itself.

One stale claim found — and fixed, not kept as a fixture

Writing skill-freshness-auditor turned up exactly the kind of thing it is for.
.claude/skills/ci-and-supply-chain/references/build-cost.md:485 asserted "The
repository is public and owned by a user account"
and concluded "its
minutes are free … The current bill for all of this CI is zero."

gh repo view --json visibility returns PRIVATE. Free standard-runner minutes
are a public-repo property, so the cost premise under that whole document was
wrong — and it is a hand-written sentence in a file with no GENERATED block,
which is precisely the gap skills-check.sh cannot see.

That changes two conclusions, not just a word: the wall-clock reductions recorded
there are a cost reduction and not only a latency one, and a scheduled
workflow — four of which are landing here — is a recurring line item rather than
a free one. Two entries in its "paths if cores are wanted" list inherited the
premise and are corrected with it.

Fixed here rather than kept as the auditor's test fixture. A standing
instruction that is wrong about money should not survive for test convenience.
Correcting my own earlier note on this PR: rust.yml:219 and infra.yml:16
argue from the same stale premise, but they are code comments and so outside
this agent's scope — it reads .claude/skills/ only. Both mechanisms there
remain correct (an untrusted PR still must not be able to plant object code;
federated OIDC still beats a static key); only their stated reasons need
rewording, which build-cost.md now records. infra.yml is additionally under
concurrent edit on another branch.

So the auditor ships unexercised against a known finding — see the caveat
below.

The honest caveat: none of these has ever run

A workflow_run workflow only fires once it is on the default branch, so there
was no way to execute any of them from this branch. The negative tests the plan
called for — breaking a clippy rule to watch ci-triage classify it, staling a
generated file to watch the healer heal it — have not been run. That is what
staged: true on the two push-capable agents is for, and why ci-triage is left
live: its first real run is the cheapest way to see whether the prompts work.
gh aw forecast likewise returns nothing yet (404: not on the default branch),
so there is no cost estimate for these four; gh aw logs and gh aw audit
will give real AIC per run once they fire.

🤖 Generated with Claude Code

@athvin
athvin force-pushed the bm/gh-aw-agents branch 2 times, most recently from 4463fb5 to 84b21ec Compare October 31, 2026 23:29
athvin added a commit that referenced this pull request Nov 1, 2026
…est (#362)

Two things, both found by looking at what the last PR actually shipped.

**The repository is private, and five files said otherwise.**
`gh repo view --json visibility` returns PRIVATE. I had propagated "public
repository" into the plan-step comment, `docs/infrastructure.md` §14.2, the
infra-platform skill, and — worst — the PR comment template, which renders
that sentence onto every infra PR. Two pre-existing claims in
`ci-terraform.tf` and `ses.tf`, plus two in `sccache.tf`, said the same.

Every decision those comments justify stays correct, so none of them is a
word swap; each needed its premise replaced:

- `-refresh=false` on the plan tier: the path was never "the whole
  internet reads the log", it is that the plan role is assumable from any
  PR branch, a PR can edit the workflow it runs under, and the resulting
  build log needs no AWS access to read, is readable by every
  collaborator, and persists in the run history. Private narrows who, not
  whether.
- zero repository secrets: the argument never depended on visibility —
  secrets are not readable by anonymous visitors on a public repo either.
  It is that a static key does not expire, is reachable by every workflow
  rather than one job, and is rotated only by someone remembering to.
- the sccache writer split: cache poisoning now has to come from a
  collaborator rather than from anyone, which narrows who can attempt it
  without closing the path — and poisoning outlives the credential that
  planted it, which is why it is worth a second role.

Left alone deliberately: six `rust.yml` sccache comments and
`build-cost.md`'s runner-cost paragraph, which claims standard minutes are
free — materially wrong on a private repo. Both files belong to #359,
which is in flight and already corrects one line of build-cost.md. Sweeping
them here would only conflict with it.

**The destroy guard had never refused anything in CI.** Every real apply
has planned `0 to destroy`, so the one mechanism between a merge and an
unattended production teardown had its refusal path verified exactly once,
by hand, by me. That is the state this repo keeps getting burned by — a
gate nobody has watched fail is indistinguishable from a gate that cannot.

`scripts/ci/tf-helpers-test.sh` asserts 31 behaviours of the three helpers
against fixtures: the refusal, the `ALLOW-DESTROY` override, the
fail-closed branch, the import-form summary a full-line pattern would miss,
the 65536-character comment cap, the backtick-in-plan-text fence, and that
a plan-only stack never gets the "merging applies this" warning. No
toolchain, no credentials, no network, no terraform binary.

`apply` now gates on it, which is the reason it is a CI job and not a local
convenience: a broken guard stops the apply instead of being discovered by
it.

The suite is mutation-checked — breaking the guard's refusal, its
fail-closed branch, the metadata parser's import handling, the comment cap
or the plan-only warning skip each turns it red. The first attempt at that
check reported a false CAUGHT from a `sed` that matched nothing, which is
why the mutations are applied by assertion now.

One bug in the test itself, worth recording because it is the same class
the suite exists to catch: the "names ALLOW-DESTROY in the refusal"
assertion piped the guard into `grep -q`. With `pipefail` on, the pipeline
returned the guard's own exit 1 — the behaviour under test — so the
assertion read false however correct the message was, and `grep -q` would
have SIGPIPEd the guard on the way. Captured and matched with `case`
instead.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 1, 2026
#365)

I made `plan (state-backend)`, `plan (core)`, `plan (dev)` and
`plan (prod)` required in #360's follow-up. The next non-infra PR — #359,
the agentic workflows — went unmergeable, with all four stuck on
"Expected — waiting for status to be reported", and the four contexts have
been removed from branch protection to unblock it.

The behaviour, stated exactly, because it is genuinely surprising:

  While a matrix job RUNS it reports one check-run per leg —
  `plan (core)`, `plan (dev)`, … — which look like perfectly good
  contexts. When the job is SKIPPED by its `if:`, GitHub reports a single
  check-run under the literal, uninterpolated name
  `plan (${{ matrix.key }})`.

So per-leg contexts never report at all on a PR that skips the tier, and a
required context that never reports blocks the PR forever — the same
failure mode as a `paths:` filter, which is precisely what this workflow's
`detect` job exists to avoid. I replaced one trap with another wearing a
different hat.

`fmt + validate (credential-free)` was fine throughout, and the contrast is
the diagnosis: it is not a matrix job, so it reports `skipped` under its own
name and branch protection accepts that.

The fix is a non-matrix aggregator, `terraform plan`, which `needs: plan`
and inspects `needs.plan.result` — the aggregate, `success` only if every
leg succeeded. It reports `skipped` when the tier is skipped, so it is
safe to require in the legs' place.

Two details in it:

- `skipped` is ACCEPTED. Exactly one thing produces it: a fork PR, which
  is issued no `id-token` and so cannot assume the plan role (the `plan`
  job skips itself for that reason). Treating it as failure would make
  every fork PR unmergeable — this same bug pointed the other way.
- anything unrecognised, including an empty result, FAILS. Verified
  against all five values `needs.*.result` can take.

Documented where the next person will hit it: the `ci-and-supply-chain`
skill now carries it as the third `name:`-is-a-context failure mode, and
the generated job table — which displays `plan (${{ matrix.key }})`
verbatim, i.e. the trap itself — gained a preamble line saying a context
containing `${{ matrix.* }}` cannot be required.

Nothing is added to branch protection here. That comes after this reports
green on `main`, which is the only safe order.

One bug caught while verifying, in the gate's own message: a backticked
word inside a double-quoted shell string is command substitution, so the
first draft ran `validate` and printed its empty output in place of the
word. Single-quoted now.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 1, 2026
…g the Rust gate (#366)

The tail of #362, which corrected the "public repository" claim in the
files it owned and deliberately left `rust.yml` and `build-cost.md` to
#359. #359 has corrected one line of `build-cost.md` and is still open, so
these are the remaining ones — the edits sit in different hunks from its,
and a rebase either way is clean.

**`rust.yml`'s six sccache comments.** The cache-poisoning argument stands;
only its premise moves. Poisoning outlives the credential that planted it,
which is why writes are restricted to `main` — and the repository being
private means the branch has to come from a collaborator rather than from
anyone at all. Narrower, not closed.

**`build-cost.md` claimed "its minutes are free, because standard
GitHub-hosted runners are free for public repositories" and that the bill
for all of this CI is zero.** That is materially wrong on a private repo:
the runtime this whole file measures is a cost, not only a wait. Two
downstream conclusions moved with it — an organisation on the Team plan
trades one metered rate for another rather than giving up a free one, which
is a smaller step than it read; and the usual objection to self-hosted
runners (a fork PR executing arbitrary code) mostly does not apply, so what
remains is the ordinary compromised-collaborator case and the runner
wanting its own least-privileged identity.

No replacement figure is asserted. The allowance and consumption are
account settings rather than repository state, and
`gh api /users/{user}/settings/billing/actions` needs a `user` scope this
session does not hold — so the text says where to read them instead of
substituting one unverified number for another.

**`.github/workflows/infra.yml` joins `rust.yml`'s detect denylist**, with
`scripts/ci/tf-*` which was already exempt in `infra.yml`'s own detect but
not here. An infra-only PR was paying the full ~40-minute backend gate —
`test` plus the DuckLake e2e — and `infra.yml` defines no Rust job and
cannot affect the workspace build. Every infra PR in this series paid it.

Named FILE BY FILE and not as `^\.github/workflows/`: `rust.yml`,
`frontend.yml` and `images.yml` must keep triggering the gates they define,
or a change to a gate would stop reporting on exactly the PR most likely to
break it. Simulated over nine shapes — infra.yml alone, with terraform, and
with a tf helper all skip; rust.yml, frontend.yml, images.yml, docs,
`scripts/ci/actionlint.sh`, and infra.yml+rust all still run.

`rust/deny.toml`'s "Public repo" is left alone: it describes
`github.com/athvin/feather-flow`, the ff-analysis dependency, which really
is public (checked).

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

@athvin athvin left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed while rebasing this onto the infra work (#358–#366). The construction is careful — I checked the things I'd expect to be wrong and they're right. One finding looks blocking, and it needs a decision rather than a patch, so I've left it alone.

Blocking: the four agents cannot authenticate as merged

gh aw compiles an unconditional Validate COPILOT_GITHUB_TOKEN secret step into each lock file (ci-triage.lock.yml:235), feeding it ${{ secrets.COPILOT_GITHUB_TOKEN }} with no fallback. Two facts together:

  • gh secret list is empty — no COPILOT_GITHUB_TOKEN.
  • None of the four workflows declares copilot-requests: write. The only occurrence of that string in any lock file is inside gh-aw's own failure-message text (:1509), not a permissions block. grep -c copilot-requests on the four .md sources returns 0.

So each run reaches activation, sets secret_verification_result=failed, and conclusion reports the missing credential. It degrades gracefully rather than crashing — and none of them is a required check, so nothing is blocked — but none of the four will ever do anything until one of the two is supplied.

The skill text describes the intended mechanism correctly:

engine: copilot draws on copilot-requests: write against the job token, so there is still no secrets.* reference in any workflow.

The permission implementing it was just never added. Which would be a one-line-per-file fix plus a recompile — except for the next part.

Why I didn't just fix it

gh-aw's own failure message scopes that path to an organisation:

If your organization has a Copilot subscription, you can avoid the need for a personal access token by adding a top-level permissions block … copilot-requests: write

gh api repos/:owner/:repo --jq .owner.type → User. Same fact that makes larger runners unavailable in build-cost.md. I don't know whether copilot-requests: write works for a user-owned repo on an individual Copilot plan, and I'd rather say so than guess. If it doesn't, the remaining option is a COPILOT_GITHUB_TOKEN PAT — the repository's first secret, which contradicts the paragraph above it:

The zero-repository-secrets invariant survives them.

That's an operator trade, not a patch: mint the PAT and retire the zero-secrets property, move the repo to an org (which also unlocks larger runners), switch engines and accept ANTHROPIC_API_KEY instead, or leave the agents dormant on purpose. Worth settling before merge, because merging as-is ships four workflows that look installed and are inert — the "built but unexercised" shape this repo keeps getting bitten by.

Cheapest way to find out: add copilot-requests: write to one workflow, recompile, and run it via workflow_dispatch.

What I checked and found sound

  • Token separation is real, not claimed. Per-job permissions: extracted from generated-artifact-healer.lock.yml: the agent job that runs the model and executes PR-branch code gets contents: read / actions: read / pull-requests: read / id-token: write. No job in the file holds contents: write. Writes live in activation/conclusion. That's the property that matters most here, given the healer re-runs a regen command from the PR branch under a workflow_run trigger — the classic escalation shape, correctly defused.
  • The id-token: write exception is honestly scoped. It's on the agent job, it buys er-ci-sccache-read, and that role has no DeleteObject. Read access to compiler output is the whole blast radius, so an agent can't plant object code a later main build consumes.
  • workflow_run over pull_request for dependabot is the right call and the comment gives the right reason (a Dependabot-raised pull_request carries a read-only token whatever the permissions block says).
  • Cost is bounded — max-turns on all four, max-ai-credits: 400 on the auditor, noop before billing.
  • protected-files: fallback-to-issue plus draft PRs plus one-skill-per-PR on the auditor is the right posture for files every future session reads.
  • Branch scopes are positive and the deliberate caps are stated rather than implied.

One wording nit

there is still no secrets.* reference in any workflow

Literally false as written — grep -oE 'secrets\.[A-Z_]+' finds six per lock file. The substance holds, because the ones that matter are fallback chains (secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN), so no secret must be set. But in a repo whose convention is that a claim should survive the obvious grep, "no repository secret has to exist" says it and this doesn't.

Rebase note

I rebased this branch twice (--force-with-lease), once onto #358 and once onto #365, and folded nothing of mine into it — infra/terraform/ was already in your agent_only denylist when I got here. #366 then added .github/workflows/infra.yml and scripts/ci/tf-* to that same pattern on main, so expect a one-line conflict there; the rest of the hunks are disjoint.

Also worth knowing, since it bit this PR: required-checks.md now carries a preamble line saying a context containing ${{ matrix.* }} can never be required. Making the four plan (<env>) legs required is what left this PR unmergeable with them stuck on "Expected" — a matrix job skipped by if: reports once, under the literal uninterpolated name. Fixed in #365 with a non-matrix aggregator; the contexts are off protection.

bmoore813 and others added 5 commits November 2, 2026 19:47
Three gaps that each turn into a red run the moment a `.github/workflows/*.md`
lands. Separated from the workflows themselves so the plumbing can be verified
against a tree that has none.

`skills-check.sh` globbed `.github/workflows/*.yml` to build the generated
required-checks table. `gh aw compile` emits `*.lock.yml`, which matches that
glob and carries a dozen machine-generated jobs, so every compile — and every
gh-aw version bump — would have churned the reference and failed both the
`skills` job and `lint`'s drift step. The lock files are skipped and the agentic
surface is summarised from the `.md` sources instead: one row per workflow,
triggers and safe outputs, which are the two questions a reviewer has. Both
halves were observed, including the gate RED at exit 1 on an uncommitted
workflow — and the first attempt to check that read exit 0, because `| tail`
had eaten the status, which is the trap already recorded in this skill.

`rust.yml`'s `detect` counted any path outside `.claude/` as code, so editing an
agent prompt would have spent ~15 minutes on `test` + `ducklake-e2e`. The
exclusion now also covers the agentic sources: the `.md`, the `.lock.yml`
compiled from it, and the `shared/` imports. Deliberately per-file and NOT
`^\.github/workflows/` — `rust.yml`, `frontend.yml`, `infra.yml` and `images.yml`
must keep triggering the gate they define, and excluding the directory wholesale
is the `paths:`-filter trap in CLAUDE.md wearing a different hat. Fifteen paths
table-tested in both directions. Drift is still caught, because the `skills` job
is not gated on `detect`.

The CI skill gains the section the above implies: agentic workflows may never be
required checks (a model run is non-deterministic, so requiring one gates every
merge on a retry), which is also why they are the only workflows here allowed a
`paths:` filter. They hold the repo's only `pull-requests: write` and
`contents: write`, though the agent process still never writes — safe outputs
are capped operations run by separate jobs after it exits. `engine: copilot`
draws on the job token, so the zero-repository-secrets invariant survives;
`engine: claude` would need an `ANTHROPIC_API_KEY` and is called out as a
trade to make explicitly.

`infra.yml`'s "NO REPOSITORY SECRETS" header needs no change: it is scoped to
AWS identities and stays literally true. Its neighbouring "PUBLIC repository"
claim is stale — this repo is private — but that is left alone deliberately,
being both inside a file under concurrent edit and a worked example for the
skill auditor landing next.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The gates here already catch everything mechanical. What they cannot do is the
judgement step, and the Dependabot history is the evidence: of the last twenty
bot pull requests, EIGHT were closed rather than landed — ulid 3.0.0, sha2
0.11.0, hmac 0.13.0, duckdb 1.20000.0, rand 0.10.3, motion 14.3.0 and two whole
frontend groups. Several were closed not because the bump was wrong but because
it needed a second, known edit nobody made. Those coupling rules are already
written down in this repo; nothing was missing except someone to read them.

Each workflow is a Markdown prompt with YAML frontmatter; `gh aw compile` emits
the `.lock.yml` beside it. The model never holds a GitHub write scope — gh-aw
splits each workflow into five or six jobs and the `agent` job gets read scopes
only, with `contents: write` confined to the `safe_outputs` and `conclusion`
jobs that run after it exits. Verified by extracting the per-job `permissions:`
from every lock file rather than by trusting the design.

- `dependency-upgrade-pilot` reads release notes for the whole version range,
  checks the five coupled pins, then returns one of three verdicts in the repo's
  own vocabulary: safe-to-merge, needs-companion-change (which it applies and
  pushes), or schedule-as-migration with the migration surface named. It is
  pointed at `dependency-bumps.md` and the comment blocks in `rust/Cargo.toml`
  rather than having their version numbers copied into the prompt, because a
  second copy of a pin is a thing that goes stale.
- `ci-triage` classifies a red run as your-diff / the-world-moved / runner-infra
  / flake, carrying this repo's specific false signals: `linking with cc failed`
  is really errno 28, semgrep reports zero findings when a ruleset fails to
  parse, a Playwright exit code gets eaten by `| tail`.
- `generated-artifact-healer` re-runs the regen command behind a byte-compared
  artifact. Its safety is that the command comes from a fixed table, is
  re-verified before the push, and the diff is refused if it touches a file that
  command does not own — a hand-edited generated file is a bug to report, not to
  overwrite.
- `skill-freshness-auditor` covers the semantic drift `skills-check.sh`
  structurally cannot see. A finding needs the stale sentence quoted AND a
  file:line that contradicts it, or it emits `noop` and costs nothing; "could be
  clearer" and "is missing X" are explicitly not findings.

`shared/rust-gate.md` is imported by the two that compile Rust. Its env must
match `rust.yml` EXACTLY — sccache keys on the compiler command line, so
dropping `-fuse-ld=mold` would silently yield a 0% hit rate against a warm
cache and the agent would wait out a cold duckdb build. It assumes
`er-ci-sccache-read`, never write, whose trust policy covers any ref so
`workflow_run` and `schedule` can use it.

Against the plan, three things changed once measured:

- `workflow_run`, not `pull_request`. A `pull_request` event raised by Dependabot
  carries a read-only token whatever the permissions block says, so the
  companion push would have failed. `workflow_run` also means CI has already
  answered, so the agent reads the result rather than guessing.
- NO disk-reclaim step, which the plan called for. `rust.yml` carries it on
  `test` alone, because that job links a debug binary per crate; `lint`, whose
  commands these agents replicate, has none. It would also have been harmful —
  the reclaim deletes `/opt/hostedtoolcache`, which a gh-aw run needs for its
  own `actions/setup-node`.
- The agent job is not purely read-only after all. The two cargo agents hold
  `id-token: write` for the sccache exchange. That mints an AWS credential, not
  a GitHub one, against a role holding `s3:GetObject`/`ListBucket` on one bucket
  and no `DeleteObject` at all. The skill says so rather than repeating the
  tidier claim.

Supply-chain review, as `gh aw compile`'s safe-update mode requires: the four
actions this introduces — Swatinem/rust-cache, aws-actions/configure-aws-
credentials, mozilla-actions/sccache-action, taiki-e/install-action — are pinned
to SHAs verified byte-identical to the ones `rust.yml` already uses, so there is
no new supply-chain surface. `.github/aw/actions-lock.json` records the one
genuinely new action, gh-aw's own `setup`, resolved to a SHA.

The `*.lock.yml` skip added in 3872ddd was too narrow: `gh aw compile` also
generates `agentics-maintenance.yml`, which the glob caught and tabulated. Now
detected by the generated-file marker in the file header instead of by filename,
so the next thing gh-aw generates is covered too. `rust.yml`'s `detect` grew
`.github/aw/` and that filename for the same reason; sixteen paths re-tested.

Two compiler warnings are accepted rather than silenced, both for
`push-to-pull-request-branch: target: "*"`. The privilege is near-nil — the push
goes to the pull request's own branch, which its author can already write to —
and the suggested fix, a required label, means opting each PR in by hand, which
is most of the cost these agents exist to remove.

NOT run: `gh aw init`. It would also write `.github/mcp.json`, `.github/skills/`,
`.github/agents/` and `.vscode/settings.json`, which is Copilot-coding-agent
scaffolding and a deliberate decision under CLAUDE.md's rules on agent tooling,
not a side effect of installing four workflows. The one piece that mattered,
`.gitattributes` marking lock files generated, `gh aw compile` writes by itself.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…rence

Merging a `workflow_run` workflow is also its first real execution — the trigger
only fires once the file is on the default branch, so there is no way to watch
these two before they can act. This repo's standard is that a gate is not
trusted until it has been observed, so both agents that push commits start with
`safe-outputs.staged: true`: every output is previewed in the run summary and
nothing is posted or pushed. Remove the one line per agent after reading a real
run. `ci-triage` stays live, because a comment is reversible and reading its
first real classification is the point.

Staging exposed a bug in the generator added two commits ago: `staged` is a
modifier under `safe-outputs:`, not an output, and it was being listed as one —
so the reference said these agents could perform an output called `staged`. It
now drives a **Mode** column instead, which is better than merely correct: the
one question a reader of that table has is whether an agent acts or rehearses,
and it is now the second column. Other `safe-outputs:` config keys are filtered
by a denylist that is deliberately not exhaustive — a new one showing up in the
Safe outputs column is the signal to add it, which keeps the table's own
staleness visible rather than silent.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Both agents trigger on a `rust.yml` failure and both push to the pull request
branch, which retriggers `rust.yml`, which retriggers them. Reviewing the pair
together is what surfaced it; neither prompt said anything about its own second
invocation.

It would in fact have terminated, for a reason too incidental to rely on:
`skills-check.sh regen` and `er-entity gen` are deterministic, so a second lap
produces no diff and falls through to `noop`. That is luck, not a guard, and
every lap is a paid model run.

Each now reads `git log` on the head branch before doing anything else and
recognises its own previous commit. The healer stops, because a fix that did not
make the run green will not work twice. The pilot splits on the CI result: its
own commit plus green means the companion change worked and the verdict is
`safe-to-merge` with nothing more to push; its own commit plus red means the
companion change was insufficient, which makes the bump a
`schedule-as-migration` rather than grounds for a second attempt. One push per
branch, ever — a retry is a human's call.

No loop was possible yet, since both ship `staged: true`. The guard belongs in
before that comes off, not after.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Rebasing onto main picked up the CI-speedup work, which bumped
`taiki-e/install-action` to v2.88.1. `shared/rust-gate.md` still pinned
v2.87.31, which quietly falsified this PR's own claim that the four
actions it introduces are byte-identical to the ones `rust.yml` already
uses — the whole basis for saying it adds no supply-chain surface.

Re-pinned and recompiled. The lock diff is that SHA and its two metadata
hashes and nothing else: `compiler_version` stays `v1.0.1`, so there is no
gh-aw version churn riding along.

Checked, rather than assumed, while the branch was on main's tip:

- all four actions now match `rust.yml` exactly (rust-cache,
  configure-aws-credentials, sccache-action, install-action)
- the sccache env still matches: `CARGO_INCREMENTAL`, `RUSTFLAGS`,
  `SCCACHE_BUCKET`, `SCCACHE_REGION` and `RUSTC_WRAPPER` are identical to
  `rust.yml`'s top-level block plus `lint`'s job env, which is what keeps
  the hit rate off the floor
- the rust-cache keys still match `lint`'s (`workspaces: rust`,
  `shared-key: rust`, `prefix-key: v1-rust`, `key` hashing
  `rust/Cargo.toml`), with `save-if: false` still deliberate
- `gh aw compile --strict` — 4 succeeded, the same 2 documented
  `target: "*"` warnings
- `gh aw lint` — actionlint over 12 files, no issues
- `scripts/skills-check.sh check` — exit 0, references current

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin

athvin commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main — it was DIRTY, so it had been getting zero CI

This branch was 51 commits behind main and mergeStateStatus: DIRTY. A
conflicted PR runs no workflows at all and reports "no checks reported", so the
green checks previously shown here were from 2026-10-31 against a tree two
weeks of main ago. CI is running again now.

Conflicts, and how each was resolved

rust.yml's detect filter (both commits that touch it). main had
independently taught the same denylist two new exemptions — infra.yml,
drift.yml and scripts/ci/tf- — by the same reasoning this branch used:
name files, never ^\.github/workflows/. Resolved as the union, keeping
main's longer rationale and folding the agentic entries into it:

exempt='^(\.claude/|infra/terraform/|scripts/ci/tf-|\.github/aw/|\.github/workflows/((infra|drift)\.yml$|shared/|agentics-maintenance\.yml$|[A-Za-z0-9._-]+\.md$|[A-Za-z0-9._-]+\.lock\.yml$))'

Re-ran the table test the original commit described, 22 paths in both
directions. Everything intended to skip skips; rust.yml, frontend.yml,
images.yml, and main's two new kind.yml / frontend-experiments.yml all
still count as code, as does docs/. One comment had to change rather than
merge: the old text asserted infra.yml "must keep triggering the gate it
defines", which main has since deliberately reversed.

build-cost.md — commit dropped. main already lands this branch's
correction, and lands it better: it carries the billing-API pointer and the
larger-runner pricing this branch lacked. The branch's one unique paragraph
claimed rust.yml and infra.yml still argue from the stale public-repo
premise — and they no longer do, both now read "The repository is private." So
the commit is superseded, not merged: carrying it would have re-introduced a
false statement. build-cost.md is now byte-identical to main.

One real breakage the rebase introduced, now fixed

main's CI work bumped taiki-e/install-action to v2.88.1, while
shared/rust-gate.md still pinned v2.87.31. That quietly falsified this
PR's own central claim — that the four actions it introduces are byte-identical
to ones rust.yml already uses, hence no new supply-chain surface. Re-pinned
and recompiled. The lock diff is that SHA plus its two metadata hashes and
nothing else; compiler_version stays v1.0.1, so no gh-aw churn rode along.

Then re-verified the parity claims against main's current rust.yml:

  • all four actions now match exactly
  • the sccache env matches — CARGO_INCREMENTAL, RUSTFLAGS, SCCACHE_BUCKET,
    SCCACHE_REGION, RUSTC_WRAPPER. This is the claim worth re-checking on
    every rebase, since a differing flag means a 0% hit rate against a warm cache
    and the agent waits out a cold duckdb C++ build
  • the rust-cache keys still match lint's (workspaces: rust,
    shared-key: rust, prefix-key: v1-rust, key hashing rust/Cargo.toml),
    with save-if: false still deliberate

Gates run locally

  • gh aw compile --strict — 4 succeeded, with the same 2 documented
    push-to-pull-request-branch: target: "*" warnings and no others
  • gh aw lint — actionlint over 12 files, no issues
  • scripts/skills-check.sh check — exit 0, generated references current
    (checked as its own command, not piped, so nothing can eat the status)

Unchanged

The PR's honest caveat still stands in full: a workflow_run workflow only
fires once it is on the default branch, so none of these four has ever run,
and merging is still their first execution. staged: true on the two
push-capable agents is what makes that acceptable.

@athvin
athvin merged commit 52bec4a into main Nov 3, 2026
34 checks passed
@athvin

athvin commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Post-merge: all four failed on first execution, and are now disabled

Merged as 52bec4a1. They fired immediately — and every one failed at
activation:

Error: None of the following secrets are set: COPILOT_GITHUB_TOKEN
COPILOT_GITHUB_TOKEN is required by GitHub Copilot CLI.

This falsifies this PR's security claim. The body says "No repository
secret is added: engine: copilot draws on the job token, so the zero-secrets
invariant holds."
That is not how gh-aw v1.0.1 works: the generated activation
job runs validate_multi_secret.sh COPILOT_GITHUB_TOKEN and hard-fails without
it. gh secret list on this repo returns nothing, so there was never a chance of
these running.

The claim was reasoned from the engine choice rather than from an execution —
which is exactly what the PR's own "none of these has ever run" caveat warned
would go unverified. It just turned out to bite the security paragraph rather
than the prompts.

They fail closed, which is the one thing that went right

Job Result
pre_activation success
activation failure
agent skipped
detection skipped
safe_outputs skipped

Nothing was posted, pushed, or run. staged: true was never even reached — the
secret gate is upstream of it. So the cost was red runs in the Actions list
beside real signal, not an unwanted action.

Done now

gh workflow disable on all four — CI triage, Dependency upgrade pilot,
Generated artifact healer, Skill freshness auditor. Reversible, no code
change, stops the noise. Agentic Maintenance (the fifth, which gh aw compile
generates for expiring safe outputs) runs no agent and is left active.

The decision this surfaces

Both engines cost a repository secret: copilot needs COPILOT_GITHUB_TOKEN,
and claude needs ANTHROPIC_API_KEY (gh-aw takes an API key only, not a
subscription OAuth token). So there is no zero-secret path to running these at
all
— the invariant this PR claimed to preserve cannot be preserved alongside
the feature. That is a genuine trade and belongs to whoever owns the invariant,
not to a follow-up commit.

Re-enabling is gh workflow enable on the four, once a secret exists.

Unrelated, for the record

#376's duckdb bump (merged minutes before this) poisoned the rust-cache entry
and turned PRs red with DirectoryNotEmpty. That is being handled separately in
#422 / #424 / #425 and is not attributable to this PR.

athvin added a commit that referenced this pull request Nov 3, 2026
…path (#439)

#359 shipped four agentic workflows on `engine: copilot` and asserted that
kept the zero-repository-secrets invariant. On their first real execution —
the run immediately after #359 landed — all four died at `activation`:

    Error: None of the following secrets are set: COPILOT_GITHUB_TOKEN
    COPILOT_GITHUB_TOKEN is required by GitHub Copilot CLI.

The generated `activation` job runs `validate_multi_secret.sh` and hard-fails
without it. `gh secret list` is empty, so they never had a chance to run.

**There is no zero-secret engine.** `copilot` wants `COPILOT_GITHUB_TOKEN`,
`claude` wants `ANTHROPIC_API_KEY`, and every other engine wants its own key.
The invariant and the feature were always mutually exclusive; #359's claim
just hid which side we were on. Since a secret is owed either way, this picks
the engine whose model and cost are selectable per workflow.

Bedrock was evaluated first and is not reachable: `gh aw compile --engine
bedrock` answers *"Must be 'agy', 'claude', 'codex', 'copilot', 'gemini', or
'pi'"*. The `amazon-bedrock` and `AWS_BEARER_TOKEN_BEDROCK` strings in the
binary belong to a generic cloud-auth layer (`AWF_AUTH_{AWS,ANTHROPIC,AZURE,
GCP,OIDC}_*`) whose AWS members are only REGION / ROLE_ARN /
ROLE_SESSION_NAME — OIDC role assumption, no inference path.

## Model per workflow, split on judgement

| Workflow | Model | Why |
|---|---|---|
| `dependency-upgrade-pilot` | `claude-sonnet-5` | verdicts a version range |
| `ci-triage` | `claude-sonnet-5` | classifies a red run |
| `generated-artifact-healer` | `claude-haiku-4-5` | re-runs a known generator |
| `skill-freshness-auditor` | `claude-haiku-4-5` | greps prose against code |

Haiku 4.5 is the cheapest current model and right for mechanical work. It is
the wrong default for the two judgement agents: #376 is the worked example of
that cost — a bump whose own release notes named the companion edit, merged
without it, three red PRs. A cheaper model reaching that verdict confidently
is worse than no agent. `effort` is deliberately absent everywhere; Haiku 4.5
rejects it.

`dependency-upgrade-pilot` also loses `copilot-sdk: true`, exactly as the note
it replaces predicted: that nesting existed only to obtain a proxy-aware fetch
tool, because Copilot's native `web-fetch` is unavailable under offline BYOK.
On `engine: claude` `web-fetch` is native.

## Security review (required by safe-update mode)

`gh aw compile` flagged one new restricted secret and refused to proceed until
reviewed. Reviewed, then `--approve`d:

- **`ANTHROPIC_API_KEY` — the only new secret.** Visible to `activation`,
  `agent` and `detection`; *not* to `safe_outputs` or `conclusion`, the
  write-capable jobs.
- **Blast radius is Anthropic spend, nothing else.** No agent job holds
  `contents: write` — extracted per-job, they carry `contents: read` plus
  reads. The `id-token: write` on the two Rust agents still mints only
  `er-ci-sccache-read` (GetObject/ListBucket on one bucket, no DeleteObject).
- **No new actions.** `setup-node@949feb24` appears as an added line but is
  already on `main` in these same files — a position shift, not a new
  dependency. No redirect changes.
- **Use a dedicated key, not the product's.** `ANTHROPIC_API_KEY` is already
  the name of the frontend assistant's credential, and per
  `docs/infrastructure.md` §18.14 that path "sends real customer personal
  data to the Anthropic API". Reusing one value would turn a CI-side leak into
  a key that touches customer data. Mint a separate key in its own workspace.
- **Cannot fully verify, flagged for a human:** whether a prompt-injected
  agent can defeat gh-aw's log masking and egress allowlist to exfiltrate the
  key. Mitigation is scoping and a spend cap, not sandbox trust.

`GH_AW_MAX_DAILY_AI_CREDITS` (5000) is denominated in Copilot credits and does
not bind a BYO-key run, so the spend ceiling is now whatever is configured
Anthropic-side. These fire on every dependabot push and every red CI run, so
that limit is load-bearing.

## Still disabled, deliberately

All four remain `disabled_manually` from the triage that followed #359. They
stay that way until `ANTHROPIC_API_KEY` exists — re-enable with
`gh workflow enable` on each. `staged: true` is untouched on both
push-capable agents, so their first real runs still only preview.

They fail closed either way: `activation` failing leaves `agent`, `detection`
and `safe_outputs` all `skipped`, so a missing or revoked key costs red runs,
never an unintended write.

Verified: `gh aw compile --strict` 4/4 with the 2 documented `target: "*"`
warnings; `gh aw lint` 12 files clean; `scripts/skills-check.sh check` exit 0.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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